29 lines
789 B
JavaScript
29 lines
789 B
JavaScript
exports.up = (knex) => {
|
|
return knex.schema.createTable('availability', (table) => {
|
|
table.increments('id').primary();
|
|
|
|
// Reference to participant composite primary key
|
|
table.uuid('meeting_id').unsigned();
|
|
table.integer('account_id').unsigned();
|
|
table
|
|
.foreign(['account_id', 'meeting_id'])
|
|
.references(['account_id', 'meeting_id'])
|
|
.on('participant')
|
|
.onDelete('cascade');
|
|
|
|
table.integer('possible_date_id');
|
|
table
|
|
.foreign('possible_date_id')
|
|
.references('possible_date.id')
|
|
.onDelete('cascade');
|
|
table.boolean('preference').notNullable();
|
|
table.datetime('start_time').notNullable();
|
|
table.datetime('end_time').notNullable();
|
|
table.timestamps(true, true);
|
|
});
|
|
};
|
|
|
|
exports.down = (knex) => {
|
|
return knex.schema.dropTable('availability');
|
|
};
|