This repository has been archived on 2022-08-14. You can view files and clone it, but cannot push or open issues or pull requests.
outline/server/migrations/20191211044319-create-group...

50 lines
1.1 KiB
JavaScript

"use strict";
module.exports = {
up: async (queryInterface, Sequelize) => {
await queryInterface.createTable("group_users", {
userId: {
type: Sequelize.UUID,
allowNull: false,
references: {
model: "users"
}
},
groupId: {
type: Sequelize.UUID,
allowNull: false,
references: {
model: "groups"
}
},
createdById: {
type: Sequelize.UUID,
allowNull: false,
references: {
model: "users"
}
},
createdAt: {
type: Sequelize.DATE,
allowNull: false
},
updatedAt: {
type: Sequelize.DATE,
allowNull: false
},
deletedAt: {
type: Sequelize.DATE,
allowNull: true
}
});
await queryInterface.addIndex("group_users", ["groupId", "userId"]);
await queryInterface.addIndex("group_users", ["userId"]);
await queryInterface.addIndex("group_users", ["deletedAt"]);
},
down: async (queryInterface, Sequelize) => {
return queryInterface.dropTable("group_users");
}
};