@lucidcms/core
Version:
The core of the Lucid CMS. It's responsible for spinning up the API and serving the CMS.
2 lines • 2.33 kB
JavaScript
import e from"../../helpers/build-schema-index.mjs";import t from"../../helpers/build-table-name.mjs";const n=n=>{let r=t(`document`,{collection:n.collection.key},n.db.config.tableNameByteLimit);if(r.error)return r;let i=r.data.name;return{data:{schema:{name:i,rawName:r.data.rawName,type:`document`,key:{collection:n.collection.key},columns:[{name:`id`,source:`core`,type:n.db.getDataType(`primary`),nullable:!1,primary:!0},{name:`collection_key`,source:`core`,type:n.db.getDataType(`text`),nullable:!1,foreignKey:{table:`lucid_collections`,column:`key`,onDelete:`cascade`}},{name:`collection_migration_id`,source:`core`,type:n.db.getDataType(`integer`),nullable:!1,foreignKey:{table:`lucid_collection_migrations`,column:`id`,onDelete:`restrict`}},{name:`tenant_key`,source:`core`,type:n.db.getDataType(`text`),nullable:!0},{name:`order`,source:`core`,type:n.db.getDataType(`text`),nullable:!0},{name:`is_deleted`,source:`core`,type:n.db.getDataType(`boolean`),default:n.db.getDefault(`boolean`,`false`),nullable:!1},{name:`is_deleted_at`,source:`core`,type:n.db.getDataType(`timestamp`),nullable:!0},{name:`deleted_by`,source:`core`,type:n.db.getDataType(`integer`),nullable:!0,foreignKey:{table:`lucid_users`,column:`id`,onDelete:`set null`}},{name:`created_by`,source:`core`,type:n.db.getDataType(`integer`),nullable:!0,foreignKey:{table:`lucid_users`,column:`id`,onDelete:`set null`}},{name:`created_at`,source:`core`,type:n.db.getDataType(`timestamp`),nullable:!0,default:n.db.getDefault(`timestamp`,`now`)},{name:`updated_by`,source:`core`,type:n.db.getDataType(`integer`),nullable:!0,foreignKey:{table:`lucid_users`,column:`id`,onDelete:`set null`}},{name:`updated_at`,source:`core`,type:n.db.getDataType(`timestamp`),nullable:!0,default:n.db.getDefault(`timestamp`,`now`)}],indexes:[e({db:n.db,tableName:i,columns:[`tenant_key`],source:`core`}),e({db:n.db,tableName:i,columns:[`order`],source:`core`}),e({db:n.db,tableName:i,columns:[`is_deleted`,`updated_at`],source:`core`}),e({db:n.db,tableName:i,columns:[`is_deleted`,`created_at`],source:`core`}),e({db:n.db,tableName:i,columns:[`created_by`],source:`core`}),e({db:n.db,tableName:i,columns:[`updated_by`],source:`core`}),e({db:n.db,tableName:i,columns:[`deleted_by`],source:`core`})]}},error:void 0}};export{n as default};
//# sourceMappingURL=document-table.mjs.map