-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSQLmodel.mjs
More file actions
27 lines (22 loc) · 818 Bytes
/
Copy pathSQLmodel.mjs
File metadata and controls
27 lines (22 loc) · 818 Bytes
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
import {QueryTypes,DataTypes, Sequelize, UUIDV4} from "sequelize";
import {fileURLToPath} from "url";
import {dirname, join} from "path";
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
export const sequelize = new Sequelize({
dialect: "sqlite", storage: join(__dirname, "database.sqlite"),
});
export const User = sequelize.define('User', {
uuid: {
type: DataTypes.UUID, defaultValue: UUIDV4, primaryKey: true
}, username: {
type: DataTypes.STRING, allowNull: false
}, password: {
type: DataTypes.STRING, allowNull: false
}, email: {
type: DataTypes.STRING
}, isActive: {
type: DataTypes.BOOLEAN, defaultValue: false, allowNull: false
}
}, {freezeTableName: true});
await sequelize.sync({alter: true});