2020-05-02 19:06:34 +00:00
|
|
|
exports.up = (knex) => {
|
2020-06-02 14:51:42 +00:00
|
|
|
return knex.schema.createTable('availability', (table) => {
|
2020-05-02 19:06:34 +00:00
|
|
|
table.increments('id').primary();
|
2020-05-05 09:54:02 +00:00
|
|
|
|
|
|
|
// Reference to participant composite primary key
|
2020-05-04 16:47:05 +00:00
|
|
|
table.uuid('meeting_id').unsigned();
|
|
|
|
table.integer('account_id').unsigned();
|
2020-05-02 19:06:34 +00:00
|
|
|
table
|
2020-05-04 16:47:05 +00:00
|
|
|
.foreign(['account_id', 'meeting_id'])
|
|
|
|
.references(['account_id', 'meeting_id'])
|
|
|
|
.on('participant')
|
2020-05-02 19:06:34 +00:00
|
|
|
.onDelete('cascade');
|
2020-05-05 09:54:02 +00:00
|
|
|
|
|
|
|
table.integer('possible_date_id');
|
2020-05-02 19:06:34 +00:00
|
|
|
table
|
2020-05-05 09:54:02 +00:00
|
|
|
.foreign('possible_date_id')
|
2020-05-02 19:06:34 +00:00
|
|
|
.references('possible_date.id')
|
|
|
|
.onDelete('cascade');
|
|
|
|
table.boolean('preference').notNullable();
|
|
|
|
table.time('start_time').notNullable();
|
2020-08-26 11:20:54 +00:00
|
|
|
table.time('end_string').notNullable();
|
2020-05-02 19:06:34 +00:00
|
|
|
table.timestamps(true, true);
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
|
|
|
exports.down = (knex) => {
|
2020-06-02 14:51:42 +00:00
|
|
|
return knex.schema.dropTable('availability');
|
2020-05-02 19:06:34 +00:00
|
|
|
};
|