pointers v0.5.0 Pointers.Migration View Source
Helpers for writing Pointer-aware migrations.
Link to this section Summary
Functions
Adds a pointer primary key to the table.
Not required if you are using create_pointable_table
Creates a mixin table - one with a ULID primary key and no trigger
Creates a pointable table along with its trigger.
Drops a mixin table. Actually just a simple cascading drop
Drops a pointable table
When migrating up: initialises the pointers database. When migrating down: deinitialises the pointers database.
Given :up
: initialises the pointers database.
Given :down
: deinitialises the pointers database.
Creates a strong, weak or unbreakable pointer depending on type
.
A reference to a pointer for use with 'add/3`. A strong pointer will be deleted when the thing it's pointing to is deleted.
A reference to a pointer for use with 'add/3`. An unbreakable pointer will prevent the thing it's pointing to from being deleted.
A reference to a pointer for use with 'add/3`. A weak pointer will be set null when the thing it's pointing to is deleted.
Link to this section Types
Specs
pointer_type() :: :strong | :weak | :unbreakable
Link to this section Functions
Specs
add_pointer_pk() :: nil
Adds a pointer primary key to the table.
Not required if you are using create_pointable_table
Specs
add_pointer_ref_pk() :: nil
Creates a mixin table - one with a ULID primary key and no trigger
Specs
Creates a pointable table along with its trigger.
Specs
Specs
Specs
drop_mixin_table(name :: binary()) :: nil
Drops a mixin table. Actually just a simple cascading drop
Specs
drop_pointable_table(schema :: atom()) :: nil
Drops a pointable table
Specs
Specs
init_pointers() :: nil
When migrating up: initialises the pointers database. When migrating down: deinitialises the pointers database.
Specs
init_pointers(direction :: :up | :down) :: nil
Given :up
: initialises the pointers database.
Given :down
: deinitialises the pointers database.
Specs
pointer(module :: atom(), type :: pointer_type()) :: term()
Creates a strong, weak or unbreakable pointer depending on type
.
A reference to a pointer for use with 'add/3`. A strong pointer will be deleted when the thing it's pointing to is deleted.
A reference to a pointer for use with 'add/3`. An unbreakable pointer will prevent the thing it's pointing to from being deleted.
A reference to a pointer for use with 'add/3`. A weak pointer will be set null when the thing it's pointing to is deleted.