Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

references another schema in sequelize

queryInterface.createTable(
  "MyTable",
  {
    id: {
      type: Sequelize.INTEGER,
      primaryKey: true,
      autoIncrement: true,
    },
    SomeTableId: {
      type: Sequelize.INTEGER,
      references: {
        model: {
          tableName: "SomeTable",
          schema: "static",
        },
        key: "id",
      },
      allowNull: false,
    },
  },
  t
);
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #references #schema #sequelize
ADD COMMENT
Topic
Name
3+7 =