1 |
|
2 |
|
3 |
|
4 | exports.up = function(knex, Promise) {
|
5 |
|
6 | return Promise.all([
|
7 |
|
8 | knex.schema.createTable('users', function(table) {
|
9 |
|
10 | table
|
11 | .uuid('id')
|
12 | .primary()
|
13 | .defaultTo(knex.raw("gen_random_uuid()"));
|
14 |
|
15 | table
|
16 | .text('email')
|
17 | .unique()
|
18 | .notNullable()
|
19 | .comment('The email of the user');
|
20 |
|
21 | table
|
22 | .text('password')
|
23 | .notNullable()
|
24 | .comment('The password of the users');
|
25 |
|
26 | table
|
27 | .timestamp('created_at')
|
28 | .notNullable()
|
29 | .defaultTo(knex.fn.now());
|
30 |
|
31 | table
|
32 | .timestamp('updated_at')
|
33 | .notNullable()
|
34 | .defaultTo(knex.fn.now());
|
35 | })
|
36 |
|
37 | ]);
|
38 |
|
39 | };
|
40 |
|
41 | exports.down = function(knex, Promise) {
|
42 |
|
43 | return Promise.all([
|
44 | knex.schema.dropTable('users')
|
45 | ]);
|
46 |
|
47 | };
|
48 |
|