Added page layouts
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
/**
|
||||
* @param { import("knex").Knex } knex
|
||||
* @returns { Promise<void> }
|
||||
*/
|
||||
exports.up = function(knex) {
|
||||
return knex.schema.createTable('page_layouts', (table) => {
|
||||
table.uuid('id').primary().defaultTo(knex.raw('(UUID())'));
|
||||
table.string('name').notNullable();
|
||||
table.uuid('object_id').notNullable();
|
||||
table.boolean('is_default').defaultTo(false);
|
||||
table.json('layout_config').notNullable();
|
||||
table.text('description');
|
||||
table.timestamps(true, true);
|
||||
|
||||
// Foreign key to object_definitions
|
||||
table.foreign('object_id').references('id').inTable('object_definitions').onDelete('CASCADE');
|
||||
|
||||
// Index for faster lookups
|
||||
table.index(['object_id', 'is_default']);
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* @param { import("knex").Knex } knex
|
||||
* @returns { Promise<void> }
|
||||
*/
|
||||
exports.down = function(knex) {
|
||||
return knex.schema.dropTable('page_layouts');
|
||||
};
|
||||
Reference in New Issue
Block a user