I'm trying to add a migration with foreign keys like this: execute 'ALTER TABLE projects ADD CONSTRAINT fk_project_user FOREIGN KEY ( user_id ) REFERENCES users ( id )' the problem is that for development i'm using sqlite and I don't think that support foreign keys, at least the migration is giving me this error: -- execute("ALTER TABLE projects ADD CONSTRAINT fk_projects_user FOREIGN KEY ( user_id ) REFERENCES users( id ) ") rake aborted! SQLite3::SQLException: near "ADD": syntax error: ALTER TABLE projects ADD CONSTRAINT fk_projects_users FOREIGN KEY ( user_id ) REFERENCES users( id ) So my question is how can I test to see what database the migration is working on so that I can do the execute on mysql (production), but not on sqlite (development)? And of course if what I'm trying to do doesn't really make sense, or there's a better way, please let me know. Thanks, Jesse
on 2007-05-31 16:02
on 2007-05-31 16:08
Can't tell you anything about the error, but my question is. Why aren't you you developing on mysql? in my opinion it makes no sense to develop on sqlite and deploy on mysql. install mysql on your box and develop on the same database.
on 2007-05-31 16:36
I'd been using sqlite because it was a bit faster for development and running tests. But at this point in development your are probably right, I'll move everything to mysql. Thanks.