Skip to content

Instantly share code, notes, and snippets.

@alanfoandrade
Created September 17, 2021 12:40
Show Gist options
  • Save alanfoandrade/6ca812b2a6e68831d77b2c1c5dcaf91b to your computer and use it in GitHub Desktop.
Save alanfoandrade/6ca812b2a6e68831d77b2c1c5dcaf91b to your computer and use it in GitHub Desktop.
import { MigrationInterface, QueryRunner, TableColumn } from 'typeorm';
export default class AlterDateToDateTime1631573747885
implements MigrationInterface
{
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.changeColumn(
'leads',
'createdAt',
new TableColumn({
name: 'createdAt',
type: 'timestamp',
}),
);
await queryRunner.changeColumn(
'users',
'createdAt',
new TableColumn({
name: 'users',
type: 'timestamp',
}),
);
await queryRunner.changeColumn(
'teams',
'createdAt',
new TableColumn({
name: 'createdAt',
type: 'timestamp',
}),
);
await queryRunner.changeColumn(
'properties',
'createdAt',
new TableColumn({
name: 'createdAt',
type: 'timestamp',
}),
);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.changeColumn(
'properties',
'createdAt',
new TableColumn({
name: 'createdAt',
type: 'timestamp with time zone',
}),
);
await queryRunner.changeColumn(
'teams',
'createdAt',
new TableColumn({
name: 'createdAt',
type: 'timestamp with time zone'
}),
);
await queryRunner.changeColumn(
'users',
'createdAt',
new TableColumn({
name: 'createdAt',
type: 'timestamp with time zone'
}),
);
await queryRunner.changeColumn(
'leads',
'createdAt',
new TableColumn({
name: 'createdAt',
type: 'timestamp with time zone'
}),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment