Skip to content
Snippets Groups Projects
Commit 70963c68 authored by Wilson JALLET's avatar Wilson JALLET :money_with_wings:
Browse files

Migrations to reimplement posts and add views counter to announcements

parent 363ae44f
No related branches found
No related tags found
No related merge requests found
exports.up = function(knex, Promise) {
return knex.schema.createTable('meta_group_membership', function (table){
table.timestamp(true, true);
table.string('member_uid').notNullable();
table.string('union_uid').notNullable();
table.enum('status', ['admin', 'speaker', 'basic']).notNullable();
});
return knex.schema.createTable('meta_group_membership', function (table){
table.timestamp(true, true);
table.string('member_uid').notNullable();
table.string('union_uid').notNullable();
table.enum('status', ['admin', 'speaker', 'basic']).notNullable();
});
};
exports.down = function(knex, Promise) {
return knex.schema.dropTable('meta_group_membership');
return knex.schema.dropTable('meta_group_membership');
};
......@@ -10,5 +10,5 @@ exports.up = function(knex, Promise) {
};
exports.down = function(knex, Promise) {
return knex.schema.dropTable('taken_rights');
return knex.schema.dropTable('taken_rights');
};
exports.up = async function(knex, Promise) {
await knex.schema.createTable('posts', function(table) {
table.inherits('messages');
});
await knex.schema.table('announcements', function(table) {
table.integer('views').defaultTo(0);
});
return;
};
exports.down = async function(knex, Promise) {
await knex.schema.dropTable('posts');
await knex.schema.table("announcements", function(table) {
table.dropColumn('views');
});
return;
};
exports.seed = function(knex, Promise) {
// Deletes ALL existing entries
/*
return knex('posts').del()
.then(function () {
const posts = [{
title: "Fissurer c'est bien",
description: "Les nouveaux ordis du JTX sont arrivés ! Le BR aide à les installer ;)",
content: "Les nouveaux ordis du JTX sont arrivés ! Le BR aide à les installer ;)",
authors: ['br','jtx']
},{
title: "Proj'et Promotion",
description: "La nouvelle proj' du JTX arrive !",
content: "La nouvelle proj' du JTX arrive !",
authors: ['br']
},{
title: "Fête de la Lune",
description: "C'est bientôt la fête de la Lune ! Inscrivez-vous pour un dîner-spectacle dans le Grand Hall !",
content: "C'est bientôt la fête de la Lune ! Inscrivez-vous pour un dîner-spectacle dans le Grand Hall !",
authors: ['x-chine']
},{
title: "Formation Web",
description: "Envie d'apprendre à faire un site Web en Django ? Alors viens en amphi Sauvy ce jeudi à 20h !",
content: "Envie d'apprendre à faire un site Web en Django ? Alors viens en amphi Sauvy ce jeudi à 20h !",
authors: ['br']
}];
return knex('posts').insert(posts);
});
*/
};
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