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

Initial commit

This commit is contained in:
Maksim Eltyshev 2019-08-31 04:07:25 +05:00
commit 36fe34e8e1
583 changed files with 91539 additions and 0 deletions

View file

@ -0,0 +1,19 @@
module.exports.up = knex =>
knex.schema.createTable('archive', table => {
/* Columns */
table.increments();
table.text('from_model').notNullable();
table.integer('original_record_id').notNullable();
table.json('original_record').notNullable();
table.timestamp('created_at', true);
table.timestamp('updated_at', true);
/* Indexes */
table.unique(['from_model', 'original_record_id']);
});
module.exports.down = knex => knex.schema.dropTable('archive');

View file

@ -0,0 +1,22 @@
module.exports.up = knex =>
knex.schema
.createTable('user', table => {
/* Columns */
table.increments();
table.text('email').notNullable();
table.text('password').notNullable();
table.boolean('is_admin').notNullable();
table.text('name').notNullable();
table.text('avatar');
table.timestamp('created_at', true);
table.timestamp('updated_at', true);
table.timestamp('deleted_at', true);
})
.raw(
'ALTER TABLE "user" ADD CONSTRAINT "user_email_unique" EXCLUDE ("email" WITH =) WHERE ("deleted_at" IS NULL)'
);
module.exports.down = knex => knex.schema.dropTable('user');

View file

@ -0,0 +1,13 @@
module.exports.up = knex =>
knex.schema.createTable('project', table => {
/* Columns */
table.increments();
table.text('name').notNullable();
table.timestamp('created_at', true);
table.timestamp('updated_at', true);
});
module.exports.down = knex => knex.schema.dropTable('project');

View file

@ -0,0 +1,19 @@
module.exports.up = knex =>
knex.schema.createTable('project_membership', table => {
/* Columns */
table.increments();
table.integer('project_id').notNullable();
table.integer('user_id').notNullable();
table.timestamp('created_at', true);
table.timestamp('updated_at', true);
/* Indexes */
table.unique(['project_id', 'user_id']);
table.index('user_id');
});
module.exports.down = knex => knex.schema.dropTable('project_membership');

View file

@ -0,0 +1,21 @@
module.exports.up = knex =>
knex.schema.createTable('board', table => {
/* Columns */
table.increments();
table.integer('project_id').notNullable();
table.specificType('position', 'double precision').notNullable();
table.text('name').notNullable();
table.timestamp('created_at', true);
table.timestamp('updated_at', true);
/* Indexes */
table.index('project_id');
table.index('position');
});
module.exports.down = knex => knex.schema.dropTable('board');

View file

@ -0,0 +1,21 @@
module.exports.up = knex =>
knex.schema.createTable('list', table => {
/* Columns */
table.increments();
table.integer('board_id').notNullable();
table.specificType('position', 'double precision').notNullable();
table.text('name').notNullable();
table.timestamp('created_at', true);
table.timestamp('updated_at', true);
/* Indexes */
table.index('board_id');
table.index('position');
});
module.exports.down = knex => knex.schema.dropTable('list');

View file

@ -0,0 +1,20 @@
module.exports.up = knex =>
knex.schema.createTable('label', table => {
/* Columns */
table.increments();
table.integer('board_id').notNullable();
table.text('name').notNullable();
table.text('color');
table.timestamp('created_at', true);
table.timestamp('updated_at', true);
/* Indexes */
table.index('board_id');
});
module.exports.down = knex => knex.schema.dropTable('label');

View file

@ -0,0 +1,25 @@
module.exports.up = knex =>
knex.schema.createTable('card', table => {
/* Columns */
table.increments();
table.integer('list_id').notNullable();
table.integer('board_id').notNullable();
table.specificType('position', 'double precision').notNullable();
table.text('name').notNullable();
table.text('description');
table.timestamp('deadline', true);
table.jsonb('timer');
table.timestamp('created_at', true);
table.timestamp('updated_at', true);
/* Indexes */
table.index('list_id');
table.index('position');
});
module.exports.down = knex => knex.schema.dropTable('card');

View file

@ -0,0 +1,21 @@
module.exports.up = knex =>
knex.schema.createTable('card_subscription', table => {
/* Columns */
table.increments();
table.integer('card_id').notNullable();
table.integer('user_id').notNullable();
table.boolean('is_permanent').notNullable();
table.timestamp('created_at', true);
table.timestamp('updated_at', true);
/* Indexes */
table.unique(['card_id', 'user_id']);
table.index('user_id');
});
module.exports.down = knex => knex.schema.dropTable('card_subscription');

View file

@ -0,0 +1,19 @@
module.exports.up = knex =>
knex.schema.createTable('card_membership', table => {
/* Columns */
table.increments();
table.integer('card_id').notNullable();
table.integer('user_id').notNullable();
table.timestamp('created_at', true);
table.timestamp('updated_at', true);
/* Indexes */
table.unique(['card_id', 'user_id']);
table.index('user_id');
});
module.exports.down = knex => knex.schema.dropTable('card_membership');

View file

@ -0,0 +1,19 @@
module.exports.up = knex =>
knex.schema.createTable('card_label', table => {
/* Columns */
table.increments();
table.integer('card_id').notNullable();
table.integer('label_id').notNullable();
table.timestamp('created_at', true);
table.timestamp('updated_at', true);
/* Indexes */
table.unique(['card_id', 'label_id']);
table.index('label_id');
});
module.exports.down = knex => knex.schema.dropTable('card_label');

View file

@ -0,0 +1,20 @@
module.exports.up = knex =>
knex.schema.createTable('task', table => {
/* Columns */
table.increments();
table.integer('card_id').notNullable();
table.text('name').notNullable();
table.boolean('is_completed').notNullable();
table.timestamp('created_at', true);
table.timestamp('updated_at', true);
/* Indexes */
table.index('card_id');
});
module.exports.down = knex => knex.schema.dropTable('task');

View file

@ -0,0 +1,21 @@
module.exports.up = knex =>
knex.schema.createTable('action', table => {
/* Columns */
table.increments();
table.integer('card_id').notNullable();
table.integer('user_id').notNullable();
table.text('type').notNullable();
table.jsonb('data').notNullable();
table.timestamp('created_at', true);
table.timestamp('updated_at', true);
/* Indexes */
table.index('card_id');
});
module.exports.down = knex => knex.schema.dropTable('action');

View file

@ -0,0 +1,24 @@
module.exports.up = knex =>
knex.schema.createTable('notification', table => {
/* Columns */
table.increments();
table.integer('user_id').notNullable();
table.integer('action_id').notNullable();
table.integer('card_id').notNullable();
table.boolean('is_read').notNullable();
table.timestamp('created_at', true);
table.timestamp('updated_at', true);
/* Indexes */
table.index('user_id');
table.index('action_id');
table.index('card_id');
table.index('is_read');
});
module.exports.down = knex => knex.schema.dropTable('notification');