Existing migrations don't run when generating migrations
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 48/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Quiet
- Tech stack
- postgresql, sqlite, typescript
- Domain
- databases
Research direction
Start with the migrations:generate command and the data-source.ts configuration described in the reproduction steps, using migrationsRun: true and the PGlite driver. Verify the current behavior by generating migrations twice, then confirm that existing migrations run before change detection and the second generated migration no longer repeats their queries.
Written by the indexing model from the issue text.
Description
Issue description
In the documentation mentions that we can configure migrationsRun: true but when generating new migrations it is not honored. Removing this behavior could be useful if the connection is an in-memory database like pglite.
Expected Behavior
When migrationsRun: true is set in data-source.ts, existing migrations run before checking for changes and generating the new migration.
Actual Behavior
When migrationsRun: true is set in data-source.ts, existing migrations don't run before checking for changes and generation. If we use a in-memory db this will generate the new migration with queries existing in previous migrations.
Steps to reproduce
- Set
"type": "module"in package.json - Set
migrationsRun: truein data-source.ts. - Using
import {PGliteDriver} from 'typeorm-pglite'set driver tonew PGliteDriver().driverin data-source.ts. - Run
typeorm-ts-node-esm migrations:generate -d data-source.ts migrations/<name>twice.
My Environment
| Dependency | Version |
|---|---|
| Operating System | Darwin Kernel Version 25.4.0 |
| Node.js version | 24.15.0 |
| Typescript version | 5.9.3 |
| TypeORM version | 0.3.28 |
Additional Context
No response
Relevant Database Driver(s)
- aurora-mysql
- aurora-postgres
- better-sqlite3
- capacitor
- cockroachdb
- cordova
- expo
- mongodb
- mysql
- nativescript
- oracle
- postgres
- react-native
- sap
- spanner
- sqlite
- sqljs
- sqlserver
Are you willing to resolve this issue by submitting a Pull Request?
Yes, I have the time, and I know how to start.
- Dominant language
- TypeScript
- Stars
- 36.7k
- Forks
- 6.7k
- Avg merge
- 3d 1h
- Merged PRs (30d)
- 6
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from typeorm/typeorm
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Similar issues
-
clawsweeper:fix-shape-clear clawsweeper:queueable-fix clawsweeper:source-repro impact:ux-friction issue-rating: 🦞 diamond lobster no-stale P3
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Difficulty 1/5 Under an hour Newbie friendliness 76/100
-
code-quality refactoring
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
github/gh-aw-firewall#8816 ·
-
integration:quickjs org:external priority:backlog topic:code-interpreter topic:middleware type:feature
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
langchain-ai/deepagents#6450 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
vercel/react-tweet#225 ·