question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

sqlite: typeorm migration:generate

See original GitHub issue

Issue type:

[X] question [ ] bug report [ ] feature request [X] documentation issue

Database system/driver:

[ ] cordova [ ] mongodb [ ] mssql [ ] mysql / mariadb [ ] oracle [ ] postgres [X] sqlite [ ] sqljs [ ] react-native

TypeORM version:

[X] latest [ ] @next [ ] 0.x.x (or put your version here)

Running typeorm migration:generate -n PostRefactoring just hangs. Is there specific documentation for using generate in sqlite?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
cjackson234commented, Jun 26, 2018

So I have it working doing the following:

In the ormconfig.json add a local copy of the database. Migrations will now be generated against the local copy of the database.

{ “type”: “sqlite”, “synchronize”: false, “logging”: false, “database”: “migrate.sqlite”, … }

Install ts-node and typescript npm install -g ts-node typescript

Added the following to the package.json

“scripts”: { … “migrate”: “ts-node ./node_modules/typeorm/cli.js migration:generate”, },

And I can not run migrations with this npm run migrate -- n [name here]

0reactions
AdditionAddictcommented, Jul 1, 2019

I had the same issue caused by having incorrect path to database "database": "dist/assets/data/database", instead of "database": "dist/assets/data/database.db", inside ormconfig.json

Read more comments on GitHub >

github_iconTop Results From Across the Web

Migrations - typeorm - GitBook
typeorm migration :create and typeorm migration:generate will create .ts files, unless you use the o flag (see more in Generating migrations).
Read more >
typeorm migration:generate - Fig.io
Generates a new migration file with sql needs to be executed to update schema.
Read more >
TypeORM: Doesn't create database table when running ...
1 migrations are new migrations that needs to be executed. query: BEGIN TRANSACTION query: CREATE TABLE "url" ("id" integer PRIMARY KEY ...
Read more >
Using TypeORM migrations for simple database seeding ...
Migrations generated by TypeORM are mostly made of raw SQL queries. TypeORM is creating a class that implements MigrationInterface and ...
Read more >
TypeORM - Amazing ORM for TypeScript and JavaScript (ES7 ...
for SQLite. npm install sqlite3 --save. for Microsoft SQL Server ... This command will generate a new project in the MyProject directory with...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found