mirror of
https://github.com/pawelmalak/snippet-box.git
synced 2025-12-21 13:23:05 +01:00
48 lines
974 B
TypeScript
48 lines
974 B
TypeScript
import { DataTypes, QueryInterface } from 'sequelize';
|
|
const { INTEGER, STRING, DATE, TEXT } = DataTypes;
|
|
|
|
export const up = async (queryInterface: QueryInterface): Promise<void> => {
|
|
await queryInterface.createTable('snippets', {
|
|
id: {
|
|
type: INTEGER,
|
|
allowNull: false,
|
|
primaryKey: true,
|
|
autoIncrement: true
|
|
},
|
|
title: {
|
|
type: STRING,
|
|
allowNull: false
|
|
},
|
|
description: {
|
|
type: TEXT,
|
|
allowNull: true,
|
|
defaultValue: ''
|
|
},
|
|
language: {
|
|
type: STRING,
|
|
allowNull: false
|
|
},
|
|
code: {
|
|
type: TEXT,
|
|
allowNull: false
|
|
},
|
|
docs: {
|
|
type: TEXT,
|
|
allowNull: true,
|
|
defaultValue: ''
|
|
},
|
|
createdAt: {
|
|
type: DATE,
|
|
allowNull: false
|
|
},
|
|
updatedAt: {
|
|
type: DATE,
|
|
allowNull: false
|
|
}
|
|
});
|
|
};
|
|
|
|
export const down = async (queryInterface: QueryInterface): Promise<void> => {
|
|
await queryInterface.dropTable('snippets');
|
|
};
|