To make a long story short, I started writing an app that wasn't going to make it to production, but my boss liked it and asked me to deploy it. Now I have to make the switch from SQLite to MySQL to get the app on the production server.
I added the gem: gem 'mysql2', '~> 0.3.20', did a bundle install, and updated database.yml:
default: &default
adapter: mysql2
encoding: utf8
pool: 5
username: root
password:
host: localhost
development:
<<: *default
database: umc2_dev
test:
<<: *default
database: umc2_test
production:
<<: *default
database: umc2
username: umc2
password: <%= ENV['PRODUCTION_DATABASE_PASSWORD'] %>
The migrations aren't doing anything complicated. The all look something like this:
create_table :checkins do |t|
t.string :public_ip
t.string :private_ip
t.string :ubermix_version
t.string :kernel
t.string :architecture
t.integer :battery_capacity
t.integer :system_free
t.integer :home_free
t.integer :user_free
t.references :device, index: true, foreign_key: true
t.references :location, index: true, foreign_key: true
t.timestamps null: false
end
When I migrate the database, the console spits this out:
Mysql2::Error: Can't create table 'umc2.#sql-4e7_10' (errno: 150): \
ALTER TABLE `checkins` ADD CONSTRAINT `fk_rails_ba93b88497`
I've been banging my head on this one for a few hours. Am I missing something? Have I inadvertently introduced a some sort of storage engine problem? MySQL 5.7.10 should default to InnoDB, right?
Aucun commentaire:
Enregistrer un commentaire