btx
btx

Reputation: 2497

TypeORM initialize new database using migrations

How is it possible to initialize a new database with TypeORM?
When using typeorm schema:sync the schema gets generated, but the migrations table is missing.
So if I have a newer migration now, typeorm will try to apply the older migrations aswell, which of course does not work.

Upvotes: 0

Views: 3039

Answers (1)

fatfatson
fatfatson

Reputation: 885

don't use schema:sync at all.

always use migration:generate and migration:run to modify schema, including the first creation.

when you need create a completely new db, just run all the migrations.

Upvotes: 1

Related Questions