mirror of
https://github.com/plankanban/planka.git
synced 2025-07-25 08:09:44 +02:00
Add username to user
This commit is contained in:
parent
ec222a5e32
commit
af00e3e191
143 changed files with 1051 additions and 420 deletions
|
@ -1,4 +1,4 @@
|
|||
module.exports.up = knex =>
|
||||
module.exports.up = (knex) =>
|
||||
knex.raw(`
|
||||
CREATE SEQUENCE next_id_seq;
|
||||
|
||||
|
@ -20,7 +20,7 @@ module.exports.up = knex =>
|
|||
$$ LANGUAGE PLPGSQL;
|
||||
`);
|
||||
|
||||
module.exports.down = knex =>
|
||||
module.exports.down = (knex) =>
|
||||
knex.raw(`
|
||||
DROP SEQUENCE next_id_seq;
|
||||
DROP FUNCTION next_id(OUT id BIGINT);
|
||||
|
|
|
@ -1,11 +1,8 @@
|
|||
module.exports.up = knex =>
|
||||
knex.schema.createTable('archive', table => {
|
||||
module.exports.up = (knex) =>
|
||||
knex.schema.createTable('archive', (table) => {
|
||||
/* Columns */
|
||||
|
||||
table
|
||||
.bigInteger('id')
|
||||
.primary()
|
||||
.defaultTo(knex.raw('next_id()'));
|
||||
table.bigInteger('id').primary().defaultTo(knex.raw('next_id()'));
|
||||
|
||||
table.text('from_model').notNullable();
|
||||
table.bigInteger('original_record_id').notNullable();
|
||||
|
@ -19,4 +16,4 @@ module.exports.up = knex =>
|
|||
table.unique(['from_model', 'original_record_id']);
|
||||
});
|
||||
|
||||
module.exports.down = knex => knex.schema.dropTable('archive');
|
||||
module.exports.down = (knex) => knex.schema.dropTable('archive');
|
||||
|
|
|
@ -1,17 +1,15 @@
|
|||
module.exports.up = knex =>
|
||||
module.exports.up = (knex) =>
|
||||
knex.schema
|
||||
.createTable('user_account', table => {
|
||||
.createTable('user_account', (table) => {
|
||||
/* Columns */
|
||||
|
||||
table
|
||||
.bigInteger('id')
|
||||
.primary()
|
||||
.defaultTo(knex.raw('next_id()'));
|
||||
table.bigInteger('id').primary().defaultTo(knex.raw('next_id()'));
|
||||
|
||||
table.text('email').notNullable();
|
||||
table.text('password').notNullable();
|
||||
table.boolean('is_admin').notNullable();
|
||||
table.text('name').notNullable();
|
||||
table.text('username');
|
||||
table.text('avatar');
|
||||
|
||||
table.timestamp('created_at', true);
|
||||
|
@ -20,6 +18,9 @@ module.exports.up = knex =>
|
|||
})
|
||||
.raw(
|
||||
'ALTER TABLE "user_account" ADD CONSTRAINT "user_email_unique" EXCLUDE ("email" WITH =) WHERE ("deleted_at" IS NULL)',
|
||||
)
|
||||
.raw(
|
||||
'ALTER TABLE "user_account" ADD CONSTRAINT "user_username_unique" EXCLUDE ("username" WITH =) WHERE ("username" IS NOT NULL AND "deleted_at" IS NULL)',
|
||||
);
|
||||
|
||||
module.exports.down = knex => knex.schema.dropTable('user_account');
|
||||
module.exports.down = (knex) => knex.schema.dropTable('user_account');
|
||||
|
|
|
@ -1,11 +1,8 @@
|
|||
module.exports.up = knex =>
|
||||
knex.schema.createTable('project', table => {
|
||||
module.exports.up = (knex) =>
|
||||
knex.schema.createTable('project', (table) => {
|
||||
/* Columns */
|
||||
|
||||
table
|
||||
.bigInteger('id')
|
||||
.primary()
|
||||
.defaultTo(knex.raw('next_id()'));
|
||||
table.bigInteger('id').primary().defaultTo(knex.raw('next_id()'));
|
||||
|
||||
table.text('name').notNullable();
|
||||
|
||||
|
@ -13,4 +10,4 @@ module.exports.up = knex =>
|
|||
table.timestamp('updated_at', true);
|
||||
});
|
||||
|
||||
module.exports.down = knex => knex.schema.dropTable('project');
|
||||
module.exports.down = (knex) => knex.schema.dropTable('project');
|
||||
|
|
|
@ -1,11 +1,8 @@
|
|||
module.exports.up = knex =>
|
||||
knex.schema.createTable('project_membership', table => {
|
||||
module.exports.up = (knex) =>
|
||||
knex.schema.createTable('project_membership', (table) => {
|
||||
/* Columns */
|
||||
|
||||
table
|
||||
.bigInteger('id')
|
||||
.primary()
|
||||
.defaultTo(knex.raw('next_id()'));
|
||||
table.bigInteger('id').primary().defaultTo(knex.raw('next_id()'));
|
||||
|
||||
table.bigInteger('project_id').notNullable();
|
||||
table.bigInteger('user_id').notNullable();
|
||||
|
@ -19,4 +16,4 @@ module.exports.up = knex =>
|
|||
table.index('user_id');
|
||||
});
|
||||
|
||||
module.exports.down = knex => knex.schema.dropTable('project_membership');
|
||||
module.exports.down = (knex) => knex.schema.dropTable('project_membership');
|
||||
|
|
|
@ -1,11 +1,8 @@
|
|||
module.exports.up = knex =>
|
||||
knex.schema.createTable('board', table => {
|
||||
module.exports.up = (knex) =>
|
||||
knex.schema.createTable('board', (table) => {
|
||||
/* Columns */
|
||||
|
||||
table
|
||||
.bigInteger('id')
|
||||
.primary()
|
||||
.defaultTo(knex.raw('next_id()'));
|
||||
table.bigInteger('id').primary().defaultTo(knex.raw('next_id()'));
|
||||
|
||||
table.bigInteger('project_id').notNullable();
|
||||
|
||||
|
@ -21,4 +18,4 @@ module.exports.up = knex =>
|
|||
table.index('position');
|
||||
});
|
||||
|
||||
module.exports.down = knex => knex.schema.dropTable('board');
|
||||
module.exports.down = (knex) => knex.schema.dropTable('board');
|
||||
|
|
|
@ -1,11 +1,8 @@
|
|||
module.exports.up = knex =>
|
||||
knex.schema.createTable('list', table => {
|
||||
module.exports.up = (knex) =>
|
||||
knex.schema.createTable('list', (table) => {
|
||||
/* Columns */
|
||||
|
||||
table
|
||||
.bigInteger('id')
|
||||
.primary()
|
||||
.defaultTo(knex.raw('next_id()'));
|
||||
table.bigInteger('id').primary().defaultTo(knex.raw('next_id()'));
|
||||
|
||||
table.bigInteger('board_id').notNullable();
|
||||
|
||||
|
@ -21,4 +18,4 @@ module.exports.up = knex =>
|
|||
table.index('position');
|
||||
});
|
||||
|
||||
module.exports.down = knex => knex.schema.dropTable('list');
|
||||
module.exports.down = (knex) => knex.schema.dropTable('list');
|
||||
|
|
|
@ -1,11 +1,8 @@
|
|||
module.exports.up = knex =>
|
||||
knex.schema.createTable('label', table => {
|
||||
module.exports.up = (knex) =>
|
||||
knex.schema.createTable('label', (table) => {
|
||||
/* Columns */
|
||||
|
||||
table
|
||||
.bigInteger('id')
|
||||
.primary()
|
||||
.defaultTo(knex.raw('next_id()'));
|
||||
table.bigInteger('id').primary().defaultTo(knex.raw('next_id()'));
|
||||
|
||||
table.bigInteger('board_id').notNullable();
|
||||
|
||||
|
@ -20,4 +17,4 @@ module.exports.up = knex =>
|
|||
table.index('board_id');
|
||||
});
|
||||
|
||||
module.exports.down = knex => knex.schema.dropTable('label');
|
||||
module.exports.down = (knex) => knex.schema.dropTable('label');
|
||||
|
|
|
@ -1,11 +1,8 @@
|
|||
module.exports.up = knex =>
|
||||
knex.schema.createTable('card', table => {
|
||||
module.exports.up = (knex) =>
|
||||
knex.schema.createTable('card', (table) => {
|
||||
/* Columns */
|
||||
|
||||
table
|
||||
.bigInteger('id')
|
||||
.primary()
|
||||
.defaultTo(knex.raw('next_id()'));
|
||||
table.bigInteger('id').primary().defaultTo(knex.raw('next_id()'));
|
||||
|
||||
table.bigInteger('list_id').notNullable();
|
||||
table.bigInteger('board_id').notNullable();
|
||||
|
@ -25,4 +22,4 @@ module.exports.up = knex =>
|
|||
table.index('position');
|
||||
});
|
||||
|
||||
module.exports.down = knex => knex.schema.dropTable('card');
|
||||
module.exports.down = (knex) => knex.schema.dropTable('card');
|
||||
|
|
|
@ -1,11 +1,8 @@
|
|||
module.exports.up = knex =>
|
||||
knex.schema.createTable('card_subscription', table => {
|
||||
module.exports.up = (knex) =>
|
||||
knex.schema.createTable('card_subscription', (table) => {
|
||||
/* Columns */
|
||||
|
||||
table
|
||||
.bigInteger('id')
|
||||
.primary()
|
||||
.defaultTo(knex.raw('next_id()'));
|
||||
table.bigInteger('id').primary().defaultTo(knex.raw('next_id()'));
|
||||
|
||||
table.bigInteger('card_id').notNullable();
|
||||
table.bigInteger('user_id').notNullable();
|
||||
|
@ -21,4 +18,4 @@ module.exports.up = knex =>
|
|||
table.index('user_id');
|
||||
});
|
||||
|
||||
module.exports.down = knex => knex.schema.dropTable('card_subscription');
|
||||
module.exports.down = (knex) => knex.schema.dropTable('card_subscription');
|
||||
|
|
|
@ -1,11 +1,8 @@
|
|||
module.exports.up = knex =>
|
||||
knex.schema.createTable('card_membership', table => {
|
||||
module.exports.up = (knex) =>
|
||||
knex.schema.createTable('card_membership', (table) => {
|
||||
/* Columns */
|
||||
|
||||
table
|
||||
.bigInteger('id')
|
||||
.primary()
|
||||
.defaultTo(knex.raw('next_id()'));
|
||||
table.bigInteger('id').primary().defaultTo(knex.raw('next_id()'));
|
||||
|
||||
table.bigInteger('card_id').notNullable();
|
||||
table.bigInteger('user_id').notNullable();
|
||||
|
@ -19,4 +16,4 @@ module.exports.up = knex =>
|
|||
table.index('user_id');
|
||||
});
|
||||
|
||||
module.exports.down = knex => knex.schema.dropTable('card_membership');
|
||||
module.exports.down = (knex) => knex.schema.dropTable('card_membership');
|
||||
|
|
|
@ -1,11 +1,8 @@
|
|||
module.exports.up = knex =>
|
||||
knex.schema.createTable('card_label', table => {
|
||||
module.exports.up = (knex) =>
|
||||
knex.schema.createTable('card_label', (table) => {
|
||||
/* Columns */
|
||||
|
||||
table
|
||||
.bigInteger('id')
|
||||
.primary()
|
||||
.defaultTo(knex.raw('next_id()'));
|
||||
table.bigInteger('id').primary().defaultTo(knex.raw('next_id()'));
|
||||
|
||||
table.bigInteger('card_id').notNullable();
|
||||
table.bigInteger('label_id').notNullable();
|
||||
|
@ -19,4 +16,4 @@ module.exports.up = knex =>
|
|||
table.index('label_id');
|
||||
});
|
||||
|
||||
module.exports.down = knex => knex.schema.dropTable('card_label');
|
||||
module.exports.down = (knex) => knex.schema.dropTable('card_label');
|
||||
|
|
|
@ -1,11 +1,8 @@
|
|||
module.exports.up = knex =>
|
||||
knex.schema.createTable('task', table => {
|
||||
module.exports.up = (knex) =>
|
||||
knex.schema.createTable('task', (table) => {
|
||||
/* Columns */
|
||||
|
||||
table
|
||||
.bigInteger('id')
|
||||
.primary()
|
||||
.defaultTo(knex.raw('next_id()'));
|
||||
table.bigInteger('id').primary().defaultTo(knex.raw('next_id()'));
|
||||
|
||||
table.bigInteger('card_id').notNullable();
|
||||
|
||||
|
@ -20,4 +17,4 @@ module.exports.up = knex =>
|
|||
table.index('card_id');
|
||||
});
|
||||
|
||||
module.exports.down = knex => knex.schema.dropTable('task');
|
||||
module.exports.down = (knex) => knex.schema.dropTable('task');
|
||||
|
|
|
@ -1,11 +1,8 @@
|
|||
module.exports.up = knex =>
|
||||
knex.schema.createTable('action', table => {
|
||||
module.exports.up = (knex) =>
|
||||
knex.schema.createTable('action', (table) => {
|
||||
/* Columns */
|
||||
|
||||
table
|
||||
.bigInteger('id')
|
||||
.primary()
|
||||
.defaultTo(knex.raw('next_id()'));
|
||||
table.bigInteger('id').primary().defaultTo(knex.raw('next_id()'));
|
||||
|
||||
table.bigInteger('card_id').notNullable();
|
||||
table.bigInteger('user_id').notNullable();
|
||||
|
@ -21,4 +18,4 @@ module.exports.up = knex =>
|
|||
table.index('card_id');
|
||||
});
|
||||
|
||||
module.exports.down = knex => knex.schema.dropTable('action');
|
||||
module.exports.down = (knex) => knex.schema.dropTable('action');
|
||||
|
|
|
@ -1,11 +1,8 @@
|
|||
module.exports.up = knex =>
|
||||
knex.schema.createTable('notification', table => {
|
||||
module.exports.up = (knex) =>
|
||||
knex.schema.createTable('notification', (table) => {
|
||||
/* Columns */
|
||||
|
||||
table
|
||||
.bigInteger('id')
|
||||
.primary()
|
||||
.defaultTo(knex.raw('next_id()'));
|
||||
table.bigInteger('id').primary().defaultTo(knex.raw('next_id()'));
|
||||
|
||||
table.bigInteger('user_id').notNullable();
|
||||
table.bigInteger('action_id').notNullable();
|
||||
|
@ -24,4 +21,4 @@ module.exports.up = knex =>
|
|||
table.index('is_read');
|
||||
});
|
||||
|
||||
module.exports.down = knex => knex.schema.dropTable('notification');
|
||||
module.exports.down = (knex) => knex.schema.dropTable('notification');
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
const bcrypt = require('bcrypt');
|
||||
|
||||
exports.seed = knex => {
|
||||
exports.seed = (knex) => {
|
||||
const date = new Date().toUTCString();
|
||||
|
||||
return knex('user_account').insert({
|
||||
|
@ -8,6 +8,7 @@ exports.seed = knex => {
|
|||
password: bcrypt.hashSync('demo', 10),
|
||||
isAdmin: true,
|
||||
name: 'Demo Demo',
|
||||
username: 'demo',
|
||||
createdAt: date,
|
||||
updatedAt: date,
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue