Skip to content

Commit

Permalink
Merge pull request #152 from Carifio24/small-class-flag
Browse files Browse the repository at this point in the history
Add small class flag
  • Loading branch information
Carifio24 authored Oct 17, 2024
2 parents 72ff314 + 6918bcf commit 3a7a9c1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/models/class.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export class Class extends Model<InferAttributes<Class>, InferCreationAttributes
declare asynchronous: CreationOptional<boolean>;
declare test: CreationOptional<boolean>;
declare expected_size: CreationOptional<number>;
declare small_class: CreationOptional<boolean>;
}

export function initializeClassModel(sequelize: Sequelize) {
Expand Down Expand Up @@ -67,6 +68,9 @@ export function initializeClassModel(sequelize: Sequelize) {
type: DataTypes.INTEGER.UNSIGNED,
allowNull: false,
},
small_class: {
type: "tinyint(1) GENERATED ALWAYS AS (expected_size < 10) VIRTUAL",
},
}, {
sequelize,
});
Expand Down
1 change: 1 addition & 0 deletions src/sql/create_class_table.sql
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ CREATE TABLE Classes (
test tinyint(1) NOT NULL DEFAULT 0,
updated datetime DEFAULT NULL,
expected_size int(11) UNSIGNED NOT NULL,
small_class tinyint(1) GENERATED ALWAYS AS (expected_size < 10) VIRTUAL,

PRIMARY KEY(id),
INDEX(educator_id),
Expand Down

0 comments on commit 3a7a9c1

Please sign in to comment.