Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Foreign Key constrainst creation error on datamapper db:automigrate #159

Closed
shadowbq opened this Issue Nov 1, 2011 · 2 comments

Comments

Projects
None yet
1 participant
Contributor

shadowbq commented Nov 1, 2011

After dropping the database;

Can't create table 'snorby.#sql-10e9_5a' (errno: 150)

errno 150 is a Foreign Key

shadowbq@thaw:~/snorby$ rake db:drop
/usr/share/ruby-rvm/gems/ruby-1.9.2-p290@global/gems/bundler-1.0.21/lib/bundler.rb:209: warning: Insecure world writable dir /usr/share/ruby-rvm/gems in PATH, mode 042777
DEPRECATION WARNING: RAILS_ROOT is deprecated. Please use ::Rails.root.to_s. (called from <top (required)> at /usr/share/ruby-rvm/gems/ruby-1.9.2-p290@snorby_master/bundler/gems/snorby_cas_authenticatable-18cca67306d6/lib/devise_cas_authenticatable.rb:8)
[datamapper] Dropped database 'snorby'
shadowbq@thaw:~/snorby$ rake db:setup
/usr/share/ruby-rvm/gems/ruby-1.9.2-p290@global/gems/bundler-1.0.21/lib/bundler.rb:209: warning: Insecure world writable dir /usr/share/ruby-rvm/gems in PATH, mode 042777
DEPRECATION WARNING: RAILS_ROOT is deprecated. Please use ::Rails.root.to_s. (called from <top (required)> at /usr/share/ruby-rvm/gems/ruby-1.9.2-p290@snorby_master/bundler/gems/snorby_cas_authenticatable-18cca67306d6/lib/devise_cas_authenticatable.rb:8)
[datamapper] Created database 'snorby'
rake aborted!
Can't create table 'snorby.#sql-10e9_5a' (errno: 150)

Tasks: TOP => db:setup => db:automigrate
(See full trace by running task with --trace)
Contributor

shadowbq commented Nov 2, 2011

mysql>  SELECT * FROM `information_schema`.`table_constraints` WHERE `constraint_type` = 'FOREIGN KEY' AND `table_schema` = 'snorby';

Empty set (0.00 sec)

Primary Constraints

mysql>  SELECT * FROM `information_schema`.`table_constraints` WHERE `table_schema` = 'snorby';
+--------------------+-------------------+-----------------+--------------+------------------+-----------------+
| CONSTRAINT_CATALOG | CONSTRAINT_SCHEMA | CONSTRAINT_NAME | TABLE_SCHEMA | TABLE_NAME       | CONSTRAINT_TYPE |
+--------------------+-------------------+-----------------+--------------+------------------+-----------------+
| NULL               | snorby            | PRIMARY         | snorby       | caches           | PRIMARY KEY     |
| NULL               | snorby            | PRIMARY         | snorby       | classifications  | PRIMARY KEY     |
| NULL               | snorby            | PRIMARY         | snorby       | daily_caches     | PRIMARY KEY     |
| NULL               | snorby            | PRIMARY         | snorby       | data             | PRIMARY KEY     |
| NULL               | snorby            | PRIMARY         | snorby       | delayed_jobs     | PRIMARY KEY     |
| NULL               | snorby            | PRIMARY         | snorby       | detail           | PRIMARY KEY     |
| NULL               | snorby            | PRIMARY         | snorby       | encoding         | PRIMARY KEY     |
| NULL               | snorby            | PRIMARY         | snorby       | event            | PRIMARY KEY     |
| NULL               | snorby            | PRIMARY         | snorby       | favorites        | PRIMARY KEY     |
| NULL               | snorby            | PRIMARY         | snorby       | icmphdr          | PRIMARY KEY     |
| NULL               | snorby            | PRIMARY         | snorby       | iphdr            | PRIMARY KEY     |
| NULL               | snorby            | PRIMARY         | snorby       | lookups          | PRIMARY KEY     |
| NULL               | snorby            | PRIMARY         | snorby       | notes            | PRIMARY KEY     |
| NULL               | snorby            | PRIMARY         | snorby       | notifications    | PRIMARY KEY     |
| NULL               | snorby            | PRIMARY         | snorby       | opt              | PRIMARY KEY     |
| NULL               | snorby            | PRIMARY         | snorby       | reference        | PRIMARY KEY     |
| NULL               | snorby            | PRIMARY         | snorby       | reference_system | PRIMARY KEY     |
| NULL               | snorby            | PRIMARY         | snorby       | schema           | PRIMARY KEY     |
| NULL               | snorby            | PRIMARY         | snorby       | sensor           | PRIMARY KEY     |
| NULL               | snorby            | PRIMARY         | snorby       | settings         | PRIMARY KEY     |
| NULL               | snorby            | PRIMARY         | snorby       | severities       | PRIMARY KEY     |
| NULL               | snorby            | PRIMARY         | snorby       | sig_class        | PRIMARY KEY     |
| NULL               | snorby            | PRIMARY         | snorby       | sig_reference    | PRIMARY KEY     |
| NULL               | snorby            | PRIMARY         | snorby       | signature        | PRIMARY KEY     |
| NULL               | snorby            | PRIMARY         | snorby       | tcphdr           | PRIMARY KEY     |
| NULL               | snorby            | PRIMARY         | snorby       | udphdr           | PRIMARY KEY     |
| NULL               | snorby            | PRIMARY         | snorby       | users            | PRIMARY KEY     |
+--------------------+-------------------+-----------------+--------------+------------------+-----------------+

@shadowbq shadowbq closed this Nov 2, 2011

Contributor

shadowbq commented Nov 2, 2011

This error for datamapper constraints is raised during

rake db:automigrate

Chain => (db:setup)

This error is not seen in

rake db:autoupgrade

Chain => (rake snorby:setup)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment