synt_backend
Version:
Synt light-weight node backend service
43 lines (42 loc) • 1.03 kB
JavaScript
"use strict";
module.exports = {
up: async (queryInterface, Sequelize) => {
await queryInterface.createTable("Requests", {
id: {
allowNull: false,
autoIncrement: true,
primaryKey: true,
type: Sequelize.INTEGER,
},
UserId: {
type: Sequelize.INTEGER,
references: {
model: "Users",
key: "id",
},
allowNull: true,
defaultValue: Sequelize.UUIDV4,
onUpdate: "CASCADE",
onDelete: "SET NULL", // request should CERTAINLY not be deleted when user is deleted
},
message: {
type: Sequelize.TEXT,
},
category: {
type: Sequelize.ENUM("general", "banking"),
defaultValue: "general",
},
createdAt: {
allowNull: false,
type: Sequelize.DATE,
},
updatedAt: {
allowNull: false,
type: Sequelize.DATE,
},
});
},
down: async (queryInterface) => {
await queryInterface.dropTable("Requests");
},
};