-
Notifications
You must be signed in to change notification settings - Fork 0
/
db.ts
44 lines (40 loc) · 1.18 KB
/
db.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
const Sequelize = require('sequelize');
const sequelize = new Sequelize({
dialect: 'sqlite',
storage: './db.sqlite',
operatorsAliases: false,
logging: false,
});
sequelize
.authenticate()
.catch((err: Error) => {
console.error('sequelize.authenticate()', err);
});
class Order extends Sequelize.Model {
public id!: number;
public mixture!: number;
public randomized_by_user!: boolean;
public finished_by_bartender!: boolean;
public paid!: boolean;
public played_by_dj!: boolean;
public time!: string;
}
Order.init({
id: { type: Sequelize.INTEGER, primaryKey: true, allowNull: false, autoIncrement: true },
mixture: { type: Sequelize.INTEGER, allowNull: false },
randomized_by_user: { type: Sequelize.BOOLEAN, allowNull: false },
finished_by_bartender: { type: Sequelize.BOOLEAN, allowNull: false },
paid: { type: Sequelize.BOOLEAN, allowNull: false },
played_by_dj: { type: Sequelize.BOOLEAN, allowNull: false },
time: { type: Sequelize.STRING, allowNull: true },
}, {
sequelize: sequelize,
timestamps: false,
freezeTableName: true,
tableName: 'orders',
});
export {
Sequelize,
sequelize,
Order,
};