How can i use TypeORM with better-sqlite3
Asked Answered
A

1

11

How can i use TypeORM with better-sqlite3?

on the official documentation, there is a section form better-sqlite3.

I already installed by typeorm@latest and typeorm@next but there is no options for better-sqlite3 yet.

If i try to force initialize it, i got the following error

MissingDriverError: Wrong driver: "better-sqlite3" given. Supported drivers are: "cordova", "expo", "mariadb", "mongodb", "mssql", "mysql", "oracle", "postgres", "sqlite", "sqljs", "react-native", "aurora-data-api", "aurora-data-api-pg".

Annuity answered 30/7, 2020 at 2:18 Comment(1)
If I'm not mistaken, you have to install github.com/JoshuaWise/better-sqlite3 --- with npm: npm install better-sqlite3Strudel
B
9

The better-sqlite3 driver was added in [email protected].

  1. Export your existing database.
  2. Update typeorm to 0.2.26 or higher.
  3. Install the package better-sqlite3. sqlite3 can be uninstalled.
  4. In your ormconfig.json change the type to "type": "better-sqlite3",
  5. Import the database exported in step 1.
Barmecidal answered 17/5, 2021 at 3:20 Comment(1)
Correct answer!Cadaver

© 2022 - 2024 — McMap. All rights reserved.