I don't understand why this is happening. I have the following migration:
def self.up
create_table :leakages do |t|
t.integer :feature_id
t.integer :project_id
t.float :total
t.date :apt_date
end
add_index :leakages, [:feature_id, :apt_date]
end
When I run it for the first time it runs properly, but when I run the migration again then an error is thrown saying leakages
table already exist. Why is this error occurring? I am using the mysql2 gem.
You need to drop that table from the sql lite console (You will lost all the data contained in it)
1) Access the sql lite console, type in terminal
sqlite3 db/development.sqlite3
2) Drop table (dont forget the last ; )
drop table table_name;
3) Exit sql lite console
.quit
4) run db:migrate again
bin/rake db:migrate
Hope it helps, it worked for me
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With