Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sequelize-auto for SQLite

I'm trying to autogenerate my data models on sequelize for SQLite using squelize-auto on Windows. I have created my sqlite file with schema only, no data inside. Also installed everything as indicated here.

The command I'm using looks like this:

sequelize-auto -h localhost -u dontcare -d "E:\full\path\to\my\database.db"  --dialect sqlite

Also tried with some other path styles like './database.db' etc.

And this is the answer I'm getting:

Executing (default): SELECT name FROM `sqlite_master` WHERE type='table' and name!='sqlite_sequence';
Done!

After this, the script creates a folder called "models" with nothing inside.

Does somebody know what's happening here?

Many thanks!

like image 281
Jose Avatar asked Oct 25 '15 00:10

Jose


1 Answers

I've found the problem: -d should be the database name, not the path to the file. For specify the file path, you should use the option -c indicating a JSON file. The storage attribute finally indicates that path. The command should looks like this:

sequelize-auto -h localhost -u dontcare -d databasename  --dialect sqlite -c options.json

And options.json looks like this:

{
    "storage":"./database_file_name.db"
}

I hope this will be useful to someone. Bye!

like image 114
Jose Avatar answered Sep 25 '22 00:09

Jose