Socialify

Folder ..

Viewing village_master.model.js
25 lines (25 loc) • 646.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 VillageMaster = sequelize.define("village_master", {
    village_id: {
      type: Sequelize.INTEGER,
      allowNull: false,
      primaryKey: true,
      autoIncrement: true,
    },
    village_name: {
      type: Sequelize.STRING(155),
      allowNull: false,
    },
    mandal_id: {
      type: Sequelize.INTEGER,
      allowNull: false,
      // FOREIGN KEY (mandal_id) REFERENCES public.mandal_master(mandal_id) ON DELETE CASCADE;
      references: {
        model: "mandal_master",
        key: "mandal_id",
        onDelete: "CASCADE",
      },
    },
  });
  return VillageMaster;
};