UNPKG

@lucidcms/core

Version:

The core of the Lucid CMS. It's responsible for spinning up the API and serving the CMS.

2 lines 1.68 kB
const e=e=>({async up(t){await t.schema.createTable(`lucid_alerts`).addColumn(`id`,e.getDataType(`primary`),t=>e.primaryKeyColumnBuilder(t)).addColumn(`type`,e.getDataType(`text`),e=>e.notNull()).addColumn(`level`,e.getDataType(`text`),e=>e.notNull()).addColumn(`dedupe_key`,e.getDataType(`text`),e=>e.notNull()).addColumn(`title`,e.getDataType(`text`),e=>e.notNull()).addColumn(`message`,e.getDataType(`text`),e=>e.notNull()).addColumn(`metadata`,e.getDataType(`json`),e=>e.notNull()).addColumn(`email_id`,e.getDataType(`integer`),e=>e.references(`lucid_emails.id`).onDelete(`set null`)).addColumn(`created_at`,e.getDataType(`timestamp`),t=>t.defaultTo(e.formatDefaultValue(`timestamp`,e.getDefault(`timestamp`,`now`)))).execute(),await t.schema.createTable(`lucid_alert_recipients`).addColumn(`id`,e.getDataType(`primary`),t=>e.primaryKeyColumnBuilder(t)).addColumn(`alert_id`,e.getDataType(`integer`),e=>e.notNull().references(`lucid_alerts.id`).onDelete(`cascade`)).addColumn(`user_id`,e.getDataType(`integer`),e=>e.notNull().references(`lucid_users.id`).onDelete(`cascade`)).addColumn(`read_at`,e.getDataType(`timestamp`)).addColumn(`dismissed_at`,e.getDataType(`timestamp`)).addColumn(`created_at`,e.getDataType(`timestamp`),t=>t.defaultTo(e.formatDefaultValue(`timestamp`,e.getDefault(`timestamp`,`now`)))).execute(),await t.schema.createIndex(`idx_lucid_alerts_type_dedupe_key`).on(`lucid_alerts`).columns([`type`,`dedupe_key`]).execute(),await t.schema.createIndex(`idx_lucid_alert_recipients_user`).on(`lucid_alert_recipients`).columns([`user_id`,`read_at`,`dismissed_at`]).execute()},async down(e){}});export{e as default}; //# sourceMappingURL=00000010-alerts.mjs.map