Initial Commit
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
-- Notification table — slimmed migration covering only the fields the
|
||||
-- @suaveplan/api-plugin-notifications repository actually reads / writes.
|
||||
-- Upstream tables that depend on sibling plugins (fn::notification helpers,
|
||||
-- bitwise types, site/group references) are deferred to follow-up changes.
|
||||
|
||||
DEFINE TABLE OVERWRITE notification SCHEMAFULL;
|
||||
|
||||
DEFINE FIELD OVERWRITE recipient ON notification TYPE record<user>
|
||||
ASSERT $value != NONE;
|
||||
|
||||
DEFINE FIELD OVERWRITE site ON notification TYPE option<record<site>>;
|
||||
|
||||
DEFINE FIELD OVERWRITE actor ON notification TYPE option<record<user>>;
|
||||
|
||||
DEFINE FIELD OVERWRITE type ON notification TYPE string
|
||||
ASSERT $value != NONE;
|
||||
|
||||
DEFINE FIELD OVERWRITE target_id ON notification TYPE option<string>;
|
||||
|
||||
DEFINE FIELD OVERWRITE target_type ON notification TYPE option<string>;
|
||||
|
||||
DEFINE FIELD OVERWRITE content ON notification TYPE string
|
||||
ASSERT $value != NONE;
|
||||
|
||||
DEFINE FIELD OVERWRITE metadata ON notification TYPE option<object> FLEXIBLE
|
||||
DEFAULT {};
|
||||
|
||||
DEFINE FIELD OVERWRITE read ON notification TYPE bool DEFAULT false;
|
||||
|
||||
DEFINE FIELD OVERWRITE dismissed ON notification TYPE bool DEFAULT false;
|
||||
|
||||
DEFINE FIELD OVERWRITE created_at ON notification TYPE datetime
|
||||
DEFAULT time::now() VALUE $value OR time::now();
|
||||
|
||||
DEFINE FIELD OVERWRITE updated_at ON notification TYPE datetime
|
||||
DEFAULT time::now() VALUE time::now();
|
||||
|
||||
DEFINE INDEX OVERWRITE notification_recipient_idx ON notification FIELDS recipient;
|
||||
DEFINE INDEX OVERWRITE notification_created_at_idx ON notification FIELDS created_at;
|
||||
DEFINE INDEX OVERWRITE notification_read_idx ON notification FIELDS read;
|
||||
DEFINE INDEX OVERWRITE notification_type_idx ON notification FIELDS type;
|
||||
Reference in New Issue
Block a user