Skip to content
Snippets Groups Projects
Commit 8052464c authored by Anatole ROMON's avatar Anatole ROMON
Browse files

migration : ajout de trois tables de requêtes

parent 3d2be5a8
No related branches found
No related tags found
No related merge requests found
exports.up = function(knex, Promise) {
return knex.schema.createTable('user_join_group_requests', function (table) {
table.timestamps(true, true);
table.increments('id');
table.string('userUID').notNullable();
table.string('groupUID').notNullable();
table.text('message')
});
return knex.schema.createTable('request', function (table){
table.timestamps(true, true);
table.increments('id');
table.string('recepient').notNullable();
table.text('message');
}).then(()=>{
return knex.schema.createTable('user_join_group', function (table) {
table.inherits('request');
table.string('useruid').notNullable();
}).then(()=>{
return knex.schema.createTable('group_join_event', function (table){
table.inherits('request');
table.string('eventuid').notNullable();
table.string('senderuid').notNullable();
}).then(() => {
return knex.schema.createTable('your_group_host_event', function(table){
table.inherits('request');
table.string('eventuid').notNullable();
table.string('senderuid').notNullable();
});
});
});
});
};
exports.down = function(knex, Promise) {
return knex.schema.dropTable('user_join_group_requests')
return knex.schema.dropTable('your_group_host_event').then(() => {
return knex.schema.dropTable('group_join_event').then(() => {
return knex.schema.dropTable('user_join_group').then(() => {
return knex.schema.dropTable('request').then(() => {
});
});
});
});
};
exports.seed = function(knex, Promise) {
// Deletes ALL existing entries
return knex('user_join_group').del()
.then(function () {
// Inserts seed entries
return knex('user_join_group').insert([
{ id: 1,
recepient: 'br',
message: "C'est ici pour développer sigma ?",
useruid: "anatole.romon"
},
{ id: 2,
recepient: 'br',
message: "Bonjour, je cherche le binet subaisse",
useruid: "quentin.gendre"
}
]);
});
};
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