Skip to content

Commit

Permalink
Update merge groups table definition.
Browse files Browse the repository at this point in the history
  • Loading branch information
Carifio24 committed Oct 29, 2024
1 parent fdf2b8f commit 0e0aa16
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
6 changes: 5 additions & 1 deletion src/stories/hubbles_law/models/hubble_class_merge_group.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,13 @@ export function initializeHubbleClassMergeGroupModel(sequelize: Sequelize) {
group_id: {
type: DataTypes.INTEGER.UNSIGNED,
allowNull: false,
autoIncrement: true,
primaryKey: true,
},
class_id: {
type: DataTypes.INTEGER.UNSIGNED,
allowNull: false,
unique: true,
primaryKey: true,
references: {
model: Class,
key: "id",
Expand All @@ -30,6 +31,9 @@ export function initializeHubbleClassMergeGroupModel(sequelize: Sequelize) {
}, {
sequelize,
indexes: [
{
fields: ["group_id"],
},
{
fields: ["class_id"],
},
Expand Down
5 changes: 3 additions & 2 deletions src/stories/hubbles_law/sql/create_merge_groups_table.sql
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
CREATE TABLE HubbleClassMergeGroups(
group_id int(11) UNSIGNED NOT NULL UNIQUE AUTO_INCREMENT,
group_id int(11) UNSIGNED NOT NULL,
class_id int(11) UNSIGNED NOT NULL UNIQUE,
merge_order int(11) UNSIGNED NOT NULL,

PRIMARY KEY(group_id),
PRIMARY KEY(group_id, class_id),
INDEX(group_id),
INDEX(class_id),
FOREIGN KEY(class_id)
REFERENCES Classes(id)
Expand Down

0 comments on commit 0e0aa16

Please sign in to comment.