spectacles icon indicating copy to clipboard operation
spectacles copied to clipboard

Schema load fails with views defined and existing tables

Open liveh2o opened this issue 10 years ago • 0 comments

When running db:schema:load, the following error is raised:

rake aborted!
ActiveRecord::StatementInvalid: PG::DependentObjectsStillExist: ERROR:  cannot drop table accounts because other objects depend on it
DETAIL:  view account_type_totals depends on table accounts
view daily_account_transaction_totals depends on table accounts
view monthly_account_transaction_totals depends on table accounts
HINT:  Use DROP ... CASCADE to drop the dependent objects too.
: DROP TABLE "accounts"

This is due to the fact that tables are created with :force => true, which drops the table if it exists. Per the error message, we may be able to modify the drop command to include cascading.

liveh2o avatar Feb 21 '15 17:02 liveh2o