timetable.model.js 1.21 KB
Newer Older
Jiwon Yoon's avatar
Jiwon Yoon committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import Sequelize from "sequelize";

const { DataTypes } = Sequelize;

const TimeTableModel = (sequelize) => {
    const TimeTable = sequelize.define(
        "timetable",
        {
            id: {
                type: DataTypes.INTEGER,
                primaryKey: true,
                autoIncrement: true,
            },
            theater: {
                type: DataTypes.INTEGER,
            },
            movieId: {
                type: DataTypes.INTEGER,
            },
            title: {
                type: DataTypes.STRING,
            },
23
24
25
            runtime: {
                type: DataTypes.INTEGER,
            },
Jiwon Yoon's avatar
Jiwon Yoon committed
26
27
28
            release_date: {
                type: DataTypes.STRING
            },
29
30
31
32
33
34
35
            start_date: {
                type: DataTypes.DATE,
                defaultValue: new Date(0)
            },
            end_date: {
                type: DataTypes.DATE,
                defaultValue: new Date(0)
Jiwon Yoon's avatar
Jiwon Yoon committed
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
            },
            time: {  
                type: DataTypes.TIME,
            },
        },
        {
            // timestamps: true,
            freezeTableName: true,
            tableName: "timetables"
        }
    );
    return TimeTable;
};

export default TimeTableModel;