aboutsummaryrefslogtreecommitdiffstats
path: root/db/migrations/20210612192804_init_waiting_list.js.js
blob: 0cef735640950156371009f6051ff84a7a444a90 (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
export const 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);
      })
    ])
};

export const down = function(knex) {
    return knex.schema.dropTable('waiting_list');
};