Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can i use TypeORM with better-sqlite3

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".

like image 514
Daniel Santos Avatar asked Jul 30 '20 02:07

Daniel Santos


1 Answers

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.
like image 81
None Avatar answered Nov 15 '22 09:11

None