Content
rake aborted! An error has occurred, all later migrations canceled: - Syntax error while setting up database for the first time
Added by Anukool R over 10 years ago
Hi Community,
I am trying to set up open project in my mac. All worked well till I started setting up database. DBs are created successfully. But when I run RAILS_ENV=“production” bundle exec rake db:migrate
I get the below error. Please advice.
RepairMessagesInitialAttachableJournal: migrated (0.0006s) ==
RepairCustomizableJournals: migrating =
-- Repair initial customizable journals
-> 0.0005s
RepairCustomizableJournals: migrated (0.0005s)
AddMissingAttachableJournals: migrating =
— Add missing attachable journals
-> 0.0006s
AddMissingAttachableJournals: migrated (0.0007s)
AddMissingCustomizableJournals: migrating ===
— Add missing customizable journals
rake aborted!
An error has occurred, all later migrations canceled:
Mysql::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘AS cvd
WHERE EXISTS
(
SELECT w.id, cf.id, cfp.pr’ at line 1: DELETE FROM custom_values AS cvd
WHERE EXISTS
(
SELECT w.id, cf.id, cfp.project_id, p.name, cft.type_id
FROM work_packages AS w
JOIN custom_values AS cv ON (w.id = cv.customized_id AND cv.customized_type = ‘WorkPackage’)
JOIN custom_fields AS cf ON (cv.custom_field_id = cf.id)
JOIN projects AS p ON (w.project_id = p.id)
LEFT JOIN custom_fields_projects AS cfp ON (cv.custom_field_id = cfp.custom_field_id AND w.project_id = cfp.project_id)
LEFT JOIN custom_fields_types AS cft ON (cv.custom_field_id = cft.custom_field_id AND w.type_id = cft.type_id)
WHERE (cfp.project_id IS NULL AND cf.is_for_all = FALSE
OR cft.type_id IS NULL)
AND cv.id = cvd.id
);
/Users/anukool/.rvm/gems/ruby-2.1.2/gems/activerecord-3.2.18/lib/active_record/connection_adapters/mysql_adapter.rb:308:in `query’
/Users/anukool/.rvm/gems/ruby-2.1.2/gems/activerecord-3.2.18/lib/active_record/connection_adapters/mysql_adapter.rb:308:in `block in exec_without_stmt’
/Users/anukool/.rvm/gems/ruby-2.1.2/gems/activerecord-3.2.18/lib/active_record/connection_adapters/abstract_adapter.rb:280:in `block in log’
/Users/anukool/.rvm/gems/ruby-2.1.2/gems/activesupport-3.2.18/lib/active_support/notifications/instrumenter.rb:20:in `instrument’
/Users/anukool/.rvm/gems/ruby-2.1.2/gems/activerecord-3.2.18/lib/active_record/connection_adapters/abstract_adapter.rb:275:in `log’
/Users/anukool/.rvm/gems/ruby-2.1.2/gems/activerecord-3.2.18/lib/active_record/connection_adapters/mysql_adapter.rb:307:in `exec_without_stmt’
/Users/anukool/.rvm/gems/ruby-2.1.2/gems/activerecord-3.2.18/lib/active_record/connection_adapters/mysql_adapter.rb:290:in `exec_query’
/Users/anukool/.rvm/gems/ruby-2.1.2/gems/activerecord-3.2.18/lib/active_record/connection_adapters/mysql_adapter.rb:339:in `exec_delete’
/Users/anukool/.rvm/gems/ruby-2.1.2/gems/activerecord-3.2.18/lib/active_record/connection_adapters/abstract/database_statements.rb:101:in `delete’
/Users/anukool/.rvm/gems/ruby-2.1.2/gems/activerecord-3.2.18/lib/active_record/connection_adapters/abstract/query_cache.rb:14:in `delete’
/Users/anukool/.rvm/gems/ruby-2.1.2/gems/activerecord-3.2.18/lib/active_record/migration.rb:466:in `block in method_missing’
/Users/anukool/.rvm/gems/ruby-2.1.2/gems/activerecord-3.2.18/lib/active_record/migration.rb:438:in `block in say_with_time’
/Users/anukool/.rvm/gems/ruby-2.1.2/gems/activerecord-3.2.18/lib/active_record/migration.rb:438:in `say_with_time’
/Users/anukool/.rvm/gems/ruby-2.1.2/gems/activerecord-3.2.18/lib/active_record/migration.rb:458:in `method_missing’
/Users/anukool/openproject/db/migrate/migration_utils/customizable_utils.rb:105:in `delete_invalid_work_package_custom_values’
/Users/anukool/openproject/db/migrate/migration_utils/customizable_utils.rb:41:in `add_missing_customizable_journals’
/Users/anukool/openproject/db/migrate/20131018134590_add_missing_customizable_journals.rb:38:in `block in up’
/Users/anukool/openproject/db/migrate/migration_utils/utils.rb:37:in `block (2 levels) in say_with_time_silently’
/Users/anukool/.rvm/gems/ruby-2.1.2/gems/activerecord-3.2.18/lib/active_record/migration.rb:446:in `suppress_messages’
/Users/anukool/openproject/db/migrate/migration_utils/utils.rb:36:in `block in say_with_time_silently’
/Users/anukool/.rvm/gems/ruby-2.1.2/gems/activerecord-3.2.18/lib/active_record/migration.rb:438:in `block in say_with_time’
/Users/anukool/.rvm/gems/ruby-2.1.2/gems/activerecord-3.2.18/lib/active_record/migration.rb:438:in `say_with_time’
/Users/anukool/openproject/db/migrate/migration_utils/utils.rb:35:in `say_with_time_silently’
/Users/anukool/openproject/db/migrate/20131018134590_add_missing_customizable_journals.rb:37:in `up’
/Users/anukool/.rvm/gems/ruby-2.1.2/gems/activerecord-3.2.18/lib/active_record/migration.rb:410:in `block (2 levels) in migrate’
/Users/anukool/.rvm/gems/ruby-2.1.2/gems/activerecord-3.2.18/lib/active_record/migration.rb:410:in `block in migrate’
/Users/anukool/.rvm/gems/ruby-2.1.2/gems/activerecord-3.2.18/lib/active_record/connection_adapters/abstract/connection_pool.rb:129:in `with_connection’
/Users/anukool/.rvm/gems/ruby-2.1.2/gems/activerecord-3.2.18/lib/active_record/migration.rb:389:in `migrate’
/Users/anukool/.rvm/gems/ruby-2.1.2/gems/activerecord-3.2.18/lib/active_record/migration.rb:528:in `migrate’
/Users/anukool/.rvm/gems/ruby-2.1.2/gems/activerecord-3.2.18/lib/active_record/migration.rb:720:in `block (2 levels) in migrate’
/Users/anukool/.rvm/gems/ruby-2.1.2/gems/activerecord-3.2.18/lib/active_record/migration.rb:777:in `call’
/Users/anukool/.rvm/gems/ruby-2.1.2/gems/activerecord-3.2.18/lib/active_record/migration.rb:777:in `ddl_transaction’
/Users/anukool/.rvm/gems/ruby-2.1.2/gems/activerecord-3.2.18/lib/active_record/migration.rb:719:in `block in migrate’
/Users/anukool/.rvm/gems/ruby-2.1.2/gems/activerecord-3.2.18/lib/active_record/migration.rb:700:in `each’
/Users/anukool/.rvm/gems/ruby-2.1.2/gems/activerecord-3.2.18/lib/active_record/migration.rb:700:in `migrate’
/Users/anukool/.rvm/gems/ruby-2.1.2/gems/activerecord-3.2.18/lib/active_record/migration.rb:570:in `up’
/Users/anukool/.rvm/gems/ruby-2.1.2/gems/activerecord-3.2.18/lib/active_record/migration.rb:551:in `migrate’
/Users/anukool/.rvm/gems/ruby-2.1.2/gems/activerecord-3.2.18/lib/active_record/railties/databases.rake:193:in `block (2 levels) in <top (required)>’
Tasks: TOP => db:migrate