diff --git a/migrations/20220419172600-create-data_groups.js b/migrations/20220419172600-create-data_groups.js index 85f015c..b35afc0 100644 --- a/migrations/20220419172600-create-data_groups.js +++ b/migrations/20220419172600-create-data_groups.js @@ -1,18 +1,16 @@ -'use strict'; +"use strict"; module.exports = { - async up(queryInterface, Sequelize) { - - await queryInterface.sequelize.query( - `CREATE TABLE data_groups ( + async up(queryInterface, Sequelize) { + await queryInterface.sequelize.query( + `CREATE TABLE data_groups ( iddata_groups INT NOT NULL AUTO_INCREMENT, title VARCHAR(45) NOT NULL, PRIMARY KEY (iddata_groups) ) ENGINE=InnoDB DEFAULT CHARSET=latin1` - ); - - }, - async down(queryInterface, Sequelize) { - await queryInterface.sequelize.query(`DROP TABLE data_groups`); - } -}; \ No newline at end of file + ); + }, + async down(queryInterface, Sequelize) { + await queryInterface.sequelize.query(`DROP TABLE data_groups`); + }, +}; diff --git a/migrations/2024041716570000-add-data_groups-hex_colour.js b/migrations/2024041716570000-add-data_groups-hex_colour.js new file mode 100644 index 0000000..482630b --- /dev/null +++ b/migrations/2024041716570000-add-data_groups-hex_colour.js @@ -0,0 +1,16 @@ +"use strict"; + +module.exports = { + async up(queryInterface, Sequelize) { + await queryInterface.sequelize.query( + `ALTER TABLE data_groups + ADD hex_colour VARCHAR(7) DEFAULT NULL;` + ); + }, + async down(queryInterface, Sequelize) { + await queryInterface.sequelize.query( + `ALTER TABLE data_groups + DROP hex_colour;` + ); + }, +}; diff --git a/src/queries/database.ts b/src/queries/database.ts index a60ac07..84f8c7b 100644 --- a/src/queries/database.ts +++ b/src/queries/database.ts @@ -123,6 +123,7 @@ const DataGroupModel = sequelize.define( primaryKey: true, }, title: { type: DataTypes.STRING }, + hex_colour: { type: DataTypes.STRING }, }, { tableName: "data_groups",