Move SQlite DB to Production DB Mysql

When you worked in your development environment using sqllite3 DB, you will need to migrate your DB to Production DB (Mysql or Postgres).

  1. Export development.sqlite3 into sql format:
    CMD: sqlite3 production.sqlite3 .dump > sqlite3.sql
  2. Download sqlite3-to-mysql.rb
  3. Convert sqlite3 into mysql:
    CMD: cd /path_to_script/ && ruby sqlite3-to-mysql.rb /path_to/sqlite3.sql > my_mysql.sql
  4. Create mysql db and import my_mysql.sql
    Note: If you have errors like too much data for column.. please change varchar(255) to bigger according to your requirements
  5. Change config/database.yml for mysql settings and change Gemfile to use mysql2 instead of sqlite
    Samples: https://gist.github.com/erichurst/961978