diff --git a/app/controllers/admin/communication/blocks_controller.rb b/app/controllers/admin/communication/blocks_controller.rb index c33b59723..61040f512 100644 --- a/app/controllers/admin/communication/blocks_controller.rb +++ b/app/controllers/admin/communication/blocks_controller.rb @@ -124,21 +124,8 @@ def redirect_if_block_language_is_incorrect def reorder_object @id = @object[:id] - @object[:kind] == 'heading' ? reorder_heading - : reorder_block - end - - def reorder_heading - @heading = current_university.communication_block_headings.find(@id) - @heading.update_columns position: @index_heading - @index_block = 0 - @index_heading += 1 - end - - def reorder_block @block = current_university.communication_blocks.find(@id) - @block.update_columns position: @index_block, - heading_id: @heading&.id + @block.update_columns position: @index_block @index_block += 1 end diff --git a/app/models/communication/block.rb b/app/models/communication/block.rb index 3261dc4a4..9ced90d1f 100644 --- a/app/models/communication/block.rb +++ b/app/models/communication/block.rb @@ -15,13 +15,11 @@ # updated_at :datetime not null # about_id :uuid indexed => [about_type] # communication_website_id :uuid indexed -# heading_id :uuid indexed # university_id :uuid not null, indexed # # Indexes # # index_communication_blocks_on_communication_website_id (communication_website_id) -# index_communication_blocks_on_heading_id (heading_id) # index_communication_blocks_on_university_id (university_id) # index_communication_website_blocks_on_about (about_type,about_id) # @@ -29,7 +27,6 @@ # # fk_rails_18291ef65f (university_id => universities.id) # fk_rails_80e5625874 (communication_website_id => communication_websites.id) -# fk_rails_90ac986fab (heading_id => communication_block_headings.id) # class Communication::Block < ApplicationRecord BLOCK_COPY_COOKIE = 'osuny-content-editor-block-copy' @@ -166,7 +163,7 @@ def to_s protected def last_ordered_element - about.blocks.where(heading_id: heading_id).ordered.last + about.blocks.ordered.last end def set_university_and_website_from_about diff --git a/app/models/communication/block/heading.rb b/app/models/communication/block/heading.rb deleted file mode 100644 index 9b16590cc..000000000 --- a/app/models/communication/block/heading.rb +++ /dev/null @@ -1,118 +0,0 @@ -# == Schema Information -# -# Table name: communication_block_headings -# -# id :uuid not null, primary key -# about_type :string not null, indexed => [about_id] -# level :integer default(2) -# migration_identifier :string -# position :integer -# slug :string indexed -# title :string -# created_at :datetime not null -# updated_at :datetime not null -# about_id :uuid not null, indexed => [about_type] -# parent_id :uuid indexed -# university_id :uuid not null, indexed -# -# Indexes -# -# index_communication_block_headings_on_about (about_type,about_id) -# index_communication_block_headings_on_parent_id (parent_id) -# index_communication_block_headings_on_slug (slug) -# index_communication_block_headings_on_university_id (university_id) -# -# Foreign Keys -# -# fk_rails_6d3de8388e (parent_id => communication_block_headings.id) -# fk_rails_ae82723550 (university_id => universities.id) -# - -# TODO TITLE remove -class Communication::Block::Heading < ApplicationRecord - include AsIndirectObject - include Orderable - include Sanitizable - include Sluggable - include WithUniversity - - belongs_to :university - belongs_to :about, - polymorphic: true - belongs_to :parent, - class_name: 'Communication::Block::Heading', - optional: true - has_many :children, - class_name: 'Communication::Block::Heading', - foreign_key: :parent_id, - dependent: :nullify - has_many :blocks, - dependent: :nullify - - DEFAULT_LEVEL = 2 - - scope :root, -> { where(parent_id: nil) } - - before_validation :compute_level - after_save :touch_about - - def references - [about] - end - - def duplicate - heading = self.dup - heading.save - heading - end - - def localize_for!(new_localization, parent_id = nil) - localized_heading = self.dup - localized_heading.about = new_localization - localized_heading.parent_id = parent_id - localized_heading.save - # then translate blocks - blocks.ordered.each do |block| - block.localize_for!(new_localization, localized_heading.id) - end - # and then children - children.ordered.each do |child| - child.localize_for!(new_localization, localized_heading.id) - end - end - - def full_text - to_s - end - - def to_s - "#{title}" - end - - protected - - def set_slug - self.slug = nil - super - end - - def slug_unavailable?(slug) - self.class.unscoped - .where(slug: slug, about_type: about_type, about_id: about_id) - .where.not(id: self.id) - .exists? - end - - def last_ordered_element - about.headings.where(parent_id: self.parent_id).ordered.last - end - - def compute_level - self.level = parent ? parent.level + 1 - : DEFAULT_LEVEL - end - - def touch_about - about.touch - end -end diff --git a/app/models/communication/block/with_heading_ranks.rb b/app/models/communication/block/with_heading_ranks.rb index e99074390..865542af3 100644 --- a/app/models/communication/block/with_heading_ranks.rb +++ b/app/models/communication/block/with_heading_ranks.rb @@ -1,12 +1,7 @@ module Communication::Block::WithHeadingRanks extend ActiveSupport::Concern - - DEFAULT_HEADING_LEVEL = 2 # h1 is the page title - included do - # TODO TITLE remove - belongs_to :heading, optional: true - end + DEFAULT_HEADING_LEVEL = 2 # h1 is the page title def heading_rank_self title.present? ? heading_rank_base : false diff --git a/app/models/communication/website/portfolio/project/localization.rb b/app/models/communication/website/portfolio/project/localization.rb index ae442bc46..9014330f5 100644 --- a/app/models/communication/website/portfolio/project/localization.rb +++ b/app/models/communication/website/portfolio/project/localization.rb @@ -10,6 +10,7 @@ # published :boolean default(FALSE) # published_at :datetime # slug :string +# subtitle :string # summary :text # title :string # created_at :datetime not null diff --git a/app/models/concerns/contentful.rb b/app/models/concerns/contentful.rb index 27f966fa7..5aff199a3 100644 --- a/app/models/concerns/contentful.rb +++ b/app/models/concerns/contentful.rb @@ -4,8 +4,10 @@ module Contentful LARGE_NUMBER_OF_BLOCKS = 5 included do - has_many :blocks, as: :about, class_name: 'Communication::Block', dependent: :destroy - has_many :headings, as: :about, class_name: 'Communication::Block::Heading', dependent: :destroy + has_many :blocks, + as: :about, + class_name: 'Communication::Block', + dependent: :destroy end def contents diff --git a/app/models/university/with_communication.rb b/app/models/university/with_communication.rb index caa64704c..f9381c895 100644 --- a/app/models/university/with_communication.rb +++ b/app/models/university/with_communication.rb @@ -28,10 +28,5 @@ module University::WithCommunication class_name: 'Communication::Block', dependent: :destroy alias_method :blocks, :communication_blocks - - has_many :communication_block_headings, - class_name: 'Communication::Block::Heading', - dependent: :destroy - alias_method :headings, :communication_block_headings end end diff --git a/app/services/migrations/fix_key_figures.rb b/app/services/migrations/fix_key_figures.rb deleted file mode 100644 index 6d9170a2e..000000000 --- a/app/services/migrations/fix_key_figures.rb +++ /dev/null @@ -1,40 +0,0 @@ -module Migrations - class FixKeyFigures - def self.migrate - begin - suspend_callbacks - new.migrate - ensure - resume_callbacks - end - end - - def migrate - Communication::Block.template_key_figures.each do |block| - block.template.elements.each do |element| - next if element.description.blank? - puts element.description - string = ActionController::Base.helpers.strip_tags(element.description.to_s) - puts "-> #{string}" - element.description = string - end - block.data = block.template.data - block.save - end - end - - protected - - def self.suspend_callbacks - Communication::Block.skip_callback :save, :after, :connect_and_sync_direct_sources - Communication::Block.skip_callback :save, :after, :clean_websites_if_necessary - Communication::Block.skip_callback :save, :after, :touch_about - end - - def self.resume_callbacks - Communication::Block.set_callback :save, :after, :connect_and_sync_direct_sources - Communication::Block.set_callback :save, :after, :clean_websites_if_necessary - Communication::Block.set_callback :save, :after, :touch_about - end - end -end \ No newline at end of file diff --git a/db/migrate/20241009141435_remove_communication_block_headings.rb b/db/migrate/20241009141435_remove_communication_block_headings.rb new file mode 100644 index 000000000..a2831c328 --- /dev/null +++ b/db/migrate/20241009141435_remove_communication_block_headings.rb @@ -0,0 +1,6 @@ +class RemoveCommunicationBlockHeadings < ActiveRecord::Migration[7.1] + def change + remove_column :communication_blocks, :heading_id + drop_table :communication_block_headings + end +end diff --git a/db/schema.rb b/db/schema.rb index b937e2012..f1560d20a 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -17,7 +17,7 @@ enable_extension "plpgsql" enable_extension "unaccent" - create_table "action_text_rich_texts", id: :uuid, default: -> { "public.gen_random_uuid()" }, force: :cascade do |t| + create_table "action_text_rich_texts", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| t.string "name", null: false t.text "body" t.string "record_type", null: false @@ -27,7 +27,7 @@ t.index ["record_type", "record_id", "name"], name: "index_action_text_rich_texts_uniqueness", unique: true end - create_table "active_storage_attachments", id: :uuid, default: -> { "public.gen_random_uuid()" }, force: :cascade do |t| + create_table "active_storage_attachments", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| t.string "name", null: false t.string "record_type", null: false t.uuid "record_id", null: false @@ -37,7 +37,7 @@ t.index ["record_type", "record_id", "name", "blob_id"], name: "index_active_storage_attachments_uniqueness", unique: true end - create_table "active_storage_blobs", id: :uuid, default: -> { "public.gen_random_uuid()" }, force: :cascade do |t| + create_table "active_storage_blobs", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| t.string "key", null: false t.string "filename", null: false t.string "content_type" @@ -51,7 +51,7 @@ t.index ["university_id"], name: "index_active_storage_blobs_on_university_id" end - create_table "active_storage_variant_records", id: :uuid, default: -> { "public.gen_random_uuid()" }, force: :cascade do |t| + create_table "active_storage_variant_records", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| t.uuid "blob_id", null: false t.string "variation_digest", null: false t.index ["blob_id", "variation_digest"], name: "index_active_storage_variant_records_uniqueness", unique: true @@ -105,7 +105,7 @@ t.index ["education_school_id", "administration_location_id"], name: "index_location_school" end - create_table "administration_qualiopi_criterions", id: :uuid, default: -> { "public.gen_random_uuid()" }, force: :cascade do |t| + create_table "administration_qualiopi_criterions", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| t.integer "number" t.text "name" t.text "description" @@ -113,7 +113,7 @@ t.datetime "updated_at", null: false end - create_table "administration_qualiopi_indicators", id: :uuid, default: -> { "public.gen_random_uuid()" }, force: :cascade do |t| + create_table "administration_qualiopi_indicators", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| t.uuid "criterion_id", null: false t.integer "number" t.text "name" @@ -127,25 +127,7 @@ t.index ["criterion_id"], name: "index_administration_qualiopi_indicators_on_criterion_id" end - create_table "communication_block_headings", id: :uuid, default: -> { "public.gen_random_uuid()" }, force: :cascade do |t| - t.uuid "university_id", null: false - t.string "about_type", null: false - t.uuid "about_id", null: false - t.string "title" - t.integer "level", default: 2 - t.uuid "parent_id" - t.integer "position" - t.string "slug" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.string "migration_identifier" - t.index ["about_type", "about_id"], name: "index_communication_block_headings_on_about" - t.index ["parent_id"], name: "index_communication_block_headings_on_parent_id" - t.index ["slug"], name: "index_communication_block_headings_on_slug" - t.index ["university_id"], name: "index_communication_block_headings_on_university_id" - end - - create_table "communication_blocks", id: :uuid, default: -> { "public.gen_random_uuid()" }, force: :cascade do |t| + create_table "communication_blocks", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| t.uuid "university_id", null: false t.string "about_type" t.uuid "about_id" @@ -157,16 +139,14 @@ t.string "title" t.boolean "published", default: true t.uuid "communication_website_id" - t.uuid "heading_id" t.string "migration_identifier" t.string "html_class" t.index ["about_type", "about_id"], name: "index_communication_website_blocks_on_about" t.index ["communication_website_id"], name: "index_communication_blocks_on_communication_website_id" - t.index ["heading_id"], name: "index_communication_blocks_on_heading_id" t.index ["university_id"], name: "index_communication_blocks_on_university_id" end - create_table "communication_extranet_connections", id: :uuid, default: -> { "public.gen_random_uuid()" }, force: :cascade do |t| + create_table "communication_extranet_connections", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| t.uuid "university_id", null: false t.uuid "extranet_id", null: false t.string "about_type" @@ -178,7 +158,7 @@ t.index ["university_id"], name: "index_communication_extranet_connections_on_university_id" end - create_table "communication_extranet_document_categories", id: :uuid, default: -> { "public.gen_random_uuid()" }, force: :cascade do |t| + create_table "communication_extranet_document_categories", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| t.uuid "extranet_id", null: false t.uuid "university_id", null: false t.datetime "created_at", null: false @@ -217,7 +197,7 @@ t.index ["university_id"], name: "idx_on_university_id_0dc1259072" end - create_table "communication_extranet_document_kinds", id: :uuid, default: -> { "public.gen_random_uuid()" }, force: :cascade do |t| + create_table "communication_extranet_document_kinds", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| t.uuid "extranet_id", null: false t.uuid "university_id", null: false t.datetime "created_at", null: false @@ -242,7 +222,7 @@ t.index ["university_id"], name: "idx_on_university_id_95419f1df4" end - create_table "communication_extranet_documents", id: :uuid, default: -> { "public.gen_random_uuid()" }, force: :cascade do |t| + create_table "communication_extranet_documents", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| t.uuid "university_id", null: false t.uuid "extranet_id", null: false t.datetime "created_at", null: false @@ -275,7 +255,7 @@ t.index ["university_id"], name: "index_communication_extranet_localizations_on_university_id" end - create_table "communication_extranet_post_categories", id: :uuid, default: -> { "public.gen_random_uuid()" }, force: :cascade do |t| + create_table "communication_extranet_post_categories", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| t.uuid "extranet_id", null: false t.uuid "university_id", null: false t.datetime "created_at", null: false @@ -320,7 +300,7 @@ t.index ["university_id"], name: "idx_on_university_id_28188e2217" end - create_table "communication_extranet_posts", id: :uuid, default: -> { "public.gen_random_uuid()" }, force: :cascade do |t| + create_table "communication_extranet_posts", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| t.uuid "author_id" t.uuid "extranet_id", null: false t.uuid "university_id", null: false @@ -333,7 +313,7 @@ t.index ["university_id"], name: "index_communication_extranet_posts_on_university_id" end - create_table "communication_extranets", id: :uuid, default: -> { "public.gen_random_uuid()" }, force: :cascade do |t| + create_table "communication_extranets", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| t.uuid "university_id", null: false t.string "host" t.datetime "created_at", null: false @@ -421,7 +401,7 @@ t.index ["university_id"], name: "idx_on_university_id_eaf79b0514" end - create_table "communication_website_agenda_events", id: :uuid, default: -> { "public.gen_random_uuid()" }, force: :cascade do |t| + create_table "communication_website_agenda_events", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| t.uuid "university_id", null: false t.uuid "communication_website_id", null: false t.date "from_day" @@ -454,7 +434,7 @@ t.index ["communication_website_post_id", "communication_website_category_id"], name: "post_category" end - create_table "communication_website_connections", id: :uuid, default: -> { "public.gen_random_uuid()" }, force: :cascade do |t| + create_table "communication_website_connections", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| t.uuid "university_id", null: false t.uuid "website_id", null: false t.string "indirect_object_type", null: false @@ -489,7 +469,7 @@ t.index ["university_id"], name: "index_communication_website_git_file_orphans_on_university_id" end - create_table "communication_website_git_files", id: :uuid, default: -> { "public.gen_random_uuid()" }, force: :cascade do |t| + create_table "communication_website_git_files", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| t.string "previous_path" t.string "about_type", null: false t.uuid "about_id", null: false @@ -526,7 +506,7 @@ t.index ["university_id"], name: "index_communication_website_localizations_on_university_id" end - create_table "communication_website_menu_items", id: :uuid, default: -> { "public.gen_random_uuid()" }, force: :cascade do |t| + create_table "communication_website_menu_items", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| t.uuid "university_id", null: false t.uuid "website_id", null: false t.uuid "menu_id", null: false @@ -546,7 +526,7 @@ t.index ["website_id"], name: "index_communication_website_menu_items_on_website_id" end - create_table "communication_website_menus", id: :uuid, default: -> { "public.gen_random_uuid()" }, force: :cascade do |t| + create_table "communication_website_menus", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| t.uuid "university_id", null: false t.uuid "communication_website_id", null: false t.string "title" @@ -590,7 +570,7 @@ t.index ["university_id"], name: "idx_on_university_id_e62b2aba53" end - create_table "communication_website_pages", id: :uuid, default: -> { "public.gen_random_uuid()" }, force: :cascade do |t| + create_table "communication_website_pages", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| t.uuid "university_id", null: false t.uuid "communication_website_id", null: false t.text "path" @@ -608,7 +588,7 @@ t.index ["university_id"], name: "index_communication_website_pages_on_university_id" end - create_table "communication_website_permalinks", id: :uuid, default: -> { "public.gen_random_uuid()" }, force: :cascade do |t| + create_table "communication_website_permalinks", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| t.uuid "university_id", null: false t.uuid "website_id", null: false t.string "about_type", null: false @@ -700,7 +680,7 @@ t.index ["university_id"], name: "idx_on_university_id_ac2f4a0bfc" end - create_table "communication_website_post_categories", id: :uuid, default: -> { "public.gen_random_uuid()" }, force: :cascade do |t| + create_table "communication_website_post_categories", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| t.uuid "university_id", null: false t.uuid "communication_website_id", null: false t.integer "position" @@ -760,7 +740,7 @@ t.index ["university_id"], name: "idx_on_university_id_a3a3f1e954" end - create_table "communication_website_posts", id: :uuid, default: -> { "public.gen_random_uuid()" }, force: :cascade do |t| + create_table "communication_website_posts", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| t.uuid "university_id", null: false t.uuid "communication_website_id", null: false t.datetime "created_at", null: false @@ -786,7 +766,7 @@ t.index ["communication_website_showcase_tag_id", "communication_website_id"], name: "index_showcase_tag_website" end - create_table "communication_websites", id: :uuid, default: -> { "public.gen_random_uuid()" }, force: :cascade do |t| + create_table "communication_websites", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| t.uuid "university_id", null: false t.string "url" t.datetime "created_at", null: false @@ -854,7 +834,7 @@ t.index ["priority", "run_at"], name: "delayed_jobs_priority" end - create_table "education_academic_years", id: :uuid, default: -> { "public.gen_random_uuid()" }, force: :cascade do |t| + create_table "education_academic_years", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| t.uuid "university_id", null: false t.integer "year" t.datetime "created_at", null: false @@ -869,7 +849,7 @@ t.index ["university_person_id", "education_academic_year_id"], name: "index_person_academic_year" end - create_table "education_cohorts", id: :uuid, default: -> { "public.gen_random_uuid()" }, force: :cascade do |t| + create_table "education_cohorts", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| t.uuid "university_id", null: false t.uuid "program_id", null: false t.uuid "academic_year_id", null: false @@ -919,7 +899,7 @@ t.index ["university_id"], name: "index_education_diploma_localizations_on_university_id" end - create_table "education_diplomas", id: :uuid, default: -> { "public.gen_random_uuid()" }, force: :cascade do |t| + create_table "education_diplomas", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| t.integer "level", default: 0 t.uuid "university_id", null: false t.datetime "created_at", null: false @@ -1002,7 +982,7 @@ t.index ["university_id"], name: "index_education_program_localizations_on_university_id" end - create_table "education_programs", id: :uuid, default: -> { "public.gen_random_uuid()" }, force: :cascade do |t| + create_table "education_programs", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| t.uuid "university_id", null: false t.integer "capacity" t.boolean "continuing" @@ -1056,7 +1036,7 @@ t.index ["university_id"], name: "index_education_school_localizations_on_university_id" end - create_table "education_schools", id: :uuid, default: -> { "public.gen_random_uuid()" }, force: :cascade do |t| + create_table "education_schools", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| t.uuid "university_id", null: false t.string "address" t.string "zipcode" @@ -1070,7 +1050,7 @@ t.index ["university_id"], name: "index_education_schools_on_university_id" end - create_table "emergency_messages", id: :uuid, default: -> { "public.gen_random_uuid()" }, force: :cascade do |t| + create_table "emergency_messages", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| t.uuid "university_id" t.string "name" t.string "role" @@ -1173,7 +1153,7 @@ t.index ["scheduled_at"], name: "index_good_jobs_on_scheduled_at", where: "(finished_at IS NULL)" end - create_table "imports", id: :uuid, default: -> { "public.gen_random_uuid()" }, force: :cascade do |t| + create_table "imports", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| t.integer "number_of_lines" t.jsonb "processing_errors" t.integer "kind" @@ -1188,7 +1168,7 @@ t.index ["user_id"], name: "index_imports_on_user_id" end - create_table "languages", id: :uuid, default: -> { "public.gen_random_uuid()" }, force: :cascade do |t| + create_table "languages", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| t.string "name" t.string "iso_code" t.datetime "created_at", null: false @@ -1202,7 +1182,7 @@ t.index ["university_id", "language_id"], name: "index_languages_universities_on_university_id_and_language_id" end - create_table "research_hal_authors", id: :uuid, default: -> { "public.gen_random_uuid()" }, force: :cascade do |t| + create_table "research_hal_authors", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| t.string "docid" t.string "form_identifier" t.string "person_identifier" @@ -1256,7 +1236,7 @@ t.index ["university_id"], name: "idx_on_university_id_dc9f1267b7" end - create_table "research_journal_paper_kinds", id: :uuid, default: -> { "public.gen_random_uuid()" }, force: :cascade do |t| + create_table "research_journal_paper_kinds", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| t.uuid "university_id", null: false t.uuid "journal_id", null: false t.datetime "created_at", null: false @@ -1285,7 +1265,7 @@ t.index ["university_id"], name: "index_research_journal_paper_localizations_on_university_id" end - create_table "research_journal_papers", id: :uuid, default: -> { "public.gen_random_uuid()" }, force: :cascade do |t| + create_table "research_journal_papers", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| t.uuid "university_id", null: false t.uuid "research_journal_id", null: false t.uuid "research_journal_volume_id" @@ -1334,7 +1314,7 @@ t.index ["university_id"], name: "index_research_journal_volume_localizations_on_university_id" end - create_table "research_journal_volumes", id: :uuid, default: -> { "public.gen_random_uuid()" }, force: :cascade do |t| + create_table "research_journal_volumes", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| t.uuid "university_id", null: false t.uuid "research_journal_id", null: false t.integer "number" @@ -1344,14 +1324,14 @@ t.index ["university_id"], name: "index_research_journal_volumes_on_university_id" end - create_table "research_journals", id: :uuid, default: -> { "public.gen_random_uuid()" }, force: :cascade do |t| + create_table "research_journals", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| t.uuid "university_id", null: false t.datetime "created_at", null: false t.datetime "updated_at", null: false t.index ["university_id"], name: "index_research_journals_on_university_id" end - create_table "research_laboratories", id: :uuid, default: -> { "public.gen_random_uuid()" }, force: :cascade do |t| + create_table "research_laboratories", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| t.uuid "university_id", null: false t.string "address" t.string "zipcode" @@ -1369,7 +1349,7 @@ t.index ["university_person_id", "research_laboratory_id"], name: "laboratory_person" end - create_table "research_laboratory_axes", id: :uuid, default: -> { "public.gen_random_uuid()" }, force: :cascade do |t| + create_table "research_laboratory_axes", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| t.uuid "university_id", null: false t.uuid "research_laboratory_id", null: false t.integer "position" @@ -1408,7 +1388,7 @@ t.index ["university_id"], name: "index_research_laboratory_localizations_on_university_id" end - create_table "research_publications", id: :uuid, default: -> { "public.gen_random_uuid()" }, force: :cascade do |t| + create_table "research_publications", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| t.string "hal_docid" t.jsonb "data" t.string "title" @@ -1439,7 +1419,7 @@ t.index ["university_person_id", "research_publication_id"], name: "index_publication_person" end - create_table "research_theses", id: :uuid, default: -> { "public.gen_random_uuid()" }, force: :cascade do |t| + create_table "research_theses", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| t.uuid "university_id", null: false t.uuid "research_laboratory_id", null: false t.uuid "author_id", null: false @@ -1468,7 +1448,7 @@ t.index ["university_id"], name: "index_research_thesis_localizations_on_university_id" end - create_table "universities", id: :uuid, default: -> { "public.gen_random_uuid()" }, force: :cascade do |t| + create_table "universities", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| t.string "name" t.string "identifier" t.string "address" @@ -1497,7 +1477,7 @@ t.index ["name"], name: "index_universities_on_name", opclass: :gin_trgm_ops, using: :gin end - create_table "university_apps", id: :uuid, default: -> { "public.gen_random_uuid()" }, force: :cascade do |t| + create_table "university_apps", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| t.string "name" t.uuid "university_id", null: false t.string "token" @@ -1508,7 +1488,7 @@ t.index ["university_id"], name: "index_university_apps_on_university_id" end - create_table "university_organization_categories", id: :uuid, default: -> { "public.gen_random_uuid()" }, force: :cascade do |t| + create_table "university_organization_categories", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| t.uuid "university_id", null: false t.datetime "created_at", null: false t.datetime "updated_at", null: false @@ -1555,7 +1535,7 @@ t.index ["university_id"], name: "index_university_organization_localizations_on_university_id" end - create_table "university_organizations", id: :uuid, default: -> { "public.gen_random_uuid()" }, force: :cascade do |t| + create_table "university_organizations", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| t.uuid "university_id", null: false t.string "address" t.string "zipcode" @@ -1576,14 +1556,14 @@ t.index ["university_id"], name: "index_university_organizations_on_university_id" end - create_table "university_organizations_categories", id: :uuid, default: -> { "public.gen_random_uuid()" }, force: :cascade do |t| + create_table "university_organizations_categories", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| t.uuid "organization_id", null: false t.uuid "category_id", null: false t.index ["category_id"], name: "index_university_organizations_categories_on_category_id" t.index ["organization_id"], name: "index_university_organizations_categories_on_organization_id" end - create_table "university_people", id: :uuid, default: -> { "public.gen_random_uuid()" }, force: :cascade do |t| + create_table "university_people", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| t.uuid "university_id", null: false t.uuid "user_id" t.boolean "is_researcher" @@ -1617,14 +1597,14 @@ t.index ["user_id"], name: "index_university_people_on_user_id" end - create_table "university_people_categories", id: :uuid, default: -> { "public.gen_random_uuid()" }, force: :cascade do |t| + create_table "university_people_categories", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| t.uuid "person_id", null: false t.uuid "category_id", null: false t.index ["category_id"], name: "index_university_people_categories_on_category_id" t.index ["person_id"], name: "index_university_people_categories_on_person_id" end - create_table "university_person_categories", id: :uuid, default: -> { "public.gen_random_uuid()" }, force: :cascade do |t| + create_table "university_person_categories", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| t.uuid "university_id", null: false t.datetime "created_at", null: false t.datetime "updated_at", null: false @@ -1660,7 +1640,7 @@ t.index ["university_id"], name: "idx_on_university_id_1be9c668d5" end - create_table "university_person_experiences", id: :uuid, default: -> { "public.gen_random_uuid()" }, force: :cascade do |t| + create_table "university_person_experiences", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| t.uuid "university_id", null: false t.uuid "person_id", null: false t.uuid "organization_id", null: false @@ -1685,7 +1665,7 @@ t.index ["university_id"], name: "idx_on_university_id_0b815cf13a" end - create_table "university_person_involvements", id: :uuid, default: -> { "public.gen_random_uuid()" }, force: :cascade do |t| + create_table "university_person_involvements", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| t.uuid "university_id", null: false t.uuid "person_id", null: false t.integer "kind" @@ -1735,7 +1715,7 @@ t.index ["university_id"], name: "index_university_role_localizations_on_university_id" end - create_table "university_roles", id: :uuid, default: -> { "public.gen_random_uuid()" }, force: :cascade do |t| + create_table "university_roles", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| t.uuid "university_id", null: false t.string "target_type" t.uuid "target_id" @@ -1746,7 +1726,7 @@ t.index ["university_id"], name: "index_university_roles_on_university_id" end - create_table "user_favorites", id: :uuid, default: -> { "public.gen_random_uuid()" }, force: :cascade do |t| + create_table "user_favorites", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| t.uuid "user_id", null: false t.string "about_type", null: false t.uuid "about_id", null: false @@ -1756,7 +1736,7 @@ t.index ["user_id"], name: "index_user_favorites_on_user_id" end - create_table "users", id: :uuid, default: -> { "public.gen_random_uuid()" }, force: :cascade do |t| + create_table "users", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| t.uuid "university_id", null: false t.string "first_name" t.string "last_name" @@ -1808,9 +1788,6 @@ add_foreign_key "administration_location_localizations", "universities" add_foreign_key "administration_locations", "universities" add_foreign_key "administration_qualiopi_indicators", "administration_qualiopi_criterions", column: "criterion_id" - add_foreign_key "communication_block_headings", "communication_block_headings", column: "parent_id" - add_foreign_key "communication_block_headings", "universities" - add_foreign_key "communication_blocks", "communication_block_headings", column: "heading_id" add_foreign_key "communication_blocks", "communication_websites" add_foreign_key "communication_blocks", "universities" add_foreign_key "communication_extranet_connections", "communication_extranets", column: "extranet_id" diff --git a/lib/tasks/app.rake b/lib/tasks/app.rake index 932fd10a2..925f0087c 100644 --- a/lib/tasks/app.rake +++ b/lib/tasks/app.rake @@ -8,7 +8,7 @@ namespace :app do desc 'Fix things' task fix: :environment do - Migrations::FixKeyFigures.migrate + # No fix yet end namespace :websites do