database migrate error

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

database migrate error

Aaron Yung
HI All

I update my OBS from  2.1 to 2.3 following the README.UPDATES guideline  in obs-api package,  but I have a prolem.

When I execute this command --- ---"  RAILS_ENV="production" rake db:migrate" in /srv/www/obs/api directory , I got the following error log:
<<<<<<<<<<<<<<

WARNING: The database is inconsistent, some FOREIGN KEYs (aka CONSTRAINTS) can not be added!
         please run    script/check_database    script to fix the data.
rake aborted!
>>>>>>>>>>>>>>>>>>>>>>>>>>>

Any body can help me ? Thanks very much!
Go OBS
Reply | Threaded
Open this post in threaded view
|

Re: database migrate error

Srinidhi B
>>> On 7/26/2012 at 04:21 PM, Aaron Yung <[hidden email]> wrote:
> HI All
>
> I update my OBS from  2.1 to 2.3 following the README.UPDATES guideline  in
> obs-api package,  but I have a prolem.
>
> When I execute this command --- ---"  RAILS_ENV="production" rake
> db:migrate" in /srv/www/obs/api directory , I got the following error log:
> <<<<<<<<<<<<<<
>
> WARNING: The database is inconsistent, some FOREIGN KEYs (aka CONSTRAINTS)
> can not be added!
>          please run    script/check_database    script to fix the data.
> rake aborted!
>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>
> Any body can help me ? Thanks very much!


Run the script it is asking you to. That check_database will print SQL statements in stdout. You'll have to run those manually in MySQL or any other database you are using for production.

HTH,
Srinidhi.

--
To unsubscribe, e-mail: [hidden email]
To contact the owner, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: database migrate error

Aaron Yung
<<<<<<<<<<<<<Run the script it is asking you to. That check_database will print SQL statements in stdout. You'll have to run those manually in MySQL or any other database you are using for production.


Yeah, I executed the check_database script and got the following stdout
==================================================
Using global environment /srv/www/obs/api/config/environments/development_base.rb (development.linux-oz3l.rb not found)
** Erubis 2.6.6
/usr/lib64/ruby/gems/1.8/gems/activerecord-2.3.14/lib/active_record/connection_adapters/mysql_adapter.rb:620:in `real_connect': Access denied for user 'root'@'localhost' (using password: YES) (Mysql::Error)
        from /usr/lib64/ruby/gems/1.8/gems/activerecord-2.3.14/lib/active_record/connection_adapters/mysql_adapter.rb:620:in `connect'
        from /usr/lib64/ruby/gems/1.8/gems/activerecord-2.3.14/lib/active_record/connection_adapters/mysql_adapter.rb:203:in `initialize'
        from /usr/lib64/ruby/gems/1.8/gems/activerecord-2.3.14/lib/active_record/connection_adapters/mysql_adapter.rb:75:in `new'
        from /usr/lib64/ruby/gems/1.8/gems/activerecord-2.3.14/lib/active_record/connection_adapters/mysql_adapter.rb:75:in `mysql_connection'
        from /usr/lib64/ruby/gems/1.8/gems/activerecord-2.3.14/lib/active_record/connection_adapters/abstract/connection_pool.rb:223:in `send'
        from /usr/lib64/ruby/gems/1.8/gems/activerecord-2.3.14/lib/active_record/connection_adapters/abstract/connection_pool.rb:223:in `new_connection'
        from /usr/lib64/ruby/gems/1.8/gems/activerecord-2.3.14/lib/active_record/connection_adapters/abstract/connection_pool.rb:245:in `checkout_new_connection'
        from /usr/lib64/ruby/gems/1.8/gems/activerecord-2.3.14/lib/active_record/connection_adapters/abstract/connection_pool.rb:188:in `checkout'
        from /usr/lib64/ruby/gems/1.8/gems/activerecord-2.3.14/lib/active_record/connection_adapters/abstract/connection_pool.rb:184:in `loop'
        from /usr/lib64/ruby/gems/1.8/gems/activerecord-2.3.14/lib/active_record/connection_adapters/abstract/connection_pool.rb:184:in `checkout'
        from /usr/lib64/ruby/1.8/monitor.rb:242:in `synchronize'
        from /usr/lib64/ruby/gems/1.8/gems/activerecord-2.3.14/lib/active_record/connection_adapters/abstract/connection_pool.rb:183:in `checkout'
        from /usr/lib64/ruby/gems/1.8/gems/activerecord-2.3.14/lib/active_record/connection_adapters/abstract/connection_pool.rb:98:in `connection'
        from /usr/lib64/ruby/gems/1.8/gems/activerecord-2.3.14/lib/active_record/connection_adapters/abstract/connection_pool.rb:326:in `retrieve_connection'
        from /usr/lib64/ruby/gems/1.8/gems/activerecord-2.3.14/lib/active_record/connection_adapters/abstract/connection_specification.rb:123:in `retrieve_connection'
        from /usr/lib64/ruby/gems/1.8/gems/activerecord-2.3.14/lib/active_record/connection_adapters/abstract/connection_specification.rb:115:in `connection'
        from /usr/lib64/ruby/gems/1.8/gems/activerecord-2.3.14/lib/active_record/base.rb:1305:in `columns'
        from /usr/lib64/ruby/gems/1.8/gems/activerecord-2.3.14/lib/active_record/base.rb:1318:in `column_names'
        from /usr/lib64/ruby/gems/1.8/gems/activerecord-2.3.14/lib/active_record/base.rb:1331:in `column_methods_hash'
        from /usr/lib64/ruby/gems/1.8/gems/activerecord-2.3.14/lib/active_record/base.rb:2025:in `all_attributes_exists?'
        from /usr/lib64/ruby/gems/1.8/gems/activesupport-2.3.14/lib/active_support/dependencies.rb:406:in `all?'
        from /usr/lib64/ruby/gems/1.8/gems/activerecord-2.3.14/lib/active_record/base.rb:2025:in `each'
        from /usr/lib64/ruby/gems/1.8/gems/activerecord-2.3.14/lib/active_record/base.rb:2025:in `all?'
        from /usr/lib64/ruby/gems/1.8/gems/activerecord-2.3.14/lib/active_record/base.rb:2025:in `all_attributes_exists?'
        from /usr/lib64/ruby/gems/1.8/gems/activerecord-2.3.14/lib/active_record/base.rb:1876:in `method_missing'
        from ./script/check_database:20
========================================================================

Did something wrong with my database.yml
==================================

production:
  adapter: mysql
  database: api_production
  username: obs
  password: obspasswd

development:
  adapter: mysql
  database: api_development
  username: root
  password: opensuse

# Warning: The database defined as 'test' will be erased and
# re-generated from your development database when you run 'rake'.
# Do not set this db to the same as development or production.
test:
  adapter: mysql
  database: api_test
  username: root
  password: opensuse
=====================================

Go OBS