Start add account endpoint

This commit is contained in:
2020-05-01 17:32:46 +02:00
parent 8465c4ecd6
commit 7e4d186446
9 changed files with 84 additions and 34 deletions

View File

@@ -1,9 +1,14 @@
/* eslint-disable camelcase */
const { PgLiteral } = require('node-pg-migrate');
exports.shorthands = {
id: { type: 'serial', primaryKey: true },
varchar: { type: 'varchar(128)' },
varchar_req: { type: 'varchar(128)', notNull: true }
varchar_req: { type: 'varchar(128)', notNull: true },
created_at: {
type: 'timestamp',
notNull: true,
default: PgLiteral.create('CURRENT_TIMESTAMP'),
},
};
exports.up = (pgm) => {
@@ -15,11 +20,7 @@ exports.up = (pgm) => {
timezone: 'varchar',
earliest_time: 'time',
latest_time: 'time',
createdAt: {
type: 'timestamp',
notNull: true,
default: pgm.func('current_timestamp'),
},
createdAt: 'created_at',
});
pgm.createTable('meeting', {
@@ -31,11 +32,7 @@ exports.up = (pgm) => {
duration: 'int',
status: 'boolean',
password: 'varchar',
createdAt: {
type: 'timestamp',
notNull: true,
default: pgm.func('current_timestamp'),
},
createdAt: 'created_at',
});
pgm.createTable('possible_date', {
@@ -70,11 +67,7 @@ exports.up = (pgm) => {
host: 'boolean',
answered: 'boolean',
timezone: 'varchar',
createdAt: {
type: 'timestamp',
notNull: true,
default: pgm.func('current_timestamp'),
},
createdAt: 'created_at',
});
pgm.createTable('availibility', {
@@ -95,11 +88,7 @@ exports.up = (pgm) => {
start_time: { type: 'timestamp', notNull: true },
end_time: { type: 'timestamp', notNull: true },
timezone: 'varchar_req',
createdAt: {
type: 'timestamp',
notNull: true,
default: pgm.func('current_timestamp'),
},
createdAt: 'created_at',
});
};

View File

@@ -1,5 +0,0 @@
## How to do a migration
- Create `.env` to the root folder
- Add the database url to the `.env` file:
`DATABASE_URL=postgres://db_user:password@server_url:PORT/db_name`
- Run `npm run migrate up`