diff --git a/app/controllers/admin/education/programs_controller.rb b/app/controllers/admin/education/programs_controller.rb index 25a6e312a0878a22e5e17d0f86de5bd96fd31627..967aed167d3b4de737a0d1fba18cc1556b5c7b4f 100644 --- a/app/controllers/admin/education/programs_controller.rb +++ b/app/controllers/admin/education/programs_controller.rb @@ -2,10 +2,28 @@ class Admin::Education::ProgramsController < Admin::Education::ApplicationContro load_and_authorize_resource class: Education::Program def index - @programs = current_university.education_programs + @programs = current_university.education_programs.root.ordered breadcrumb end + def reorder + parent_id = params['parentId'].blank? ? nil : params['parentId'] + ids = params['ids'] + ids.each.with_index do |id, index| + program = current_university.education_programs.find(id) + program.update( + parent_id: parent_id, + position: index + 1 + ) + end + end + + def children + return unless request.xhr? + @program = current_university.education_programs.find(params[:id]) + @children = @program.children.ordered + end + def show breadcrumb end @@ -56,6 +74,6 @@ class Admin::Education::ProgramsController < Admin::Education::ApplicationContro params.require(:education_program) .permit(:name, :level, :capacity, :ects, :continuing, :prerequisites, :objectives, :duration, :registration, :pedagogy, - :evaluation, :accessibility, :pricing, :contacts, :opportunities, :other, school_ids: [], teacher_ids: []) + :evaluation, :accessibility, :pricing, :contacts, :opportunities, :other, :parent_id, school_ids: [], teacher_ids: []) end end diff --git a/app/models/communication/website.rb b/app/models/communication/website.rb index d1b84de2492e5736ca6c0ea473c2903cc4abb2dd..df225c5f28a311e95bf60ce935f5f05f1d063985 100644 --- a/app/models/communication/website.rb +++ b/app/models/communication/website.rb @@ -79,7 +79,7 @@ class Communication::Website < ApplicationRecord def list_of_pages all_pages = [] - pages.where.not(id: id).root.ordered.each do |page| + pages.root.ordered.each do |page| all_pages.concat(page.self_and_children(0)) end all_pages diff --git a/app/models/concerns/with_publication_to_websites.rb b/app/models/concerns/with_publication_to_websites.rb new file mode 100644 index 0000000000000000000000000000000000000000..75d957038bd35e22e0d679d57b5cd9ef936a7494 --- /dev/null +++ b/app/models/concerns/with_publication_to_websites.rb @@ -0,0 +1,52 @@ +module WithPublicationToWebsites + extend ActiveSupport::Concern + + included do + after_save_commit :publish_to_github + end + + def publish_to_website(website) + github = Github.new website.access_token, website.repository + return unless github.valid? + github.publish path: "_#{path_root}/#{ id }.md", + data: to_jekyll, + commit: "[#{element_name}] Save #{to_s}" + end + + def github_frontmatter + @frontmatter ||= FrontMatterParser::Parser.new(:md).call(github_content) + rescue + FrontMatterParser::Parser.new(:md).call('') + end + + protected + + def to_jekyll + ApplicationController.render( + template: "admin/#{path_relative}/jekyll", + layout: false, + assigns: { object: self } + ) + end + + def publish_to_github + websites.each { |website| publish_to_website(website) } + end + + # return "Program" + def element_name + self.class.name.demodulize + end + + # return "programs" + def path_root + element_name.pluralize.downcase + end + + # return "education/programs" + def path_relative + self.class.name.underscore.pluralize + end + + +end diff --git a/app/models/concerns/with_tree.rb b/app/models/concerns/with_tree.rb index d914a1e0e33fca4d846ab0ac6d8059ed3011b57d..eb0d0ff76459d32478f457410f55f049ec7c2e2f 100644 --- a/app/models/concerns/with_tree.rb +++ b/app/models/concerns/with_tree.rb @@ -19,13 +19,13 @@ module WithTree end def self_and_children(level) - pages = [] + elements = [] label = " " * level + self.to_s - pages << { label: label, id: self.id } + elements << { label: label, id: self.id } children.each do |child| - pages.concat(child.self_and_children(level + 1)) + elements.concat(child.self_and_children(level + 1)) end - pages + elements end end diff --git a/app/models/education/program.rb b/app/models/education/program.rb index 6cb08e5d8c59773edcb8d40999d8c384f2e5fb55..e050b551ae2ae701cb7986e0cb5fed9f5a00c712 100644 --- a/app/models/education/program.rb +++ b/app/models/education/program.rb @@ -8,19 +8,26 @@ # ects :integer # level :integer # name :string +# position :integer default(0) # created_at :datetime not null # updated_at :datetime not null +# parent_id :uuid # university_id :uuid not null # # Indexes # +# index_education_programs_on_parent_id (parent_id) # index_education_programs_on_university_id (university_id) # # Foreign Keys # +# fk_rails_... (parent_id => education_programs.id) # fk_rails_... (university_id => universities.id) # class Education::Program < ApplicationRecord + include WithPublicationToWebsites + include WithTree + has_rich_text :accessibility has_rich_text :contacts has_rich_text :duration @@ -34,6 +41,13 @@ class Education::Program < ApplicationRecord has_rich_text :registration belongs_to :university + belongs_to :parent, + class_name: 'Education::Program', + optional: true + has_many :children, + class_name: 'Education::Program', + foreign_key: :parent_id, + dependent: :nullify has_and_belongs_to_many :schools, class_name: 'Education::School', join_table: 'education_programs_schools', @@ -44,6 +58,7 @@ class Education::Program < ApplicationRecord join_table: 'education_programs_teachers', foreign_key: 'education_program_id', association_foreign_key: 'education_teacher_id' + has_many :websites, -> { distinct }, through: :schools enum level: { bachelor: 300, @@ -53,7 +68,14 @@ class Education::Program < ApplicationRecord validates_presence_of :name + scope :ordered, -> { order(:position) } + def to_s "#{name}" end + + def list_of_other_programs + university.list_of_programs.reject! { |p| p[:id] == id } + end + end diff --git a/app/models/education/school.rb b/app/models/education/school.rb index 8d02690ae0dcf539f2720a65cbbdf1bd8bcc9914..bf7dc359882e514f308a7642549abbef0b87c7cc 100644 --- a/app/models/education/school.rb +++ b/app/models/education/school.rb @@ -24,7 +24,7 @@ # class Education::School < ApplicationRecord belongs_to :university - has_one :website, class_name: 'Communication::Website', foreign_key: :about + has_one :website, class_name: 'Communication::Website', as: :about has_and_belongs_to_many :programs, class_name: 'Education::Program', join_table: 'education_programs_schools', diff --git a/app/models/education/teacher.rb b/app/models/education/teacher.rb index 41ad533f93b0746638c62bc451973805c2ceac5c..970d4a4784f55e50c9d7de33a9a8901a3267ffd3 100644 --- a/app/models/education/teacher.rb +++ b/app/models/education/teacher.rb @@ -4,7 +4,6 @@ # # id :uuid not null, primary key # first_name :string -# github_path :text # last_name :string # slug :string # created_at :datetime not null @@ -23,7 +22,7 @@ # fk_rails_... (user_id => users.id) # class Education::Teacher < ApplicationRecord - include WithGithub + include WithPublicationToWebsites include WithSlug has_rich_text :biography @@ -35,7 +34,7 @@ class Education::Teacher < ApplicationRecord join_table: 'education_programs_teachers', foreign_key: 'education_teacher_id', association_foreign_key: 'education_program_id' - + has_many :websites, -> { distinct }, through: :programs scope :ordered, -> { order(:last_name, :first_name) } @@ -43,15 +42,4 @@ class Education::Teacher < ApplicationRecord "#{last_name} #{first_name}" end - def github_path_generated - "_teachers/#{slug}.html" - end - - def to_jekyll - ApplicationController.render( - template: 'admin/education/teachers/jekyll', - layout: false, - assigns: { teacher: self } - ) - end end diff --git a/app/models/research/journal.rb b/app/models/research/journal.rb index 6e9b547487ea268bbc83e64aad726fbff30cf1a1..5a59896717dcba5f3d4b98e1711f034517b8290f 100644 --- a/app/models/research/journal.rb +++ b/app/models/research/journal.rb @@ -22,7 +22,7 @@ # class Research::Journal < ApplicationRecord belongs_to :university - has_one :website, class_name: 'Communication::Website', foreign_key: :about + has_one :website, class_name: 'Communication::Website', as: :about has_many :volumes, foreign_key: :research_journal_id has_many :articles, foreign_key: :research_journal_id diff --git a/app/models/research/researcher.rb b/app/models/research/researcher.rb index fbbde5513b0bc270c5472c394c10ac8e9f2fd9b4..dacee4ec3aa95ded174bd6e08ffff5ba37b78426 100644 --- a/app/models/research/researcher.rb +++ b/app/models/research/researcher.rb @@ -4,7 +4,6 @@ # # id :uuid not null, primary key # first_name :string -# github_path :text # last_name :string # old_biography :text # created_at :datetime not null @@ -23,44 +22,27 @@ # fk_rails_... (user_id => users.id) # class Research::Researcher < ApplicationRecord + include WithPublicationToWebsites + has_rich_text :biography belongs_to :university belongs_to :user, optional: true has_and_belongs_to_many :articles, class_name: 'Research::Journal::Article' has_many :journals, through: :articles - - after_save :publish_to_github + has_many :websites, -> { distinct }, through: :journals scope :ordered, -> { order(:last_name, :first_name) } - def websites - @websites ||= journals.collect(&:website).uniq.compact - end - - def publish_to_website(website) - github = Github.new website.access_token, website.repository - return unless github.valid? - github.publish path: "_authors/#{ id }.md", - data: to_jekyll, - commit: "[Researcher] Save #{to_s}" - end - def to_s "#{ first_name } #{ last_name }" end protected - def to_jekyll - ApplicationController.render( - template: 'admin/research/researchers/jekyll', - layout: false, - assigns: { researcher: self } - ) + # overwrite from WithPublicationToWebsites + def path_root + 'authors' end - def publish_to_github - websites.each { |website| publish_to_website(website) } - end end diff --git a/app/models/university/with_education.rb b/app/models/university/with_education.rb index 786749c3ed9cbd68d69179609186859d5fd08f1f..01bec1aadf07a73007885ff47234f1228ac8465b 100644 --- a/app/models/university/with_education.rb +++ b/app/models/university/with_education.rb @@ -5,5 +5,14 @@ module University::WithEducation has_many :teachers, class_name: 'Education::Teacher', dependent: :destroy has_many :education_programs, class_name: 'Education::Program', dependent: :destroy has_many :education_schools, class_name: 'Education::School', dependent: :destroy + + def list_of_programs + all_programs = [] + education_programs.root.ordered.each do |program| + all_programs.concat(program.self_and_children(0)) + end + all_programs + end + end end diff --git a/app/views/admin/communication/website/categories/_treebranch.html.erb b/app/views/admin/communication/website/categories/_treebranch.html.erb index 7b9b979b7977ec1d033f5e33619629a19b9b4807..1caf23cbd3edb56cef0506882e6dec71e831df0b 100644 --- a/app/views/admin/communication/website/categories/_treebranch.html.erb +++ b/app/views/admin/communication/website/categories/_treebranch.html.erb @@ -3,7 +3,6 @@ <div class="d-flex align-items-center treeview__label border-bottom p-1"> <%= link_to children_admin_communication_website_category_path(website_id: category.website.id, id: category.id), class: 'js-treeview-openzone d-inline-block p-2 ps-0', style: 'width: 22px', remote: true do %> - <% icon_style = category.has_children? ? 'fas' : 'far' %> <span class="open_btn"> <i class="open_btn--with_children fas fa-folder"></i> <i class="open_btn--without_children far fa-folder"></i> @@ -15,6 +14,10 @@ <% end %> <%= link_to category, admin_communication_website_category_path(website_id: category.website.id, id: category.id) %> <span class="move_btn py-2 ps-2"><i class="fas fa-sort"></i></span> + <div class="btn-group ms-auto" role="group"> + <%= edit_link category %> + <%= destroy_link category %> + </div> </div> <ul class="list-unstyled treeview__children js-treeview-children js-treeview-sortable-container ms-4" data-id="<%= category.id %>"> <li class="treeview__empty"> diff --git a/app/views/admin/communication/website/pages/_treebranch.html.erb b/app/views/admin/communication/website/pages/_treebranch.html.erb index 7901ed7d93cc93361cedd756ab35c11837fef2cb..e85e3fd3046d21020ff61374aaa58314a0cf0710 100644 --- a/app/views/admin/communication/website/pages/_treebranch.html.erb +++ b/app/views/admin/communication/website/pages/_treebranch.html.erb @@ -3,7 +3,6 @@ <div class="d-flex align-items-center treeview__label border-bottom p-1"> <%= link_to children_admin_communication_website_page_path(website_id: page.website.id, id: page.id), class: 'js-treeview-openzone d-inline-block p-2 ps-0', style: 'width: 22px', remote: true do %> - <% icon_style = page.has_children? ? 'fas' : 'far' %> <span class="open_btn"> <i class="open_btn--with_children fas fa-folder"></i> <i class="open_btn--without_children far fa-folder"></i> @@ -17,7 +16,7 @@ admin_communication_website_page_path(website_id: page.website.id, id: page.id), class: "#{'opacity-50' unless page.published?}" %> <span class="move_btn py-2 ps-2"><i class="fas fa-sort"></i></span> - <div class="ms-auto"> + <div class="btn-group ms-auto" role="group"> <%= edit_link page %> <%= destroy_link page %> </div> diff --git a/app/views/admin/education/programs/_form.html.erb b/app/views/admin/education/programs/_form.html.erb index 4f54820cbaf34aeeb697cea5dfc740486255d1ce..5094af7e14af7a1fb4456b2e70b9f5ce5cd469fe 100644 --- a/app/views/admin/education/programs/_form.html.erb +++ b/app/views/admin/education/programs/_form.html.erb @@ -10,6 +10,7 @@ <%= f.association :schools, as: :check_boxes, collection: current_university.education_schools.ordered %> + <%= f.association :parent, collection: program.persisted? ? program.list_of_other_programs : current_university.list_of_programs, label_method: ->(p) { sanitize p[:label] }, value_method: ->(p) { p[:id] } %> </div> <div class="col-md-8"> <h2 class="h4"><%= t('education.program.useful_informations') %></h2> diff --git a/app/views/admin/education/programs/_treebranch.html.erb b/app/views/admin/education/programs/_treebranch.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..739e18caa1d23603bff3ac683ebb68d1521d2f2e --- /dev/null +++ b/app/views/admin/education/programs/_treebranch.html.erb @@ -0,0 +1,32 @@ +<% programs.each do |program| %> + <li class="treeview__element js-treeview-element <%= 'treeview__element--empty' unless program.has_children? %>" data-id="<%= program.id %>" data-parent="<%= program.parent_id %>"> + <div class="d-flex align-items-center treeview__label border-bottom p-1"> + <%= link_to children_admin_education_program_path(id: program.id), + class: 'js-treeview-openzone d-inline-block p-2 ps-0', style: 'width: 22px', remote: true do %> + <span class="open_btn"> + <i class="open_btn--with_children fas fa-folder"></i> + <i class="open_btn--without_children far fa-folder"></i> + </span> + <span class="close_btn"> + <i class="close_btn--with_children fas fa-folder-open"></i> + <i class="close_btn--without_children far fa-folder-open"></i> + </span> + <% end %> + <%= link_to program, + admin_education_program_path(id: program.id) %> + <span class="move_btn py-2 ps-2"><i class="fas fa-sort"></i></span> + <div class="btn-group ms-auto" role="group"> + <%= edit_link program %> + <%= destroy_link program %> + </div> + </div> + <ul class="list-unstyled treeview__children js-treeview-children <%= 'js-treeview-sortable-container' if can?(:reorder, program) %> ms-4" data-id="<%= program.id %>"> + <li class="treeview__empty"> + <div class="d-flex align-items-center treeview__label border-bottom p-1"> + <span class="p-2 ps-0"><%= t('empty_folder') %></span> + </div> + </li> + <li class="treeview__loading border-bottom p-1"><%= t('loading') %></li> + </ul> + </li> +<% end %> diff --git a/app/views/admin/education/programs/children.js.erb b/app/views/admin/education/programs/children.js.erb new file mode 100644 index 0000000000000000000000000000000000000000..1fcfcfb0373708fc357359f8cdde9e9b9a3de4e0 --- /dev/null +++ b/app/views/admin/education/programs/children.js.erb @@ -0,0 +1,8 @@ +$branch = $('.js-treeview-element[data-id=<%= @program.id %>]'); +<% if @children.any? %> + $('.js-treeview-children', $branch).append("<%= escape_javascript(render 'treebranch', programs: @children) %>"); +<% else %> + $branch.addClass('treeview__element--empty'); +<% end %> +$branch.addClass('treeview__element--loaded'); +window.osuny.treeView.initSortable(); diff --git a/app/views/admin/education/programs/index.html.erb b/app/views/admin/education/programs/index.html.erb index 9d3783318ad8f3433eec879937d09ed1f8ba20eb..9bf782f6057f0d3bcdac0ec886ff40d4f52d0edd 100644 --- a/app/views/admin/education/programs/index.html.erb +++ b/app/views/admin/education/programs/index.html.erb @@ -1,28 +1,8 @@ <% content_for :title, Education::Program.model_name.human(count: 2) %> -<table class="table"> - <thead> - <tr> - <th><%= Education::Program.human_attribute_name('name') %></th> - <th><%= Education::Program.human_attribute_name('level') %></th> - <th></th> - </tr> - </thead> - <tbody> - <% @programs.each do |program| %> - <tr> - <td><%= link_to program, [:admin, program] %></td> - <td><%= program.level %></td> - <td class="text-end"> - <div class="btn-group" role="group"> - <%= edit_link program %> - <%= destroy_link program %> - </div> - </td> - </tr> - <% end %> - </tbody> -</table> +<ul class="list-unstyled treeview js-treeview <%= 'treeview--sortable js-treeview-sortable js-treeview-sortable-container' if can?(:reorder, @programs.first) %>" data-id="" data-sort-url="<%= reorder_admin_education_programs_path %>"> + <%= render 'treebranch', programs: @programs %> +</ul> <% content_for :action_bar_right do %> <%= create_link Education::Program %> diff --git a/app/views/admin/education/programs/jekyll.html.erb b/app/views/admin/education/programs/jekyll.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..e833906bfa8c1cc3c326fbfb5d86fa2b2256e6f4 --- /dev/null +++ b/app/views/admin/education/programs/jekyll.html.erb @@ -0,0 +1,32 @@ +--- +title: "<%= @object.name %>" +identifier: "<%= @object.id %>" +parent: "<%= @object.parent_id %>" +continuing: <%= @object.continuing %> +level: <%= @object.level %> +ects: <%= @object.ects %> +position: <%= @object.position %> +accessibility: > + <%= prepare_for_github @object.accessibility, @object.university %> +contacts: > + <%= prepare_for_github @object.contacts, @object.university %> +duration: > + <%= prepare_for_github @object.duration, @object.university %> +evaluation: > + <%= prepare_for_github @object.evaluation, @object.university %> +objectives: > + <%= prepare_for_github @object.objectives, @object.university %> +opportunities: > + <%= prepare_for_github @object.opportunities, @object.university %> +other: > + <%= prepare_for_github @object.other, @object.university %> +pedagogy: > + <%= prepare_for_github @object.pedagogy, @object.university %> +prerequisites: > + <%= prepare_for_github @object.prerequisites, @object.university %> +pricing: > + <%= prepare_for_github @object.pricing, @object.university %> +registration: > + <%= prepare_for_github @object.registration, @object.university %> +--- +<%= @object.github_frontmatter.content.html_safe %> diff --git a/app/views/admin/education/teachers/jekyll.html.erb b/app/views/admin/education/teachers/jekyll.html.erb index 8aa58250eeda0702d4f386b63321b42378225bd3..f26e8d52633e9ff63cc003ef7bc70f9d888a3bb8 100644 --- a/app/views/admin/education/teachers/jekyll.html.erb +++ b/app/views/admin/education/teachers/jekyll.html.erb @@ -1,10 +1,10 @@ --- -title: "<%= @author.to_s %>" -identifier: "<%= @author.id %>" -first_name: "<%= @author.first_name %>" -last_name: "<%= @author.last_name %>" -slug: "<%= @author.slug %>" +title: "<%= @object.to_s %>" +identifier: "<%= @object.id %>" +first_name: "<%= @object.first_name %>" +last_name: "<%= @object.last_name %>" +slug: "<%= @object.slug %>" biography: > - <%= prepare_for_github @author.biography, @author.university %> + <%= prepare_for_github @object.biography, @object.university %> --- -<%= @author.github_frontmatter.content.html_safe %> +<%= @object.github_frontmatter.content.html_safe %> diff --git a/app/views/admin/research/researchers/jekyll.html.erb b/app/views/admin/research/researchers/jekyll.html.erb index 698fec862ab277f4ff2e6e69187fcbd0c7cfa7e2..446221fd221f6170cb3cc985e42bec9f09663d0d 100644 --- a/app/views/admin/research/researchers/jekyll.html.erb +++ b/app/views/admin/research/researchers/jekyll.html.erb @@ -1,7 +1,7 @@ --- -title: "<%= "#{ @researcher }"%>" -first_name: "<%= @researcher.first_name %>" -last_name: "<%= @researcher.last_name %>" +title: "<%= "#{ @object }"%>" +first_name: "<%= @object.first_name %>" +last_name: "<%= @object.last_name %>" biography: > - <%= prepare_for_github @researcher.biography, @researcher.university %> + <%= prepare_for_github @object.biography, @object.university %> --- diff --git a/config/routes/admin/education.rb b/config/routes/admin/education.rb index 6969aa6f3afd12a510125c0df297b1623f13b427..0a11f525cbeacf0d1abf2f2ef8a767afa65d5d15 100644 --- a/config/routes/admin/education.rb +++ b/config/routes/admin/education.rb @@ -1,3 +1,11 @@ namespace :education do - resources :programs, :schools, :teachers + resources :teachers, :schools + resources :programs do + collection do + post :reorder + end + member do + get :children + end + end end diff --git a/db/migrate/20211116100253_add_parent_to_education_formation.rb b/db/migrate/20211116100253_add_parent_to_education_formation.rb new file mode 100644 index 0000000000000000000000000000000000000000..239d495b031e26718c3e1a90ed7998369b02fe6d --- /dev/null +++ b/db/migrate/20211116100253_add_parent_to_education_formation.rb @@ -0,0 +1,6 @@ +class AddParentToEducationFormation < ActiveRecord::Migration[6.1] + def change + add_reference :education_programs, :parent, foreign_key: { to_table: :education_programs }, type: :uuid + add_column :education_programs, :position, :integer, default: 0 + end +end diff --git a/db/migrate/20211116154220_remove_github_path_from_unused_models.rb b/db/migrate/20211116154220_remove_github_path_from_unused_models.rb new file mode 100644 index 0000000000000000000000000000000000000000..869e38da66e0d79ce368e6826a6bdb5b88e58389 --- /dev/null +++ b/db/migrate/20211116154220_remove_github_path_from_unused_models.rb @@ -0,0 +1,6 @@ +class RemoveGithubPathFromUnusedModels < ActiveRecord::Migration[6.1] + def change + remove_column :research_researchers, :github_path + remove_column :education_teachers, :github_path + end +end diff --git a/db/schema.rb b/db/schema.rb index 85299fd5125630c41413ea4cd6b9e94f1bcb2415..275a37e1cbc698d2e9874325e661b40050ccfac2 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.define(version: 2021_11_15_162245) do +ActiveRecord::Schema.define(version: 2021_11_16_154220) do # These are extensions that must be enabled in order to support this database enable_extension "pgcrypto" @@ -335,6 +335,9 @@ ActiveRecord::Schema.define(version: 2021_11_15_162245) do t.boolean "continuing" t.datetime "created_at", precision: 6, null: false t.datetime "updated_at", precision: 6, null: false + t.uuid "parent_id" + t.integer "position", default: 0 + t.index ["parent_id"], name: "index_education_programs_on_parent_id" t.index ["university_id"], name: "index_education_programs_on_university_id" end @@ -371,7 +374,6 @@ ActiveRecord::Schema.define(version: 2021_11_15_162245) do t.string "first_name" t.string "last_name" t.string "slug" - t.text "github_path" t.uuid "user_id" t.datetime "created_at", precision: 6, null: false t.datetime "updated_at", precision: 6, null: false @@ -447,7 +449,6 @@ ActiveRecord::Schema.define(version: 2021_11_15_162245) do t.uuid "user_id" t.datetime "created_at", precision: 6, null: false t.datetime "updated_at", precision: 6, null: false - t.text "github_path" t.uuid "university_id" t.index ["university_id"], name: "idx_researcher_university" t.index ["user_id"], name: "index_research_researchers_on_user_id" @@ -551,6 +552,7 @@ ActiveRecord::Schema.define(version: 2021_11_15_162245) do add_foreign_key "communication_website_posts", "communication_websites" add_foreign_key "communication_website_posts", "universities" add_foreign_key "communication_websites", "universities" + add_foreign_key "education_programs", "education_programs", column: "parent_id" add_foreign_key "education_programs", "universities" add_foreign_key "education_schools", "universities" add_foreign_key "education_teachers", "universities"