Skip to content

Commit cb5bb0c

Browse files
committed
feat(platform): add Creatable module to Platform class for creator association
feat(migration): add creator association to better_together_platforms table fix(schema): update schema version and add creator_id column with foreign key
1 parent abbeca2 commit cb5bb0c

File tree

3 files changed

+17
-2
lines changed

3 files changed

+17
-2
lines changed

app/models/better_together/platform.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ module BetterTogether
66
# Represents the host application and it's peers
77
class Platform < ApplicationRecord
88
include PlatformHost
9+
include Creatable
910
include Identifier
1011
include Joinable
1112
include Permissible
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# frozen_string_literal: true
2+
3+
# Adds creator association to platforms
4+
class AddCreatorToBetterTogetherPlatforms < ActiveRecord::Migration[8.0]
5+
def change
6+
change_table :better_together_platforms, bulk: true do |t|
7+
t.bt_creator :better_together_platforms
8+
end
9+
end
10+
end

spec/dummy/db/schema.rb

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

13-
ActiveRecord::Schema[7.2].define(version: 2025_09_06_172911) do
13+
ActiveRecord::Schema[8.0].define(version: 2025_11_07_222131) do
1414
# These are extensions that must be enabled in order to support this database
15+
enable_extension "pg_catalog.plpgsql"
1516
enable_extension "pgcrypto"
16-
enable_extension "plpgsql"
1717
enable_extension "postgis"
1818

1919
create_table "action_text_rich_texts", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
@@ -350,6 +350,7 @@
350350
t.string "privacy", limit: 50, default: "private", null: false
351351
t.boolean "visible", default: true, null: false
352352
t.jsonb "content_area_settings", default: {}, null: false
353+
t.boolean "protected", default: false, null: false
353354
t.index ["creator_id"], name: "by_better_together_content_blocks_creator"
354355
t.index ["privacy"], name: "by_better_together_content_blocks_privacy"
355356
end
@@ -1180,7 +1181,9 @@
11801181
t.string "url", null: false
11811182
t.string "time_zone", null: false
11821183
t.jsonb "settings", default: {}, null: false
1184+
t.uuid "creator_id"
11831185
t.index ["community_id"], name: "by_platform_community"
1186+
t.index ["creator_id"], name: "by_better_together_platforms_creator"
11841187
t.index ["host"], name: "index_better_together_platforms_on_host", unique: true, where: "(host IS TRUE)"
11851188
t.index ["identifier"], name: "index_better_together_platforms_on_identifier", unique: true
11861189
t.index ["privacy"], name: "by_platform_privacy"
@@ -1554,6 +1557,7 @@
15541557
add_foreign_key "better_together_platform_invitations", "better_together_roles", column: "community_role_id"
15551558
add_foreign_key "better_together_platform_invitations", "better_together_roles", column: "platform_role_id"
15561559
add_foreign_key "better_together_platforms", "better_together_communities", column: "community_id"
1560+
add_foreign_key "better_together_platforms", "better_together_people", column: "creator_id"
15571561
add_foreign_key "better_together_posts", "better_together_people", column: "creator_id"
15581562
add_foreign_key "better_together_reports", "better_together_people", column: "reporter_id"
15591563
add_foreign_key "better_together_role_resource_permissions", "better_together_resource_permissions", column: "resource_permission_id"

0 commit comments

Comments
 (0)