Created
January 2, 2019 11:53
-
-
Save Ionaru/5ac6f41759dc72230c266bc8ee1bf593 to your computer and use it in GitHub Desktop.
Running this code shows TypeORM dropping the `someText` column and recreating it.
This file contains 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 'reflect-metadata'; // Required by TypeORM. | |
import { BaseEntity, Column, createConnection, Entity, PrimaryGeneratedColumn } from 'typeorm'; | |
@Entity() | |
export class Bar extends BaseEntity { | |
@PrimaryGeneratedColumn() | |
public id!: number; | |
@Column({ | |
type: 'text', | |
}) | |
public someText!: string; | |
} | |
createConnection({ | |
database: 'REDACTED', | |
entities: [Bar], | |
host: 'REDACTED', | |
logging: true, | |
password: 'REDACTED', | |
port: 3306, | |
synchronize: true, | |
type: 'mysql', | |
username: 'REDACTED' | |
}).then((connection) => { | |
console.log('Connected', connection.isConnected); | |
process.exit(0); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment