Skip to content

Instantly share code, notes, and snippets.

@paulodutra
Last active August 26, 2024 23:07
Show Gist options
  • Save paulodutra/9a2165156437fc064c8bc9a8eb7cf2ab to your computer and use it in GitHub Desktop.
Save paulodutra/9a2165156437fc064c8bc9a8eb7cf2ab to your computer and use it in GitHub Desktop.
Migration typeorm
import { MigrationInterface, QueryRunner, Table } from 'typeorm';
export class CreateTaskTable1722825209848 implements MigrationInterface {
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.createTable(
new Table({
name: 'task',
columns: [
{
name: 'id',
type: 'int',
},
{
name: 'name',
type: 'varchar',
},
{
name: 'done',
type: 'int',
default: 0,
},
],
}),
);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.dropTable('task');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment