exports.up = function (knex) { return knex.schema.table('object_definitions', (table) => { table.uuid('app_id').nullable() .comment('Optional: App that this object belongs to'); table .foreign('app_id') .references('id') .inTable('apps') .onDelete('SET NULL'); table.index(['app_id']); }); }; exports.down = function (knex) { return knex.schema.table('object_definitions', (table) => { table.dropForeign('app_id'); table.dropIndex('app_id'); table.dropColumn('app_id'); }); };