Socialify

Folder ..

Viewing district_master.model.js
25 lines (25 loc) • 764.0 B

 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
module.exports = (Sequelize, sequelize) => {
    const DistrictMaster = sequelize.define("district_master", {
        district_id: {
            type: Sequelize.INTEGER,
            allowNull: false,
            primaryKey: true,
            autoIncrement: true,
        },
        district_name: {
            type: Sequelize.STRING(155),
            allowNull: false,
        },
        state_id: {
            type: Sequelize.INTEGER,
            allowNull: false,
            // FOREIGN KEY (state_id) REFERENCES public.state_master(state_id) ON DELETE CASCADE;
            references: {
                model: "state_master",
                key: "state_id",
                onDelete: "CASCADE",
            },
        },
    });
    return DistrictMaster;
}