From 1de194c168ac56c5b2609b436513533677d9c013 Mon Sep 17 00:00:00 2001 From: diti Date: Thu, 5 Mar 2026 12:18:25 +0100 Subject: [PATCH 1/3] Add started_at/ended_at datetime fields to Banner --- app/helpers/application_helper.rb | 3 ++- app/models/banner.rb | 7 +++++++ db/migrate/20260305105227_add_timeto_banner.rb | 6 ++++++ 3 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 db/migrate/20260305105227_add_timeto_banner.rb diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index f477fb141..36e08afbc 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -25,7 +25,7 @@ def today def display_banner # Cache banners to avoid repeated queries during page render - @banners ||= Banner.published.select("id, content").to_a + @banners ||= Banner.active.select("id, content").to_a return if @banners.empty? safe_content_array = @banners.map { |banner| @@ -41,6 +41,7 @@ def display_banner content_tag(:div, id: "banner-news", class: "bg-yellow-200 text-black text-center px-4 py-2") do content_tag(:div, safe_content.html_safe, class: "font-medium") end + end def ra_path(obj, action = nil) diff --git a/app/models/banner.rb b/app/models/banner.rb index 592d7ae41..32b5720c2 100644 --- a/app/models/banner.rb +++ b/app/models/banner.rb @@ -12,4 +12,11 @@ class Banner < ApplicationRecord def name content.truncate(50) end + + scope :active, -> { + where(show: true) + .where('started_at IS NULL OR started_at <= ?', Time.current) + .where('ended_at IS NULL OR ended_at >= ?', Time.current) + } + end diff --git a/db/migrate/20260305105227_add_timeto_banner.rb b/db/migrate/20260305105227_add_timeto_banner.rb new file mode 100644 index 000000000..627ea1350 --- /dev/null +++ b/db/migrate/20260305105227_add_timeto_banner.rb @@ -0,0 +1,6 @@ +class AddTimetoBanner < ActiveRecord::Migration[8.1] + def change + add_column :banners, :started_at, :datetime + add_column :banners, :ended_at, :datetime + end +end From 267b5216f249f2081f94e195b7cc8711ab8e7cac Mon Sep 17 00:00:00 2001 From: diti Date: Thu, 5 Mar 2026 12:28:20 +0100 Subject: [PATCH 2/3] rubocop --- app/helpers/application_helper.rb | 1 - app/models/banner.rb | 11 +++++------ 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 36e08afbc..f4a5f7aba 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -41,7 +41,6 @@ def display_banner content_tag(:div, id: "banner-news", class: "bg-yellow-200 text-black text-center px-4 py-2") do content_tag(:div, safe_content.html_safe, class: "font-medium") end - end def ra_path(obj, action = nil) diff --git a/app/models/banner.rb b/app/models/banner.rb index 32b5720c2..c54e993f8 100644 --- a/app/models/banner.rb +++ b/app/models/banner.rb @@ -13,10 +13,9 @@ def name content.truncate(50) end - scope :active, -> { - where(show: true) - .where('started_at IS NULL OR started_at <= ?', Time.current) - .where('ended_at IS NULL OR ended_at >= ?', Time.current) - } - + scope :active, -> { + where(show: true) + .where("started_at IS NULL OR started_at <= ?", Time.current) + .where("ended_at IS NULL OR ended_at >= ?", Time.current) + } end From 6515dbbeeb7664b8f373835ce172f888cc6549f1 Mon Sep 17 00:00:00 2001 From: diti Date: Thu, 5 Mar 2026 12:32:19 +0100 Subject: [PATCH 3/3] Update schema with banner timestamps --- db/schema.rb | 193 +++++++++++++++++++++++++-------------------------- 1 file changed, 95 insertions(+), 98 deletions(-) diff --git a/db/schema.rb b/db/schema.rb index 1baa25275..3401ff5fe 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[8.1].define(version: 2026_03_02_150000) do +ActiveRecord::Schema[8.1].define(version: 2026_03_05_105227) do create_table "action_text_mentions", charset: "utf8mb4", collation: "utf8mb4_unicode_ci", force: :cascade do |t| t.bigint "action_text_rich_text_id", null: false t.datetime "created_at", null: false @@ -18,6 +18,7 @@ t.string "mentionable_type", null: false t.datetime "updated_at", null: false t.index ["action_text_rich_text_id", "mentionable_type", "mentionable_id"], name: "index_at_mentions_on_rich_text_and_mentionable", unique: true + t.index ["action_text_rich_text_id"], name: "index_action_text_mentions_on_action_text_rich_text_id" t.index ["mentionable_type", "mentionable_id"], name: "index_action_text_mentions_on_mentionable" end @@ -63,8 +64,8 @@ create_table "addresses", charset: "utf8mb4", collation: "utf8mb4_unicode_ci", force: :cascade do |t| t.string "address_type" - t.bigint "addressable_id", null: false - t.string "addressable_type", null: false + t.bigint "addressable_id" + t.string "addressable_type" t.string "city", null: false t.string "country" t.string "county" @@ -74,7 +75,7 @@ t.integer "la_city_council_district" t.integer "la_service_planning_area" t.integer "la_supervisorial_district" - t.string "locality", null: false + t.string "locality" t.string "phone" t.boolean "primary", default: false, null: false t.string "state", null: false @@ -133,12 +134,12 @@ create_table "ahoy_events", charset: "utf8mb4", collation: "utf8mb4_unicode_ci", force: :cascade do |t| t.string "name" - t.json "properties" + t.text "properties" t.bigint "resource_id" t.string "resource_type" t.datetime "time" t.bigint "user_id" - t.bigint "visit_id", null: false + t.bigint "visit_id" t.index ["name", "time"], name: "index_ahoy_events_on_name_and_time" t.index ["resource_id"], name: "index_ahoy_events_on_resource_id" t.index ["resource_type", "resource_id", "time"], name: "index_ahoy_events_on_resource_type_and_resource_id_and_time" @@ -192,7 +193,8 @@ t.string "title" t.string "type", default: "PrimaryAsset", null: false t.datetime "updated_at", null: false - t.index ["owner_type", "owner_id"], name: "index_assets_on_owner_type_and_owner_id" + t.index ["owner_id"], name: "index_assets_on_owner_id" + t.index ["owner_type"], name: "index_assets_on_owner_type" t.index ["type"], name: "index_assets_on_type" end @@ -202,26 +204,28 @@ t.string "file_file_name" t.integer "file_file_size" t.datetime "file_updated_at", precision: nil - t.integer "owner_id", null: false - t.string "owner_type", null: false + t.integer "owner_id" + t.string "owner_type" t.datetime "updated_at", precision: nil, null: false end create_table "banners", id: :integer, charset: "utf8mb4", collation: "utf8mb4_unicode_ci", force: :cascade do |t| - t.text "content", size: :medium, null: false + t.text "content", size: :medium t.datetime "created_at", precision: nil, null: false - t.integer "created_by_id", null: false + t.integer "created_by_id" + t.datetime "ended_at" t.boolean "published", default: false, null: false - t.boolean "show", default: false, null: false + t.boolean "show" + t.datetime "started_at" t.datetime "updated_at", precision: nil, null: false - t.integer "updated_by_id", null: false + t.integer "updated_by_id" t.index ["created_by_id"], name: "index_banners_on_created_by_id" t.index ["published"], name: "index_banners_on_published" t.index ["updated_by_id"], name: "index_banners_on_updated_by_id" end create_table "blazer_audits", charset: "utf8mb4", collation: "utf8mb4_unicode_ci", force: :cascade do |t| - t.timestamp "created_at", null: false + t.timestamp "created_at", default: -> { "current_timestamp() ON UPDATE current_timestamp()" }, null: false t.string "data_source" t.bigint "query_id" t.text "statement" @@ -285,48 +289,48 @@ end create_table "bookmarks", id: :integer, charset: "utf8mb4", collation: "utf8mb4_unicode_ci", force: :cascade do |t| - t.integer "bookmarkable_id", null: false - t.string "bookmarkable_type", null: false + t.integer "bookmarkable_id" + t.string "bookmarkable_type" t.datetime "created_at", precision: nil, null: false t.datetime "updated_at", precision: nil, null: false - t.integer "user_id", null: false + t.integer "user_id" t.index ["bookmarkable_type", "bookmarkable_id"], name: "index_bookmarks_on_bookmarkable" t.index ["user_id"], name: "index_bookmarks_on_user_id" end create_table "categories", id: :integer, charset: "utf8mb4", collation: "utf8mb4_unicode_ci", force: :cascade do |t| - t.integer "category_type_id", null: false + t.integer "category_type_id" t.datetime "created_at", precision: nil, null: false t.integer "legacy_id" - t.string "name", null: false + t.string "name" t.integer "position", null: false - t.boolean "published", default: false, null: false + t.boolean "published", default: false t.datetime "updated_at", precision: nil, null: false t.index ["category_type_id", "position"], name: "index_categories_on_category_type_id_and_position", unique: true - t.index ["name"], name: "index_categories_on_name", unique: true + t.index ["category_type_id"], name: "index_categories_on_category_type_id" end create_table "categorizable_items", id: :integer, charset: "utf8mb4", collation: "utf8mb4_unicode_ci", force: :cascade do |t| - t.integer "categorizable_id", null: false + t.integer "categorizable_id" t.string "categorizable_type" - t.integer "category_id", null: false + t.integer "category_id" t.datetime "created_at", precision: nil, null: false t.integer "legacy_id" t.datetime "updated_at", precision: nil, null: false t.index ["categorizable_type", "categorizable_id"], name: "idx_on_categorizable_type_categorizable_id_ccce65d80c" t.index ["category_id", "categorizable_type", "categorizable_id"], name: "index_categorizable_items_uniqueness", unique: true + t.index ["category_id"], name: "index_categorizable_items_on_category_id" end create_table "category_types", id: :integer, charset: "utf8mb4", collation: "utf8mb4_unicode_ci", force: :cascade do |t| t.datetime "created_at", precision: nil, null: false t.string "display_text" t.string "legacy_id" - t.string "name", null: false + t.string "name" t.boolean "profile_specific", default: false, null: false - t.boolean "published", default: false, null: false - t.boolean "story_specific", default: false, null: false + t.boolean "published", default: false + t.boolean "story_specific", default: false t.datetime "updated_at", precision: nil, null: false - t.index ["name"], name: "index_category_types_on_name", unique: true end create_table "ckeditor_assets", id: :integer, charset: "utf8mb4", collation: "utf8mb4_unicode_ci", force: :cascade do |t| @@ -354,6 +358,7 @@ t.datetime "updated_at", null: false t.integer "updated_by_id" t.index ["commentable_type", "commentable_id", "created_at"], name: "idx_on_commentable_type_commentable_id_created_at_89c6e27600" + t.index ["commentable_type", "commentable_id"], name: "index_comments_on_commentable" t.index ["created_by_id"], name: "index_comments_on_created_by_id" t.index ["updated_by_id"], name: "index_comments_on_updated_by_id" end @@ -363,13 +368,13 @@ t.text "body", size: :medium t.datetime "created_at", null: false t.integer "created_by_id", null: false - t.boolean "featured", default: false, null: false + t.boolean "featured" t.integer "organization_id" t.boolean "publicly_featured", default: false, null: false t.boolean "publicly_visible", default: false, null: false - t.boolean "published", default: false, null: false + t.boolean "published" t.string "reference_url" - t.string "title", null: false + t.string "title" t.datetime "updated_at", null: false t.integer "updated_by_id", null: false t.integer "windows_type_id" @@ -449,7 +454,7 @@ t.datetime "created_at", null: false t.integer "created_by_id" t.text "description", size: :medium - t.datetime "end_date", precision: nil, null: false + t.datetime "end_date", precision: nil t.boolean "featured", default: false, null: false t.boolean "inactive", default: true, null: false t.integer "location_id" @@ -460,8 +465,8 @@ t.boolean "publicly_visible", default: false, null: false t.boolean "published", default: false, null: false t.datetime "registration_close_date", precision: nil - t.datetime "start_date", precision: nil, null: false - t.string "title", null: false + t.datetime "start_date", precision: nil + t.string "title" t.datetime "updated_at", null: false t.string "videoconference_label", default: "Virtual event" t.string "videoconference_url" @@ -471,13 +476,13 @@ end create_table "faqs", id: :integer, charset: "utf8mb4", collation: "utf8mb4_unicode_ci", force: :cascade do |t| - t.text "answer", size: :long, null: false + t.text "answer", size: :long t.datetime "created_at", precision: nil, null: false - t.boolean "inactive", default: false, null: false + t.boolean "inactive" t.integer "position", null: false t.boolean "publicly_visible", default: false, null: false t.boolean "published", default: false, null: false - t.string "question", null: false + t.string "question" t.datetime "updated_at", precision: nil, null: false t.index ["published"], name: "index_faqs_on_published" end @@ -494,17 +499,17 @@ create_table "form_builders", id: :integer, charset: "utf8mb4", collation: "utf8mb4_unicode_ci", force: :cascade do |t| t.datetime "created_at", precision: nil, null: false t.text "description", size: :long - t.string "name", null: false + t.string "name" t.integer "owner_type" t.datetime "updated_at", precision: nil, null: false - t.integer "windows_type_id", null: false + t.integer "windows_type_id" t.index ["windows_type_id"], name: "index_form_builders_on_windows_type_id" end create_table "form_field_answer_options", id: :integer, charset: "utf8mb4", collation: "utf8mb4_unicode_ci", force: :cascade do |t| - t.integer "answer_option_id", null: false + t.integer "answer_option_id" t.datetime "created_at", precision: nil, null: false - t.integer "form_field_id", null: false + t.integer "form_field_id" t.datetime "updated_at", precision: nil, null: false t.index ["answer_option_id"], name: "index_form_field_answer_options_on_answer_option_id" t.index ["form_field_id"], name: "index_form_field_answer_options_on_form_field_id" @@ -516,18 +521,17 @@ t.datetime "created_at", precision: nil, null: false t.string "field_group" t.string "field_key" - t.integer "form_id", null: false + t.integer "form_id" t.text "instructional_hint" t.boolean "is_required", default: true t.integer "parent_id" t.integer "position" - t.string "question", null: false + t.string "question" t.integer "status", default: 1 t.datetime "updated_at", precision: nil, null: false t.index ["field_group"], name: "index_form_fields_on_field_group" t.index ["field_key"], name: "index_form_fields_on_field_key" t.index ["form_id"], name: "index_form_fields_on_form_id" - t.index ["parent_id"], name: "index_form_fields_on_parent_id" end create_table "forms", id: :integer, charset: "utf8mb4", collation: "utf8mb4_unicode_ci", force: :cascade do |t| @@ -539,7 +543,6 @@ t.boolean "scholarship_application", default: false, null: false t.datetime "updated_at", precision: nil, null: false t.index ["form_builder_id"], name: "index_forms_on_form_builder_id" - t.index ["owner_type", "owner_id"], name: "index_forms_on_owner_type_and_owner_id" end create_table "images", id: :integer, charset: "utf8mb4", collation: "utf8mb4_unicode_ci", force: :cascade do |t| @@ -558,8 +561,8 @@ end create_table "locations", id: :integer, charset: "utf8mb4", collation: "utf8mb4_unicode_ci", force: :cascade do |t| - t.string "city", null: false - t.string "country", null: false + t.string "city" + t.string "country" t.datetime "created_at", precision: nil, null: false t.string "state" t.datetime "updated_at", precision: nil, null: false @@ -572,7 +575,6 @@ t.datetime "file_updated_at", precision: nil t.integer "report_id" t.integer "workshop_log_id" - t.index ["report_id"], name: "index_media_files_on_report_id" end create_table "monthly_reports", id: :integer, charset: "utf8mb4", collation: "utf8mb4_unicode_ci", force: :cascade do |t| @@ -610,7 +612,7 @@ t.string "kind", null: false t.integer "noticeable_id" t.string "noticeable_type" - t.integer "notification_type", null: false + t.integer "notification_type" t.integer "parent_notification_id" t.string "recipient_email", null: false t.string "recipient_role", null: false @@ -632,10 +634,9 @@ create_table "organization_statuses", id: :integer, charset: "utf8mb4", collation: "utf8mb4_unicode_ci", force: :cascade do |t| t.datetime "created_at", precision: nil, null: false - t.string "name", null: false + t.string "name" t.boolean "published", default: false, null: false t.datetime "updated_at", precision: nil, null: false - t.index ["name"], name: "index_organization_statuses_on_name", unique: true t.index ["published"], name: "index_organization_statuses_on_published" end @@ -648,11 +649,11 @@ t.date "end_date" t.string "filemaker_code" t.string "internal_id" - t.boolean "legacy", default: false, null: false + t.boolean "legacy", default: false t.integer "legacy_id" t.integer "location_id" t.string "mission_vision_values" - t.string "name", null: false + t.string "name" t.text "notes", size: :long t.integer "organization_status_id" t.boolean "profile_show_description", default: true, null: false @@ -687,15 +688,18 @@ t.string "payment_type", default: "stripe", null: false t.string "status", null: false t.string "stripe_charge_id" - t.json "stripe_metadata" + t.text "stripe_metadata", size: :long, collation: "utf8mb4_bin" t.string "stripe_payment_intent_id" t.datetime "updated_at", null: false t.index ["event_id"], name: "index_payments_on_event_id" t.index ["payable_type", "payable_id", "status"], name: "index_payments_on_payable_type_and_payable_id_and_status" t.index ["payable_type", "payable_id"], name: "index_payments_on_payable" + t.index ["payable_type", "payable_id"], name: "index_payments_on_payable_type_and_payable_id" t.index ["payer_type", "payer_id"], name: "index_payments_on_payer" - t.index ["stripe_charge_id"], name: "index_payments_on_stripe_charge_id", unique: true + t.index ["payer_type", "payer_id"], name: "index_payments_on_payer_type_and_payer_id" + t.index ["stripe_charge_id"], name: "index_payments_on_stripe_charge_id" t.index ["stripe_payment_intent_id"], name: "index_payments_on_stripe_payment_intent_id", unique: true + t.check_constraint "json_valid(`stripe_metadata`)", name: "stripe_metadata" end create_table "people", charset: "utf8mb4", collation: "utf8mb4_unicode_ci", force: :cascade do |t| @@ -773,11 +777,10 @@ create_table "quotable_item_quotes", id: :integer, charset: "utf8mb4", collation: "utf8mb4_unicode_ci", force: :cascade do |t| t.datetime "created_at", precision: nil, null: false t.integer "legacy_id" - t.integer "quotable_id", null: false - t.string "quotable_type", null: false - t.integer "quote_id", null: false + t.integer "quotable_id" + t.string "quotable_type" + t.integer "quote_id" t.datetime "updated_at", precision: nil, null: false - t.index ["quotable_type", "quotable_id"], name: "index_quotable_item_quotes_on_quotable_type_and_quotable_id" t.index ["quote_id"], name: "index_quotable_item_quotes_on_quote_id" end @@ -785,7 +788,7 @@ t.string "age" t.datetime "created_at", precision: nil, null: false t.string "gender", limit: 1 - t.boolean "inactive", default: true, null: false + t.boolean "inactive", default: true t.boolean "legacy", default: false t.integer "legacy_id" t.boolean "published", default: false, null: false @@ -801,8 +804,8 @@ t.text "answer", size: :long t.integer "answer_option_id" t.datetime "created_at", precision: nil - t.integer "form_field_id", null: false - t.integer "report_id", null: false + t.integer "form_field_id" + t.integer "report_id" t.datetime "updated_at", precision: nil t.index ["answer_option_id"], name: "index_report_form_field_answers_on_answer_option_id" t.index ["form_field_id"], name: "index_report_form_field_answers_on_form_field_id" @@ -815,15 +818,15 @@ t.integer "children_first_time", default: 0 t.integer "children_ongoing", default: 0 t.datetime "created_at", precision: nil, null: false - t.integer "created_by_id", null: false + t.integer "created_by_id" t.date "date" t.string "external_workshop_title" t.string "form_file_content_type" t.string "form_file_file_name" t.integer "form_file_file_size" t.datetime "form_file_updated_at", precision: nil - t.boolean "has_attachment", default: false, null: false - t.integer "organization_id", null: false + t.boolean "has_attachment", default: false + t.integer "organization_id" t.string "other_description" t.integer "owner_id" t.string "owner_type" @@ -832,12 +835,11 @@ t.integer "teens_ongoing", default: 0 t.string "type" t.datetime "updated_at", precision: nil, null: false - t.integer "windows_type_id", null: false + t.integer "windows_type_id" t.integer "workshop_id" t.string "workshop_name" t.index ["created_by_id"], name: "index_reports_on_created_by_id" t.index ["organization_id"], name: "index_reports_on_organization_id" - t.index ["owner_type", "owner_id"], name: "index_reports_on_owner_type_and_owner_id" t.index ["type", "date"], name: "index_reports_on_type_and_date" t.index ["type", "organization_id"], name: "index_reports_on_type_and_organization_id" t.index ["windows_type_id"], name: "index_reports_on_windows_type_id" @@ -849,28 +851,26 @@ t.string "author" t.text "body", size: :long t.datetime "created_at", precision: nil, null: false - t.integer "created_by_id", null: false + t.integer "created_by_id" t.boolean "featured", default: false t.boolean "female", default: false t.string "filemaker_code" t.boolean "inactive", default: true - t.string "kind", null: false + t.string "kind" t.boolean "legacy" t.integer "legacy_id" t.boolean "male", default: false - t.boolean "pdf_from_body", default: false, null: false t.integer "position" t.boolean "publicly_featured", default: false, null: false t.boolean "publicly_visible", default: false, null: false t.boolean "published", default: false, null: false - t.string "title", null: false + t.string "title" t.datetime "updated_at", precision: nil, null: false t.string "url" t.integer "windows_type_id" t.integer "workshop_id" t.index ["created_by_id"], name: "index_resources_on_created_by_id" t.index ["published"], name: "index_resources_on_published" - t.index ["title"], name: "index_resources_on_title", unique: true t.index ["windows_type_id"], name: "index_resources_on_windows_type_id" t.index ["workshop_id"], name: "index_resources_on_workshop_id" end @@ -879,19 +879,19 @@ t.datetime "created_at", precision: nil, null: false t.boolean "is_leader", default: false, null: false t.integer "sector_id" - t.integer "sectorable_id", null: false - t.string "sectorable_type", null: false + t.integer "sectorable_id" + t.string "sectorable_type" t.datetime "updated_at", precision: nil, null: false t.index ["sector_id", "sectorable_type", "sectorable_id"], name: "index_sectorable_items_uniqueness", unique: true + t.index ["sector_id"], name: "index_sectorable_items_on_sector_id" t.index ["sectorable_type", "sectorable_id"], name: "index_sectorable_items_on_sectorable_type_and_sectorable_id" end create_table "sectors", id: :integer, charset: "utf8mb4", collation: "utf8mb4_unicode_ci", force: :cascade do |t| t.datetime "created_at", precision: nil, null: false - t.string "name", null: false - t.boolean "published", default: false, null: false + t.string "name" + t.boolean "published", default: false t.datetime "updated_at", precision: nil, null: false - t.index ["name"], name: "index_sectors_on_name", unique: true end create_table "stories", charset: "utf8mb4", collation: "utf8mb4_unicode_ci", force: :cascade do |t| @@ -908,7 +908,7 @@ t.boolean "published", default: false, null: false t.bigint "spotlighted_facilitator_id" t.bigint "story_idea_id" - t.string "title", null: false + t.string "title" t.datetime "updated_at", null: false t.integer "updated_by_id", null: false t.string "website_url" @@ -920,14 +920,13 @@ t.index ["published"], name: "index_stories_on_published" t.index ["spotlighted_facilitator_id"], name: "index_stories_on_spotlighted_facilitator_id" t.index ["story_idea_id"], name: "index_stories_on_story_idea_id" - t.index ["title"], name: "index_stories_on_title", unique: true t.index ["updated_by_id"], name: "index_stories_on_updated_by_id" t.index ["windows_type_id"], name: "index_stories_on_windows_type_id" t.index ["workshop_id"], name: "index_stories_on_workshop_id" end create_table "story_ideas", charset: "utf8mb4", collation: "utf8mb4_unicode_ci", force: :cascade do |t| - t.string "author_credit_preference", null: false + t.string "author_credit_preference" t.text "body", size: :medium t.datetime "created_at", null: false t.integer "created_by_id", null: false @@ -955,29 +954,29 @@ t.boolean "publicly_featured", default: false, null: false t.boolean "publicly_visible", default: false, null: false t.boolean "published", default: false, null: false - t.string "title", null: false + t.string "title" t.datetime "updated_at", null: false t.string "youtube_url" t.index ["featured"], name: "index_tutorials_on_featured" t.index ["published"], name: "index_tutorials_on_published" - t.index ["title"], name: "index_tutorials_on_title", unique: true + t.index ["title"], name: "index_tutorials_on_title" end create_table "user_form_form_fields", id: :integer, charset: "utf8mb4", collation: "utf8mb4_unicode_ci", force: :cascade do |t| t.datetime "created_at", precision: nil, null: false - t.integer "form_field_id", null: false + t.integer "form_field_id" t.text "text", size: :long t.datetime "updated_at", precision: nil, null: false - t.integer "user_form_id", null: false + t.integer "user_form_id" t.index ["form_field_id"], name: "index_user_form_form_fields_on_form_field_id" t.index ["user_form_id"], name: "index_user_form_form_fields_on_user_form_id" end create_table "user_forms", id: :integer, charset: "utf8mb4", collation: "utf8mb4_unicode_ci", force: :cascade do |t| t.datetime "created_at", precision: nil, null: false - t.integer "form_id", null: false + t.integer "form_id" t.datetime "updated_at", precision: nil, null: false - t.integer "user_id", null: false + t.integer "user_id" t.index ["form_id"], name: "index_user_forms_on_form_id" t.index ["user_id"], name: "index_user_forms_on_user_id" end @@ -1051,7 +1050,7 @@ t.index ["confirmation_token"], name: "index_users_on_confirmation_token", unique: true t.index ["created_by_id"], name: "index_users_on_created_by_id" t.index ["email"], name: "index_users_on_email", unique: true - t.index ["person_id"], name: "index_users_on_person_id_unique", unique: true + t.index ["person_id"], name: "index_users_on_person_id" t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true t.index ["unlock_token"], name: "index_users_on_unlock_token", unique: true t.index ["updated_by_id"], name: "index_users_on_updated_by_id" @@ -1061,8 +1060,8 @@ create_table "windows_types", id: :integer, charset: "utf8mb4", collation: "utf8mb4_unicode_ci", force: :cascade do |t| t.datetime "created_at", precision: nil, null: false t.integer "legacy_id" - t.string "name", null: false - t.string "short_name", null: false + t.string "name" + t.string "short_name" t.datetime "updated_at", precision: nil, null: false end @@ -1120,7 +1119,7 @@ t.text "timeframe_spanish", size: :medium t.text "tips", size: :medium t.text "tips_spanish", size: :medium - t.string "title", null: false + t.string "title" t.datetime "updated_at", null: false t.integer "updated_by_id", null: false t.text "visualization", size: :medium @@ -1129,7 +1128,6 @@ t.text "warm_up_spanish", size: :medium t.integer "windows_type_id", null: false t.index ["created_by_id"], name: "index_workshop_ideas_on_created_by_id" - t.index ["title"], name: "index_workshop_ideas_on_title", unique: true t.index ["updated_by_id"], name: "index_workshop_ideas_on_updated_by_id" t.index ["windows_type_id"], name: "index_workshop_ideas_on_windows_type_id" end @@ -1161,9 +1159,9 @@ create_table "workshop_resources", id: :integer, charset: "utf8mb4", collation: "utf8mb4_unicode_ci", force: :cascade do |t| t.datetime "created_at", precision: nil, null: false - t.integer "resource_id", null: false + t.integer "resource_id" t.datetime "updated_at", precision: nil, null: false - t.integer "workshop_id", null: false + t.integer "workshop_id" t.index ["resource_id"], name: "index_workshop_resources_on_resource_id" t.index ["workshop_id"], name: "index_workshop_resources_on_workshop_id" end @@ -1182,7 +1180,7 @@ end create_table "workshop_variation_ideas", charset: "utf8mb4", collation: "utf8mb4_unicode_ci", force: :cascade do |t| - t.string "author_credit_preference", null: false + t.string "author_credit_preference" t.text "body", size: :long t.datetime "created_at", null: false t.integer "created_by_id", null: false @@ -1196,10 +1194,10 @@ t.string "youtube_url" t.index ["body"], name: "index_workshop_variation_ideas_on_body", type: :fulltext t.index ["created_by_id"], name: "index_workshop_variation_ideas_on_created_by_id" + t.index ["name"], name: "index_workshop_variation_ideas_on_name" t.index ["organization_id"], name: "index_workshop_variation_ideas_on_organization_id" t.index ["updated_by_id"], name: "index_workshop_variation_ideas_on_updated_by_id" t.index ["windows_type_id"], name: "index_workshop_variation_ideas_on_windows_type_id" - t.index ["workshop_id", "name"], name: "index_workshop_variation_ideas_on_workshop_id_and_name", unique: true t.index ["workshop_id"], name: "index_workshop_variation_ideas_on_workshop_id" end @@ -1210,20 +1208,19 @@ t.integer "created_by_id" t.boolean "inactive", default: true t.boolean "legacy", default: false - t.string "name", null: false + t.string "name" t.integer "organization_id" t.integer "position" t.boolean "publicly_visible", default: false, null: false t.boolean "published", default: false, null: false t.datetime "updated_at", precision: nil, null: false t.integer "variation_id" - t.integer "workshop_id", null: false + t.integer "workshop_id" t.bigint "workshop_variation_idea_id" t.string "youtube_url" t.index ["created_by_id"], name: "index_workshop_variations_on_created_by_id" t.index ["organization_id"], name: "index_workshop_variations_on_organization_id" t.index ["published"], name: "index_workshop_variations_on_published" - t.index ["workshop_id", "name"], name: "index_workshop_variations_on_workshop_id_and_name", unique: true t.index ["workshop_id"], name: "index_workshop_variations_on_workshop_id" t.index ["workshop_variation_idea_id"], name: "index_workshop_variations_on_workshop_variation_idea_id" end @@ -1303,7 +1300,7 @@ t.text "timestamps", size: :long t.text "tips", size: :long t.text "tips_spanish", size: :long - t.string "title", null: false + t.string "title" t.datetime "updated_at", precision: nil, null: false t.text "visualization", size: :long t.text "visualization_spanish", size: :long