View Source Needle.Migration (Bonfire v0.9.10-classic-beta.169)
Helpers for writing Pointer-aware migrations.
Summary
Functions
Creates a mixin table - one with a UID primary key and no trigger
Creates a pointable table along with its trigger.
Creates a random table - one with a UUID v4 primary key.
Drops a mixin table.
Drops a pointable table
Drops a random 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.
See Needle.UID.Migration.init_pointers_ulid_extra/0
.
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.
Types
@type pointer_type() :: :strong | :weak | :unbreakable
Functions
Creates a mixin table - one with a UID primary key and no trigger
Creates a pointable table along with its trigger.
Creates a random table - one with a UUID v4 primary key.
Drops a mixin table.
@spec drop_pointable_table(schema :: atom()) :: nil
Drops a pointable table
Drops a random table.
@spec init_pointers() :: nil
When migrating up: initialises the pointers database. When migrating down: deinitialises the pointers database.
@spec init_pointers(direction :: :up | :down) :: nil
Given :up
: initialises the pointers database.
Given :down
: deinitialises the pointers database.
See Needle.UID.Migration.init_pointers_ulid_extra/0
.
@spec 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.