spina-admin-conferences 1.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +101 -0
- data/Rakefile +40 -0
- data/app/assets/config/spina_admin_conferences_manifest.js +4 -0
- data/app/assets/javascripts/spina/admin/conferences/application.es6 +20 -0
- data/app/assets/javascripts/spina/admin/conferences/controllers/conference_events_form_controller.es6 +175 -0
- data/app/assets/javascripts/spina/admin/conferences/controllers/presentation_attachments_form_controller.es6 +175 -0
- data/app/assets/javascripts/spina/admin/conferences/controllers/select_options_controller.es6 +216 -0
- data/app/assets/stylesheets/spina/admin/conferences/application.sass +14 -0
- data/app/controllers/spina/admin/conferences/application_controller.rb +20 -0
- data/app/controllers/spina/admin/conferences/conferences_controller.rb +148 -0
- data/app/controllers/spina/admin/conferences/delegates_controller.rb +116 -0
- data/app/controllers/spina/admin/conferences/dietary_requirements_controller.rb +106 -0
- data/app/controllers/spina/admin/conferences/events_controller.rb +24 -0
- data/app/controllers/spina/admin/conferences/institutions_controller.rb +106 -0
- data/app/controllers/spina/admin/conferences/presentation_attachment_types_controller.rb +104 -0
- data/app/controllers/spina/admin/conferences/presentation_attachments_controller.rb +24 -0
- data/app/controllers/spina/admin/conferences/presentation_types_controller.rb +109 -0
- data/app/controllers/spina/admin/conferences/presentations_controller.rb +124 -0
- data/app/controllers/spina/admin/conferences/rooms_controller.rb +109 -0
- data/app/controllers/spina/admin/conferences/sessions_controller.rb +118 -0
- data/app/helpers/spina/admin/conferences/conferences_helper.rb +44 -0
- data/app/jobs/spina/admin/conferences/application_job.rb +11 -0
- data/app/jobs/spina/admin/conferences/delegate_import_job.rb +37 -0
- data/app/jobs/spina/admin/conferences/import_job.rb +26 -0
- data/app/jobs/spina/admin/conferences/presentation_import_job.rb +38 -0
- data/app/mailers/spina/admin/conferences/application_mailer.rb +13 -0
- data/app/models/spina/admin/conferences.rb +11 -0
- data/app/models/spina/admin/conferences/application_record.rb +14 -0
- data/app/models/spina/admin/conferences/conference.rb +152 -0
- data/app/models/spina/admin/conferences/date_part.rb +15 -0
- data/app/models/spina/admin/conferences/delegate.rb +89 -0
- data/app/models/spina/admin/conferences/dietary_requirement.rb +33 -0
- data/app/models/spina/admin/conferences/email_address_part.rb +21 -0
- data/app/models/spina/admin/conferences/event.rb +120 -0
- data/app/models/spina/admin/conferences/institution.rb +46 -0
- data/app/models/spina/admin/conferences/part.rb +20 -0
- data/app/models/spina/admin/conferences/presentation.rb +143 -0
- data/app/models/spina/admin/conferences/presentation_attachment.rb +27 -0
- data/app/models/spina/admin/conferences/presentation_attachment_type.rb +35 -0
- data/app/models/spina/admin/conferences/presentation_type.rb +60 -0
- data/app/models/spina/admin/conferences/room.rb +52 -0
- data/app/models/spina/admin/conferences/session.rb +56 -0
- data/app/models/spina/admin/conferences/time_part.rb +53 -0
- data/app/models/spina/admin/conferences/url_part.rb +21 -0
- data/app/validators/spina/admin/conferences/conference_date_validator.rb +20 -0
- data/app/validators/spina/admin/conferences/email_address_validator.rb +28 -0
- data/app/validators/spina/admin/conferences/finish_date_validator.rb +20 -0
- data/app/validators/spina/admin/conferences/finish_time_validator.rb +20 -0
- data/app/validators/spina/admin/conferences/http_url_validator.rb +28 -0
- data/app/views/layouts/spina/admin/conferences/conferences.html.haml +19 -0
- data/app/views/layouts/spina/admin/conferences/delegates.html.haml +10 -0
- data/app/views/layouts/spina/admin/conferences/dietary_requirements.html.haml +10 -0
- data/app/views/layouts/spina/admin/conferences/institutions.html.haml +17 -0
- data/app/views/layouts/spina/admin/conferences/presentation_attachment_types.html.haml +10 -0
- data/app/views/layouts/spina/admin/conferences/presentations.html.haml +10 -0
- data/app/views/spina/admin/conferences/application/_empty_list.html.haml +3 -0
- data/app/views/spina/admin/conferences/application/_errors.html.haml +11 -0
- data/app/views/spina/admin/conferences/application/_errors.js.erb +2 -0
- data/app/views/spina/admin/conferences/conferences/_conference.html.haml +9 -0
- data/app/views/spina/admin/conferences/conferences/_event_fields.html.haml +39 -0
- data/app/views/spina/admin/conferences/conferences/_event_row.html.haml +5 -0
- data/app/views/spina/admin/conferences/conferences/_form.html.haml +23 -0
- data/app/views/spina/admin/conferences/conferences/_form_conference_details.html.haml +29 -0
- data/app/views/spina/admin/conferences/conferences/_form_delegates.html.haml +12 -0
- data/app/views/spina/admin/conferences/conferences/_form_parts.html.haml +15 -0
- data/app/views/spina/admin/conferences/conferences/_form_presentation_types.html.haml +12 -0
- data/app/views/spina/admin/conferences/conferences/_form_presentations.html.haml +12 -0
- data/app/views/spina/admin/conferences/conferences/_form_rooms.html.haml +12 -0
- data/app/views/spina/admin/conferences/conferences/_form_structure.html.haml +19 -0
- data/app/views/spina/admin/conferences/conferences/_form_structure_item.html.haml +13 -0
- data/app/views/spina/admin/conferences/conferences/edit.html.haml +1 -0
- data/app/views/spina/admin/conferences/conferences/index.html.haml +18 -0
- data/app/views/spina/admin/conferences/conferences/new.html.haml +1 -0
- data/app/views/spina/admin/conferences/delegates/_delegate.html.haml +13 -0
- data/app/views/spina/admin/conferences/delegates/_form.html.haml +23 -0
- data/app/views/spina/admin/conferences/delegates/_form_conferences.html.haml +14 -0
- data/app/views/spina/admin/conferences/delegates/_form_delegate_details.html.haml +38 -0
- data/app/views/spina/admin/conferences/delegates/_form_presentations.html.haml +12 -0
- data/app/views/spina/admin/conferences/delegates/edit.html.haml +1 -0
- data/app/views/spina/admin/conferences/delegates/index.html.haml +23 -0
- data/app/views/spina/admin/conferences/delegates/new.html.haml +1 -0
- data/app/views/spina/admin/conferences/dietary_requirements/_dietary_requirement.html.haml +6 -0
- data/app/views/spina/admin/conferences/dietary_requirements/_form.html.haml +23 -0
- data/app/views/spina/admin/conferences/dietary_requirements/_form_delegates.html.haml +12 -0
- data/app/views/spina/admin/conferences/dietary_requirements/_form_dietary_requirement_details.html.haml +9 -0
- data/app/views/spina/admin/conferences/dietary_requirements/edit.html.haml +1 -0
- data/app/views/spina/admin/conferences/dietary_requirements/index.html.haml +15 -0
- data/app/views/spina/admin/conferences/dietary_requirements/new.html.haml +1 -0
- data/app/views/spina/admin/conferences/events/new.js.erb +27 -0
- data/app/views/spina/admin/conferences/institutions/_form.html.haml +23 -0
- data/app/views/spina/admin/conferences/institutions/_form_delegates.html.haml +12 -0
- data/app/views/spina/admin/conferences/institutions/_form_institution_details.html.haml +35 -0
- data/app/views/spina/admin/conferences/institutions/_form_rooms.html.haml +12 -0
- data/app/views/spina/admin/conferences/institutions/_institution.html.haml +7 -0
- data/app/views/spina/admin/conferences/institutions/edit.html.haml +1 -0
- data/app/views/spina/admin/conferences/institutions/index.html.haml +16 -0
- data/app/views/spina/admin/conferences/institutions/new.html.haml +1 -0
- data/app/views/spina/admin/conferences/presentation_attachment_types/_form.html.haml +23 -0
- data/app/views/spina/admin/conferences/presentation_attachment_types/_presentation_attachment_type.html.haml +6 -0
- data/app/views/spina/admin/conferences/presentation_attachment_types/edit.html.haml +1 -0
- data/app/views/spina/admin/conferences/presentation_attachment_types/index.html.haml +15 -0
- data/app/views/spina/admin/conferences/presentation_attachment_types/new.html.haml +1 -0
- data/app/views/spina/admin/conferences/presentation_attachments/new.js.erb +21 -0
- data/app/views/spina/admin/conferences/presentation_types/_form.html.haml +23 -0
- data/app/views/spina/admin/conferences/presentation_types/_form_presentation_type_details.html.haml +20 -0
- data/app/views/spina/admin/conferences/presentation_types/_form_presentations.html.haml +12 -0
- data/app/views/spina/admin/conferences/presentation_types/_form_sessions.html.haml +12 -0
- data/app/views/spina/admin/conferences/presentation_types/_presentation_type.html.haml +8 -0
- data/app/views/spina/admin/conferences/presentation_types/edit.html.haml +1 -0
- data/app/views/spina/admin/conferences/presentation_types/index.html.haml +17 -0
- data/app/views/spina/admin/conferences/presentation_types/new.html.haml +1 -0
- data/app/views/spina/admin/conferences/presentations/_attachment_fields.html.haml +27 -0
- data/app/views/spina/admin/conferences/presentations/_attachment_row.html.haml +2 -0
- data/app/views/spina/admin/conferences/presentations/_form.html.haml +23 -0
- data/app/views/spina/admin/conferences/presentations/_form_presentation_details.html.haml +55 -0
- data/app/views/spina/admin/conferences/presentations/_form_presenters.html.haml +12 -0
- data/app/views/spina/admin/conferences/presentations/_presentation.html.haml +11 -0
- data/app/views/spina/admin/conferences/presentations/edit.html.haml +1 -0
- data/app/views/spina/admin/conferences/presentations/index.html.haml +23 -0
- data/app/views/spina/admin/conferences/presentations/new.html.haml +1 -0
- data/app/views/spina/admin/conferences/rooms/_form.html.haml +23 -0
- data/app/views/spina/admin/conferences/rooms/_form_presentations.html.haml +12 -0
- data/app/views/spina/admin/conferences/rooms/_form_room_details.html.haml +18 -0
- data/app/views/spina/admin/conferences/rooms/_room.html.haml +8 -0
- data/app/views/spina/admin/conferences/rooms/edit.html.haml +1 -0
- data/app/views/spina/admin/conferences/rooms/index.html.haml +17 -0
- data/app/views/spina/admin/conferences/rooms/new.html.haml +1 -0
- data/app/views/spina/admin/conferences/sessions/_form.html.haml +23 -0
- data/app/views/spina/admin/conferences/sessions/_form_presentations.html.haml +12 -0
- data/app/views/spina/admin/conferences/sessions/_form_session_details.html.haml +23 -0
- data/app/views/spina/admin/conferences/sessions/_session.html.haml +8 -0
- data/app/views/spina/admin/conferences/sessions/edit.html.haml +1 -0
- data/app/views/spina/admin/conferences/sessions/index.html.haml +17 -0
- data/app/views/spina/admin/conferences/sessions/new.html.haml +1 -0
- data/app/views/spina/admin/hooks/conferences/_head.html.haml +2 -0
- data/app/views/spina/admin/hooks/conferences/_primary_navigation.html.haml +20 -0
- data/app/views/spina/admin/hooks/conferences/_settings_secondary_navigation.html.haml +4 -0
- data/app/views/spina/admin/partables/admin/conferences/date_parts/_form.html.haml +5 -0
- data/app/views/spina/admin/partables/admin/conferences/email_address_parts/_form.html.haml +5 -0
- data/app/views/spina/admin/partables/admin/conferences/time_parts/_form.html.haml +7 -0
- data/app/views/spina/admin/partables/admin/conferences/url_parts/_form.html.haml +5 -0
- data/config/initializers/assets.rb +13 -0
- data/config/initializers/types.rb +13 -0
- data/config/locales/en.yml +354 -0
- data/config/routes.rb +27 -0
- data/db/migrate/20180907141228_create_spina_dates.rb +11 -0
- data/db/migrate/20180907141229_create_spina_email_addresses.rb +11 -0
- data/db/migrate/20180907141230_create_spina_urls.rb +11 -0
- data/db/migrate/20180907141231_create_spina_conferences_institutions.rb +12 -0
- data/db/migrate/20180907141232_create_spina_conferences_delegates.rb +15 -0
- data/db/migrate/20180907141234_create_spina_conferences_dietary_requirements.rb +11 -0
- data/db/migrate/20180907141235_create_spina_conferences_conferences.rb +12 -0
- data/db/migrate/20180907141236_create_spina_conferences_presentation_types.rb +13 -0
- data/db/migrate/20180907141238_create_join_table_spina_conferences_conference_delegate.rb +7 -0
- data/db/migrate/20180907141239_create_join_table_spina_conferences_delegate_presentation.rb +7 -0
- data/db/migrate/20180907141240_create_join_table_spina_conferences_delegate_dietary_requirement.rb +7 -0
- data/db/migrate/20180907141242_add_type_to_spina_pages.rb +7 -0
- data/db/migrate/20180907141243_create_spina_conferences_conference_page_parts.rb +14 -0
- data/db/migrate/20180914121905_add_logo_ref_to_spina_conferences_institutions.rb +7 -0
- data/db/migrate/20180916135431_create_spina_conferences_rooms.rb +13 -0
- data/db/migrate/20180916135432_create_spina_conferences_room_possessions.rb +10 -0
- data/db/migrate/20180916135433_create_spina_conferences_room_uses.rb +10 -0
- data/db/migrate/20180916135434_create_spina_conferences_presentations.rb +15 -0
- data/db/migrate/20181009122503_create_spina_times.rb +11 -0
- data/db/migrate/20181009130631_rename_spina_page_parts.rb +10 -0
- data/db/migrate/20181012190811_rename_spina_conferences_page_parts.rb +10 -0
- data/db/migrate/20181012213049_change_start_time_in_spina_conferences_conferences.rb +15 -0
- data/db/migrate/20181012214813_rename_start_time_in_spina_conferences_conferences.rb +7 -0
- data/db/migrate/20181017155705_add_dependent_option_to_foreign_keys.rb +36 -0
- data/db/migrate/20190408131354_change_spina_resources.rb +56 -0
- data/db/migrate/20190622131423_create_spina_conferences_parts.rb +12 -0
- data/db/migrate/20190701174807_remove_spina_conference_pages.rb +199 -0
- data/db/migrate/20190704135524_add_constraints_to_columns.rb +24 -0
- data/db/migrate/20200126034441_create_spina_conferences_presentation_attachment_types.rb +11 -0
- data/db/migrate/20200126213718_create_spina_conferences_presentation_attachments.rb +19 -0
- data/db/migrate/20200420104603_create_spina_conferences_dietary_requirement_name_translations.rb +19 -0
- data/db/migrate/20200420104740_create_spina_conferences_institution_name_and_city_translations.rb +20 -0
- data/db/migrate/20200420105057_create_spina_conferences_presentation_title_and_abstract_translations.rb +20 -0
- data/db/migrate/20200420105144_create_spina_conferences_presentation_attachment_type_name_translations.rb +20 -0
- data/db/migrate/20200420105201_create_spina_conferences_presentation_type_name_translations.rb +19 -0
- data/db/migrate/20200420105458_create_spina_conferences_room_building_and_number_translations.rb +20 -0
- data/db/migrate/20200420110407_move_attributes_to_translation_tables.rb +161 -0
- data/db/migrate/20200420120706_remove_name_from_spina_conferences_dietary_requirements.rb +7 -0
- data/db/migrate/20200420120759_remove_name_and_city_from_spina_conferences_institutions.rb +8 -0
- data/db/migrate/20200420120946_remove_title_and_abstract_from_spina_conferences_presentations.rb +8 -0
- data/db/migrate/20200420121310_remove_name_from_spina_conferences_presentation_attachment_types.rb +7 -0
- data/db/migrate/20200420121321_remove_name_from_spina_conferences_presentation_types.rb +7 -0
- data/db/migrate/20200420121443_remove_building_and_number_from_spina_conferences_rooms.rb +8 -0
- data/db/migrate/20200502133408_create_spina_conferences_conference_name_translations.rb +19 -0
- data/db/migrate/20200502183409_set_name_for_spina_conferences_conferences.rb +47 -0
- data/db/migrate/20200502183410_remove_institution_from_spina_conferences_conferences.rb +8 -0
- data/db/migrate/20200502183719_remove_spina_conferences_room_possessions.rb +60 -0
- data/db/migrate/20200503230732_rename_spina_conferences_room_uses.rb +8 -0
- data/db/migrate/20200510125131_create_spina_conferences_session_name_translations.rb +19 -0
- data/db/migrate/20200802165242_create_spina_conferences_events.rb +13 -0
- data/db/migrate/20200802184921_create_spina_conferences_event_name_description_and_location_translations.rb +21 -0
- data/db/migrate/20200911161632_update_spina_conferences_parts.rb +23 -0
- data/db/migrate/20200911161651_update_spina_parts.rb +37 -0
- data/db/migrate/20200911161726_move_presentation_parts.rb +101 -0
- data/db/migrate/20200911161739_move_conference_parts.rb +219 -0
- data/db/migrate/20201002122517_remove_spina_conferences_conference_page_parts.rb +14 -0
- data/db/migrate/20201007125625_add_timestamps_to_spina_conferences_parts.rb +9 -0
- data/lib/spina/admin/conferences.rb +20 -0
- data/lib/spina/admin/conferences/engine.rb +26 -0
- data/lib/spina/admin/conferences/migration/renaming.rb +81 -0
- data/lib/spina/admin/conferences/railtie.rb +34 -0
- data/lib/spina/admin/conferences/types/interval_type.rb +29 -0
- data/lib/spina/admin/conferences/version.rb +10 -0
- data/lib/tasks/spina/admin/conferences_tasks.rake +4 -0
- metadata +561 -0
data/config/routes.rb
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
Spina::Engine.routes.draw do
|
|
4
|
+
namespace :admin, path: Spina.config.backend_path do
|
|
5
|
+
namespace :conferences do
|
|
6
|
+
root to: 'conferences#index'
|
|
7
|
+
resources :conferences, except: [:show] do
|
|
8
|
+
resources :events, only: [:new]
|
|
9
|
+
end
|
|
10
|
+
resources :events, only: [:new]
|
|
11
|
+
resources :institutions, except: [:show]
|
|
12
|
+
resources :rooms, except: [:show]
|
|
13
|
+
resources :sessions, except: [:show]
|
|
14
|
+
resources :delegates, except: [:show] do
|
|
15
|
+
post :import, on: :collection
|
|
16
|
+
end
|
|
17
|
+
resources :presentations, except: [:show] do
|
|
18
|
+
post :import, on: :collection
|
|
19
|
+
resources :presentation_attachments, only: [:new]
|
|
20
|
+
end
|
|
21
|
+
resources :presentation_attachments, only: [:new]
|
|
22
|
+
resources :presentation_types, except: [:show]
|
|
23
|
+
resources :dietary_requirements, except: [:show]
|
|
24
|
+
resources :presentation_attachment_types, except: [:show]
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
class CreateSpinaConferencesInstitutions < ActiveRecord::Migration[5.2] # :nodoc:
|
|
4
|
+
def change
|
|
5
|
+
create_table :spina_conferences_institutions do |t|
|
|
6
|
+
t.string :name
|
|
7
|
+
t.string :city
|
|
8
|
+
|
|
9
|
+
t.timestamps null: false
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
class CreateSpinaConferencesDelegates < ActiveRecord::Migration[5.2] # :nodoc:
|
|
4
|
+
def change
|
|
5
|
+
create_table :spina_conferences_delegates do |t|
|
|
6
|
+
t.string :first_name
|
|
7
|
+
t.string :last_name
|
|
8
|
+
t.string :email_address
|
|
9
|
+
t.string :url
|
|
10
|
+
t.references :institution, foreign_key: { to_table: :spina_conferences_institutions }
|
|
11
|
+
|
|
12
|
+
t.timestamps null: false
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
class CreateSpinaConferencesDietaryRequirements < ActiveRecord::Migration[5.2] # :nodoc:
|
|
4
|
+
def change
|
|
5
|
+
create_table :spina_conferences_dietary_requirements do |t|
|
|
6
|
+
t.string :name
|
|
7
|
+
|
|
8
|
+
t.timestamps null: false
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
end
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
class CreateSpinaConferencesConferences < ActiveRecord::Migration[5.2] # :nodoc:
|
|
4
|
+
def change
|
|
5
|
+
create_table :spina_conferences_conferences do |t|
|
|
6
|
+
t.daterange :dates
|
|
7
|
+
t.references :institution, foreign_key: { to_table: :spina_conferences_institutions }
|
|
8
|
+
|
|
9
|
+
t.timestamps null: false
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
class CreateSpinaConferencesPresentationTypes < ActiveRecord::Migration[5.2] # :nodoc:
|
|
4
|
+
def change
|
|
5
|
+
create_table :spina_conferences_presentation_types do |t|
|
|
6
|
+
t.string :name
|
|
7
|
+
t.interval :duration
|
|
8
|
+
t.references :conference, foreign_key: { to_table: :spina_conferences_conferences }
|
|
9
|
+
|
|
10
|
+
t.timestamps null: false
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
class CreateSpinaConferencesConferencePageParts < ActiveRecord::Migration[5.2] #:nodoc:
|
|
4
|
+
def change
|
|
5
|
+
create_table :spina_conferences_conference_page_parts do |t|
|
|
6
|
+
t.belongs_to :conference_page, foreign_key: { to_table: :spina_pages, on_delete: :cascade },
|
|
7
|
+
index: { name: 'index_spina_conferences_parts_on_page_id' }
|
|
8
|
+
t.belongs_to :conference_page_partable, polymorphic: true,
|
|
9
|
+
index: { name: 'index_spina_conferences_parts_on_partable_type_and_partable_id' }
|
|
10
|
+
|
|
11
|
+
t.timestamps
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
class CreateSpinaConferencesRooms < ActiveRecord::Migration[5.2] # :nodoc:
|
|
4
|
+
def change
|
|
5
|
+
create_table :spina_conferences_rooms do |t|
|
|
6
|
+
t.string :number
|
|
7
|
+
t.string :building
|
|
8
|
+
t.references :institution, foreign_key: { to_table: :spina_conferences_institutions }
|
|
9
|
+
|
|
10
|
+
t.timestamps null: false
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
class CreateSpinaConferencesRoomPossessions < ActiveRecord::Migration[5.2] # :nodoc:
|
|
4
|
+
def change
|
|
5
|
+
create_table :spina_conferences_room_possessions do |t| # rubocop:disable Rails/CreateTableWithTimestamps
|
|
6
|
+
t.references :room, foreign_key: { to_table: :spina_conferences_rooms }
|
|
7
|
+
t.references :conference, foreign_key: { to_table: :spina_conferences_conferences }
|
|
8
|
+
end
|
|
9
|
+
end
|
|
10
|
+
end
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
class CreateSpinaConferencesRoomUses < ActiveRecord::Migration[5.2] # :nodoc:
|
|
4
|
+
def change
|
|
5
|
+
create_table :spina_conferences_room_uses do |t| # rubocop:disable Rails/CreateTableWithTimestamps
|
|
6
|
+
t.references :room_possession, foreign_key: { to_table: :spina_conferences_room_possessions }
|
|
7
|
+
t.references :presentation_type, foreign_key: { to_table: :spina_conferences_presentation_types }
|
|
8
|
+
end
|
|
9
|
+
end
|
|
10
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
class CreateSpinaConferencesPresentations < ActiveRecord::Migration[5.2] # :nodoc:
|
|
4
|
+
def change
|
|
5
|
+
create_table :spina_conferences_presentations do |t|
|
|
6
|
+
t.string :title
|
|
7
|
+
t.date :date
|
|
8
|
+
t.time :start_time
|
|
9
|
+
t.text :abstract
|
|
10
|
+
t.references :room_use, foreign_key: { to_table: :spina_conferences_room_uses }
|
|
11
|
+
|
|
12
|
+
t.timestamps null: false
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
class RenameSpinaPageParts < ActiveRecord::Migration[5.2] # :nodoc:
|
|
4
|
+
def change
|
|
5
|
+
rename_table 'spina_dates', 'spina_conferences_dates'
|
|
6
|
+
rename_table 'spina_email_addresses', 'spina_conferences_email_addresses'
|
|
7
|
+
rename_table 'spina_urls', 'spina_conferences_urls'
|
|
8
|
+
rename_table 'spina_times', 'spina_conferences_times'
|
|
9
|
+
end
|
|
10
|
+
end
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
class RenameSpinaConferencesPageParts < ActiveRecord::Migration[5.2] # :nodoc:
|
|
4
|
+
def change
|
|
5
|
+
rename_table 'spina_conferences_dates', 'spina_conferences_date_parts'
|
|
6
|
+
rename_table 'spina_conferences_email_addresses', 'spina_conferences_email_address_parts'
|
|
7
|
+
rename_table 'spina_conferences_urls', 'spina_conferences_url_parts'
|
|
8
|
+
rename_table 'spina_conferences_times', 'spina_conferences_time_parts'
|
|
9
|
+
end
|
|
10
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
class ChangeStartTimeInSpinaConferencesConferences < ActiveRecord::Migration[5.2] # :nodoc:
|
|
4
|
+
def up
|
|
5
|
+
remove_column :spina_conferences_presentations, :date
|
|
6
|
+
remove_column :spina_conferences_presentations, :start_time
|
|
7
|
+
add_column :spina_conferences_presentations, :start_time, :datetime
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def down
|
|
11
|
+
remove_column :spina_conferences_presentations, :start_time
|
|
12
|
+
add_column :spina_conferences_presentations, :date, :date
|
|
13
|
+
add_column :spina_conferences_presentations, :start_time, :time
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
class AddDependentOptionToForeignKeys < ActiveRecord::Migration[5.2] # :nodoc:
|
|
4
|
+
def change # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
|
|
5
|
+
remove_foreign_key :spina_conferences_delegates, :spina_conferences_institutions, column: :institution_id
|
|
6
|
+
remove_foreign_key :spina_conferences_presentations, :spina_conferences_room_uses, column: :room_use_id
|
|
7
|
+
remove_foreign_key :spina_conferences_room_uses, :spina_conferences_room_possessions, column: :room_possession_id
|
|
8
|
+
remove_foreign_key :spina_conferences_room_uses, :spina_conferences_presentation_types, column: :presentation_type_id
|
|
9
|
+
remove_foreign_key :spina_conferences_room_possessions, :spina_conferences_rooms, column: :room_id
|
|
10
|
+
remove_foreign_key :spina_conferences_room_possessions, :spina_conferences_conferences, column: :conference_id
|
|
11
|
+
remove_foreign_key :spina_conferences_rooms, :spina_conferences_institutions, column: :institution_id
|
|
12
|
+
remove_foreign_key :spina_conferences_institutions, :spina_images, column: :logo_id
|
|
13
|
+
remove_foreign_key :spina_conferences_presentation_types, :spina_conferences_conferences, column: :conference_id
|
|
14
|
+
remove_foreign_key :spina_conferences_conferences, :spina_conferences_institutions, column: :institution_id
|
|
15
|
+
add_foreign_key :spina_conferences_delegates, :spina_conferences_institutions,
|
|
16
|
+
column: :institution_id, on_delete: :cascade
|
|
17
|
+
add_foreign_key :spina_conferences_presentations, :spina_conferences_room_uses,
|
|
18
|
+
column: :room_use_id, on_delete: :cascade
|
|
19
|
+
add_foreign_key :spina_conferences_room_uses, :spina_conferences_room_possessions,
|
|
20
|
+
column: :room_possession_id, on_delete: :cascade
|
|
21
|
+
add_foreign_key :spina_conferences_room_uses, :spina_conferences_presentation_types,
|
|
22
|
+
column: :presentation_type_id, on_delete: :cascade
|
|
23
|
+
add_foreign_key :spina_conferences_room_possessions, :spina_conferences_rooms,
|
|
24
|
+
column: :room_id, on_delete: :cascade
|
|
25
|
+
add_foreign_key :spina_conferences_room_possessions, :spina_conferences_conferences,
|
|
26
|
+
column: :conference_id, on_delete: :cascade
|
|
27
|
+
add_foreign_key :spina_conferences_rooms, :spina_conferences_institutions,
|
|
28
|
+
column: :institution_id, on_delete: :cascade
|
|
29
|
+
add_foreign_key :spina_conferences_institutions, :spina_images, column: :logo_id,
|
|
30
|
+
on_delete: :cascade
|
|
31
|
+
add_foreign_key :spina_conferences_presentation_types, :spina_conferences_conferences,
|
|
32
|
+
column: :conference_id, on_delete: :cascade
|
|
33
|
+
add_foreign_key :spina_conferences_conferences, :spina_conferences_institutions,
|
|
34
|
+
column: :institution_id, on_delete: :cascade
|
|
35
|
+
end
|
|
36
|
+
end
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
class ChangeSpinaResources < ActiveRecord::Migration[6.0] #:nodoc:
|
|
4
|
+
def up
|
|
5
|
+
insert <<-SQL, 'Insert conference pages resource if missing'
|
|
6
|
+
INSERT INTO spina_resources (name, label, created_at, updated_at)
|
|
7
|
+
SELECT 'conference_pages', 'Conference pages', current_timestamp, current_timestamp
|
|
8
|
+
WHERE NOT EXISTS (SELECT name FROM spina_resources WHERE name = 'conference_pages')
|
|
9
|
+
SQL
|
|
10
|
+
update <<-SQL, 'Update conference conference pages'
|
|
11
|
+
WITH resources AS (SELECT id FROM spina_resources WHERE name = 'conference_pages' LIMIT 1)
|
|
12
|
+
UPDATE spina_pages SET ancestry = null, resource_id = resources.id
|
|
13
|
+
FROM spina_conferences_conference_page_parts, resources
|
|
14
|
+
WHERE conference_page_id = spina_pages.id AND conference_page_partable_type = 'Spina::Conferences::Conference'
|
|
15
|
+
SQL
|
|
16
|
+
update <<-SQL, 'Update presentation conference pages'
|
|
17
|
+
WITH resources AS (SELECT id FROM spina_resources WHERE name = 'conference_pages' LIMIT 1)
|
|
18
|
+
UPDATE spina_pages SET resource_id = resources.id
|
|
19
|
+
FROM spina_conferences_conference_page_parts, resources
|
|
20
|
+
WHERE conference_page_id = spina_pages.id AND conference_page_partable_type = 'Spina::Conferences::Presentation'
|
|
21
|
+
SQL
|
|
22
|
+
delete <<-SQL, 'Delete resources'
|
|
23
|
+
DELETE FROM spina_resources WHERE name IN ('conferences', 'presentations')
|
|
24
|
+
SQL
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def down
|
|
28
|
+
insert <<-SQL, 'Insert conferences resource if missing'
|
|
29
|
+
INSERT INTO spina_resources (name, label, view_template, created_at, updated_at)
|
|
30
|
+
SELECT 'conferences', 'Conferences', 'conference', current_timestamp, current_timestamp
|
|
31
|
+
WHERE NOT EXISTS (SELECT name FROM spina_resources WHERE name = 'conferences')
|
|
32
|
+
SQL
|
|
33
|
+
update <<-SQL, 'Update conference conference pages'
|
|
34
|
+
WITH
|
|
35
|
+
conferences_resources AS (SELECT id FROM spina_resources WHERE name = 'conferences' LIMIT 1),
|
|
36
|
+
conferences_pages AS (SELECT id FROM spina_pages WHERE view_template = 'conference' LIMIT 1)
|
|
37
|
+
UPDATE spina_pages SET ancestry = conferences_pages.id, resource_id = conferences_resources.id
|
|
38
|
+
FROM spina_conferences_conference_page_parts, conferences_resources, conferences_pages
|
|
39
|
+
WHERE conference_page_id = spina_pages.id AND conference_page_partable_type = 'Spina::Conferences::Conference'
|
|
40
|
+
SQL
|
|
41
|
+
insert <<-SQL, 'Insert presentations resource if missing'
|
|
42
|
+
INSERT INTO spina_resources (name, label, view_template, created_at, updated_at)
|
|
43
|
+
SELECT 'presentations', 'Presentations', 'presentation', current_timestamp, current_timestamp
|
|
44
|
+
WHERE NOT EXISTS (SELECT name FROM spina_resources WHERE name = 'presentations')
|
|
45
|
+
SQL
|
|
46
|
+
update <<-SQL, 'Update presentation conference pages'
|
|
47
|
+
WITH presentations_resources AS (SELECT id FROM spina_resources WHERE name = 'presentations' LIMIT 1)
|
|
48
|
+
UPDATE spina_pages SET resource_id = presentations_resources.id
|
|
49
|
+
FROM spina_conferences_conference_page_parts, presentations_resources
|
|
50
|
+
WHERE conference_page_id = spina_pages.id AND conference_page_partable_type = 'Spina::Conferences::Presentation'
|
|
51
|
+
SQL
|
|
52
|
+
delete <<-SQL, 'Delete resources'
|
|
53
|
+
DELETE FROM spina_resources WHERE name = 'conference_pages'
|
|
54
|
+
SQL
|
|
55
|
+
end
|
|
56
|
+
end
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
class CreateSpinaConferencesParts < ActiveRecord::Migration[6.0] # :nodoc:
|
|
4
|
+
def change
|
|
5
|
+
create_table :spina_conferences_parts do |t| # rubocop:disable Rails/CreateTableWithTimestamps
|
|
6
|
+
t.string :title
|
|
7
|
+
t.string :name
|
|
8
|
+
t.references :partable, polymorphic: true, index: false
|
|
9
|
+
t.references :pageable, polymorphic: true, index: false
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# This migration comes from spina_conferences (originally 20190701174807)
|
|
4
|
+
|
|
5
|
+
class RemoveSpinaConferencePages < ActiveRecord::Migration[6.0] #:nodoc:
|
|
6
|
+
def up
|
|
7
|
+
insert <<-SQL, 'Insert conferences parts'
|
|
8
|
+
WITH parts AS (
|
|
9
|
+
SELECT
|
|
10
|
+
title,
|
|
11
|
+
name,
|
|
12
|
+
page_partable_id, page_partable_type,
|
|
13
|
+
spina_conferences_conferences.id AS pageable_id,
|
|
14
|
+
page_partable_type AS pageable_type
|
|
15
|
+
FROM spina_conferences_conferences
|
|
16
|
+
INNER JOIN spina_conferences_conference_page_parts
|
|
17
|
+
ON conference_page_partable_id = spina_conferences_conferences.id
|
|
18
|
+
AND conference_page_partable_type = 'Spina::Conferences::Conference'
|
|
19
|
+
INNER JOIN spina_page_parts ON conference_page_id = page_id
|
|
20
|
+
UNION
|
|
21
|
+
SELECT
|
|
22
|
+
spina_page_parts.title, name, page_partable_id, page_partable_type, spina_conferences_presentations.id, page_partable_type
|
|
23
|
+
FROM spina_conferences_presentations
|
|
24
|
+
INNER JOIN spina_conferences_conference_page_parts
|
|
25
|
+
ON conference_page_partable_id = spina_conferences_presentations.id
|
|
26
|
+
AND conference_page_partable_type = 'Spina::Conferences::Presentation'
|
|
27
|
+
INNER JOIN spina_page_parts ON conference_page_id = page_id
|
|
28
|
+
)
|
|
29
|
+
INSERT INTO spina_conferences_parts (title, name, partable_id, partable_type, pageable_id, pageable_type)
|
|
30
|
+
SELECT title, name, page_partable_id, page_partable_type, pageable_id, pageable_type FROM parts
|
|
31
|
+
SQL
|
|
32
|
+
delete <<-SQL, 'Delete page parts'
|
|
33
|
+
WITH parts AS (
|
|
34
|
+
SELECT spina_page_parts.id AS id
|
|
35
|
+
FROM spina_conferences_conferences
|
|
36
|
+
LEFT JOIN spina_conferences_conference_page_parts
|
|
37
|
+
ON conference_page_partable_id = spina_conferences_conferences.id
|
|
38
|
+
AND conference_page_partable_type = 'Spina::Conferences::Conference'
|
|
39
|
+
LEFT JOIN spina_page_parts ON conference_page_id = page_id
|
|
40
|
+
UNION
|
|
41
|
+
SELECT spina_page_parts.id
|
|
42
|
+
FROM spina_conferences_presentations
|
|
43
|
+
LEFT JOIN spina_conferences_conference_page_parts
|
|
44
|
+
ON conference_page_partable_id = spina_conferences_presentations.id
|
|
45
|
+
AND conference_page_partable_type = 'Spina::Conferences::Presentation'
|
|
46
|
+
LEFT JOIN spina_page_parts ON conference_page_id = page_id
|
|
47
|
+
)
|
|
48
|
+
DELETE FROM spina_page_parts USING parts WHERE spina_page_parts.id = parts.id
|
|
49
|
+
SQL
|
|
50
|
+
delete <<-SQL, 'Delete pages'
|
|
51
|
+
DELETE FROM spina_pages USING spina_conferences_conference_page_parts WHERE conference_page_id = spina_pages.id
|
|
52
|
+
SQL
|
|
53
|
+
delete <<-SQL, 'Delete conference page parts'
|
|
54
|
+
DELETE FROM spina_conferences_conference_page_parts
|
|
55
|
+
USING spina_conferences_conferences, spina_conferences_presentations
|
|
56
|
+
WHERE (
|
|
57
|
+
conference_page_partable_id = spina_conferences_conferences.id
|
|
58
|
+
AND conference_page_partable_type = 'Spina::Conferences::Conference'
|
|
59
|
+
)
|
|
60
|
+
OR (
|
|
61
|
+
conference_page_partable_id = spina_conferences_presentations.id
|
|
62
|
+
AND conference_page_partable_type = 'Spina::Conferences::Presentation'
|
|
63
|
+
)
|
|
64
|
+
SQL
|
|
65
|
+
delete <<-SQL, 'Delete conferences page'
|
|
66
|
+
DELETE FROM spina_pages WHERE name = 'conferences'
|
|
67
|
+
SQL
|
|
68
|
+
delete <<-SQL, 'Delete conference pages resource'
|
|
69
|
+
DELETE FROM spina_resources WHERE name = 'conference_pages'
|
|
70
|
+
SQL
|
|
71
|
+
remove_column :spina_pages, :type
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
def down
|
|
75
|
+
add_column :spina_pages, :type, :string
|
|
76
|
+
insert <<-SQL, 'Insert resource if missing'
|
|
77
|
+
INSERT INTO spina_resources (name, label, created_at, updated_at)
|
|
78
|
+
SELECT 'conference_pages', 'Conference pages', current_timestamp, current_timestamp
|
|
79
|
+
WHERE NOT EXISTS (SELECT name FROM spina_resources WHERE name = 'conference_pages')
|
|
80
|
+
SQL
|
|
81
|
+
locale = ActiveRecord::Relation::QueryAttribute.new('locale', I18n.default_locale, ActiveRecord::Type::String.new)
|
|
82
|
+
insert <<-SQL, 'Insert root page if missing', nil, nil, nil, [locale]
|
|
83
|
+
WITH pages AS (
|
|
84
|
+
INSERT INTO spina_pages (name, view_template, deletable, created_at, updated_at)
|
|
85
|
+
SELECT 'conferences', 'conferences', false, current_timestamp, current_timestamp
|
|
86
|
+
WHERE NOT EXISTS (SELECT name FROM spina_pages WHERE name = 'conferences')
|
|
87
|
+
RETURNING id
|
|
88
|
+
)
|
|
89
|
+
INSERT INTO spina_page_translations (title, spina_page_id, locale, created_at, updated_at)
|
|
90
|
+
SELECT 'Conferences', pages.id, $1, current_timestamp, current_timestamp FROM pages
|
|
91
|
+
SQL
|
|
92
|
+
insert <<-SQL, 'Insert conference pages for conferences', nil, nil, nil, [locale]
|
|
93
|
+
WITH
|
|
94
|
+
resources AS (SELECT id FROM spina_resources WHERE name = 'conference_pages' LIMIT 1),
|
|
95
|
+
conferences_pages AS (SELECT id FROM spina_pages WHERE view_template = 'conferences' LIMIT 1),
|
|
96
|
+
conference_pages_to_insert AS (
|
|
97
|
+
SELECT
|
|
98
|
+
concat_ws(' ', name, date_part('year', lower(dates))) AS title,
|
|
99
|
+
false AS deletable,
|
|
100
|
+
resources.id AS resource_id,
|
|
101
|
+
conferences_pages.id AS ancestry,
|
|
102
|
+
'conference' AS view_template,
|
|
103
|
+
spina_conferences_conferences.id AS conference_id,
|
|
104
|
+
'Spina::Conferences::Conference' AS type
|
|
105
|
+
FROM spina_conferences_conferences
|
|
106
|
+
INNER JOIN spina_conferences_institutions ON institution_id = spina_conferences_institutions.id
|
|
107
|
+
CROSS JOIN resources
|
|
108
|
+
CROSS JOIN conferences_pages
|
|
109
|
+
ORDER BY type, spina_conferences_conferences.id
|
|
110
|
+
), conference_pages AS (
|
|
111
|
+
INSERT INTO spina_pages (deletable, resource_id, ancestry, view_template, type, created_at, updated_at)
|
|
112
|
+
SELECT
|
|
113
|
+
deletable, resource_id, ancestry, view_template, 'Spina::Conferences::ConferencePage', current_timestamp, current_timestamp
|
|
114
|
+
FROM conference_pages_to_insert
|
|
115
|
+
RETURNING id AS page_id
|
|
116
|
+
), conference_page_translations AS (
|
|
117
|
+
INSERT INTO spina_page_translations (spina_page_id, locale, title, created_at, updated_at)
|
|
118
|
+
SELECT page_id, $1, title, current_timestamp, current_timestamp
|
|
119
|
+
FROM (
|
|
120
|
+
SELECT title, row_number() OVER (ORDER BY type, conference_id) AS index FROM conference_pages_to_insert
|
|
121
|
+
) AS pages_to_insert_with_indices
|
|
122
|
+
INNER JOIN (
|
|
123
|
+
SELECT page_id, row_number() OVER (ORDER BY page_id) AS index FROM conference_pages
|
|
124
|
+
) AS pages_with_indices USING (index)
|
|
125
|
+
)
|
|
126
|
+
INSERT INTO spina_conferences_conference_page_parts
|
|
127
|
+
(conference_page_id, conference_page_partable_id, conference_page_partable_type, created_at, updated_at)
|
|
128
|
+
SELECT page_id, conference_id, type, current_timestamp, current_timestamp
|
|
129
|
+
FROM (
|
|
130
|
+
SELECT conference_id, type, row_number() OVER (ORDER BY type, conference_id) AS index FROM conference_pages_to_insert
|
|
131
|
+
) AS pages_to_insert_with_indices
|
|
132
|
+
INNER JOIN (
|
|
133
|
+
SELECT page_id, row_number() OVER (ORDER BY page_id) AS index FROM conference_pages
|
|
134
|
+
) AS pages_with_indices USING (index)
|
|
135
|
+
SQL
|
|
136
|
+
insert <<-SQL, 'Insert conference pages for presentations', nil, nil, nil, [locale]
|
|
137
|
+
WITH
|
|
138
|
+
resources AS (SELECT id FROM spina_resources WHERE name = 'conference_pages' LIMIT 1),
|
|
139
|
+
conference_pages_to_insert AS (
|
|
140
|
+
SELECT
|
|
141
|
+
title,
|
|
142
|
+
false AS deletable,
|
|
143
|
+
resources.id AS resource_id,
|
|
144
|
+
spina_conferences_conference_page_parts.conference_page_id AS ancestry,
|
|
145
|
+
'presentation' AS view_template,
|
|
146
|
+
spina_conferences_presentations.id AS presentation_id,
|
|
147
|
+
'Spina::Conferences::Presentation' AS type
|
|
148
|
+
FROM spina_conferences_presentations
|
|
149
|
+
INNER JOIN spina_conferences_room_uses ON room_use_id = spina_conferences_room_uses.id
|
|
150
|
+
INNER JOIN spina_conferences_presentation_types ON presentation_type_id = spina_conferences_presentation_types.id
|
|
151
|
+
INNER JOIN spina_conferences_conference_page_parts
|
|
152
|
+
ON conference_page_partable_id = conference_id AND conference_page_partable_type = 'Spina::Conferences::Conference'
|
|
153
|
+
CROSS JOIN resources
|
|
154
|
+
ORDER BY type, presentation_id
|
|
155
|
+
), conference_pages AS (
|
|
156
|
+
INSERT INTO spina_pages (deletable, resource_id, ancestry, view_template, type, created_at, updated_at)
|
|
157
|
+
SELECT
|
|
158
|
+
deletable, resource_id, ancestry, view_template, 'Spina::Conferences::ConferencePage', current_timestamp, current_timestamp
|
|
159
|
+
FROM conference_pages_to_insert
|
|
160
|
+
RETURNING id AS page_id
|
|
161
|
+
), conference_page_translations AS (
|
|
162
|
+
INSERT INTO spina_page_translations (spina_page_id, locale, title, created_at, updated_at)
|
|
163
|
+
SELECT page_id, $1, title, current_timestamp, current_timestamp
|
|
164
|
+
FROM (
|
|
165
|
+
SELECT title, row_number() OVER (ORDER BY type, presentation_id) AS index FROM conference_pages_to_insert
|
|
166
|
+
) AS conference_pages_with_indices
|
|
167
|
+
INNER JOIN (
|
|
168
|
+
SELECT page_id, row_number() OVER (ORDER BY page_id) AS index FROM conference_pages
|
|
169
|
+
) AS pages_with_indices USING (index)
|
|
170
|
+
)
|
|
171
|
+
INSERT INTO spina_conferences_conference_page_parts
|
|
172
|
+
(conference_page_id, conference_page_partable_id, conference_page_partable_type, created_at, updated_at)
|
|
173
|
+
SELECT page_id, presentation_id, type, current_timestamp, current_timestamp
|
|
174
|
+
FROM (
|
|
175
|
+
SELECT presentation_id, type, row_number() OVER (ORDER BY type, presentation_id) AS index FROM conference_pages_to_insert
|
|
176
|
+
) AS conference_pages_with_indices
|
|
177
|
+
INNER JOIN (
|
|
178
|
+
SELECT page_id, row_number() OVER (ORDER BY page_id) AS index FROM conference_pages
|
|
179
|
+
) AS pages_with_indices USING (index)
|
|
180
|
+
SQL
|
|
181
|
+
insert <<-SQL, 'Insert page parts'
|
|
182
|
+
INSERT INTO spina_page_parts (title, name, page_id, page_partable_id, page_partable_type, created_at, updated_at)
|
|
183
|
+
SELECT
|
|
184
|
+
spina_conferences_parts.title, spina_conferences_parts.name, spina_pages.id, partable_id, partable_type, current_timestamp,
|
|
185
|
+
current_timestamp
|
|
186
|
+
FROM spina_conferences_parts
|
|
187
|
+
LEFT JOIN spina_conferences_conferences
|
|
188
|
+
ON pageable_id = spina_conferences_conferences.id AND pageable_type = 'Spina::Conferences::Conference'
|
|
189
|
+
LEFT JOIN spina_conferences_presentations
|
|
190
|
+
ON pageable_id = spina_conferences_presentations.id AND pageable_type = 'Spina::Conferences::Presentation'
|
|
191
|
+
INNER JOIN spina_conferences_conference_page_parts
|
|
192
|
+
ON pageable_id = conference_page_partable_id AND pageable_type = conference_page_partable_type
|
|
193
|
+
INNER JOIN spina_pages ON conference_page_id = spina_pages.id
|
|
194
|
+
SQL
|
|
195
|
+
delete <<-SQL, 'Delete conference parts'
|
|
196
|
+
DELETE FROM spina_conferences_parts USING spina_page_parts WHERE page_partable_id = partable_id AND page_partable_type = partable_type
|
|
197
|
+
SQL
|
|
198
|
+
end
|
|
199
|
+
end
|