diff --git a/app/controllers/admin/communication/websites_controller.rb b/app/controllers/admin/communication/websites_controller.rb index 731546ff8b6a9a84275a9c8c6413238530d769e4..ffdff0776096308f58e73c3975c52cc7a685a3eb 100644 --- a/app/controllers/admin/communication/websites_controller.rb +++ b/app/controllers/admin/communication/websites_controller.rb @@ -82,7 +82,7 @@ class Admin::Communication::WebsitesController < Admin::Communication::Applicati def website_params params.require(:communication_website).permit( :name, :url, :repository, :access_token, :about_type, :about_id, :in_production, - :git_provider, :git_endpoint, :git_branch, :plausible_url, language_ids: [] + :git_provider, :git_endpoint, :git_branch, :plausible_url, :default_language_id, language_ids: [] ) end end diff --git a/app/models/communication/website.rb b/app/models/communication/website.rb index 30298135c9fcc3d60a04280bdabfb42550e2f5c8..6139d6a521db9facdf853a0559b43c66cf94ddc7 100644 --- a/app/models/communication/website.rb +++ b/app/models/communication/website.rb @@ -2,31 +2,34 @@ # # Table name: communication_websites # -# id :uuid not null, primary key -# about_type :string indexed => [about_id] -# access_token :string -# git_branch :string -# git_endpoint :string -# git_provider :integer default("github") -# in_production :boolean default(FALSE) -# name :string -# plausible_url :string -# repository :string -# style :text -# style_updated_at :date -# url :string -# created_at :datetime not null -# updated_at :datetime not null -# about_id :uuid indexed => [about_type] -# university_id :uuid not null, indexed +# id :uuid not null, primary key +# about_type :string indexed => [about_id] +# access_token :string +# git_branch :string +# git_endpoint :string +# git_provider :integer default("github") +# in_production :boolean default(FALSE) +# name :string +# plausible_url :string +# repository :string +# style :text +# style_updated_at :date +# url :string +# created_at :datetime not null +# updated_at :datetime not null +# about_id :uuid indexed => [about_type] +# default_language_id :uuid indexed +# university_id :uuid not null, indexed # # Indexes # -# index_communication_websites_on_about (about_type,about_id) -# index_communication_websites_on_university_id (university_id) +# index_communication_websites_on_about (about_type,about_id) +# index_communication_websites_on_default_language_id (default_language_id) +# index_communication_websites_on_university_id (university_id) # # Foreign Keys # +# fk_rails_2b6d929310 (default_language_id => languages.id) # fk_rails_bb6a496c08 (university_id => universities.id) # class Communication::Website < ApplicationRecord @@ -49,6 +52,7 @@ class Communication::Website < ApplicationRecord gitlab: 1 } + belongs_to :default_language, class_name: "Language", optional: true has_and_belongs_to_many :languages, class_name: 'Language', join_table: 'communication_websites_languages', diff --git a/app/models/communication/website/configs/default_languages.rb b/app/models/communication/website/configs/default_languages.rb index 56f6c9865ff42b7c454c12ad0ee5f00b95a1c910..d3d27677962f78ee9f65e0a6cbd9ffbaed940df2 100644 --- a/app/models/communication/website/configs/default_languages.rb +++ b/app/models/communication/website/configs/default_languages.rb @@ -2,31 +2,34 @@ # # Table name: communication_websites # -# id :uuid not null, primary key -# about_type :string indexed => [about_id] -# access_token :string -# git_branch :string -# git_endpoint :string -# git_provider :integer default("github") -# in_production :boolean default(FALSE) -# name :string -# plausible_url :string -# repository :string -# style :text -# style_updated_at :date -# url :string -# created_at :datetime not null -# updated_at :datetime not null -# about_id :uuid indexed => [about_type] -# university_id :uuid not null, indexed +# id :uuid not null, primary key +# about_type :string indexed => [about_id] +# access_token :string +# git_branch :string +# git_endpoint :string +# git_provider :integer default("github") +# in_production :boolean default(FALSE) +# name :string +# plausible_url :string +# repository :string +# style :text +# style_updated_at :date +# url :string +# created_at :datetime not null +# updated_at :datetime not null +# about_id :uuid indexed => [about_type] +# default_language_id :uuid indexed +# university_id :uuid not null, indexed # # Indexes # -# index_communication_websites_on_about (about_type,about_id) -# index_communication_websites_on_university_id (university_id) +# index_communication_websites_on_about (about_type,about_id) +# index_communication_websites_on_default_language_id (default_language_id) +# index_communication_websites_on_university_id (university_id) # # Foreign Keys # +# fk_rails_2b6d929310 (default_language_id => languages.id) # fk_rails_bb6a496c08 (university_id => universities.id) # class Communication::Website::Configs::DefaultLanguages < Communication::Website diff --git a/app/models/communication/website/configs/default_permalinks.rb b/app/models/communication/website/configs/default_permalinks.rb index b028dd2b65b46dd2de15e783f299a650b56fdd2e..842de1d49d4f1b7144d7287de4f9e17efc4ed62c 100644 --- a/app/models/communication/website/configs/default_permalinks.rb +++ b/app/models/communication/website/configs/default_permalinks.rb @@ -2,31 +2,34 @@ # # Table name: communication_websites # -# id :uuid not null, primary key -# about_type :string indexed => [about_id] -# access_token :string -# git_branch :string -# git_endpoint :string -# git_provider :integer default("github") -# in_production :boolean default(FALSE) -# name :string -# plausible_url :string -# repository :string -# style :text -# style_updated_at :date -# url :string -# created_at :datetime not null -# updated_at :datetime not null -# about_id :uuid indexed => [about_type] -# university_id :uuid not null, indexed +# id :uuid not null, primary key +# about_type :string indexed => [about_id] +# access_token :string +# git_branch :string +# git_endpoint :string +# git_provider :integer default("github") +# in_production :boolean default(FALSE) +# name :string +# plausible_url :string +# repository :string +# style :text +# style_updated_at :date +# url :string +# created_at :datetime not null +# updated_at :datetime not null +# about_id :uuid indexed => [about_type] +# default_language_id :uuid indexed +# university_id :uuid not null, indexed # # Indexes # -# index_communication_websites_on_about (about_type,about_id) -# index_communication_websites_on_university_id (university_id) +# index_communication_websites_on_about (about_type,about_id) +# index_communication_websites_on_default_language_id (default_language_id) +# index_communication_websites_on_university_id (university_id) # # Foreign Keys # +# fk_rails_2b6d929310 (default_language_id => languages.id) # fk_rails_bb6a496c08 (university_id => universities.id) # class Communication::Website::Configs::DefaultPermalinks < Communication::Website diff --git a/app/models/communication/website/configs/development_config.rb b/app/models/communication/website/configs/development_config.rb index 5d5d9a8cb869d73ea6159c10b7eea307a6966278..3d9d48815c05fc28c0ff74085f4531d1bfb20bfa 100644 --- a/app/models/communication/website/configs/development_config.rb +++ b/app/models/communication/website/configs/development_config.rb @@ -2,31 +2,34 @@ # # Table name: communication_websites # -# id :uuid not null, primary key -# about_type :string indexed => [about_id] -# access_token :string -# git_branch :string -# git_endpoint :string -# git_provider :integer default("github") -# in_production :boolean default(FALSE) -# name :string -# plausible_url :string -# repository :string -# style :text -# style_updated_at :date -# url :string -# created_at :datetime not null -# updated_at :datetime not null -# about_id :uuid indexed => [about_type] -# university_id :uuid not null, indexed +# id :uuid not null, primary key +# about_type :string indexed => [about_id] +# access_token :string +# git_branch :string +# git_endpoint :string +# git_provider :integer default("github") +# in_production :boolean default(FALSE) +# name :string +# plausible_url :string +# repository :string +# style :text +# style_updated_at :date +# url :string +# created_at :datetime not null +# updated_at :datetime not null +# about_id :uuid indexed => [about_type] +# default_language_id :uuid indexed +# university_id :uuid not null, indexed # # Indexes # -# index_communication_websites_on_about (about_type,about_id) -# index_communication_websites_on_university_id (university_id) +# index_communication_websites_on_about (about_type,about_id) +# index_communication_websites_on_default_language_id (default_language_id) +# index_communication_websites_on_university_id (university_id) # # Foreign Keys # +# fk_rails_2b6d929310 (default_language_id => languages.id) # fk_rails_bb6a496c08 (university_id => universities.id) # class Communication::Website::Configs::DevelopmentConfig < Communication::Website diff --git a/app/models/communication/website/configs/production_config.rb b/app/models/communication/website/configs/production_config.rb index b5aff16217640f864b212a6af6c90837be4b3c09..f16360bd6b1efed75d11cc29e341e1b1e1998a6e 100644 --- a/app/models/communication/website/configs/production_config.rb +++ b/app/models/communication/website/configs/production_config.rb @@ -2,31 +2,34 @@ # # Table name: communication_websites # -# id :uuid not null, primary key -# about_type :string indexed => [about_id] -# access_token :string -# git_branch :string -# git_endpoint :string -# git_provider :integer default("github") -# in_production :boolean default(FALSE) -# name :string -# plausible_url :string -# repository :string -# style :text -# style_updated_at :date -# url :string -# created_at :datetime not null -# updated_at :datetime not null -# about_id :uuid indexed => [about_type] -# university_id :uuid not null, indexed +# id :uuid not null, primary key +# about_type :string indexed => [about_id] +# access_token :string +# git_branch :string +# git_endpoint :string +# git_provider :integer default("github") +# in_production :boolean default(FALSE) +# name :string +# plausible_url :string +# repository :string +# style :text +# style_updated_at :date +# url :string +# created_at :datetime not null +# updated_at :datetime not null +# about_id :uuid indexed => [about_type] +# default_language_id :uuid indexed +# university_id :uuid not null, indexed # # Indexes # -# index_communication_websites_on_about (about_type,about_id) -# index_communication_websites_on_university_id (university_id) +# index_communication_websites_on_about (about_type,about_id) +# index_communication_websites_on_default_language_id (default_language_id) +# index_communication_websites_on_university_id (university_id) # # Foreign Keys # +# fk_rails_2b6d929310 (default_language_id => languages.id) # fk_rails_bb6a496c08 (university_id => universities.id) # class Communication::Website::Configs::ProductionConfig < Communication::Website diff --git a/app/views/admin/communication/websites/_form.html.erb b/app/views/admin/communication/websites/_form.html.erb index 64f4e94841aabadb904dd2c0cd20fc2af4c664cc..30a3dcc406b453afbe3d1a9931cd2fb758fd61db 100644 --- a/app/views/admin/communication/websites/_form.html.erb +++ b/app/views/admin/communication/websites/_form.html.erb @@ -13,6 +13,7 @@ <%= f.input :url %> <%= render 'admin/communication/abouts', f: f, i18n_key: 'activerecord.attributes.communication/website.about_' %> <%= f.association :languages, as: :check_boxes %> + <%= f.association :default_language %> <%= f.input :in_production %> </div> </div> diff --git a/config/locales/communication/en.yml b/config/locales/communication/en.yml index f6742bb36ecad8c747c211329bfc9ca16a13cf28..5717243247c521f2b9905f743b8dc8754ee7b500 100644 --- a/config/locales/communication/en.yml +++ b/config/locales/communication/en.yml @@ -73,6 +73,7 @@ en: about_Research::Laboratory: Laboratory website about_type: About access_token: Access token + default_language: Default language git_branch: Git branch git_endpoint: Git endpoint git_provider: Git provider @@ -697,3 +698,6 @@ en: full_width: On large screens, a full width page uses all available space for the content. This is good for landing pages, or to make them spectacular. If the page is not full width, the content column will be smaller to make reading easier. The unused space might be used for a table of contents. communication_website_post: description: If this field is empty, the "lead text" field will be used. If also emty the main text's begining will be used. + include_blanks: + communication_website: + default_language: "Select a language" \ No newline at end of file diff --git a/config/locales/communication/fr.yml b/config/locales/communication/fr.yml index 6af324365cf4ca8b92e16c45809c9d22d5c10cb7..2e98a1652a5dc2c1e1f253cea1b0d5931db36064 100644 --- a/config/locales/communication/fr.yml +++ b/config/locales/communication/fr.yml @@ -73,6 +73,7 @@ fr: about_Research::Laboratory: Site de laboratoire about_type: Type de site access_token: Access token + default_language: Langue par défaut git_branch: Branche git_endpoint: Point d'accès Git git_provider: Provider Git @@ -438,7 +439,7 @@ fr: description: Une grille avec toutes les images à la même taille. list: label: Liste - description: Une liste d'articles avec de petites images à la même largeur. + description: Une liste d'articles avec de petites images à la même largeur. edit: add_post: Ajouter un article mode: @@ -697,3 +698,6 @@ fr: full_width: Sur de grands écrans, la page en pleine largeur utilisera tout l'espace disponible, ce qui est pertinent pour événementialiser une page. Si la page n'est pas en pleine largeur, l'espace dédié au contenu sera réduit pour faciliter la lecture, et l'espace libre pourra être utilisé pour une table des matières facilitant la navigation. communication_website_post: description: Si ce champ est vide le "chapô" sera utilisé. Si il est également vide le début du texte principal sera utilisé. + include_blanks: + communication_website: + default_language: "Sélectionnez une langue" \ No newline at end of file diff --git a/db/migrate/20221216152525_add_default_language_to_communication_websites.rb b/db/migrate/20221216152525_add_default_language_to_communication_websites.rb new file mode 100644 index 0000000000000000000000000000000000000000..7ce384483f982fc0b85167e1e7aded8a91827dc2 --- /dev/null +++ b/db/migrate/20221216152525_add_default_language_to_communication_websites.rb @@ -0,0 +1,14 @@ +class AddDefaultLanguageToCommunicationWebsites < ActiveRecord::Migration[7.0] + def up + add_reference :communication_websites, :default_language, null: true, foreign_key: { to_table: :languages }, type: :uuid + + Communication::Website.find_each do |website| + next if website.languages.none? + website.update_column :default_language_id, website.languages.first.id + end + end + + def down + remove_reference :communication_websites, :default_language + end +end diff --git a/db/schema.rb b/db/schema.rb index 3b9e215a0e5cebda09bbd8f4399b6dbf17a97770..13d83e59059588dd2c90b629c41b04c0dcb01431 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,13 +10,13 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[7.0].define(version: 2022_12_12_165617) do +ActiveRecord::Schema[7.0].define(version: 2022_12_16_152525) do # These are extensions that must be enabled in order to support this database enable_extension "pgcrypto" enable_extension "plpgsql" enable_extension "unaccent" - create_table "action_text_rich_texts", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| + create_table "action_text_rich_texts", id: :uuid, default: -> { "public.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: -> { "gen_random_uuid()" }, force: :cascade do |t| + create_table "active_storage_attachments", id: :uuid, default: -> { "public.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: -> { "gen_random_uuid()" }, force: :cascade do |t| + create_table "active_storage_blobs", id: :uuid, default: -> { "public.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: -> { "gen_random_uuid()" }, force: :cascade do |t| + create_table "active_storage_variant_records", id: :uuid, default: -> { "public.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: -> { "gen_random_uuid()" }, force: :cascade do |t| + create_table "administration_qualiopi_criterions", id: :uuid, default: -> { "public.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: -> { "gen_random_uuid()" }, force: :cascade do |t| + create_table "administration_qualiopi_indicators", id: :uuid, default: -> { "public.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: -> { "gen_random_uuid()" }, force: :cascade do |t| + create_table "communication_blocks", id: :uuid, default: -> { "public.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: -> { "gen_random_uuid()" }, force: :cascade do |t| + create_table "communication_extranets", id: :uuid, default: -> { "public.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: -> { "gen_random_uuid()" }, force: :cascade do |t| + create_table "communication_website_categories", id: :uuid, default: -> { "public.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: -> { "gen_random_uuid()" }, force: :cascade do |t| + create_table "communication_website_git_files", id: :uuid, default: -> { "public.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: -> { "gen_random_uuid()" }, force: :cascade do |t| + create_table "communication_website_imported_authors", id: :uuid, default: -> { "public.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: -> { "gen_random_uuid()" }, force: :cascade do |t| + create_table "communication_website_imported_categories", id: :uuid, default: -> { "public.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: -> { "gen_random_uuid()" }, force: :cascade do |t| + create_table "communication_website_imported_media", id: :uuid, default: -> { "public.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: -> { "gen_random_uuid()" }, force: :cascade do |t| + create_table "communication_website_imported_pages", id: :uuid, default: -> { "public.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: -> { "gen_random_uuid()" }, force: :cascade do |t| + create_table "communication_website_imported_posts", id: :uuid, default: -> { "public.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: -> { "gen_random_uuid()" }, force: :cascade do |t| + create_table "communication_website_imported_websites", id: :uuid, default: -> { "public.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: -> { "gen_random_uuid()" }, force: :cascade do |t| + create_table "communication_website_menu_items", id: :uuid, default: -> { "public.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: -> { "gen_random_uuid()" }, force: :cascade do |t| + create_table "communication_website_menus", id: :uuid, default: -> { "public.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: -> { "gen_random_uuid()" }, force: :cascade do |t| + create_table "communication_website_pages", id: :uuid, default: -> { "public.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: -> { "gen_random_uuid()" }, force: :cascade do |t| + create_table "communication_website_posts", id: :uuid, default: -> { "public.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: -> { "gen_random_uuid()" }, force: :cascade do |t| + create_table "communication_websites", id: :uuid, default: -> { "public.gen_random_uuid()" }, force: :cascade do |t| t.uuid "university_id", null: false t.string "name" t.string "url" @@ -382,7 +382,9 @@ ActiveRecord::Schema[7.0].define(version: 2022_12_12_165617) do t.string "plausible_url" t.string "git_branch" t.boolean "in_production", default: false + t.uuid "default_language_id" 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" end @@ -414,7 +416,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: -> { "gen_random_uuid()" }, force: :cascade do |t| + create_table "education_academic_years", id: :uuid, default: -> { "public.gen_random_uuid()" }, force: :cascade do |t| t.uuid "university_id", null: false t.integer "year" t.datetime "created_at", null: false @@ -429,7 +431,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: -> { "gen_random_uuid()" }, force: :cascade do |t| + create_table "education_cohorts", id: :uuid, default: -> { "public.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 +452,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: -> { "gen_random_uuid()" }, force: :cascade do |t| + create_table "education_diplomas", id: :uuid, default: -> { "public.gen_random_uuid()" }, force: :cascade do |t| t.string "name" t.string "short_name" t.integer "level", default: 0 @@ -464,7 +466,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: -> { "gen_random_uuid()" }, force: :cascade do |t| + create_table "education_programs", id: :uuid, default: -> { "public.gen_random_uuid()" }, force: :cascade do |t| t.uuid "university_id", null: false t.string "name" t.integer "capacity" @@ -524,7 +526,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: -> { "gen_random_uuid()" }, force: :cascade do |t| + create_table "education_schools", id: :uuid, default: -> { "public.gen_random_uuid()" }, force: :cascade do |t| t.uuid "university_id", null: false t.string "name" t.string "address" @@ -539,7 +541,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: -> { "gen_random_uuid()" }, force: :cascade do |t| + create_table "imports", id: :uuid, default: -> { "public.gen_random_uuid()" }, force: :cascade do |t| t.integer "number_of_lines" t.jsonb "processing_errors" t.integer "kind" @@ -552,14 +554,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: -> { "gen_random_uuid()" }, force: :cascade do |t| + create_table "languages", id: :uuid, default: -> { "public.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: -> { "gen_random_uuid()" }, force: :cascade do |t| + create_table "research_journal_papers", id: :uuid, default: -> { "public.gen_random_uuid()" }, force: :cascade do |t| t.string "title" t.datetime "published_at", precision: nil t.uuid "university_id", null: false @@ -589,7 +591,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: -> { "gen_random_uuid()" }, force: :cascade do |t| + create_table "research_journal_volumes", id: :uuid, default: -> { "public.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 +610,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: -> { "gen_random_uuid()" }, force: :cascade do |t| + create_table "research_journals", id: :uuid, default: -> { "public.gen_random_uuid()" }, force: :cascade do |t| t.uuid "university_id", null: false t.string "title" t.text "description" @@ -620,7 +622,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: -> { "gen_random_uuid()" }, force: :cascade do |t| + create_table "research_laboratories", id: :uuid, default: -> { "public.gen_random_uuid()" }, force: :cascade do |t| t.uuid "university_id", null: false t.string "name" t.string "address" @@ -632,7 +634,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: -> { "gen_random_uuid()" }, force: :cascade do |t| + create_table "research_laboratory_axes", id: :uuid, default: -> { "public.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 +648,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: -> { "gen_random_uuid()" }, force: :cascade do |t| + create_table "research_theses", id: :uuid, default: -> { "public.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 +666,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: -> { "gen_random_uuid()" }, force: :cascade do |t| + create_table "universities", id: :uuid, default: -> { "public.gen_random_uuid()" }, force: :cascade do |t| t.string "name" t.string "identifier" t.string "address" @@ -689,7 +691,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: -> { "gen_random_uuid()" }, force: :cascade do |t| + create_table "university_organizations", id: :uuid, default: -> { "public.gen_random_uuid()" }, force: :cascade do |t| t.uuid "university_id", null: false t.string "name" t.string "long_name" @@ -712,7 +714,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: -> { "gen_random_uuid()" }, force: :cascade do |t| + create_table "university_people", id: :uuid, default: -> { "public.gen_random_uuid()" }, force: :cascade do |t| t.uuid "university_id", null: false t.uuid "user_id" t.string "last_name" @@ -748,7 +750,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: -> { "gen_random_uuid()" }, force: :cascade do |t| + create_table "university_person_experiences", id: :uuid, default: -> { "public.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 +764,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: -> { "gen_random_uuid()" }, force: :cascade do |t| + create_table "university_person_involvements", id: :uuid, default: -> { "public.gen_random_uuid()" }, force: :cascade do |t| t.uuid "university_id", null: false t.uuid "person_id", null: false t.integer "kind" @@ -777,7 +779,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: -> { "gen_random_uuid()" }, force: :cascade do |t| + create_table "university_roles", id: :uuid, default: -> { "public.gen_random_uuid()" }, force: :cascade do |t| t.uuid "university_id", null: false t.string "target_type" t.uuid "target_id" @@ -789,7 +791,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: -> { "gen_random_uuid()" }, force: :cascade do |t| + create_table "users", id: :uuid, default: -> { "public.gen_random_uuid()" }, force: :cascade do |t| t.uuid "university_id", null: false t.string "first_name" t.string "last_name" @@ -877,6 +879,7 @@ ActiveRecord::Schema[7.0].define(version: 2022_12_12_165617) do add_foreign_key "communication_website_posts", "communication_websites" add_foreign_key "communication_website_posts", "universities" add_foreign_key "communication_website_posts", "university_people", column: "author_id" + add_foreign_key "communication_websites", "languages", column: "default_language_id" add_foreign_key "communication_websites", "universities" add_foreign_key "education_academic_years", "universities" add_foreign_key "education_cohorts", "education_academic_years", column: "academic_year_id" diff --git a/test/fixtures/communication/websites.yml b/test/fixtures/communication/websites.yml index a72ecbcf7dbf46b9c1cbaf45e61e852538f63d29..4b9fff274b838f934c6d579d822c1250060ca233 100644 --- a/test/fixtures/communication/websites.yml +++ b/test/fixtures/communication/websites.yml @@ -2,31 +2,34 @@ # # Table name: communication_websites # -# id :uuid not null, primary key -# about_type :string indexed => [about_id] -# access_token :string -# git_branch :string -# git_endpoint :string -# git_provider :integer default("github") -# in_production :boolean default(FALSE) -# name :string -# plausible_url :string -# repository :string -# style :text -# style_updated_at :date -# url :string -# created_at :datetime not null -# updated_at :datetime not null -# about_id :uuid indexed => [about_type] -# university_id :uuid not null, indexed +# id :uuid not null, primary key +# about_type :string indexed => [about_id] +# access_token :string +# git_branch :string +# git_endpoint :string +# git_provider :integer default("github") +# in_production :boolean default(FALSE) +# name :string +# plausible_url :string +# repository :string +# style :text +# style_updated_at :date +# url :string +# created_at :datetime not null +# updated_at :datetime not null +# about_id :uuid indexed => [about_type] +# default_language_id :uuid indexed +# university_id :uuid not null, indexed # # Indexes # -# index_communication_websites_on_about (about_type,about_id) -# index_communication_websites_on_university_id (university_id) +# index_communication_websites_on_about (about_type,about_id) +# index_communication_websites_on_default_language_id (default_language_id) +# index_communication_websites_on_university_id (university_id) # # Foreign Keys # +# fk_rails_2b6d929310 (default_language_id => languages.id) # fk_rails_bb6a496c08 (university_id => universities.id) # website_with_github: