backend/data/migrations/20200502193443_availability.js

24 lines
668 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();
table.uuid('participant_id').notNullable();
2020-05-02 19:06:34 +00:00
table
.foreign('participant_id')
.references('participant.id')
2020-05-02 19:06:34 +00:00
.onDelete('cascade');
table.integer('possible_date_id').notNullable();
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.datetime('start_time').notNullable();
table.datetime('end_time').notNullable();
2020-05-02 19:06:34 +00:00
table.timestamps(true, true);
});
};
exports.down = (knex) => {
return knex.schema.dropTable('availability');
2020-05-02 19:06:34 +00:00
};