Skip to content
Snippets Groups Projects
Commit c4a7f0cd authored by Arnaud Levy's avatar Arnaud Levy
Browse files

fix

parent 3c829d1c
No related branches found
No related tags found
No related merge requests found
......@@ -5,9 +5,17 @@ class RenameHalPublications < ActiveRecord::Migration[7.1]
rename_table :research_hal_publications_university_people, :research_publications_university_people
rename_column :research_publications_university_people, :research_hal_publication_id, :research_publication_id
# Vieil index problématique
# https://stackoverflow.com/questions/32395126/rename-table-relation-table-pkey-does-not-exist
execute "ALTER INDEX research_documents_pkey RENAME TO research_hal_publications_pkey;"
reversible do |dir|
# Vieil index problématique
# Pas évident à intégrer dans une migration :
# 1. la première fois qu'on migre on répare l'index
# 2. mais on ne peut pas reverse la migration, d'où l'usage de reversible
# 3. et quand on remet après revert, il ne veut plus passer parce que l'index à réparer est déjà réparé
# 4. en ajoutant IF EXISTS, on peut le repasser
# Bingo !
# https://stackoverflow.com/questions/32395126/rename-table-relation-table-pkey-does-not-exist
dir.up { execute "ALTER INDEX IF EXISTS research_documents_pkey RENAME TO research_hal_publications_pkey" }
end
rename_table :research_hal_publications, :research_publications
rename_column :research_publications, :docid, :hal_docid
add_column :research_publications, :source, :integer, default: 0
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment