2020-05-02 19:06:34 +00:00
|
|
|
exports.up = (knex) => {
|
|
|
|
return knex.schema.createTable('availibility', (table) => {
|
|
|
|
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();
|
|
|
|
table.time('end_time').notNullable();
|
|
|
|
table.string('timezone').notNullable();
|
|
|
|
table.timestamps(true, true);
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
|
|
|
exports.down = (knex) => {
|
|
|
|
return knex.schema.dropTable('availibility');
|
|
|
|
};
|