Add accounts migration
This commit is contained in:
28
migrations/1_initial-migration.js
Normal file
28
migrations/1_initial-migration.js
Normal file
@@ -0,0 +1,28 @@
|
||||
/* eslint-disable camelcase */
|
||||
|
||||
exports.shorthands = {
|
||||
uuid: { type: 'uuid', primaryKey: true },
|
||||
id: { type: 'serial', primaryKey: true },
|
||||
timezone: { type: 'varchar(128)' },
|
||||
};
|
||||
|
||||
exports.up = (pgm) => {
|
||||
pgm.createTable('accounts', {
|
||||
id: 'id',
|
||||
username: { type: 'varchar(128)', notNull: true },
|
||||
email: { type: 'varchar(128)', notNull: true },
|
||||
password: { type: 'varchar(128)', notNull: true },
|
||||
timezone: 'timezone',
|
||||
earliest_time: { type: 'time' },
|
||||
latest_time: { type: 'time' },
|
||||
createdAt: {
|
||||
type: 'timestamp',
|
||||
notNull: true,
|
||||
default: pgm.func('current_timestamp'),
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
exports.down = (pgm) => {
|
||||
pgm.dropTable('accounts', { ifExists: true });
|
||||
};
|
||||
Reference in New Issue
Block a user