synt_backend
Version:
Synt light-weight node backend service
57 lines (54 loc) • 1.36 kB
JavaScript
"use strict";
module.exports = {
up: async (queryInterface, Sequelize) => {
await queryInterface.createTable("NotificationSettingUser", {
id: {
allowNull: false,
autoIncrement: true,
primaryKey: true,
type: Sequelize.INTEGER,
},
NotificationSettingId: {
type: Sequelize.INTEGER,
references: {
model: "NotificationSettings",
key: "id",
},
allowNull: false,
defaultValue: Sequelize.UUIDV4,
onUpdate: "CASCADE",
onDelete: "CASCADE",
},
UserId: {
type: Sequelize.INTEGER,
references: {
model: "Users",
key: "id",
},
allowNull: false,
defaultValue: Sequelize.UUIDV4,
onUpdate: "CASCADE",
onDelete: "CASCADE",
},
value: {
type: Sequelize.BOOLEAN,
defaultValue: true,
},
createdAt: {
allowNull: false,
type: Sequelize.DATE,
},
updatedAt: {
allowNull: false,
type: Sequelize.DATE,
},
});
await queryInterface.addConstraint("NotificationSettingUser", {
fields: ["NotificationSettingId", "UserId"],
type: "unique",
});
},
down: async (queryInterface) => {
await queryInterface.dropTable("NotificationSettingUser");
},
};