From 6e9d06abf1be1ca4659ef3190bc08dc47e186da6 Mon Sep 17 00:00:00 2001
From: pabois <pierreandre.boissinot@noesya.coop>
Date: Fri, 10 Feb 2023 14:52:32 +0100
Subject: [PATCH] add filters to server websites list

---
 .../admin/application_controller.rb           | 10 +--
 app/controllers/concerns/admin/filterable.rb  | 18 +++++
 .../server/application_controller.rb          |  2 +
 app/controllers/server/websites_controller.rb |  5 +-
 app/models/communication/website.rb           |  3 +-
 .../website/configs/default_languages.rb      |  2 +-
 .../website/configs/default_permalinks.rb     |  2 +-
 .../website/configs/development_config.rb     |  2 +-
 .../website/configs/production_config.rb      |  2 +-
 app/models/university/person.rb               | 71 +++++++++----------
 app/models/university/person/administrator.rb | 71 +++++++++----------
 app/models/university/person/alumnus.rb       | 71 +++++++++----------
 app/models/university/person/author.rb        | 71 +++++++++----------
 app/models/university/person/researcher.rb    | 71 +++++++++----------
 app/models/university/person/teacher.rb       | 71 +++++++++----------
 app/services/filters/server/websites.rb       | 11 +++
 app/views/admin/users/index.html.erb          |  6 +-
 app/views/server/websites/index.html.erb      |  6 +-
 ..._default_value_to_website_theme_version.rb |  6 ++
 db/schema.rb                                  | 21 +-----
 test/fixtures/communication/websites.yml      |  2 +-
 test/fixtures/university/people.yml           | 71 +++++++++----------
 22 files changed, 305 insertions(+), 290 deletions(-)
 create mode 100644 app/controllers/concerns/admin/filterable.rb
 create mode 100644 app/services/filters/server/websites.rb
 create mode 100644 db/migrate/20230210132818_add_default_value_to_website_theme_version.rb

diff --git a/app/controllers/admin/application_controller.rb b/app/controllers/admin/application_controller.rb
index edd21493e..44877c2ca 100644
--- a/app/controllers/admin/application_controller.rb
+++ b/app/controllers/admin/application_controller.rb
@@ -1,7 +1,7 @@
 class Admin::ApplicationController < ApplicationController
   layout 'admin/layouts/application'
 
-  before_action :load_filters, only: :index
+  include Admin::Filterable
 
   def set_theme
     current_user.update_column :admin_theme, params[:theme]
@@ -27,11 +27,5 @@ class Admin::ApplicationController < ApplicationController
                       : add_breadcrumb(t('create'))
   end
 
-  def load_filters
-    @filters = []
-    filter_class_name = "::Filters::#{self.class.to_s.gsub('Controller', '')}"
-    # filter_class will be nil if filter does not exist
-    filter_class = filter_class_name.safe_constantize
-    @filters = filter_class.new(current_user).list unless filter_class.nil?
-  end
+
 end
diff --git a/app/controllers/concerns/admin/filterable.rb b/app/controllers/concerns/admin/filterable.rb
new file mode 100644
index 000000000..db61a29a4
--- /dev/null
+++ b/app/controllers/concerns/admin/filterable.rb
@@ -0,0 +1,18 @@
+module Admin::Filterable
+  extend ActiveSupport::Concern
+
+  included do
+    before_action :load_filters, only: :index
+  end
+
+  protected
+
+  def load_filters
+    @filters = []
+    filter_class_name = "::Filters::#{self.class.to_s.gsub('Controller', '')}"
+    # filter_class will be nil if filter does not exist
+    filter_class = filter_class_name.safe_constantize
+    @filters = filter_class.new(current_user).list unless filter_class.nil?
+  end
+
+end
diff --git a/app/controllers/server/application_controller.rb b/app/controllers/server/application_controller.rb
index 3966163c2..15ed3b9a9 100644
--- a/app/controllers/server/application_controller.rb
+++ b/app/controllers/server/application_controller.rb
@@ -1,6 +1,8 @@
 class Server::ApplicationController < ApplicationController
   layout 'server/layouts/application'
 
+  include Admin::Filterable
+
   before_action :authenticate_user!, :ensure_user_if_server_admin
 
   protected
diff --git a/app/controllers/server/websites_controller.rb b/app/controllers/server/websites_controller.rb
index 775523bba..a318cc32a 100644
--- a/app/controllers/server/websites_controller.rb
+++ b/app/controllers/server/websites_controller.rb
@@ -1,7 +1,10 @@
 class Server::WebsitesController < Server::ApplicationController
 
+  has_scope :for_theme_version
+  has_scope :for_search_term
+
   def index
-    @websites = Communication::Website.all.ordered
+    @websites = apply_scopes(Communication::Website.all).ordered
     breadcrumb
     add_breadcrumb Communication::Website.model_name.human(count: 2), server_websites_path
   end
diff --git a/app/models/communication/website.rb b/app/models/communication/website.rb
index a750fc647..52a48b87f 100644
--- a/app/models/communication/website.rb
+++ b/app/models/communication/website.rb
@@ -14,7 +14,7 @@
 #  repository          :string
 #  style               :text
 #  style_updated_at    :date
-#  theme_version       :string
+#  theme_version       :string           default("NA")
 #  url                 :string
 #  created_at          :datetime         not null
 #  updated_at          :datetime         not null
@@ -66,6 +66,7 @@ class Communication::Website < ApplicationRecord
 
   scope :ordered, -> { order(:name) }
   scope :in_production, -> { where(in_production: true) }
+  scope :for_theme_version, -> (version) { where(theme_version: version) }
   scope :for_search_term, -> (term) {
     where("
       unaccent(communication_websites.name) ILIKE unaccent(:term) OR
diff --git a/app/models/communication/website/configs/default_languages.rb b/app/models/communication/website/configs/default_languages.rb
index 59fe81710..cd5602c6a 100644
--- a/app/models/communication/website/configs/default_languages.rb
+++ b/app/models/communication/website/configs/default_languages.rb
@@ -14,7 +14,7 @@
 #  repository          :string
 #  style               :text
 #  style_updated_at    :date
-#  theme_version       :string
+#  theme_version       :string           default("NA")
 #  url                 :string
 #  created_at          :datetime         not null
 #  updated_at          :datetime         not null
diff --git a/app/models/communication/website/configs/default_permalinks.rb b/app/models/communication/website/configs/default_permalinks.rb
index 287cc69e4..f3d35ca03 100644
--- a/app/models/communication/website/configs/default_permalinks.rb
+++ b/app/models/communication/website/configs/default_permalinks.rb
@@ -14,7 +14,7 @@
 #  repository          :string
 #  style               :text
 #  style_updated_at    :date
-#  theme_version       :string
+#  theme_version       :string           default("NA")
 #  url                 :string
 #  created_at          :datetime         not null
 #  updated_at          :datetime         not null
diff --git a/app/models/communication/website/configs/development_config.rb b/app/models/communication/website/configs/development_config.rb
index d3b15c0ec..e9f4d3e20 100644
--- a/app/models/communication/website/configs/development_config.rb
+++ b/app/models/communication/website/configs/development_config.rb
@@ -14,7 +14,7 @@
 #  repository          :string
 #  style               :text
 #  style_updated_at    :date
-#  theme_version       :string
+#  theme_version       :string           default("NA")
 #  url                 :string
 #  created_at          :datetime         not null
 #  updated_at          :datetime         not null
diff --git a/app/models/communication/website/configs/production_config.rb b/app/models/communication/website/configs/production_config.rb
index c6eb64a65..b9290cbe2 100644
--- a/app/models/communication/website/configs/production_config.rb
+++ b/app/models/communication/website/configs/production_config.rb
@@ -14,7 +14,7 @@
 #  repository          :string
 #  style               :text
 #  style_updated_at    :date
-#  theme_version       :string
+#  theme_version       :string           default("NA")
 #  url                 :string
 #  created_at          :datetime         not null
 #  updated_at          :datetime         not null
diff --git a/app/models/university/person.rb b/app/models/university/person.rb
index 5706c62d7..55a5bbfcb 100644
--- a/app/models/university/person.rb
+++ b/app/models/university/person.rb
@@ -2,42 +2,41 @@
 #
 # Table name: university_people
 #
-#  id                    :uuid             not null, primary key
-#  address               :string
-#  biography             :text
-#  birthdate             :date
-#  city                  :string
-#  country               :string
-#  email                 :string
-#  first_name            :string
-#  gender                :integer
-#  habilitation          :boolean          default(FALSE)
-#  hal_person_identifier :string
-#  is_administration     :boolean
-#  is_alumnus            :boolean          default(FALSE)
-#  is_author             :boolean
-#  is_researcher         :boolean
-#  is_teacher            :boolean
-#  last_name             :string
-#  linkedin              :string
-#  mastodon              :string
-#  meta_description      :text
-#  name                  :string
-#  phone_mobile          :string
-#  phone_personal        :string
-#  phone_professional    :string
-#  slug                  :string
-#  summary               :text
-#  tenure                :boolean          default(FALSE)
-#  twitter               :string
-#  url                   :string
-#  zipcode               :string
-#  created_at            :datetime         not null
-#  updated_at            :datetime         not null
-#  language_id           :uuid             not null, indexed
-#  original_id           :uuid             indexed
-#  university_id         :uuid             not null, indexed
-#  user_id               :uuid             indexed
+#  id                 :uuid             not null, primary key
+#  address            :string
+#  biography          :text
+#  birthdate          :date
+#  city               :string
+#  country            :string
+#  email              :string
+#  first_name         :string
+#  gender             :integer
+#  habilitation       :boolean          default(FALSE)
+#  is_administration  :boolean
+#  is_alumnus         :boolean          default(FALSE)
+#  is_author          :boolean
+#  is_researcher      :boolean
+#  is_teacher         :boolean
+#  last_name          :string
+#  linkedin           :string
+#  mastodon           :string
+#  meta_description   :text
+#  name               :string
+#  phone_mobile       :string
+#  phone_personal     :string
+#  phone_professional :string
+#  slug               :string
+#  summary            :text
+#  tenure             :boolean          default(FALSE)
+#  twitter            :string
+#  url                :string
+#  zipcode            :string
+#  created_at         :datetime         not null
+#  updated_at         :datetime         not null
+#  language_id        :uuid             not null, indexed
+#  original_id        :uuid             indexed
+#  university_id      :uuid             not null, indexed
+#  user_id            :uuid             indexed
 #
 # Indexes
 #
diff --git a/app/models/university/person/administrator.rb b/app/models/university/person/administrator.rb
index 14c3f802b..0e2fcd0e1 100644
--- a/app/models/university/person/administrator.rb
+++ b/app/models/university/person/administrator.rb
@@ -2,42 +2,41 @@
 #
 # Table name: university_people
 #
-#  id                    :uuid             not null, primary key
-#  address               :string
-#  biography             :text
-#  birthdate             :date
-#  city                  :string
-#  country               :string
-#  email                 :string
-#  first_name            :string
-#  gender                :integer
-#  habilitation          :boolean          default(FALSE)
-#  hal_person_identifier :string
-#  is_administration     :boolean
-#  is_alumnus            :boolean          default(FALSE)
-#  is_author             :boolean
-#  is_researcher         :boolean
-#  is_teacher            :boolean
-#  last_name             :string
-#  linkedin              :string
-#  mastodon              :string
-#  meta_description      :text
-#  name                  :string
-#  phone_mobile          :string
-#  phone_personal        :string
-#  phone_professional    :string
-#  slug                  :string
-#  summary               :text
-#  tenure                :boolean          default(FALSE)
-#  twitter               :string
-#  url                   :string
-#  zipcode               :string
-#  created_at            :datetime         not null
-#  updated_at            :datetime         not null
-#  language_id           :uuid             not null, indexed
-#  original_id           :uuid             indexed
-#  university_id         :uuid             not null, indexed
-#  user_id               :uuid             indexed
+#  id                 :uuid             not null, primary key
+#  address            :string
+#  biography          :text
+#  birthdate          :date
+#  city               :string
+#  country            :string
+#  email              :string
+#  first_name         :string
+#  gender             :integer
+#  habilitation       :boolean          default(FALSE)
+#  is_administration  :boolean
+#  is_alumnus         :boolean          default(FALSE)
+#  is_author          :boolean
+#  is_researcher      :boolean
+#  is_teacher         :boolean
+#  last_name          :string
+#  linkedin           :string
+#  mastodon           :string
+#  meta_description   :text
+#  name               :string
+#  phone_mobile       :string
+#  phone_personal     :string
+#  phone_professional :string
+#  slug               :string
+#  summary            :text
+#  tenure             :boolean          default(FALSE)
+#  twitter            :string
+#  url                :string
+#  zipcode            :string
+#  created_at         :datetime         not null
+#  updated_at         :datetime         not null
+#  language_id        :uuid             not null, indexed
+#  original_id        :uuid             indexed
+#  university_id      :uuid             not null, indexed
+#  user_id            :uuid             indexed
 #
 # Indexes
 #
diff --git a/app/models/university/person/alumnus.rb b/app/models/university/person/alumnus.rb
index 0208d188b..9d0679e92 100644
--- a/app/models/university/person/alumnus.rb
+++ b/app/models/university/person/alumnus.rb
@@ -2,42 +2,41 @@
 #
 # Table name: university_people
 #
-#  id                    :uuid             not null, primary key
-#  address               :string
-#  biography             :text
-#  birthdate             :date
-#  city                  :string
-#  country               :string
-#  email                 :string
-#  first_name            :string
-#  gender                :integer
-#  habilitation          :boolean          default(FALSE)
-#  hal_person_identifier :string
-#  is_administration     :boolean
-#  is_alumnus            :boolean          default(FALSE)
-#  is_author             :boolean
-#  is_researcher         :boolean
-#  is_teacher            :boolean
-#  last_name             :string
-#  linkedin              :string
-#  mastodon              :string
-#  meta_description      :text
-#  name                  :string
-#  phone_mobile          :string
-#  phone_personal        :string
-#  phone_professional    :string
-#  slug                  :string
-#  summary               :text
-#  tenure                :boolean          default(FALSE)
-#  twitter               :string
-#  url                   :string
-#  zipcode               :string
-#  created_at            :datetime         not null
-#  updated_at            :datetime         not null
-#  language_id           :uuid             not null, indexed
-#  original_id           :uuid             indexed
-#  university_id         :uuid             not null, indexed
-#  user_id               :uuid             indexed
+#  id                 :uuid             not null, primary key
+#  address            :string
+#  biography          :text
+#  birthdate          :date
+#  city               :string
+#  country            :string
+#  email              :string
+#  first_name         :string
+#  gender             :integer
+#  habilitation       :boolean          default(FALSE)
+#  is_administration  :boolean
+#  is_alumnus         :boolean          default(FALSE)
+#  is_author          :boolean
+#  is_researcher      :boolean
+#  is_teacher         :boolean
+#  last_name          :string
+#  linkedin           :string
+#  mastodon           :string
+#  meta_description   :text
+#  name               :string
+#  phone_mobile       :string
+#  phone_personal     :string
+#  phone_professional :string
+#  slug               :string
+#  summary            :text
+#  tenure             :boolean          default(FALSE)
+#  twitter            :string
+#  url                :string
+#  zipcode            :string
+#  created_at         :datetime         not null
+#  updated_at         :datetime         not null
+#  language_id        :uuid             not null, indexed
+#  original_id        :uuid             indexed
+#  university_id      :uuid             not null, indexed
+#  user_id            :uuid             indexed
 #
 # Indexes
 #
diff --git a/app/models/university/person/author.rb b/app/models/university/person/author.rb
index 496f29bab..a19bc5d64 100644
--- a/app/models/university/person/author.rb
+++ b/app/models/university/person/author.rb
@@ -2,42 +2,41 @@
 #
 # Table name: university_people
 #
-#  id                    :uuid             not null, primary key
-#  address               :string
-#  biography             :text
-#  birthdate             :date
-#  city                  :string
-#  country               :string
-#  email                 :string
-#  first_name            :string
-#  gender                :integer
-#  habilitation          :boolean          default(FALSE)
-#  hal_person_identifier :string
-#  is_administration     :boolean
-#  is_alumnus            :boolean          default(FALSE)
-#  is_author             :boolean
-#  is_researcher         :boolean
-#  is_teacher            :boolean
-#  last_name             :string
-#  linkedin              :string
-#  mastodon              :string
-#  meta_description      :text
-#  name                  :string
-#  phone_mobile          :string
-#  phone_personal        :string
-#  phone_professional    :string
-#  slug                  :string
-#  summary               :text
-#  tenure                :boolean          default(FALSE)
-#  twitter               :string
-#  url                   :string
-#  zipcode               :string
-#  created_at            :datetime         not null
-#  updated_at            :datetime         not null
-#  language_id           :uuid             not null, indexed
-#  original_id           :uuid             indexed
-#  university_id         :uuid             not null, indexed
-#  user_id               :uuid             indexed
+#  id                 :uuid             not null, primary key
+#  address            :string
+#  biography          :text
+#  birthdate          :date
+#  city               :string
+#  country            :string
+#  email              :string
+#  first_name         :string
+#  gender             :integer
+#  habilitation       :boolean          default(FALSE)
+#  is_administration  :boolean
+#  is_alumnus         :boolean          default(FALSE)
+#  is_author          :boolean
+#  is_researcher      :boolean
+#  is_teacher         :boolean
+#  last_name          :string
+#  linkedin           :string
+#  mastodon           :string
+#  meta_description   :text
+#  name               :string
+#  phone_mobile       :string
+#  phone_personal     :string
+#  phone_professional :string
+#  slug               :string
+#  summary            :text
+#  tenure             :boolean          default(FALSE)
+#  twitter            :string
+#  url                :string
+#  zipcode            :string
+#  created_at         :datetime         not null
+#  updated_at         :datetime         not null
+#  language_id        :uuid             not null, indexed
+#  original_id        :uuid             indexed
+#  university_id      :uuid             not null, indexed
+#  user_id            :uuid             indexed
 #
 # Indexes
 #
diff --git a/app/models/university/person/researcher.rb b/app/models/university/person/researcher.rb
index 72e633ff0..70847b670 100644
--- a/app/models/university/person/researcher.rb
+++ b/app/models/university/person/researcher.rb
@@ -2,42 +2,41 @@
 #
 # Table name: university_people
 #
-#  id                    :uuid             not null, primary key
-#  address               :string
-#  biography             :text
-#  birthdate             :date
-#  city                  :string
-#  country               :string
-#  email                 :string
-#  first_name            :string
-#  gender                :integer
-#  habilitation          :boolean          default(FALSE)
-#  hal_person_identifier :string
-#  is_administration     :boolean
-#  is_alumnus            :boolean          default(FALSE)
-#  is_author             :boolean
-#  is_researcher         :boolean
-#  is_teacher            :boolean
-#  last_name             :string
-#  linkedin              :string
-#  mastodon              :string
-#  meta_description      :text
-#  name                  :string
-#  phone_mobile          :string
-#  phone_personal        :string
-#  phone_professional    :string
-#  slug                  :string
-#  summary               :text
-#  tenure                :boolean          default(FALSE)
-#  twitter               :string
-#  url                   :string
-#  zipcode               :string
-#  created_at            :datetime         not null
-#  updated_at            :datetime         not null
-#  language_id           :uuid             not null, indexed
-#  original_id           :uuid             indexed
-#  university_id         :uuid             not null, indexed
-#  user_id               :uuid             indexed
+#  id                 :uuid             not null, primary key
+#  address            :string
+#  biography          :text
+#  birthdate          :date
+#  city               :string
+#  country            :string
+#  email              :string
+#  first_name         :string
+#  gender             :integer
+#  habilitation       :boolean          default(FALSE)
+#  is_administration  :boolean
+#  is_alumnus         :boolean          default(FALSE)
+#  is_author          :boolean
+#  is_researcher      :boolean
+#  is_teacher         :boolean
+#  last_name          :string
+#  linkedin           :string
+#  mastodon           :string
+#  meta_description   :text
+#  name               :string
+#  phone_mobile       :string
+#  phone_personal     :string
+#  phone_professional :string
+#  slug               :string
+#  summary            :text
+#  tenure             :boolean          default(FALSE)
+#  twitter            :string
+#  url                :string
+#  zipcode            :string
+#  created_at         :datetime         not null
+#  updated_at         :datetime         not null
+#  language_id        :uuid             not null, indexed
+#  original_id        :uuid             indexed
+#  university_id      :uuid             not null, indexed
+#  user_id            :uuid             indexed
 #
 # Indexes
 #
diff --git a/app/models/university/person/teacher.rb b/app/models/university/person/teacher.rb
index 00f430100..48cf9b6ad 100644
--- a/app/models/university/person/teacher.rb
+++ b/app/models/university/person/teacher.rb
@@ -2,42 +2,41 @@
 #
 # Table name: university_people
 #
-#  id                    :uuid             not null, primary key
-#  address               :string
-#  biography             :text
-#  birthdate             :date
-#  city                  :string
-#  country               :string
-#  email                 :string
-#  first_name            :string
-#  gender                :integer
-#  habilitation          :boolean          default(FALSE)
-#  hal_person_identifier :string
-#  is_administration     :boolean
-#  is_alumnus            :boolean          default(FALSE)
-#  is_author             :boolean
-#  is_researcher         :boolean
-#  is_teacher            :boolean
-#  last_name             :string
-#  linkedin              :string
-#  mastodon              :string
-#  meta_description      :text
-#  name                  :string
-#  phone_mobile          :string
-#  phone_personal        :string
-#  phone_professional    :string
-#  slug                  :string
-#  summary               :text
-#  tenure                :boolean          default(FALSE)
-#  twitter               :string
-#  url                   :string
-#  zipcode               :string
-#  created_at            :datetime         not null
-#  updated_at            :datetime         not null
-#  language_id           :uuid             not null, indexed
-#  original_id           :uuid             indexed
-#  university_id         :uuid             not null, indexed
-#  user_id               :uuid             indexed
+#  id                 :uuid             not null, primary key
+#  address            :string
+#  biography          :text
+#  birthdate          :date
+#  city               :string
+#  country            :string
+#  email              :string
+#  first_name         :string
+#  gender             :integer
+#  habilitation       :boolean          default(FALSE)
+#  is_administration  :boolean
+#  is_alumnus         :boolean          default(FALSE)
+#  is_author          :boolean
+#  is_researcher      :boolean
+#  is_teacher         :boolean
+#  last_name          :string
+#  linkedin           :string
+#  mastodon           :string
+#  meta_description   :text
+#  name               :string
+#  phone_mobile       :string
+#  phone_personal     :string
+#  phone_professional :string
+#  slug               :string
+#  summary            :text
+#  tenure             :boolean          default(FALSE)
+#  twitter            :string
+#  url                :string
+#  zipcode            :string
+#  created_at         :datetime         not null
+#  updated_at         :datetime         not null
+#  language_id        :uuid             not null, indexed
+#  original_id        :uuid             indexed
+#  university_id      :uuid             not null, indexed
+#  user_id            :uuid             indexed
 #
 # Indexes
 #
diff --git a/app/services/filters/server/websites.rb b/app/services/filters/server/websites.rb
new file mode 100644
index 000000000..b0ff06b06
--- /dev/null
+++ b/app/services/filters/server/websites.rb
@@ -0,0 +1,11 @@
+module Filters
+  class Server::Websites < Filters::Base
+    def initialize(user)
+      super
+      add_search
+      add :for_theme_version,
+          ::Communication::Website.all.pluck(:theme_version).uniq.sort,
+          'Filter par version du thème'
+    end
+  end
+end
diff --git a/app/views/admin/users/index.html.erb b/app/views/admin/users/index.html.erb
index ce585ca20..288e6602c 100644
--- a/app/views/admin/users/index.html.erb
+++ b/app/views/admin/users/index.html.erb
@@ -1,8 +1,8 @@
 <% content_for :title, "#{User.model_name.human(count: 2)} (#{@users.total_count})" %>
 
-<%= render 'admin/application/filters',
-    current_path: admin_users_path,
-    filters: @filters if @filters.any? %>
+<%= render  'admin/application/filters',
+            current_path: admin_users_path,
+            filters: @filters if @filters.any? %>
 
 <div class="table-responsive">
   <table class="<%= table_classes %>">
diff --git a/app/views/server/websites/index.html.erb b/app/views/server/websites/index.html.erb
index b3d4a09cc..32fd7c7a7 100644
--- a/app/views/server/websites/index.html.erb
+++ b/app/views/server/websites/index.html.erb
@@ -2,4 +2,8 @@
 
 <p><%= Communication::Website.in_production.count %> en production</p>
 
-<%= render 'server/websites/list', websites: @websites %>
\ No newline at end of file
+<%= render  'admin/application/filters',
+            current_path: server_websites_path,
+            filters: @filters if @filters.any? %>
+
+<%= render 'server/websites/list', websites: @websites %>
diff --git a/db/migrate/20230210132818_add_default_value_to_website_theme_version.rb b/db/migrate/20230210132818_add_default_value_to_website_theme_version.rb
new file mode 100644
index 000000000..e66bdb6c3
--- /dev/null
+++ b/db/migrate/20230210132818_add_default_value_to_website_theme_version.rb
@@ -0,0 +1,6 @@
+class AddDefaultValueToWebsiteThemeVersion < ActiveRecord::Migration[7.0]
+  def change
+    change_column_default :communication_websites, :theme_version, 'NA'
+    Communication::Website.where(theme_version: nil).update_all(theme_version: 'NA')
+  end
+end
diff --git a/db/schema.rb b/db/schema.rb
index aae0b24e6..c146ac356 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -10,7 +10,7 @@
 #
 # It's strongly recommended that you check this file into your version control system.
 
-ActiveRecord::Schema[7.0].define(version: 2023_02_03_135355) do
+ActiveRecord::Schema[7.0].define(version: 2023_02_10_132818) do
   # These are extensions that must be enabled in order to support this database
   enable_extension "pgcrypto"
   enable_extension "plpgsql"
@@ -397,7 +397,7 @@ ActiveRecord::Schema[7.0].define(version: 2023_02_03_135355) do
     t.string "git_branch"
     t.boolean "in_production", default: false
     t.uuid "default_language_id", null: false
-    t.string "theme_version"
+    t.string "theme_version", default: "NA"
     t.index ["about_type", "about_id"], name: "index_communication_websites_on_about"
     t.index ["default_language_id"], name: "index_communication_websites_on_default_language_id"
     t.index ["university_id"], name: "index_communication_websites_on_university_id"
@@ -577,20 +577,6 @@ ActiveRecord::Schema[7.0].define(version: 2023_02_03_135355) do
     t.string "summernote_locale"
   end
 
-  create_table "research_documents", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
-    t.uuid "university_id", null: false
-    t.uuid "university_person_id", null: false
-    t.string "docid"
-    t.jsonb "data"
-    t.string "title"
-    t.string "url"
-    t.string "ref"
-    t.datetime "created_at", null: false
-    t.datetime "updated_at", null: false
-    t.index ["university_id"], name: "index_research_documents_on_university_id"
-    t.index ["university_person_id"], name: "index_research_documents_on_university_person_id"
-  end
-
   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
@@ -796,7 +782,6 @@ ActiveRecord::Schema[7.0].define(version: 2023_02_03_135355) do
     t.string "zipcode"
     t.string "city"
     t.string "country"
-    t.string "hal_person_identifier"
     t.string "mastodon"
     t.uuid "language_id", null: false
     t.uuid "original_id"
@@ -954,8 +939,6 @@ ActiveRecord::Schema[7.0].define(version: 2023_02_03_135355) do
   add_foreign_key "education_schools", "universities"
   add_foreign_key "imports", "universities"
   add_foreign_key "imports", "users"
-  add_foreign_key "research_documents", "universities"
-  add_foreign_key "research_documents", "university_people"
   add_foreign_key "research_journal_paper_kinds", "research_journals", column: "journal_id"
   add_foreign_key "research_journal_paper_kinds", "universities"
   add_foreign_key "research_journal_papers", "research_journal_paper_kinds", column: "kind_id"
diff --git a/test/fixtures/communication/websites.yml b/test/fixtures/communication/websites.yml
index c88335243..8f739d38a 100644
--- a/test/fixtures/communication/websites.yml
+++ b/test/fixtures/communication/websites.yml
@@ -14,7 +14,7 @@
 #  repository          :string
 #  style               :text
 #  style_updated_at    :date
-#  theme_version       :string
+#  theme_version       :string           default("NA")
 #  url                 :string
 #  created_at          :datetime         not null
 #  updated_at          :datetime         not null
diff --git a/test/fixtures/university/people.yml b/test/fixtures/university/people.yml
index 4c0df963a..c8c32545e 100644
--- a/test/fixtures/university/people.yml
+++ b/test/fixtures/university/people.yml
@@ -2,42 +2,41 @@
 #
 # Table name: university_people
 #
-#  id                    :uuid             not null, primary key
-#  address               :string
-#  biography             :text
-#  birthdate             :date
-#  city                  :string
-#  country               :string
-#  email                 :string
-#  first_name            :string
-#  gender                :integer
-#  habilitation          :boolean          default(FALSE)
-#  hal_person_identifier :string
-#  is_administration     :boolean
-#  is_alumnus            :boolean          default(FALSE)
-#  is_author             :boolean
-#  is_researcher         :boolean
-#  is_teacher            :boolean
-#  last_name             :string
-#  linkedin              :string
-#  mastodon              :string
-#  meta_description      :text
-#  name                  :string
-#  phone_mobile          :string
-#  phone_personal        :string
-#  phone_professional    :string
-#  slug                  :string
-#  summary               :text
-#  tenure                :boolean          default(FALSE)
-#  twitter               :string
-#  url                   :string
-#  zipcode               :string
-#  created_at            :datetime         not null
-#  updated_at            :datetime         not null
-#  language_id           :uuid             not null, indexed
-#  original_id           :uuid             indexed
-#  university_id         :uuid             not null, indexed
-#  user_id               :uuid             indexed
+#  id                 :uuid             not null, primary key
+#  address            :string
+#  biography          :text
+#  birthdate          :date
+#  city               :string
+#  country            :string
+#  email              :string
+#  first_name         :string
+#  gender             :integer
+#  habilitation       :boolean          default(FALSE)
+#  is_administration  :boolean
+#  is_alumnus         :boolean          default(FALSE)
+#  is_author          :boolean
+#  is_researcher      :boolean
+#  is_teacher         :boolean
+#  last_name          :string
+#  linkedin           :string
+#  mastodon           :string
+#  meta_description   :text
+#  name               :string
+#  phone_mobile       :string
+#  phone_personal     :string
+#  phone_professional :string
+#  slug               :string
+#  summary            :text
+#  tenure             :boolean          default(FALSE)
+#  twitter            :string
+#  url                :string
+#  zipcode            :string
+#  created_at         :datetime         not null
+#  updated_at         :datetime         not null
+#  language_id        :uuid             not null, indexed
+#  original_id        :uuid             indexed
+#  university_id      :uuid             not null, indexed
+#  user_id            :uuid             indexed
 #
 # Indexes
 #
-- 
GitLab