Last active
August 26, 2024 23:07
-
-
Save paulodutra/9a2165156437fc064c8bc9a8eb7cf2ab to your computer and use it in GitHub Desktop.
Migration typeorm
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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