Skip to content

Commit

Permalink
Added hex_colour column to data_groups table (#56)
Browse files Browse the repository at this point in the history
  • Loading branch information
ms0ur1s authored Apr 18, 2024
1 parent af1ee26 commit 09f9689
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 12 deletions.
22 changes: 10 additions & 12 deletions migrations/20220419172600-create-data_groups.js
Original file line number Diff line number Diff line change
@@ -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`);
}
};
);
},
async down(queryInterface, Sequelize) {
await queryInterface.sequelize.query(`DROP TABLE data_groups`);
},
};
16 changes: 16 additions & 0 deletions migrations/2024041716570000-add-data_groups-hex_colour.js
Original file line number Diff line number Diff line change
@@ -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;`
);
},
};
1 change: 1 addition & 0 deletions src/queries/database.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ const DataGroupModel = sequelize.define(
primaryKey: true,
},
title: { type: DataTypes.STRING },
hex_colour: { type: DataTypes.STRING },
},
{
tableName: "data_groups",
Expand Down

0 comments on commit 09f9689

Please sign in to comment.