Message from JavaScript discussions

October 2020

— Repository, but it really doesn't matter

— 

Entity()
export class User {

PrimaryGeneratedColumn()
id: number;

Column()
firstName: string;

Column()
lastName: string;

Column()
age: number;

}


createConnection({
...,
entities: [ User ],
synchronize: true,
logging: true
});

— This is really the crux of TypeORM

— synchronize: true for development

— Yep i already fantasized about using it

— It'll scan your class, and apply whatever changes are needed to the actual DB (creating tables, adding / removing / changing column types)

Message permanent page

— And you just modify your class to update the table, and start the app

— And you're done

— And it just applies those changes on startup

— Omg the amount of time i spent for migrations..

— Well there are migrations here too

— For when there are complex changes or changes in production are safer with migrations ofc