/
users.model.ts
73 lines (71 loc) · 1.69 KB
/
users.model.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
import {DataTypes, Model, ReferenceOption} from "../src/";
const model: Model = {
tableName: 'users',
autoId: true,
comment: 'User Table',
columns: {
code: {
type: 'varchar',
length: 20,
},
username: {
type: 'varchar',
length: 15,
unique: true,
defaultValue: 'hello',
comment: 'user use username to login',
},
password: {
type: 'string',
length: 100,
comment: ` password`,
},
description: {
type: 'string',
comment: 'your description'
},
enabled: {
type: 'char',
defaultValue: 'D'
},
profile: {
type: 'json',
},
height: {
type: 'integer',
defaultValue: 30,
},
dept_id: {
type: 'integer',
unsigned: true,
},
province_id: {
type: 'integer',
unsigned: true,
},
accountStatus: {
type: DataTypes.INTEGER,
defaultValue: 1,
comment: '收费状态, 0未收费,1收费'
},
weight: {
type: 'integer',
},
deptId: {
type: DataTypes.INTEGER,
unsigned: true,
nullable: true,
reference: {
table: 'Depts',
column: 'id',
onDelete: ReferenceOption.SET_NULL,
}
}
},
timestamps: {
makeDefaultNow: true,
},
indexes: [['dept_id', 'province_id'], ['deptId']],
engine: 'InnoDB',
}
export default model;