-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #161 from Carifio24/hubble-s5-overrides
Add waiting room overrides for Hubble story
- Loading branch information
Showing
5 changed files
with
156 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
src/stories/hubbles_law/models/hubble_waiting_room_override.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { Class } from "../../../models"; | ||
import { Sequelize, DataTypes, Model, InferAttributes, InferCreationAttributes, CreationOptional } from "sequelize"; | ||
|
||
export class HubbleWaitingRoomOverride extends Model<InferAttributes<HubbleWaitingRoomOverride>, InferCreationAttributes<HubbleWaitingRoomOverride>> { | ||
declare class_id: number; | ||
declare timestamp: CreationOptional<Date>; | ||
} | ||
|
||
export function initializeHubbleWaitingRoomOverrideModel(sequelize: Sequelize) { | ||
HubbleWaitingRoomOverride.init({ | ||
class_id: { | ||
type: DataTypes.INTEGER.UNSIGNED, | ||
allowNull: false, | ||
primaryKey: true, | ||
references: { | ||
model: Class, | ||
key: "id", | ||
} | ||
}, | ||
timestamp: { | ||
type: DataTypes.DATE, | ||
allowNull: false, | ||
defaultValue: Sequelize.literal("CURRENT_TIMESTAMP"), | ||
} | ||
}, { | ||
sequelize, | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
src/stories/hubbles_law/sql/create_hubble_waiting_room_overrides.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
CREATE TABLE HubbleWaitingRoomOverrides ( | ||
class_id int(11) UNSIGNED NOT NULL, | ||
timestamp TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP | ||
ON UPDATE CURRENT_TIMESTAMP, | ||
|
||
PRIMARY KEY(class_id), | ||
FOREIGN KEY(class_id) | ||
REFERENCES Classes(id) | ||
ON UPDATE CASCADE | ||
ON DELETE CASCADE | ||
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci PACK_KEYS=0; |