From 32aef45a1a1dafee8a3e13cecb5411d5043ca179 Mon Sep 17 00:00:00 2001
From: pabois <pierreandre.boissinot@noesya.coop>
Date: Fri, 16 Dec 2022 11:32:26 +0100
Subject: [PATCH] rationnalisation path des pages

---
 app/models/communication/website/page.rb      |  6 +-
 .../communication/website/page/with_path.rb   | 34 +++-----
 .../website/permalink/administrator.rb        |  2 +-
 .../communication/website/permalink/author.rb |  2 +-
 .../website/permalink/category.rb             |  2 +-
 .../website/permalink/diploma.rb              |  2 +-
 .../website/permalink/organization.rb         |  2 +-
 .../communication/website/permalink/person.rb |  2 +-
 .../communication/website/permalink/post.rb   |  3 +-
 .../website/permalink/program.rb              |  2 +-
 .../website/permalink/researcher.rb           |  2 +-
 .../website/permalink/teacher.rb              |  2 +-
 db/schema.rb                                  | 84 +++++++++----------
 13 files changed, 64 insertions(+), 81 deletions(-)

diff --git a/app/models/communication/website/page.rb b/app/models/communication/website/page.rb
index f72e9eeba..6b7f30e7a 100644
--- a/app/models/communication/website/page.rb
+++ b/app/models/communication/website/page.rb
@@ -41,6 +41,8 @@
 #
 
 class Communication::Website::Page < ApplicationRecord
+  self.ignored_columns = %w(path)
+
   include Accessible
   include Sanitizable
   include WithUniversity
@@ -98,10 +100,6 @@ class Communication::Website::Page < ApplicationRecord
     active_storage_blobs
   end
 
-  def language_prefix
-    "/#{language.iso_code}" if website.languages.any? && language_id
-  end
-
   def duplicate
     page = self.dup
     page.published = false
diff --git a/app/models/communication/website/page/with_path.rb b/app/models/communication/website/page/with_path.rb
index 9ff256b12..33a22b610 100644
--- a/app/models/communication/website/page/with_path.rb
+++ b/app/models/communication/website/page/with_path.rb
@@ -13,22 +13,19 @@ module Communication::Website::Page::WithPath
               },
               unless: :kind_home?
 
-    before_validation :check_slug, :make_path
-    after_save :update_children_paths, if: :saved_change_to_path?
+    before_validation :check_slug
   end
 
-  def generated_path
-    "#{parent&.path}#{slug}/".gsub(/\/+/, '/')
+  def path
+    # TODO i18n remplacer le choix de la langue
+    path = ''
+    path += "/#{website.languages.first.iso_code}" if website.languages.any?
+    path += "/#{slug_with_ancestors}/"
+    path.gsub(/\/+/, '/')
   end
 
-  def path_without_language
-    if kind_home?
-      "/"
-    elsif parent_id.present?
-      "#{parent&.path_without_language}#{slug}/".gsub(/\/+/, '/')
-    else
-      "/#{slug}/".gsub(/\/+/, '/')
-    end
+  def slug_with_ancestors
+    (ancestors.map(&:slug) << slug).reject(&:blank?).join('/')
   end
 
   def git_path(website)
@@ -40,7 +37,7 @@ module Communication::Website::Page::WithPath
     elsif has_special_git_path?
       path += "#{kind.split('_').last}/_index.html"
     else
-      path += "pages/#{path_without_language}/_index.html"
+      path += "pages/#{slug_with_ancestors}/_index.html"
     end
 
     path
@@ -54,13 +51,6 @@ module Communication::Website::Page::WithPath
 
   protected
 
-  def update_children_paths
-    children.each do |child|
-      child.update_column :path, child.generated_path
-      child.update_children_paths
-    end
-  end
-
   def check_slug
     self.slug = to_s.parameterize if self.slug.blank? && !kind_home?
     current_slug = self.slug
@@ -78,10 +68,6 @@ module Communication::Website::Page::WithPath
               .exists?
   end
 
-  def make_path
-    self.path = kind_home? ? "#{language_prefix}/" : generated_path
-  end
-
   def slug_must_be_unique
     errors.add(:slug, ActiveRecord::Errors.default_error_messages[:taken]) if slug_unavailable?(slug)
   end
diff --git a/app/models/communication/website/permalink/administrator.rb b/app/models/communication/website/permalink/administrator.rb
index a68bdc15e..a852b130b 100644
--- a/app/models/communication/website/permalink/administrator.rb
+++ b/app/models/communication/website/permalink/administrator.rb
@@ -33,6 +33,6 @@ class Communication::Website::Permalink::Administrator < Communication::Website:
 
   # /equipe/:slug/roles/
   def self.pattern_in_website(website)
-    "#{website.special_page(:persons).path_without_language}:slug/roles/"
+    "#{website.special_page(:persons).path}:slug/roles/"
   end
 end
diff --git a/app/models/communication/website/permalink/author.rb b/app/models/communication/website/permalink/author.rb
index d721a2d34..d5e2aa061 100644
--- a/app/models/communication/website/permalink/author.rb
+++ b/app/models/communication/website/permalink/author.rb
@@ -34,6 +34,6 @@ class Communication::Website::Permalink::Author < Communication::Website::Permal
 
   # /equipe/:slug/actualites/
   def self.pattern_in_website(website)
-    "#{website.special_page(:persons).path_without_language}:slug/#{website.special_page(:communication_posts).slug}/"
+    "#{website.special_page(:persons).path}:slug/#{website.special_page(:communication_posts).slug}/"
   end
 end
diff --git a/app/models/communication/website/permalink/category.rb b/app/models/communication/website/permalink/category.rb
index 4ed09cfc5..baf5ebd30 100644
--- a/app/models/communication/website/permalink/category.rb
+++ b/app/models/communication/website/permalink/category.rb
@@ -33,7 +33,7 @@ class Communication::Website::Permalink::Category < Communication::Website::Perm
 
   # /actualites/:slug/
   def self.pattern_in_website(website)
-    "#{website.special_page(:communication_posts).path_without_language}:slug/"
+    "#{website.special_page(:communication_posts).path}:slug/"
   end
 
   protected
diff --git a/app/models/communication/website/permalink/diploma.rb b/app/models/communication/website/permalink/diploma.rb
index 62331308e..0446d7323 100644
--- a/app/models/communication/website/permalink/diploma.rb
+++ b/app/models/communication/website/permalink/diploma.rb
@@ -33,6 +33,6 @@ class Communication::Website::Permalink::Diploma < Communication::Website::Perma
 
   # /diplomes/:slug/
   def self.pattern_in_website(website)
-    "#{website.special_page(:education_diplomas).path_without_language}:slug/"
+    "#{website.special_page(:education_diplomas).path}:slug/"
   end
 end
diff --git a/app/models/communication/website/permalink/organization.rb b/app/models/communication/website/permalink/organization.rb
index abfab5cbf..00220b12d 100644
--- a/app/models/communication/website/permalink/organization.rb
+++ b/app/models/communication/website/permalink/organization.rb
@@ -33,6 +33,6 @@ class Communication::Website::Permalink::Organization < Communication::Website::
 
   # /organisations/:slug/
   def self.pattern_in_website(website)
-    "#{website.special_page(:organizations).path_without_language}:slug/"
+    "#{website.special_page(:organizations).path}:slug/"
   end
 end
diff --git a/app/models/communication/website/permalink/person.rb b/app/models/communication/website/permalink/person.rb
index 5c8001914..dbe8b043a 100644
--- a/app/models/communication/website/permalink/person.rb
+++ b/app/models/communication/website/permalink/person.rb
@@ -33,6 +33,6 @@ class Communication::Website::Permalink::Person < Communication::Website::Permal
 
   # /equipe/:slug/
   def self.pattern_in_website(website)
-    "#{website.special_page(:persons).path_without_language}:slug/"
+    "#{website.special_page(:persons).path}:slug/"
   end
 end
diff --git a/app/models/communication/website/permalink/post.rb b/app/models/communication/website/permalink/post.rb
index 898350539..fdb8fcdf7 100644
--- a/app/models/communication/website/permalink/post.rb
+++ b/app/models/communication/website/permalink/post.rb
@@ -32,9 +32,8 @@ class Communication::Website::Permalink::Post < Communication::Website::Permalin
   end
 
   # /actualites/2022-10-21-un-article/
-  # Pas de /fr au dƩbut, parce qu'Hugo a besoin du permalink sans langue
   def self.pattern_in_website(website)
-    "#{website.special_page(:communication_posts).path_without_language}:year-:month-:day-:slug/"
+    "#{website.special_page(:communication_posts).path}:year-:month-:day-:slug/"
   end
 
   protected
diff --git a/app/models/communication/website/permalink/program.rb b/app/models/communication/website/permalink/program.rb
index 2fb1ee2ef..506696d7e 100644
--- a/app/models/communication/website/permalink/program.rb
+++ b/app/models/communication/website/permalink/program.rb
@@ -33,6 +33,6 @@ class Communication::Website::Permalink::Program < Communication::Website::Perma
 
   # /formations/:slug/
   def self.pattern_in_website(website)
-    "#{website.special_page(:education_programs).path_without_language}:slug/"
+    "#{website.special_page(:education_programs).path}:slug/"
   end
 end
diff --git a/app/models/communication/website/permalink/researcher.rb b/app/models/communication/website/permalink/researcher.rb
index fb03e96b7..e0cbf3c44 100644
--- a/app/models/communication/website/permalink/researcher.rb
+++ b/app/models/communication/website/permalink/researcher.rb
@@ -34,6 +34,6 @@ class Communication::Website::Permalink::Researcher < Communication::Website::Pe
   # /equipe/:slug/papers/
   # FIXME
   def self.pattern_in_website(website)
-    "#{website.special_page(:persons).path_without_language}:slug/papers/"
+    "#{website.special_page(:persons).path}:slug/papers/"
   end
 end
diff --git a/app/models/communication/website/permalink/teacher.rb b/app/models/communication/website/permalink/teacher.rb
index 8d49d2cd7..ebd6ed95d 100644
--- a/app/models/communication/website/permalink/teacher.rb
+++ b/app/models/communication/website/permalink/teacher.rb
@@ -34,6 +34,6 @@ class Communication::Website::Permalink::Teacher < Communication::Website::Perma
   # /equipe/:slug/programs/
   # FIXME
   def self.pattern_in_website(website)
-    "#{website.special_page(:persons).path_without_language}:slug/programs/"
+    "#{website.special_page(:persons).path}:slug/programs/"
   end
 end
diff --git a/db/schema.rb b/db/schema.rb
index 55067828b..3b9e215a0 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -16,7 +16,7 @@ ActiveRecord::Schema[7.0].define(version: 2022_12_12_165617) do
   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
@@ -26,7 +26,7 @@ ActiveRecord::Schema[7.0].define(version: 2022_12_12_165617) do
     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
@@ -36,7 +36,7 @@ ActiveRecord::Schema[7.0].define(version: 2022_12_12_165617) do
     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"
@@ -50,13 +50,13 @@ ActiveRecord::Schema[7.0].define(version: 2022_12_12_165617) do
     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
   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"
@@ -64,7 +64,7 @@ ActiveRecord::Schema[7.0].define(version: 2022_12_12_165617) do
     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"
@@ -78,7 +78,7 @@ ActiveRecord::Schema[7.0].define(version: 2022_12_12_165617) do
     t.index ["criterion_id"], name: "index_administration_qualiopi_indicators_on_criterion_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"
@@ -93,7 +93,7 @@ ActiveRecord::Schema[7.0].define(version: 2022_12_12_165617) do
     t.index ["university_id"], name: "index_communication_blocks_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.string "name"
     t.uuid "university_id", null: false
     t.string "host"
@@ -117,7 +117,7 @@ ActiveRecord::Schema[7.0].define(version: 2022_12_12_165617) do
     t.index ["university_id"], name: "index_communication_extranets_on_university_id"
   end
 
-  create_table "communication_website_categories", id: :uuid, default: -> { "public.gen_random_uuid()" }, force: :cascade do |t|
+  create_table "communication_website_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.string "name"
@@ -147,7 +147,7 @@ ActiveRecord::Schema[7.0].define(version: 2022_12_12_165617) do
     t.index ["communication_website_post_id", "communication_website_category_id"], name: "post_category"
   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
@@ -159,7 +159,7 @@ ActiveRecord::Schema[7.0].define(version: 2022_12_12_165617) do
     t.index ["website_id"], name: "index_communication_website_git_files_on_website_id"
   end
 
-  create_table "communication_website_imported_authors", id: :uuid, default: -> { "public.gen_random_uuid()" }, force: :cascade do |t|
+  create_table "communication_website_imported_authors", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
     t.uuid "university_id", null: false
     t.uuid "website_id", null: false
     t.uuid "author_id"
@@ -175,7 +175,7 @@ ActiveRecord::Schema[7.0].define(version: 2022_12_12_165617) do
     t.index ["website_id"], name: "idx_communication_website_imported_auth_on_website"
   end
 
-  create_table "communication_website_imported_categories", id: :uuid, default: -> { "public.gen_random_uuid()" }, force: :cascade do |t|
+  create_table "communication_website_imported_categories", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
     t.uuid "university_id", null: false
     t.uuid "website_id", null: false
     t.uuid "category_id"
@@ -193,7 +193,7 @@ ActiveRecord::Schema[7.0].define(version: 2022_12_12_165617) do
     t.index ["website_id"], name: "idx_communication_website_imported_cat_on_website"
   end
 
-  create_table "communication_website_imported_media", id: :uuid, default: -> { "public.gen_random_uuid()" }, force: :cascade do |t|
+  create_table "communication_website_imported_media", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
     t.string "identifier"
     t.jsonb "data"
     t.text "file_url"
@@ -208,7 +208,7 @@ ActiveRecord::Schema[7.0].define(version: 2022_12_12_165617) do
     t.index ["website_id"], name: "index_communication_website_imported_media_on_website_id"
   end
 
-  create_table "communication_website_imported_pages", id: :uuid, default: -> { "public.gen_random_uuid()" }, force: :cascade do |t|
+  create_table "communication_website_imported_pages", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
     t.uuid "university_id", null: false
     t.uuid "website_id", null: false
     t.uuid "page_id"
@@ -232,7 +232,7 @@ ActiveRecord::Schema[7.0].define(version: 2022_12_12_165617) do
     t.index ["website_id"], name: "index_communication_website_imported_pages_on_website_id"
   end
 
-  create_table "communication_website_imported_posts", id: :uuid, default: -> { "public.gen_random_uuid()" }, force: :cascade do |t|
+  create_table "communication_website_imported_posts", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
     t.uuid "university_id", null: false
     t.uuid "website_id", null: false
     t.uuid "post_id"
@@ -257,7 +257,7 @@ ActiveRecord::Schema[7.0].define(version: 2022_12_12_165617) do
     t.index ["website_id"], name: "index_communication_website_imported_posts_on_website_id"
   end
 
-  create_table "communication_website_imported_websites", id: :uuid, default: -> { "public.gen_random_uuid()" }, force: :cascade do |t|
+  create_table "communication_website_imported_websites", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
     t.uuid "university_id", null: false
     t.uuid "website_id", null: false
     t.integer "status", default: 0
@@ -267,7 +267,7 @@ ActiveRecord::Schema[7.0].define(version: 2022_12_12_165617) do
     t.index ["website_id"], name: "index_communication_website_imported_websites_on_website_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
@@ -287,7 +287,7 @@ ActiveRecord::Schema[7.0].define(version: 2022_12_12_165617) do
     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"
@@ -299,7 +299,7 @@ ActiveRecord::Schema[7.0].define(version: 2022_12_12_165617) do
     t.index ["university_id"], name: "index_communication_website_menus_on_university_id"
   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.string "title"
@@ -314,10 +314,10 @@ ActiveRecord::Schema[7.0].define(version: 2022_12_12_165617) do
     t.text "github_path"
     t.string "featured_image_alt"
     t.text "text"
-    t.text "description_short"
     t.string "breadcrumb_title"
     t.text "header_text"
     t.integer "kind"
+    t.text "description_short"
     t.string "bodyclass"
     t.uuid "language_id"
     t.text "featured_image_credit"
@@ -341,7 +341,7 @@ ActiveRecord::Schema[7.0].define(version: 2022_12_12_165617) do
     t.index ["website_id"], name: "index_communication_website_permalinks_on_website_id"
   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.string "title"
@@ -365,7 +365,7 @@ ActiveRecord::Schema[7.0].define(version: 2022_12_12_165617) do
     t.index ["university_id"], name: "index_communication_website_posts_on_university_id"
   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 "name"
     t.string "url"
@@ -414,7 +414,7 @@ ActiveRecord::Schema[7.0].define(version: 2022_12_12_165617) do
     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
@@ -429,7 +429,7 @@ ActiveRecord::Schema[7.0].define(version: 2022_12_12_165617) do
     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
@@ -450,7 +450,7 @@ ActiveRecord::Schema[7.0].define(version: 2022_12_12_165617) do
     t.index ["university_person_id", "education_cohort_id"], name: "index_person_cohort"
   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.string "name"
     t.string "short_name"
     t.integer "level", default: 0
@@ -464,7 +464,7 @@ ActiveRecord::Schema[7.0].define(version: 2022_12_12_165617) do
     t.index ["university_id"], name: "index_education_diplomas_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.string "name"
     t.integer "capacity"
@@ -524,7 +524,7 @@ ActiveRecord::Schema[7.0].define(version: 2022_12_12_165617) do
     t.index ["education_program_id", "user_id"], name: "index_education_programs_users_on_program_id_and_user_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 "name"
     t.string "address"
@@ -539,7 +539,7 @@ ActiveRecord::Schema[7.0].define(version: 2022_12_12_165617) do
     t.index ["university_id"], name: "index_education_schools_on_university_id"
   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"
@@ -552,14 +552,14 @@ ActiveRecord::Schema[7.0].define(version: 2022_12_12_165617) do
     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
     t.datetime "updated_at", null: false
   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.string "title"
     t.datetime "published_at", precision: nil
     t.uuid "university_id", null: false
@@ -589,7 +589,7 @@ ActiveRecord::Schema[7.0].define(version: 2022_12_12_165617) do
     t.index ["researcher_id"], name: "index_research_journal_papers_researchers_on_researcher_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.string "title"
@@ -608,7 +608,7 @@ ActiveRecord::Schema[7.0].define(version: 2022_12_12_165617) do
     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.string "title"
     t.text "description"
@@ -620,7 +620,7 @@ ActiveRecord::Schema[7.0].define(version: 2022_12_12_165617) do
     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 "name"
     t.string "address"
@@ -632,7 +632,7 @@ ActiveRecord::Schema[7.0].define(version: 2022_12_12_165617) do
     t.index ["university_id"], name: "index_research_laboratories_on_university_id"
   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.string "name"
@@ -646,7 +646,7 @@ ActiveRecord::Schema[7.0].define(version: 2022_12_12_165617) do
     t.index ["university_id"], name: "index_research_laboratory_axes_on_university_id"
   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
@@ -664,7 +664,7 @@ ActiveRecord::Schema[7.0].define(version: 2022_12_12_165617) do
     t.index ["university_id"], name: "index_research_theses_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"
@@ -689,7 +689,7 @@ ActiveRecord::Schema[7.0].define(version: 2022_12_12_165617) do
     t.string "sso_button_label"
   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 "name"
     t.string "long_name"
@@ -712,7 +712,7 @@ ActiveRecord::Schema[7.0].define(version: 2022_12_12_165617) do
     t.index ["university_id"], name: "index_university_organizations_on_university_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.string "last_name"
@@ -748,7 +748,7 @@ ActiveRecord::Schema[7.0].define(version: 2022_12_12_165617) do
     t.index ["user_id"], name: "index_university_people_on_user_id"
   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
@@ -762,7 +762,7 @@ ActiveRecord::Schema[7.0].define(version: 2022_12_12_165617) do
     t.index ["university_id"], name: "index_university_person_experiences_on_university_id"
   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"
@@ -777,7 +777,7 @@ ActiveRecord::Schema[7.0].define(version: 2022_12_12_165617) do
     t.index ["university_id"], name: "index_university_person_involvements_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"
@@ -789,7 +789,7 @@ ActiveRecord::Schema[7.0].define(version: 2022_12_12_165617) do
     t.index ["university_id"], name: "index_university_roles_on_university_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"
-- 
GitLab