aboutsummaryrefslogtreecommitdiffstats
path: root/db/migrations/20210612192804_init_waiting_list.js.js
blob: 1e8d2be6ab8a2ecced82f99d4e8312c3fbb14d68 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
exports.up = function(knex) {

    return Promise.all([
      knex.schema.dropTableIfExists('waiting_list'),

      knex.schema.createTable('waiting_list', function(t) {
        t.increments('id').unsigned().primary();
    
        t.string('email').notNull();
        t.string('phone').notNull();
        t.enu('status', ['pending', 'activated', 'expired', 'cancelled']).notNull();
  
        t.integer('user_id').nullable();
        t.foreign('user_id').references('users.id');
        t.text('notes').nullable();

        t.timestamps(true, true);
      })
    ])
}
  
exports.down = function(knex) {
    return knex.schema.dropTable('waiting_list');
}