Skip to content

Commit 05a4fb2

Browse files
committed
Enable Single Table Inheritable for PlatformInvitations
1 parent 39b0ffa commit 05a4fb2

File tree

2 files changed

+45
-11
lines changed

2 files changed

+45
-11
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
class AddTypeToBetterTogetherPlatformInvitation < ActiveRecord::Migration[7.1]
2+
def change
3+
add_column :better_together_platform_invitations, :type, :string, null: false, default: 'BetterTogether::PlatformInvitation'
4+
add_index :better_together_platform_invitations, :type, name: 'platform_invitations_by_type'
5+
end
6+
end

spec/dummy/db/schema.rb

Lines changed: 39 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#
1111
# It's strongly recommended that you check this file into your version control system.
1212

13-
ActiveRecord::Schema[7.1].define(version: 2025_02_28_154526) do
13+
ActiveRecord::Schema[7.1].define(version: 2025_03_05_213225) do
1414
# These are extensions that must be enabled in order to support this database
1515
enable_extension "pgcrypto"
1616
enable_extension "plpgsql"
@@ -68,7 +68,7 @@
6868
t.string "state_province_name"
6969
t.string "postal_code"
7070
t.string "country_name"
71-
t.string "privacy", limit: 50, default: "unlisted", null: false
71+
t.string "privacy", limit: 50, default: "private", null: false
7272
t.uuid "contact_detail_id", null: false
7373
t.boolean "primary_flag", default: false, null: false
7474
t.index ["contact_detail_id", "primary_flag"], name: "index_bt_addresses_on_contact_detail_id_and_primary", unique: true, where: "(primary_flag IS TRUE)"
@@ -143,7 +143,7 @@
143143
t.string "identifier", limit: 100, null: false
144144
t.boolean "host", default: false, null: false
145145
t.boolean "protected", default: false, null: false
146-
t.string "privacy", limit: 50, default: "public", null: false
146+
t.string "privacy", limit: 50, default: "private", null: false
147147
t.string "slug"
148148
t.uuid "creator_id"
149149
t.string "type", default: "BetterTogether::Community", null: false
@@ -178,7 +178,7 @@
178178
t.jsonb "media_settings", default: {}, null: false
179179
t.jsonb "content_data", default: {}
180180
t.uuid "creator_id"
181-
t.string "privacy", limit: 50, default: "unlisted", null: false
181+
t.string "privacy", limit: 50, default: "private", null: false
182182
t.boolean "visible", default: true, null: false
183183
t.jsonb "content_area_settings", default: {}, null: false
184184
t.index ["creator_id"], name: "by_better_together_content_blocks_creator"
@@ -233,7 +233,7 @@
233233
t.datetime "updated_at", null: false
234234
t.string "email", null: false
235235
t.string "label", null: false
236-
t.string "privacy", limit: 50, default: "unlisted", null: false
236+
t.string "privacy", limit: 50, default: "private", null: false
237237
t.uuid "contact_detail_id", null: false
238238
t.boolean "primary_flag", default: false, null: false
239239
t.index ["contact_detail_id", "primary_flag"], name: "index_bt_email_addresses_on_contact_detail_id_and_primary", unique: true, where: "(primary_flag IS TRUE)"
@@ -543,7 +543,7 @@
543543
t.text "meta_description"
544544
t.string "keywords"
545545
t.datetime "published_at"
546-
t.string "privacy", default: "public", null: false
546+
t.string "privacy", default: "private", null: false
547547
t.string "layout"
548548
t.string "template"
549549
t.uuid "sidebar_nav_id"
@@ -562,7 +562,7 @@
562562
t.string "slug"
563563
t.uuid "community_id", null: false
564564
t.jsonb "preferences", default: {}, null: false
565-
t.string "privacy", limit: 50, default: "unlisted", null: false
565+
t.string "privacy", limit: 50, default: "private", null: false
566566
t.index ["community_id"], name: "by_person_community"
567567
t.index ["identifier"], name: "index_better_together_people_on_identifier", unique: true
568568
t.index ["privacy"], name: "by_better_together_people_privacy"
@@ -624,7 +624,7 @@
624624
t.datetime "updated_at", null: false
625625
t.string "number", null: false
626626
t.string "label", null: false
627-
t.string "privacy", limit: 50, default: "unlisted", null: false
627+
t.string "privacy", limit: 50, default: "private", null: false
628628
t.uuid "contact_detail_id", null: false
629629
t.boolean "primary_flag", default: false, null: false
630630
t.index ["contact_detail_id", "primary_flag"], name: "index_bt_phone_numbers_on_contact_detail_id_and_primary", unique: true, where: "(primary_flag IS TRUE)"
@@ -649,6 +649,7 @@
649649
t.datetime "valid_until"
650650
t.datetime "last_sent"
651651
t.datetime "accepted_at"
652+
t.string "type", default: "BetterTogether::PlatformInvitation", null: false
652653
t.index ["community_role_id"], name: "platform_invitations_by_community_role"
653654
t.index ["invitable_id", "status"], name: "index_platform_invitations_on_invitable_id_and_status"
654655
t.index ["invitable_id"], name: "platform_invitations_by_invitable"
@@ -661,6 +662,7 @@
661662
t.index ["platform_role_id"], name: "platform_invitations_by_platform_role"
662663
t.index ["status"], name: "platform_invitations_by_status"
663664
t.index ["token"], name: "platform_invitations_by_token", unique: true
665+
t.index ["type"], name: "platform_invitations_by_type"
664666
t.index ["valid_from"], name: "platform_invitations_by_valid_from"
665667
t.index ["valid_until"], name: "platform_invitations_by_valid_until"
666668
end
@@ -672,7 +674,7 @@
672674
t.string "identifier", limit: 100, null: false
673675
t.boolean "host", default: false, null: false
674676
t.boolean "protected", default: false, null: false
675-
t.string "privacy", limit: 50, default: "public", null: false
677+
t.string "privacy", limit: 50, default: "private", null: false
676678
t.string "slug"
677679
t.uuid "community_id"
678680
t.string "url", null: false
@@ -743,14 +745,39 @@
743745
t.index ["slug"], name: "index_better_together_roles_on_slug", unique: true
744746
end
745747

748+
create_table "better_together_seeds", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
749+
t.integer "lock_version", default: 0, null: false
750+
t.datetime "created_at", null: false
751+
t.datetime "updated_at", null: false
752+
t.string "type", default: "BetterTogether::Seed", null: false
753+
t.string "seedable_type"
754+
t.uuid "seedable_id"
755+
t.uuid "creator_id"
756+
t.string "identifier", limit: 100, null: false
757+
t.string "privacy", limit: 50, default: "private", null: false
758+
t.string "version", null: false
759+
t.string "created_by", null: false
760+
t.datetime "seeded_at", null: false
761+
t.text "description", null: false
762+
t.jsonb "origin", null: false
763+
t.jsonb "payload", null: false
764+
t.index ["creator_id"], name: "by_better_together_seeds_creator"
765+
t.index ["identifier"], name: "index_better_together_seeds_on_identifier", unique: true
766+
t.index ["origin"], name: "index_better_together_seeds_on_origin", using: :gin
767+
t.index ["payload"], name: "index_better_together_seeds_on_payload", using: :gin
768+
t.index ["privacy"], name: "by_better_together_seeds_privacy"
769+
t.index ["seedable_type", "seedable_id"], name: "index_better_together_seeds_on_seedable"
770+
t.index ["type", "identifier"], name: "index_better_together_seeds_on_type_and_identifier", unique: true
771+
end
772+
746773
create_table "better_together_social_media_accounts", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
747774
t.integer "lock_version", default: 0, null: false
748775
t.datetime "created_at", null: false
749776
t.datetime "updated_at", null: false
750777
t.string "platform", null: false
751778
t.string "handle", null: false
752779
t.string "url"
753-
t.string "privacy", limit: 50, default: "public", null: false
780+
t.string "privacy", limit: 50, default: "private", null: false
754781
t.uuid "contact_detail_id", null: false
755782
t.index ["contact_detail_id", "platform"], name: "index_bt_sma_on_contact_detail_and_platform", unique: true
756783
t.index ["contact_detail_id"], name: "idx_on_contact_detail_id_6380b64b3b"
@@ -790,7 +817,7 @@
790817
t.datetime "updated_at", null: false
791818
t.string "url", null: false
792819
t.string "label", null: false
793-
t.string "privacy", limit: 50, default: "unlisted", null: false
820+
t.string "privacy", limit: 50, default: "private", null: false
794821
t.uuid "contact_detail_id", null: false
795822
t.index ["contact_detail_id"], name: "index_better_together_website_links_on_contact_detail_id"
796823
t.index ["privacy"], name: "by_better_together_website_links_privacy"
@@ -968,6 +995,7 @@
968995
add_foreign_key "better_together_platforms", "better_together_communities", column: "community_id"
969996
add_foreign_key "better_together_role_resource_permissions", "better_together_resource_permissions", column: "resource_permission_id"
970997
add_foreign_key "better_together_role_resource_permissions", "better_together_roles", column: "role_id"
998+
add_foreign_key "better_together_seeds", "better_together_people", column: "creator_id"
971999
add_foreign_key "better_together_social_media_accounts", "better_together_contact_details", column: "contact_detail_id"
9721000
add_foreign_key "better_together_website_links", "better_together_contact_details", column: "contact_detail_id"
9731001
add_foreign_key "better_together_wizard_step_definitions", "better_together_wizards", column: "wizard_id"

0 commit comments

Comments
 (0)