indexer
indexer copied to clipboard
feat: add typeorm
File structure
src/data-source.ts
src/migration
src/entities
Init migration
run migrate but actually doesn't execute any SQL, used to set the database state to the latest migration
yarn typeorm-migrate-init
Migration
yarn typeorm-migrate
# revert to prev step
yarn typeorm-revert
Codebase Sync
auto sync Migration or Entitiy definitions to the src/data-source.ts
yarn typeorm-sync
Nice, a few questions / notes:
- How does the new migration logic handles the old migrations (which I see were ported over)? Ideally it will skip them and only pick up the new ones (we don't want to have the old migrations re-run since that could create issues).
- We should probably remove the
node-pg-migrate
dependency if it's not needed anymore together with any scripts for it (yarn migrate
).
cc @nofir
Nice, a few questions / notes:
- How does the new migration logic handles the old migrations (which I see were ported over)? Ideally it will skip them and only pick up the new ones (we don't want to have the old migrations re-run since that could create issues).
- We should probably remove the
node-pg-migrate
dependency if it's not needed anymore together with any scripts for it (yarn migrate
).cc @nofir
all the old migrations were converted to the TypeORM migration style from the original migration SQL, the migration state will be stored in the typeorm_migrations
table, run yarn typeorm-migrate-init
to skip all.
all the Entity was exported from the database by typeorm-model-generator
. we could remove them if we don't really need them for now