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
|
module.exports = (Sequelize, sequelize) => {
const Citizens = sequelize.define("citizens", {
citizen_id: {
type: Sequelize.STRING(12),
allowNull: false,
primaryKey: true,
},
first_name: {
type: Sequelize.STRING(255),
allowNull: false,
},
middle_name: {
type: Sequelize.STRING(255),
allowNull: true,
},
last_name: {
type: Sequelize.STRING(255),
allowNull: false,
},
address: {
type: Sequelize.STRING(500),
allowNull: false,
},
mobile_num: {
type: Sequelize.STRING(15),
allowNull: false,
},
dob: {
type: Sequelize.DATE,
allowNull: false,
},
gender: {
type: Sequelize.STRING(1),
allowNull: false,
},
marital_status: {
type: Sequelize.STRING(5),
allowNull: false,
},
disabled: {
type: Sequelize.STRING(3),
allowNull: false,
defaultValue: "No",
},
disbaled_percentage: {
// numeric(10,3)
type: Sequelize.DECIMAL(10, 3),
},
caste: {
type: Sequelize.STRING(2),
allowNull: false,
},
village_id: {
type: Sequelize.INTEGER,
allowNull: false,
// FOREIGN KEY (village_id) REFERENCES public.village_master(village_id) ON DELETE CASCADE;
references: {
model: "village_master",
key: "village_id",
onDelete: "CASCADE",
},
},
});
return Citizens;
};
|