36 lines
1.2 KiB
JavaScript
36 lines
1.2 KiB
JavaScript
exports.up = function (knex) {
|
|
return knex.schema
|
|
.createTable('apps', (table) => {
|
|
table.uuid('id').primary().defaultTo(knex.raw('(UUID())'));
|
|
table.string('slug', 255).notNullable().unique();
|
|
table.string('label', 255).notNullable();
|
|
table.text('description');
|
|
table.integer('display_order').defaultTo(0);
|
|
table.timestamps(true, true);
|
|
|
|
table.index(['slug']);
|
|
})
|
|
.createTable('app_pages', (table) => {
|
|
table.uuid('id').primary().defaultTo(knex.raw('(UUID())'));
|
|
table.uuid('app_id').notNullable();
|
|
table.string('slug', 255).notNullable();
|
|
table.string('label', 255).notNullable();
|
|
table.string('type', 50).notNullable(); // List, Detail, Custom
|
|
table.string('object_api_name', 255);
|
|
table.integer('display_order').defaultTo(0);
|
|
table.timestamps(true, true);
|
|
|
|
table
|
|
.foreign('app_id')
|
|
.references('id')
|
|
.inTable('apps')
|
|
.onDelete('CASCADE');
|
|
table.unique(['app_id', 'slug']);
|
|
table.index(['app_id']);
|
|
});
|
|
};
|
|
|
|
exports.down = function (knex) {
|
|
return knex.schema.dropTableIfExists('app_pages').dropTableIfExists('apps');
|
|
};
|