Skip to content
Snippets Groups Projects
Commit 10171cb3 authored by Olivér FACKLAM's avatar Olivér FACKLAM
Browse files

authors et recipients tables dans Knex

parent f99ac481
No related branches found
No related tags found
No related merge requests found
exports.up = function (knex, Promise) {
return knex.schema.createTable('announcements_authors', function (table) {
table.increments('id'); //autoincrementing (non-nullable) primary key
table.integer('mid').notNullable()
.references('mid').inTable('messages_announcements')
.onDelete('CASCADE'); //if announcement is deleted, also delete authors
table.integer('gid').notNullable()
.references('gid').inTable('groups')
.onDelete('CASCADE'); //if group is deleted, also delete authors
});
};
exports.down = function (knex, Promise) {
return knex.schema.dropTable('announcements_authors');
};
exports.up = function (knex, Promise) {
return knex.schema.createTable('announcements_recipients', function (table) {
table.increments('id'); //autoincrementing (non-nullable) primary key
table.integer('mid').notNullable()
.references('mid').inTable('messages_announcements')
.onDelete('CASCADE'); //if announcement is deleted, also delete recipients
table.integer('gid').notNullable()
.references('gid').inTable('groups')
.onDelete('CASCADE'); //if group is deleted, also delete recipient
});
};
exports.down = function (knex, Promise) {
return knex.schema.dropTable('announcements_recipients');
};
exports.up = function (knex, Promise) {
return knex.schema.createTable('events_authors', function (table) {
table.increments('id'); //autoincrementing (non-nullable) primary key
table.integer('mid').notNullable()
.references('mid').inTable('messages_events')
.onDelete('CASCADE'); //if event is deleted, also delete authors
table.integer('gid').notNullable()
.references('gid').inTable('groups')
.onDelete('CASCADE'); //if group is deleted, also delete authors
});
};
exports.down = function (knex, Promise) {
return knex.schema.dropTable('events_authors');
};
exports.up = function (knex, Promise) {
return knex.schema.createTable('events_recipients', function (table) {
table.increments('id'); //autoincrementing (non-nullable) primary key
table.integer('mid').notNullable()
.references('mid').inTable('messages_events')
.onDelete('CASCADE'); //if event is deleted, also delete recipients
table.integer('gid').notNullable()
.references('gid').inTable('groups')
.onDelete('CASCADE'); //if group is deleted, also delete recipient
});
};
exports.down = function (knex, Promise) {
return knex.schema.dropTable('events_recipients');
};
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment