Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I migrate my data from my rails app from mySql to SQLite

Tags:

How can I migrate my data from my rails app from mySql to SQLite?

Is this possible?

like image 429
Verhogen Avatar asked Nov 14 '09 21:11

Verhogen


People also ask

Can SQLite connect to MySQL?

The quickest and easiest way to convert SQLite to MySQL is by exporting an SQL Database to a Dump File, and then importing the SQLite Dump into MySQL Database. You can export an SQLite Database to Dump File using the . dump command.

How do I change a database in Rails?

To use the Rails 6 db system change command, you simply need to specify the new database adapter with the --to option. Keep in mind, you may need to change the version numbers of the database adapter in your Gemfile after running this command.

What database does Rails use by default?

Rails defaults to using a SQLite database when creating a new project, but you can always change it later.


1 Answers

Great question!

In the past I had to migrate Gb of databases from SQlite to MySQL to PostgreSQl and viceversa. I tried tons of utilities, scripts and tools but the only way I found to successfully migrate the database was to export the data into a database-free schema, then import the data.

This plugin saved my life thousands of times: yaml_db.

like image 164
Simone Carletti Avatar answered Oct 27 '22 00:10

Simone Carletti