Files
outline/server/migrations/20210730210120-add-fileOperations.js
Tom Moor 15b1069bcc chore: Move to Typescript (#2783)
This PR moves the entire project to Typescript. Due to the ~1000 ignores this will lead to a messy codebase for a while, but the churn is worth it – all of those ignore comments are places that were never type-safe previously.

closes #1282
2021-11-29 06:40:55 -08:00

71 lines
1.5 KiB
JavaScript

"use strict";
module.exports = {
up: async (queryInterface, Sequelize) => {
await queryInterface.createTable("file_operations", {
id: {
type: Sequelize.UUID,
allowNull: false,
primaryKey: true,
},
state: {
type: Sequelize.ENUM(
"creating",
"uploading",
"complete",
"error",
"expired"
),
allowNull: false,
},
type: {
type: Sequelize.ENUM("import", "export"),
allowNull: false,
},
key: {
type: Sequelize.STRING,
},
url: {
type: Sequelize.STRING,
},
size: {
type: Sequelize.BIGINT,
allowNull: false,
},
userId: {
type: Sequelize.UUID,
allowNull: false,
references: {
model: "users",
},
},
collectionId: {
type: Sequelize.UUID,
references: {
model: "collections",
},
},
teamId: {
type: Sequelize.UUID,
allowNull: false,
references: {
model: "teams",
},
},
createdAt: {
type: Sequelize.DATE,
allowNull: false,
},
updatedAt: {
type: Sequelize.DATE,
allowNull: false,
},
});
await queryInterface.addIndex("file_operations", ["type", "state"]);
},
down: async (queryInterface, Sequelize) => {
await queryInterface.removeIndex("file_operations", ["type", "state"]);
await queryInterface.dropTable("file_operations");
},
};