-
Notifications
You must be signed in to change notification settings - Fork 2
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 #9 from uwblueprint/S24/daniel/adding-behaviour-table
Added behaviour table
- Loading branch information
Showing
2 changed files
with
31 additions
and
0 deletions.
There are no files selected for viewing
24 changes: 24 additions & 0 deletions
24
backend/typescript/migrations/2024.06.12T01.36.05.create-behaviour-table.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,24 @@ | ||
import { DataType } from "sequelize-typescript"; | ||
|
||
import { Migration } from "../umzug"; | ||
|
||
const TABLE_NAME = "behaviours"; | ||
|
||
export const up: Migration = async ({ context: sequelize }) => { | ||
await sequelize.getQueryInterface().createTable(TABLE_NAME, { | ||
id: { | ||
type: DataType.INTEGER, | ||
allowNull: false, | ||
primaryKey: true, | ||
autoIncrement: true, | ||
}, | ||
behaviour_name: { | ||
type: DataType.STRING, | ||
allowNull: false, | ||
}, | ||
}); | ||
}; | ||
|
||
export const down: Migration = async ({ context: sequelize }) => { | ||
await sequelize.getQueryInterface().dropTable(TABLE_NAME); | ||
}; |
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,7 @@ | ||
import { Column, Model, Table } from "sequelize-typescript"; | ||
|
||
@Table({ tableName: "behaviours" }) | ||
export default class Behaviour extends Model { | ||
@Column | ||
behaviour_name!: string; | ||
} |