CoastalCommitsPastes/server/src/migrations/02_post_table.ts

35 lines
695 B
TypeScript
Raw Normal View History

"use strict"
import { DataTypes } from "sequelize"
import type { Migration } from "../database"
export const up: Migration = async ({ context: queryInterface }) =>
2022-03-29 03:19:33 -04:00
queryInterface.createTable("posts", {
id: {
type: DataTypes.UUID,
defaultValue: DataTypes.UUIDV4,
primaryKey: true,
unique: true
},
title: {
type: DataTypes.STRING
},
visibility: {
type: DataTypes.STRING
},
password: {
type: DataTypes.STRING
},
createdAt: {
type: DataTypes.DATE
},
updatedAt: {
type: DataTypes.DATE
},
deletedAt: {
type: DataTypes.DATE
}
})
export const down: Migration = async ({ context: queryInterface }) =>
2022-03-29 03:19:33 -04:00
await queryInterface.dropTable("posts")