Home » Topic » Using Sqlite3 in ruby on rails and cmd

Using Sqlite3 in ruby on rails and cmd

Andrew Jackson ~ Modified: September 8th, 2015 ~ ~ 1 Minute Reading

Home Forums Using Sqlite3 in ruby on rails and cmd

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #601 Score: 0
    Andrew Jackson
    Moderator
    1 pt

    I have a table with name buildings and I want to drop it because i forgot a column. In cmd I go to the folder and type “sqlite3” then “.tables” and nothing shows me. why that? and what can i do?

    #613 Score: 0
    Stephen West
    Moderator
    4 pts

    Did you create the table originally via a migration?

    #622 Score: 0
    Andrew Jackson
    Moderator
    1 pt

    yes and i have stuff inside but i dont care for the entity’s

    #651 Score: 0
    Stephen West
    Moderator
    4 pts

    You should avoid directly manipulating the database and use migrations instead. If you forgot to add a column then you should create a new migration using add_column to add the column to the table.

    Alternativly if the previous migration was the one that created the table with the missing column and you’ve not distributed this migration yet you can do rake db:rollback, editing the migration and run rake db:migrate again.

    Your lack of tables when running the sqlite command is most likely because you forgot to specify the sqlite file to load: sqlite3 <db_name>

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.