Hi I have a sqlite3 database full of data from my previous version of a web application that is NOT written on rails. Im now rewrite the web application in rails from scratch. But Id like to use the data from my previous application in the new rails application. What is the best way to do this?
This is what Ive tried so far, and it did not work very well: 1) I created a new rails application
2) replaced my sqlite3 database in the new application with sqlite3 database from the old application
3) Created a model with the same scheme as the old database.
4) changed the databse.yml file with the updated DB file data.
5) The method "set_connection" is added in my model
6) I could make him show me all the details of the old database in my browser @ "index.html"
7) However, I had problems inserting / editing records in the database. Since the database did not have a primary key column for each row, it did not work.
8) So, I tried to migrate to add a column with a primary key. He did not work
9) unexpectedly, a new development.sqlite3 database appeared in the application, and she tried to add a primary key to the NEW DB.
10) So, I just deleted the new database that popped up, and after that the application did not work
11) Now I want to start from scratch, and therefore my question is: "The best way to import data from a previous application without rails (in DB sqlite3 format) into a new application" rails "
source share