add create user table migration
This commit is contained in:
parent
dc295fc3d3
commit
6abf6d2f7d
1 changed files with 22 additions and 0 deletions
22
server/migrations/20200109160637_user.js
Normal file
22
server/migrations/20200109160637_user.js
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
const rankArray = [
|
||||||
|
'D7', 'D6', 'D5', 'D4', 'D3', 'D2', 'D1',
|
||||||
|
'K1', 'K2', 'K3', 'K4', 'K5', 'K6', 'K7', 'K8', 'K9', 'K10',
|
||||||
|
'K11', 'K12', 'K13', 'K14', 'K15', 'K16', 'K17', 'K18', 'K19', 'K20',
|
||||||
|
'K21', 'K22', 'K23', 'K24', 'K25', 'K26', 'K27', 'K28', 'K29', 'K30', 'UR'
|
||||||
|
]
|
||||||
|
|
||||||
|
exports.up = knex => {
|
||||||
|
return knex.schema.createTable("user", table => {
|
||||||
|
table.increments('id').primary();
|
||||||
|
table.string('username').notNullable().unique();
|
||||||
|
table.string('email').notNullable().unique();
|
||||||
|
table.string('password').notNullable();
|
||||||
|
table.boolean('admin').notNullable().defaultTo(false);
|
||||||
|
table.enu('rank', rankArray).notNullable().defaultTo('UR')
|
||||||
|
table.integer('elo');
|
||||||
|
table.boolean('rank_certainty').defaultTo(false);
|
||||||
|
table.timestamps(true, true);
|
||||||
|
})
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.down = knex => knex.schema.dropTableIfExists("user");
|
Loading…
Reference in a new issue