@eldar_web

Как в Ruby on Rails удалить уникальный индекс?

Удаляю так:
remove_index :price_crosses, name: :price_crosses_oem_make_name_cross_oem_cross_make_name_key

А пишет:
rails aborted!
StandardError: An error has occurred, this and all later migrations canceled:

PG::DependentObjectsStillExist: ERROR: cannot drop index price_crosses_oem_make_name_cross_oem_cross_make_name_key because constraint price_crosses_oem_make_name_cross_oem_cross_make_name_key on table price_crosses requires it
HINT: You can drop constraint price_crosses_oem_make_name_cross_oem_cross_make_name_key on table price_crosses instead.
: DROP INDEX "price_crosses_oem_make_name_cross_oem_cross_make_name_key"
/home/woto/work/eldar/allzap/apps/www/db/migrate/9011090606662959_remove_index_from_price_crosses.rb:3:in `change'
script/rails:6:in `require'
script/rails:6:in `'

Caused by:
ActiveRecord::StatementInvalid: PG::DependentObjectsStillExist: ERROR: cannot drop index price_crosses_oem_make_name_cross_oem_cross_make_name_key because constraint price_crosses_oem_make_name_cross_oem_cross_make_name_key on table price_crosses requires it
HINT: You can drop constraint price_crosses_oem_make_name_cross_oem_cross_make_name_key on table price_crosses instead.
: DROP INDEX "price_crosses_oem_make_name_cross_oem_cross_make_name_key"
/home/woto/work/eldar/allzap/apps/www/db/migrate/9011090606662959_remove_index_from_price_crosses.rb:3:in `change'
  • Вопрос задан
  • 133 просмотра
Пригласить эксперта
Ответы на вопрос 2
@notwrite
Тут же прям и написано что делать
HINT: You can drop constraint price_crosses_oem_make_name_cross_oem_cross_make_name_key on table price_crosses instead.
: DROP INDEX "price_crosses_oem_make_name_cross_oem_cross_make_name_key
Ответ написан
@vortx
IT-инженер, Web-разработчик, MicroChip-dev
remove_index :accounts, column: [:branch_id, :party_id]
Ответ написан
Комментировать
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы