1
0
Fork 0
mirror of https://github.com/plankanban/planka.git synced 2025-07-18 20:59:44 +02:00
planka/server/db/migrations/20180721220409_create_user_account_table.js

30 lines
1 KiB
JavaScript
Raw Normal View History

2020-04-03 00:35:25 +05:00
module.exports.up = (knex) =>
knex.schema
2020-04-03 00:35:25 +05:00
.createTable('user_account', (table) => {
/* Columns */
2019-08-31 04:07:25 +05:00
2020-04-03 00:35:25 +05:00
table.bigInteger('id').primary().defaultTo(knex.raw('next_id()'));
2019-08-31 04:07:25 +05:00
table.text('email').notNullable();
table.text('password').notNullable();
table.boolean('is_admin').notNullable();
table.text('name').notNullable();
2020-04-03 00:35:25 +05:00
table.text('username');
2020-04-21 05:04:34 +05:00
table.text('avatar_dirname');
table.text('phone');
table.text('organization');
table.boolean('subscribe_to_own_cards').notNullable();
2019-08-31 04:07:25 +05:00
table.timestamp('created_at', true);
table.timestamp('updated_at', true);
table.timestamp('deleted_at', true);
})
.raw(
'ALTER TABLE "user_account" ADD CONSTRAINT "user_email_unique" EXCLUDE ("email" WITH =) WHERE ("deleted_at" IS NULL)',
2020-04-03 00:35:25 +05:00
)
.raw(
'ALTER TABLE "user_account" ADD CONSTRAINT "user_username_unique" EXCLUDE ("username" WITH =) WHERE ("username" IS NOT NULL AND "deleted_at" IS NULL)',
);
2019-08-31 04:07:25 +05:00
2020-04-03 00:35:25 +05:00
module.exports.down = (knex) => knex.schema.dropTable('user_account');