backend/data/migrations/20200502193443_availability.js

30 lines
823 B
JavaScript
Raw Normal View History

2020-05-02 19:06:34 +00:00
exports.up = (knex) => {
return knex.schema.createTable('availability', (table) => {
2020-05-02 19:06:34 +00:00
table.increments('id').primary();
// 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');
table.integer('possible_date_id');
2020-05-02 19:06:34 +00:00
table
.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('availability');
2020-05-02 19:06:34 +00:00
};