diff --git a/app/models/access.rb b/app/models/access.rb index 27026fb87..afdd6312f 100644 --- a/app/models/access.rb +++ b/app/models/access.rb @@ -1,4 +1,5 @@ class Access < ApplicationRecord + belongs_to :account, default: -> { user.account } belongs_to :board, touch: true belongs_to :user, touch: true diff --git a/app/models/account.rb b/app/models/account.rb index 46ba44213..ee2d6d85a 100644 --- a/app/models/account.rb +++ b/app/models/account.rb @@ -24,4 +24,8 @@ class Account < ApplicationRecord def slug "/#{external_account_id}" end + + def account + self + end end diff --git a/app/models/account/entropic.rb b/app/models/account/entropic.rb index e54af1432..b1303e0e2 100644 --- a/app/models/account/entropic.rb +++ b/app/models/account/entropic.rb @@ -5,6 +5,6 @@ module Account::Entropic included do has_one :entropy, as: :container, dependent: :destroy - after_create -> { create_entropy!(auto_postpone_period: DEFAULT_ENTROPY_PERIOD) } + after_create -> { create_entropy!(auto_postpone_period: DEFAULT_ENTROPY_PERIOD, account: self) } end end diff --git a/app/models/assignment.rb b/app/models/assignment.rb index 312bc3bf7..f60eb974d 100644 --- a/app/models/assignment.rb +++ b/app/models/assignment.rb @@ -1,4 +1,5 @@ class Assignment < ApplicationRecord + belongs_to :account, default: -> { card.account } belongs_to :card, touch: true belongs_to :assignee, class_name: "User" diff --git a/app/models/board/accessible.rb b/app/models/board/accessible.rb index 1302438e5..e4eb26e32 100644 --- a/app/models/board/accessible.rb +++ b/app/models/board/accessible.rb @@ -11,7 +11,7 @@ module Board::Accessible end def grant_to(users) - Access.insert_all Array(users).collect { |user| { id: ActiveRecord::Type::Uuid.generate, board_id: proxy_association.owner.id, user_id: user.id } } + Access.insert_all Array(users).collect { |user| { id: ActiveRecord::Type::Uuid.generate, board_id: proxy_association.owner.id, user_id: user.id, account_id: proxy_association.owner.account.id } } end def revoke_from(users) diff --git a/app/models/board/publication.rb b/app/models/board/publication.rb index a21fb00b6..bd480eecc 100644 --- a/app/models/board/publication.rb +++ b/app/models/board/publication.rb @@ -1,4 +1,5 @@ class Board::Publication < ApplicationRecord + belongs_to :account, default: -> { board.account } belongs_to :board has_secure_token :key diff --git a/app/models/card/activity_spike.rb b/app/models/card/activity_spike.rb index cbfbe906a..9bf9c29c6 100644 --- a/app/models/card/activity_spike.rb +++ b/app/models/card/activity_spike.rb @@ -1,3 +1,4 @@ class Card::ActivitySpike < ApplicationRecord + belongs_to :account, default: -> { card.account } belongs_to :card, touch: true end diff --git a/app/models/card/engagement.rb b/app/models/card/engagement.rb index e9a46428f..2f45543dc 100644 --- a/app/models/card/engagement.rb +++ b/app/models/card/engagement.rb @@ -1,4 +1,5 @@ class Card::Engagement < ApplicationRecord + belongs_to :account, default: -> { card.account } belongs_to :card, class_name: "::Card", touch: true validates :status, presence: true, inclusion: { in: %w[doing on_deck] } diff --git a/app/models/card/goldness.rb b/app/models/card/goldness.rb index fc2697328..96bf426af 100644 --- a/app/models/card/goldness.rb +++ b/app/models/card/goldness.rb @@ -1,3 +1,4 @@ class Card::Goldness < ApplicationRecord + belongs_to :account, default: -> { card.account } belongs_to :card, touch: true end diff --git a/app/models/card/not_now.rb b/app/models/card/not_now.rb index dcd16a86d..f99aaee9c 100644 --- a/app/models/card/not_now.rb +++ b/app/models/card/not_now.rb @@ -1,4 +1,5 @@ class Card::NotNow < ApplicationRecord + belongs_to :account, default: -> { card.account } belongs_to :card, class_name: "::Card", touch: true belongs_to :user, optional: true end diff --git a/app/models/closure.rb b/app/models/closure.rb index ec0a812fc..512de6667 100644 --- a/app/models/closure.rb +++ b/app/models/closure.rb @@ -1,4 +1,5 @@ class Closure < ApplicationRecord + belongs_to :account, default: -> { card.account } belongs_to :card, touch: true belongs_to :user, optional: true end diff --git a/app/models/entropy.rb b/app/models/entropy.rb index 6be6675ee..902e7732f 100644 --- a/app/models/entropy.rb +++ b/app/models/entropy.rb @@ -1,4 +1,5 @@ class Entropy < ApplicationRecord + belongs_to :account, default: -> { container.account } belongs_to :container, polymorphic: true after_commit -> { container.cards.touch_all } diff --git a/app/models/mention.rb b/app/models/mention.rb index 54a20e0ce..5491bfd9f 100644 --- a/app/models/mention.rb +++ b/app/models/mention.rb @@ -1,6 +1,7 @@ class Mention < ApplicationRecord include Notifiable + belongs_to :account, default: -> { source.account } belongs_to :source, polymorphic: true belongs_to :mentioner, class_name: "User" belongs_to :mentionee, class_name: "User", inverse_of: :mentions diff --git a/app/models/pin.rb b/app/models/pin.rb index 425a504bf..41bb28f99 100644 --- a/app/models/pin.rb +++ b/app/models/pin.rb @@ -1,4 +1,5 @@ class Pin < ApplicationRecord + belongs_to :account, default: -> { user.account } belongs_to :card belongs_to :user diff --git a/app/models/reaction.rb b/app/models/reaction.rb index d70f8333b..76edf152e 100644 --- a/app/models/reaction.rb +++ b/app/models/reaction.rb @@ -1,4 +1,5 @@ class Reaction < ApplicationRecord + belongs_to :account, default: -> { comment.account } belongs_to :comment, touch: true belongs_to :reacter, class_name: "User", default: -> { Current.user } diff --git a/app/models/search/query.rb b/app/models/search/query.rb index 0186cc424..d54142f9e 100644 --- a/app/models/search/query.rb +++ b/app/models/search/query.rb @@ -1,4 +1,7 @@ class Search::Query < ApplicationRecord + belongs_to :account, default: -> { user&.account || Current.account } + belongs_to :user, optional: true + validates :terms, presence: true before_validation :sanitize_terms diff --git a/app/models/tagging.rb b/app/models/tagging.rb index 73daa0879..0ed8df9f9 100644 --- a/app/models/tagging.rb +++ b/app/models/tagging.rb @@ -1,4 +1,5 @@ class Tagging < ApplicationRecord + belongs_to :account, default: -> { card.account } belongs_to :tag belongs_to :card, touch: true end diff --git a/app/models/user/accessor.rb b/app/models/user/accessor.rb index 1c7529b8e..352a9ecb2 100644 --- a/app/models/user/accessor.rb +++ b/app/models/user/accessor.rb @@ -12,6 +12,6 @@ module User::Accessor private def grant_access_to_boards - Access.insert_all account.boards.all_access.pluck(:id).collect { |board_id| { id: ActiveRecord::Type::Uuid.generate, board_id: board_id, user_id: id } } + Access.insert_all account.boards.all_access.pluck(:id).collect { |board_id| { id: ActiveRecord::Type::Uuid.generate, board_id: board_id, user_id: id, account_id: account.id } } end end diff --git a/app/models/user/settings.rb b/app/models/user/settings.rb index a381acae3..1651e9a64 100644 --- a/app/models/user/settings.rb +++ b/app/models/user/settings.rb @@ -1,4 +1,5 @@ class User::Settings < ApplicationRecord + belongs_to :account, default: -> { user.account } belongs_to :user enum :bundle_email_frequency, %i[ never every_few_hours daily weekly ], diff --git a/app/models/watch.rb b/app/models/watch.rb index 7b88a7ec4..9739075ec 100644 --- a/app/models/watch.rb +++ b/app/models/watch.rb @@ -1,4 +1,5 @@ class Watch < ApplicationRecord + belongs_to :account, default: -> { user.account } belongs_to :user belongs_to :card, touch: true diff --git a/app/models/webhook/delinquency_tracker.rb b/app/models/webhook/delinquency_tracker.rb index 1824db418..df6df706b 100644 --- a/app/models/webhook/delinquency_tracker.rb +++ b/app/models/webhook/delinquency_tracker.rb @@ -2,6 +2,7 @@ class Webhook::DelinquencyTracker < ApplicationRecord DELINQUENCY_THRESHOLD = 10 DELINQUENCY_DURATION = 1.hour + belongs_to :account, default: -> { webhook.account } belongs_to :webhook def record_delivery_of(delivery) diff --git a/app/models/webhook/delivery.rb b/app/models/webhook/delivery.rb index e90a8decb..05768e04a 100644 --- a/app/models/webhook/delivery.rb +++ b/app/models/webhook/delivery.rb @@ -10,6 +10,7 @@ class Webhook::Delivery < ApplicationRecord IPAddr.new("0.0.0.0/8") ].freeze + belongs_to :account, default: -> { webhook.account } belongs_to :webhook belongs_to :event diff --git a/config/initializers/uuid_framework_models.rb b/config/initializers/uuid_framework_models.rb index 68a6b9066..c0e900176 100644 --- a/config/initializers/uuid_framework_models.rb +++ b/config/initializers/uuid_framework_models.rb @@ -1,7 +1,14 @@ # Inject UUID primary key support into Rails framework models Rails.application.config.to_prepare do ActionText::RichText.attribute :id, :uuid, default: -> { ActiveRecord::Type::Uuid.generate } + ActionText::RichText.belongs_to :account, default: -> { record.account } + ActiveStorage::Attachment.attribute :id, :uuid, default: -> { ActiveRecord::Type::Uuid.generate } + ActiveStorage::Attachment.belongs_to :account, default: -> { record.account } + ActiveStorage::Blob.attribute :id, :uuid, default: -> { ActiveRecord::Type::Uuid.generate } + ActiveStorage::Blob.belongs_to :account, default: -> { Current.account } + ActiveStorage::VariantRecord.attribute :id, :uuid, default: -> { ActiveRecord::Type::Uuid.generate } + ActiveStorage::VariantRecord.belongs_to :account, default: -> { blob.account } end diff --git a/db/migrate/20251113160907_add_missing_account_id_columns.rb b/db/migrate/20251113160907_add_missing_account_id_columns.rb new file mode 100644 index 000000000..ab88b3676 --- /dev/null +++ b/db/migrate/20251113160907_add_missing_account_id_columns.rb @@ -0,0 +1,54 @@ +class AddMissingAccountIdColumns < ActiveRecord::Migration[8.2] + MISSING_TABLES= %w[ + accesses + assignments + board_publications + card_activity_spikes + card_engagements + card_goldnesses + card_not_nows + closures + entropies + mentions + pins + reactions + search_queries + taggings + user_settings + watches + webhook_delinquency_trackers + webhook_deliveries + + action_text_rich_texts + active_storage_attachments + active_storage_blobs + active_storage_variant_records + ] + + NOT_REQUIRED_TABLES = %w[ + account_join_codes + boards + cards + columns + comments + events + filters + notification_bundles + notifications + push_subscriptions + steps + tags + users + webhooks + ] + + def change + MISSING_TABLES.each do |table| + add_column table, "account_id", :uuid, null: false + end + + NOT_REQUIRED_TABLES.each do |table| + change_column table, "account_id", :uuid, null: false + end + end +end diff --git a/db/migrate/20251113163145_ensure_account_id_index.rb b/db/migrate/20251113163145_ensure_account_id_index.rb new file mode 100644 index 000000000..8834b4f4a --- /dev/null +++ b/db/migrate/20251113163145_ensure_account_id_index.rb @@ -0,0 +1,91 @@ +class EnsureAccountIdIndex < ActiveRecord::Migration[8.2] + def change + remove_index :accesses, :accessed_at + add_index :accesses, [:account_id, :accessed_at] + + remove_index :account_join_codes, :code + add_index :account_join_codes, [:account_id, :code], unique: true + + add_index :assignments, :account_id + + remove_index :board_publications, :key + add_index :board_publications, [:account_id, :key] + + add_index :boards, :account_id + + add_index :card_activity_spikes, :account_id + + remove_index :card_engagements, :status + add_index :card_engagements, [:account_id, :status] + + add_index :card_goldnesses, :account_id + + add_index :card_not_nows, :account_id + + remove_index :cards, [:last_active_at, :status] + add_index :cards, [:account_id, :last_active_at, :status] + + add_index :closures, :account_id + + add_index :columns, :account_id + + add_index :comments, :account_id + + add_index :entropies, :account_id + + remove_index :events, :action + add_index :events, [:account_id, :action] + + add_index :filters, :account_id + + add_index :mentions, :account_id + + add_index :notification_bundles, :account_id + + add_index :notifications, :account_id + + add_index :pins, :account_id + + add_index :push_subscriptions, :account_id + remove_index :push_subscriptions, :endpoint # duplicative because we always query [user_id, endpoint] + remove_index :push_subscriptions, [:endpoint, :p256dh_key, :auth_key] # duplicative and not necessary + remove_index :push_subscriptions, :user_agent # not necessary + remove_index :push_subscriptions, :user_id # duplicative of [user_id, endpoint] + + add_index :reactions, :account_id + + add_index :search_queries, :account_id + + add_index :steps, :account_id + + add_index :taggings, :account_id + + remove_index :tags, :title + add_index :tags, [:account_id, :title], unique: true + + add_index :user_settings, :account_id + + remove_index :users, :role + add_index :users, [:account_id, :role] + + add_index :watches, :account_id + + add_index :webhook_delinquency_trackers, :account_id + + add_index :webhook_deliveries, :account_id + + # For webhooks, I'm making an additional change to collapse board_id and subscribed_actions into + # a single index, since Triggerable only queries for `subscribed_actions` in conjunction with + # `board_id`. + add_index :webhooks, :account_id + remove_index :webhooks, :subscribed_actions + add_index :webhooks, [:board_id, :subscribed_actions], length: { subscribed_actions: 255 } + remove_index :webhooks, :board_id + + # Rails models + add_index :action_text_rich_texts, :account_id + add_index :active_storage_attachments, :account_id + add_index :active_storage_blobs, :account_id + add_index :active_storage_variant_records, :account_id + end +end diff --git a/db/schema.rb b/db/schema.rb index 305562fa2..144b2ce33 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,28 +10,29 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[8.2].define(version: 2025_11_13_111501) do +ActiveRecord::Schema[8.2].define(version: 2025_11_13_163145) do create_table "accesses", id: :uuid, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| t.datetime "accessed_at" + t.uuid "account_id", null: false t.uuid "board_id", null: false t.datetime "created_at", null: false t.string "involvement", default: "access_only", null: false t.datetime "updated_at", null: false t.uuid "user_id", null: false - t.index ["accessed_at"], name: "index_accesses_on_accessed_at", order: :desc + t.index ["account_id", "accessed_at"], name: "index_accesses_on_account_id_and_accessed_at" t.index ["board_id", "user_id"], name: "index_accesses_on_board_id_and_user_id", unique: true t.index ["board_id"], name: "index_accesses_on_board_id" t.index ["user_id"], name: "index_accesses_on_user_id" end create_table "account_join_codes", id: :uuid, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| - t.uuid "account_id" + t.uuid "account_id", null: false t.string "code", null: false t.datetime "created_at", null: false t.datetime "updated_at", null: false t.integer "usage_count", default: 0, null: false t.integer "usage_limit", default: 10, null: false - t.index ["code"], name: "index_account_join_codes_on_code", unique: true + t.index ["account_id", "code"], name: "index_account_join_codes_on_account_id_and_code", unique: true end create_table "accounts", id: :uuid, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| @@ -44,26 +45,31 @@ ActiveRecord::Schema[8.2].define(version: 2025_11_13_111501) do end create_table "action_text_rich_texts", id: :uuid, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| + t.uuid "account_id", null: false t.text "body", size: :long t.datetime "created_at", null: false t.string "name", null: false t.uuid "record_id", null: false t.string "record_type", null: false t.datetime "updated_at", null: false + t.index ["account_id"], name: "index_action_text_rich_texts_on_account_id" t.index ["record_type", "record_id", "name"], name: "index_action_text_rich_texts_uniqueness", unique: true end create_table "active_storage_attachments", id: :uuid, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| + t.uuid "account_id", null: false t.uuid "blob_id", null: false t.datetime "created_at", null: false t.string "name", null: false t.uuid "record_id", null: false t.string "record_type", null: false + t.index ["account_id"], name: "index_active_storage_attachments_on_account_id" t.index ["blob_id"], name: "index_active_storage_attachments_on_blob_id" t.index ["record_type", "record_id", "name", "blob_id"], name: "index_active_storage_attachments_uniqueness", unique: true end create_table "active_storage_blobs", id: :uuid, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| + t.uuid "account_id", null: false t.bigint "byte_size", null: false t.string "checksum" t.string "content_type" @@ -72,12 +78,15 @@ ActiveRecord::Schema[8.2].define(version: 2025_11_13_111501) do t.string "key", null: false t.text "metadata" t.string "service_name", null: false + t.index ["account_id"], name: "index_active_storage_blobs_on_account_id" t.index ["key"], name: "index_active_storage_blobs_on_key", unique: true end create_table "active_storage_variant_records", id: :uuid, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| + t.uuid "account_id", null: false t.uuid "blob_id", null: false t.string "variation_digest", null: false + t.index ["account_id"], name: "index_active_storage_variant_records_on_account_id" t.index ["blob_id", "variation_digest"], name: "index_active_storage_variant_records_uniqueness", unique: true end @@ -96,31 +105,35 @@ ActiveRecord::Schema[8.2].define(version: 2025_11_13_111501) do end create_table "assignments", id: :uuid, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| + t.uuid "account_id", null: false t.uuid "assignee_id", null: false t.uuid "assigner_id", null: false t.uuid "card_id", null: false t.datetime "created_at", null: false t.datetime "updated_at", null: false + t.index ["account_id"], name: "index_assignments_on_account_id" t.index ["assignee_id", "card_id"], name: "index_assignments_on_assignee_id_and_card_id", unique: true t.index ["card_id"], name: "index_assignments_on_card_id" end create_table "board_publications", id: :uuid, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| + t.uuid "account_id", null: false t.uuid "board_id", null: false t.datetime "created_at", null: false t.string "key" t.datetime "updated_at", null: false + t.index ["account_id", "key"], name: "index_board_publications_on_account_id_and_key" t.index ["board_id"], name: "index_board_publications_on_board_id" - t.index ["key"], name: "index_board_publications_on_key", unique: true end create_table "boards", id: :uuid, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| - t.uuid "account_id" + t.uuid "account_id", null: false t.boolean "all_access", default: false, null: false t.datetime "created_at", null: false t.uuid "creator_id", null: false t.string "name", null: false t.datetime "updated_at", null: false + t.index ["account_id"], name: "index_boards_on_account_id" t.index ["creator_id"], name: "index_boards_on_creator_id" end @@ -132,39 +145,46 @@ ActiveRecord::Schema[8.2].define(version: 2025_11_13_111501) do end create_table "card_activity_spikes", id: :uuid, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| + t.uuid "account_id", null: false t.uuid "card_id", null: false t.datetime "created_at", null: false t.datetime "updated_at", null: false + t.index ["account_id"], name: "index_card_activity_spikes_on_account_id" t.index ["card_id"], name: "index_card_activity_spikes_on_card_id" end create_table "card_engagements", id: :uuid, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| + t.uuid "account_id", null: false t.uuid "card_id" t.datetime "created_at", null: false t.string "status", default: "doing", null: false t.datetime "updated_at", null: false + t.index ["account_id", "status"], name: "index_card_engagements_on_account_id_and_status" t.index ["card_id"], name: "index_card_engagements_on_card_id" - t.index ["status"], name: "index_card_engagements_on_status" end create_table "card_goldnesses", id: :uuid, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| + t.uuid "account_id", null: false t.uuid "card_id", null: false t.datetime "created_at", null: false t.datetime "updated_at", null: false + t.index ["account_id"], name: "index_card_goldnesses_on_account_id" t.index ["card_id"], name: "index_card_goldnesses_on_card_id", unique: true end create_table "card_not_nows", id: :uuid, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| + t.uuid "account_id", null: false t.uuid "card_id", null: false t.datetime "created_at", null: false t.datetime "updated_at", null: false t.uuid "user_id" + t.index ["account_id"], name: "index_card_not_nows_on_account_id" t.index ["card_id"], name: "index_card_not_nows_on_card_id", unique: true t.index ["user_id"], name: "index_card_not_nows_on_user_id" end create_table "cards", id: :uuid, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| - t.uuid "account_id" + t.uuid "account_id", null: false t.uuid "board_id", null: false t.uuid "column_id" t.datetime "created_at", null: false @@ -175,10 +195,10 @@ ActiveRecord::Schema[8.2].define(version: 2025_11_13_111501) do t.string "status", default: "drafted", null: false t.string "title" t.datetime "updated_at", null: false + t.index ["account_id", "last_active_at", "status"], name: "index_cards_on_account_id_and_last_active_at_and_status" t.index ["account_id", "number"], name: "index_cards_on_account_id_and_number", unique: true t.index ["board_id"], name: "index_cards_on_board_id" t.index ["column_id"], name: "index_cards_on_column_id" - t.index ["last_active_at", "status"], name: "index_cards_on_last_active_at_and_status" end create_table "closers_filters", id: false, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| @@ -189,33 +209,37 @@ ActiveRecord::Schema[8.2].define(version: 2025_11_13_111501) do end create_table "closures", id: :uuid, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| + t.uuid "account_id", null: false t.uuid "card_id", null: false t.datetime "created_at", null: false t.datetime "updated_at", null: false t.uuid "user_id" + t.index ["account_id"], name: "index_closures_on_account_id" t.index ["card_id", "created_at"], name: "index_closures_on_card_id_and_created_at" t.index ["card_id"], name: "index_closures_on_card_id", unique: true t.index ["user_id"], name: "index_closures_on_user_id" end create_table "columns", id: :uuid, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| - t.uuid "account_id" + t.uuid "account_id", null: false t.uuid "board_id", null: false t.string "color", null: false t.datetime "created_at", null: false t.string "name", null: false t.integer "position", default: 0, null: false t.datetime "updated_at", null: false + t.index ["account_id"], name: "index_columns_on_account_id" t.index ["board_id", "position"], name: "index_columns_on_board_id_and_position" t.index ["board_id"], name: "index_columns_on_board_id" end create_table "comments", id: :uuid, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| - t.uuid "account_id" + t.uuid "account_id", null: false t.uuid "card_id", null: false t.datetime "created_at", null: false t.uuid "creator_id", null: false t.datetime "updated_at", null: false + t.index ["account_id"], name: "index_comments_on_account_id" t.index ["card_id"], name: "index_comments_on_card_id" end @@ -227,17 +251,19 @@ ActiveRecord::Schema[8.2].define(version: 2025_11_13_111501) do end create_table "entropies", id: :uuid, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| + t.uuid "account_id", null: false t.bigint "auto_postpone_period", default: 2592000, null: false t.uuid "container_id", null: false t.string "container_type", null: false t.datetime "created_at", null: false t.datetime "updated_at", null: false + t.index ["account_id"], name: "index_entropies_on_account_id" t.index ["container_type", "container_id", "auto_postpone_period"], name: "idx_on_container_type_container_id_auto_postpone_pe_3d79b50517" t.index ["container_type", "container_id"], name: "index_entropy_configurations_on_container", unique: true end create_table "events", id: :uuid, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| - t.uuid "account_id" + t.uuid "account_id", null: false t.string "action", null: false t.uuid "board_id", null: false t.datetime "created_at", null: false @@ -246,7 +272,7 @@ ActiveRecord::Schema[8.2].define(version: 2025_11_13_111501) do t.string "eventable_type", null: false t.json "particulars", default: -> { "(json_object())" } t.datetime "updated_at", null: false - t.index ["action"], name: "index_events_on_summary_id_and_action" + t.index ["account_id", "action"], name: "index_events_on_account_id_and_action" t.index ["board_id", "action", "created_at"], name: "index_events_on_board_id_and_action_and_created_at" t.index ["board_id"], name: "index_events_on_board_id" t.index ["creator_id"], name: "index_events_on_creator_id" @@ -254,12 +280,13 @@ ActiveRecord::Schema[8.2].define(version: 2025_11_13_111501) do end create_table "filters", id: :uuid, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| - t.uuid "account_id" + t.uuid "account_id", null: false t.datetime "created_at", null: false t.uuid "creator_id", null: false t.json "fields", default: -> { "(json_object())" }, null: false t.string "params_digest", null: false t.datetime "updated_at", null: false + t.index ["account_id"], name: "index_filters_on_account_id" t.index ["creator_id", "params_digest"], name: "index_filters_on_creator_id_and_params_digest", unique: true end @@ -289,32 +316,35 @@ ActiveRecord::Schema[8.2].define(version: 2025_11_13_111501) do end create_table "mentions", id: :uuid, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| + t.uuid "account_id", null: false t.datetime "created_at", null: false t.uuid "mentionee_id", null: false t.uuid "mentioner_id", null: false t.uuid "source_id", null: false t.string "source_type", null: false t.datetime "updated_at", null: false + t.index ["account_id"], name: "index_mentions_on_account_id" t.index ["mentionee_id"], name: "index_mentions_on_mentionee_id" t.index ["mentioner_id"], name: "index_mentions_on_mentioner_id" t.index ["source_type", "source_id"], name: "index_mentions_on_source" end create_table "notification_bundles", id: :uuid, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| - t.uuid "account_id" + t.uuid "account_id", null: false t.datetime "created_at", null: false t.datetime "ends_at", null: false t.datetime "starts_at", null: false t.integer "status", default: 0, null: false t.datetime "updated_at", null: false t.uuid "user_id", null: false + t.index ["account_id"], name: "index_notification_bundles_on_account_id" t.index ["ends_at", "status"], name: "index_notification_bundles_on_ends_at_and_status" t.index ["user_id", "starts_at", "ends_at"], name: "idx_on_user_id_starts_at_ends_at_7eae5d3ac5" t.index ["user_id", "status"], name: "index_notification_bundles_on_user_id_and_status" end create_table "notifications", id: :uuid, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| - t.uuid "account_id" + t.uuid "account_id", null: false t.datetime "created_at", null: false t.uuid "creator_id" t.datetime "read_at" @@ -322,6 +352,7 @@ ActiveRecord::Schema[8.2].define(version: 2025_11_13_111501) do t.string "source_type", null: false t.datetime "updated_at", null: false t.uuid "user_id", null: false + t.index ["account_id"], name: "index_notifications_on_account_id" t.index ["creator_id"], name: "index_notifications_on_creator_id" t.index ["source_type", "source_id"], name: "index_notifications_on_source" t.index ["user_id", "read_at", "created_at"], name: "index_notifications_on_user_id_and_read_at_and_created_at", order: { read_at: :desc, created_at: :desc } @@ -329,17 +360,19 @@ ActiveRecord::Schema[8.2].define(version: 2025_11_13_111501) do end create_table "pins", id: :uuid, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| + t.uuid "account_id", null: false t.uuid "card_id", null: false t.datetime "created_at", null: false t.datetime "updated_at", null: false t.uuid "user_id", null: false + t.index ["account_id"], name: "index_pins_on_account_id" t.index ["card_id", "user_id"], name: "index_pins_on_card_id_and_user_id", unique: true t.index ["card_id"], name: "index_pins_on_card_id" t.index ["user_id"], name: "index_pins_on_user_id" end create_table "push_subscriptions", id: :uuid, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| - t.uuid "account_id" + t.uuid "account_id", null: false t.string "auth_key" t.datetime "created_at", null: false t.string "endpoint" @@ -347,19 +380,18 @@ ActiveRecord::Schema[8.2].define(version: 2025_11_13_111501) do t.datetime "updated_at", null: false t.string "user_agent" t.uuid "user_id", null: false - t.index ["endpoint", "p256dh_key", "auth_key"], name: "idx_on_endpoint_p256dh_key_auth_key_7553014576" - t.index ["endpoint"], name: "index_push_subscriptions_on_endpoint" - t.index ["user_agent"], name: "index_push_subscriptions_on_user_agent" + t.index ["account_id"], name: "index_push_subscriptions_on_account_id" t.index ["user_id", "endpoint"], name: "index_push_subscriptions_on_user_id_and_endpoint", unique: true - t.index ["user_id"], name: "index_push_subscriptions_on_user_id" end create_table "reactions", id: :uuid, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| + t.uuid "account_id", null: false t.uuid "comment_id", null: false t.string "content", limit: 16, null: false t.datetime "created_at", null: false t.uuid "reacter_id", null: false t.datetime "updated_at", null: false + t.index ["account_id"], name: "index_reactions_on_account_id" t.index ["comment_id"], name: "index_reactions_on_comment_id" t.index ["reacter_id"], name: "index_reactions_on_reacter_id" end @@ -557,10 +589,12 @@ ActiveRecord::Schema[8.2].define(version: 2025_11_13_111501) do end create_table "search_queries", id: :uuid, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| + t.uuid "account_id", null: false t.datetime "created_at", null: false t.string "terms", limit: 2000, null: false t.datetime "updated_at", null: false t.uuid "user_id", null: false + t.index ["account_id"], name: "index_search_queries_on_account_id" t.index ["user_id", "terms"], name: "index_search_queries_on_user_id_and_terms", length: { terms: 255 } t.index ["user_id", "updated_at"], name: "index_search_queries_on_user_id_and_updated_at", unique: true t.index ["user_id"], name: "index_search_queries_on_user_id" @@ -581,76 +615,86 @@ ActiveRecord::Schema[8.2].define(version: 2025_11_13_111501) do end create_table "steps", id: :uuid, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| - t.uuid "account_id" + t.uuid "account_id", null: false t.uuid "card_id", null: false t.boolean "completed", default: false, null: false t.text "content", null: false t.datetime "created_at", null: false t.datetime "updated_at", null: false + t.index ["account_id"], name: "index_steps_on_account_id" t.index ["card_id", "completed"], name: "index_steps_on_card_id_and_completed" t.index ["card_id"], name: "index_steps_on_card_id" end create_table "taggings", id: :uuid, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| + t.uuid "account_id", null: false t.uuid "card_id", null: false t.datetime "created_at", null: false t.uuid "tag_id", null: false t.datetime "updated_at", null: false + t.index ["account_id"], name: "index_taggings_on_account_id" t.index ["card_id", "tag_id"], name: "index_taggings_on_card_id_and_tag_id", unique: true t.index ["tag_id"], name: "index_taggings_on_tag_id" end create_table "tags", id: :uuid, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| - t.uuid "account_id" + t.uuid "account_id", null: false t.datetime "created_at", null: false t.string "title" t.datetime "updated_at", null: false - t.index ["title"], name: "index_tags_on_title", unique: true + t.index ["account_id", "title"], name: "index_tags_on_account_id_and_title", unique: true end create_table "user_settings", id: :uuid, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| + t.uuid "account_id", null: false t.integer "bundle_email_frequency", default: 0, null: false t.datetime "created_at", null: false t.string "timezone_name" t.datetime "updated_at", null: false t.uuid "user_id", null: false + t.index ["account_id"], name: "index_user_settings_on_account_id" t.index ["user_id", "bundle_email_frequency"], name: "index_user_settings_on_user_id_and_bundle_email_frequency" t.index ["user_id"], name: "index_user_settings_on_user_id" end create_table "users", id: :uuid, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| - t.uuid "account_id" + t.uuid "account_id", null: false t.boolean "active", default: true, null: false t.datetime "created_at", null: false t.uuid "identity_id" t.string "name", null: false t.string "role", default: "member", null: false t.datetime "updated_at", null: false + t.index ["account_id", "role"], name: "index_users_on_account_id_and_role" t.index ["identity_id"], name: "index_users_on_identity_id" - t.index ["role"], name: "index_users_on_role" end create_table "watches", id: :uuid, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| + t.uuid "account_id", null: false t.uuid "card_id", null: false t.datetime "created_at", null: false t.datetime "updated_at", null: false t.uuid "user_id", null: false t.boolean "watching", default: true, null: false + t.index ["account_id"], name: "index_watches_on_account_id" t.index ["card_id"], name: "index_watches_on_card_id" t.index ["user_id", "card_id"], name: "index_watches_on_user_id_and_card_id" t.index ["user_id"], name: "index_watches_on_user_id" end create_table "webhook_delinquency_trackers", id: :uuid, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| + t.uuid "account_id", null: false t.integer "consecutive_failures_count", default: 0 t.datetime "created_at", null: false t.datetime "first_failure_at" t.datetime "updated_at", null: false t.uuid "webhook_id", null: false + t.index ["account_id"], name: "index_webhook_delinquency_trackers_on_account_id" t.index ["webhook_id"], name: "index_webhook_delinquency_trackers_on_webhook_id" end create_table "webhook_deliveries", id: :uuid, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| + t.uuid "account_id", null: false t.datetime "created_at", null: false t.uuid "event_id", null: false t.text "request" @@ -658,12 +702,13 @@ ActiveRecord::Schema[8.2].define(version: 2025_11_13_111501) do t.string "state", null: false t.datetime "updated_at", null: false t.uuid "webhook_id", null: false + t.index ["account_id"], name: "index_webhook_deliveries_on_account_id" t.index ["event_id"], name: "index_webhook_deliveries_on_event_id" t.index ["webhook_id"], name: "index_webhook_deliveries_on_webhook_id" end create_table "webhooks", id: :uuid, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| - t.uuid "account_id" + t.uuid "account_id", null: false t.boolean "active", default: true, null: false t.uuid "board_id", null: false t.datetime "created_at", null: false @@ -672,8 +717,8 @@ ActiveRecord::Schema[8.2].define(version: 2025_11_13_111501) do t.text "subscribed_actions" t.datetime "updated_at", null: false t.text "url", null: false - t.index ["board_id"], name: "index_webhooks_on_board_id" - t.index ["subscribed_actions"], name: "index_webhooks_on_subscribed_actions", length: 255 + t.index ["account_id"], name: "index_webhooks_on_account_id" + t.index ["board_id", "subscribed_actions"], name: "index_webhooks_on_board_id_and_subscribed_actions", length: { subscribed_actions: 255 } end add_foreign_key "active_storage_attachments", "active_storage_blobs", column: "blob_id" diff --git a/script/import-sqlite-database.rb b/script/import-sqlite-database.rb index 73547f4ed..4155a985a 100755 --- a/script/import-sqlite-database.rb +++ b/script/import-sqlite-database.rb @@ -270,6 +270,7 @@ class Import if old_activity_spike activity_spikes_to_insert << { id: generate_uuid, + account_id: account.id, card_id: new_id, created_at: old_activity_spike.created_at, updated_at: old_activity_spike.updated_at @@ -280,6 +281,7 @@ class Import if old_engagement engagements_to_insert << { id: generate_uuid, + account_id: account.id, card_id: new_id, status: old_engagement.status, created_at: old_engagement.created_at, @@ -291,6 +293,7 @@ class Import if old_goldness goldnesses_to_insert << { id: generate_uuid, + account_id: account.id, card_id: new_id, created_at: old_goldness.created_at, updated_at: old_goldness.updated_at @@ -301,6 +304,7 @@ class Import if old_not_now not_nows_to_insert << { id: generate_uuid, + account_id: account.id, card_id: new_id, user_id: old_not_now.user_id ? mapping[:users][old_not_now.user_id] : nil, created_at: old_not_now.created_at, @@ -311,6 +315,7 @@ class Import old_card.assignments.each do |old_assignment| assignments_to_insert << { id: generate_uuid, + account_id: account.id, card_id: new_id, assignee_id: mapping[:users][old_assignment.assignee_id], assigner_id: mapping[:users][old_assignment.assigner_id], @@ -323,6 +328,7 @@ class Import if old_closure closures_to_insert << { id: generate_uuid, + account_id: account.id, card_id: new_id, user_id: old_closure.user_id ? mapping[:users][old_closure.user_id] : nil, created_at: old_closure.created_at, @@ -442,6 +448,7 @@ class Import accesses_to_insert << { id: new_id, + account_id: account.id, board_id: mapping[:boards][old_access.board_id], user_id: mapping[:users][old_access.user_id], involvement: old_access.involvement, @@ -701,6 +708,7 @@ class Import ActiveStorage::VariantRecord.find_or_create_by!( id: new_variant_blob.id, + account_id: account.id, blob_id: new_blob.id, variation_digest: old_variant_record.variation_digest ) @@ -772,6 +780,7 @@ class Import watches_to_insert << { id: new_id, + account_id: account.id, user_id: mapping[:users][old_watch.user_id], card_id: mapping[:cards][old_watch.card_id], watching: old_watch.watching, @@ -800,6 +809,7 @@ class Import pins_to_insert << { id: new_id, + account_id: account.id, user_id: mapping[:users][old_pin.user_id], card_id: mapping[:cards][old_pin.card_id], created_at: old_pin.created_at, diff --git a/test/fixtures/accesses.yml b/test/fixtures/accesses.yml index 50df4355e..25800f47b 100644 --- a/test/fixtures/accesses.yml +++ b/test/fixtures/accesses.yml @@ -1,19 +1,23 @@ writebook_david: id: <%= ActiveRecord::FixtureSet.identify("writebook_david", :uuid) %> + account: 37s_uuid board: writebook_uuid user: david_uuid writebook_jz: id: <%= ActiveRecord::FixtureSet.identify("writebook_jz", :uuid) %> + account: 37s_uuid board: writebook_uuid user: jz_uuid writebook_kevin: id: <%= ActiveRecord::FixtureSet.identify("writebook_kevin", :uuid) %> + account: 37s_uuid board: writebook_uuid user: kevin_uuid private_kevin: id: <%= ActiveRecord::FixtureSet.identify("private_kevin", :uuid) %> + account: 37s_uuid board: private_uuid user: kevin_uuid diff --git a/test/fixtures/action_text/rich_texts.yml b/test/fixtures/action_text/rich_texts.yml index 1e223ab8d..82f5cd20b 100644 --- a/test/fixtures/action_text/rich_texts.yml +++ b/test/fixtures/action_text/rich_texts.yml @@ -1,32 +1,20 @@ logo_agreement_jz: id: <%= ActiveRecord::FixtureSet.identify("logo_agreement_jz_rich_text", :uuid) %> + account: 37s_uuid record: logo_agreement_jz_uuid (Comment) name: body body: I agree. logo_agreement_kevin: id: <%= ActiveRecord::FixtureSet.identify("logo_agreement_kevin_rich_text", :uuid) %> + account: 37s_uuid record: logo_agreement_kevin_uuid (Comment) name: body body: Same, let's do it. layout_overflowing_david: id: <%= ActiveRecord::FixtureSet.identify("layout_overflowing_david_rich_text", :uuid) %> + account: 37s_uuid record: layout_overflowing_david_uuid (Comment) name: body body: The text is overflowing the container. - -kevins_conversation_question: - record: kevins_question (Conversation::Message) - name: content - body: "Who is on a hot-streak?" - -kevins_conversation_answer: - record: kevins_answer (Conversation::Message) - name: content - body: "David is on a hot-streak. He has recently added many cards to Writebook." - -davids_conversation_question: - record: davids_question (Conversation::Message) - name: content - body: "What is the meaning of life, the Universe, and everything else?" diff --git a/test/fixtures/assignments.yml b/test/fixtures/assignments.yml index b341b2516..0777f70a2 100644 --- a/test/fixtures/assignments.yml +++ b/test/fixtures/assignments.yml @@ -1,5 +1,6 @@ logo_jz: id: <%= ActiveRecord::FixtureSet.identify("logo_jz", :uuid) %> + account: 37s_uuid assigner: david_uuid assignee: jz_uuid card: logo_uuid @@ -7,6 +8,7 @@ logo_jz: logo_kevin: id: <%= ActiveRecord::FixtureSet.identify("logo_kevin", :uuid) %> + account: 37s_uuid assigner: david_uuid assignee: kevin_uuid card: logo_uuid @@ -14,6 +16,7 @@ logo_kevin: layout_jz: id: <%= ActiveRecord::FixtureSet.identify("layout_jz", :uuid) %> + account: 37s_uuid assigner: david_uuid assignee: jz_uuid card: layout_uuid diff --git a/test/fixtures/card/engagements.yml b/test/fixtures/card/engagements.yml index 3a1b4b870..8c96bd4b5 100644 --- a/test/fixtures/card/engagements.yml +++ b/test/fixtures/card/engagements.yml @@ -1,3 +1,4 @@ logo: id: <%= ActiveRecord::FixtureSet.identify("logo_engagement", :uuid) %> + account: 37s_uuid card: logo_uuid diff --git a/test/fixtures/card/goldnesses.yml b/test/fixtures/card/goldnesses.yml index 57cbc112e..f47389d60 100644 --- a/test/fixtures/card/goldnesses.yml +++ b/test/fixtures/card/goldnesses.yml @@ -1,3 +1,4 @@ logo: id: <%= ActiveRecord::FixtureSet.identify("logo_goldness", :uuid) %> + account: 37s_uuid card: logo_uuid diff --git a/test/fixtures/closures.yml b/test/fixtures/closures.yml index f502bb006..573e526c0 100644 --- a/test/fixtures/closures.yml +++ b/test/fixtures/closures.yml @@ -1,4 +1,5 @@ shipping: id: <%= ActiveRecord::FixtureSet.identify("shipping_closure", :uuid) %> + account: 37s_uuid card: shipping_uuid - user: kevin_uuid \ No newline at end of file + user: kevin_uuid diff --git a/test/fixtures/entropies.yml b/test/fixtures/entropies.yml index f294a5d91..2f66e05ef 100644 --- a/test/fixtures/entropies.yml +++ b/test/fixtures/entropies.yml @@ -1,14 +1,17 @@ 37s_account: id: <%= ActiveRecord::FixtureSet.identify("37s_account", :uuid) %> + account: 37s_uuid container: 37s_uuid (Account) auto_postpone_period: <%= 30.days.to_i %> writebook_board: id: <%= ActiveRecord::FixtureSet.identify("writebook_board", :uuid) %> + account: 37s_uuid container: writebook_uuid (Board) auto_postpone_period: <%= 90.days.to_i %> private_board: id: <%= ActiveRecord::FixtureSet.identify("private_board", :uuid) %> + account: 37s_uuid container: private_uuid (Board) auto_postpone_period: <%= 30.days.to_i %> diff --git a/test/fixtures/mentions.yml b/test/fixtures/mentions.yml index db37f5bc5..aa54dd720 100644 --- a/test/fixtures/mentions.yml +++ b/test/fixtures/mentions.yml @@ -1,11 +1,13 @@ logo_card_david_mention_by_jz: id: <%= ActiveRecord::FixtureSet.identify("logo_card_david_mention_by_jz", :uuid) %> + account: 37s_uuid source: logo_uuid (Card) mentioner: jz_uuid mentionee: david_uuid logo_comment_david_mention_by_jz: id: <%= ActiveRecord::FixtureSet.identify("logo_comment_david_mention_by_jz", :uuid) %> + account: 37s_uuid source: logo_agreement_jz_uuid (Comment) mentioner: jz_uuid mentionee: david_uuid diff --git a/test/fixtures/pins.yml b/test/fixtures/pins.yml index 0e279e375..15de01498 100644 --- a/test/fixtures/pins.yml +++ b/test/fixtures/pins.yml @@ -1,9 +1,11 @@ logo_kevin: id: <%= ActiveRecord::FixtureSet.identify("logo_kevin_pin", :uuid) %> + account: 37s_uuid card: logo_uuid user: kevin_uuid shipping_kevin: id: <%= ActiveRecord::FixtureSet.identify("shipping_kevin_pin", :uuid) %> + account: 37s_uuid card: shipping_uuid - user: kevin_uuid \ No newline at end of file + user: kevin_uuid diff --git a/test/fixtures/reactions.yml b/test/fixtures/reactions.yml index 589aa1114..16714c601 100644 --- a/test/fixtures/reactions.yml +++ b/test/fixtures/reactions.yml @@ -1,11 +1,13 @@ kevin: id: <%= ActiveRecord::FixtureSet.identify("kevin_reaction", :uuid) %> + account: 37s_uuid content: "👍" comment: logo_agreement_jz_uuid reacter: kevin_uuid david: id: <%= ActiveRecord::FixtureSet.identify("david_reaction", :uuid) %> + account: 37s_uuid content: "👍" comment: logo_agreement_jz_uuid reacter: david_uuid diff --git a/test/fixtures/taggings.yml b/test/fixtures/taggings.yml index c68ec92be..70b82ad8f 100644 --- a/test/fixtures/taggings.yml +++ b/test/fixtures/taggings.yml @@ -1,19 +1,23 @@ logo_web: id: <%= ActiveRecord::FixtureSet.identify("logo_web_tagging", :uuid) %> + account: 37s_uuid card: logo_uuid tag: web_uuid layout_web: id: <%= ActiveRecord::FixtureSet.identify("layout_web_tagging", :uuid) %> + account: 37s_uuid card: layout_uuid tag: web_uuid layout_mobile: id: <%= ActiveRecord::FixtureSet.identify("layout_mobile_tagging", :uuid) %> + account: 37s_uuid card: layout_uuid tag: mobile_uuid text_mobile: id: <%= ActiveRecord::FixtureSet.identify("text_mobile_tagging", :uuid) %> + account: 37s_uuid card: text_uuid tag: mobile_uuid diff --git a/test/fixtures/user/settings.yml b/test/fixtures/user/settings.yml index 3c31a0b13..ecfc80065 100644 --- a/test/fixtures/user/settings.yml +++ b/test/fixtures/user/settings.yml @@ -3,20 +3,24 @@ _fixture: david_settings: id: <%= ActiveRecord::FixtureSet.identify("david_settings", :uuid) %> + account: 37s_uuid user: david_uuid bundle_email_frequency: never jz_settings: id: <%= ActiveRecord::FixtureSet.identify("jz_settings", :uuid) %> + account: 37s_uuid user: jz_uuid bundle_email_frequency: never kevin_settings: id: <%= ActiveRecord::FixtureSet.identify("kevin_settings", :uuid) %> + account: 37s_uuid user: kevin_uuid bundle_email_frequency: never system_settings: id: <%= ActiveRecord::FixtureSet.identify("system_settings", :uuid) %> + account: 37s_uuid user: system_uuid bundle_email_frequency: never diff --git a/test/fixtures/watches.yml b/test/fixtures/watches.yml index b668c80e0..e274dc362 100644 --- a/test/fixtures/watches.yml +++ b/test/fixtures/watches.yml @@ -1,53 +1,62 @@ logo_david: id: <%= ActiveRecord::FixtureSet.identify("logo_david_watch", :uuid) %> + account: 37s_uuid card: logo_uuid user: david_uuid watching: true logo_kevin: id: <%= ActiveRecord::FixtureSet.identify("logo_kevin_watch", :uuid) %> + account: 37s_uuid card: logo_uuid user: kevin_uuid watching: true layout_david: id: <%= ActiveRecord::FixtureSet.identify("layout_david_watch", :uuid) %> + account: 37s_uuid card: layout_uuid user: david_uuid watching: true layout_kevin: id: <%= ActiveRecord::FixtureSet.identify("layout_kevin_watch", :uuid) %> + account: 37s_uuid card: layout_uuid user: kevin_uuid watching: true text_david: id: <%= ActiveRecord::FixtureSet.identify("text_david_watch", :uuid) %> + account: 37s_uuid card: text_uuid user: david_uuid watching: true text_jz: id: <%= ActiveRecord::FixtureSet.identify("text_jz_watch", :uuid) %> + account: 37s_uuid card: text_uuid user: jz_uuid watching: true shipping_david: id: <%= ActiveRecord::FixtureSet.identify("shipping_david_watch", :uuid) %> + account: 37s_uuid card: shipping_uuid user: david_uuid watching: true shipping_jz: id: <%= ActiveRecord::FixtureSet.identify("shipping_jz_watch", :uuid) %> + account: 37s_uuid card: shipping_uuid user: jz_uuid watching: true shipping_kevin: id: <%= ActiveRecord::FixtureSet.identify("shipping_kevin_watch", :uuid) %> + account: 37s_uuid card: shipping_uuid user: kevin_uuid watching: true diff --git a/test/fixtures/webhook/delinquency_trackers.yml b/test/fixtures/webhook/delinquency_trackers.yml index 7cf0610de..ea3fe284f 100644 --- a/test/fixtures/webhook/delinquency_trackers.yml +++ b/test/fixtures/webhook/delinquency_trackers.yml @@ -2,12 +2,14 @@ active_webhook_tracker: id: <%= ActiveRecord::FixtureSet.identify("active_webhook_tracker", :uuid) %> + account: 37s_uuid webhook: active_uuid consecutive_failures_count: 1 first_failure_at: <%= 1.hour.ago %> inactive_webhook_tracker: id: <%= ActiveRecord::FixtureSet.identify("inactive_webhook_tracker", :uuid) %> + account: 37s_uuid webhook: inactive_uuid consecutive_failures_count: 1 first_failure_at: <%= 1.hour.ago %> diff --git a/test/fixtures/webhook/deliveries.yml b/test/fixtures/webhook/deliveries.yml index 678421e24..b30f93daf 100644 --- a/test/fixtures/webhook/deliveries.yml +++ b/test/fixtures/webhook/deliveries.yml @@ -2,6 +2,7 @@ successfully_completed: id: <%= ActiveRecord::FixtureSet.identify("successfully_completed_delivery", :uuid) %> + account: 37s_uuid webhook: active_uuid event: logo_published_uuid state: completed @@ -11,6 +12,7 @@ successfully_completed: unsuccessfully_completed: id: <%= ActiveRecord::FixtureSet.identify("unsuccessfully_completed_delivery", :uuid) %> + account: 37s_uuid webhook: active_uuid event: logo_assignment_jz_uuid state: completed @@ -20,6 +22,7 @@ unsuccessfully_completed: errored: id: <%= ActiveRecord::FixtureSet.identify("errored_delivery", :uuid) %> + account: 37s_uuid webhook: active_uuid event: layout_published_uuid state: errored @@ -29,6 +32,7 @@ errored: pending: id: <%= ActiveRecord::FixtureSet.identify("pending_delivery", :uuid) %> + account: 37s_uuid webhook: active_uuid event: shipping_closed_uuid state: pending @@ -38,6 +42,7 @@ pending: in_progress: id: <%= ActiveRecord::FixtureSet.identify("in_progress_delivery", :uuid) %> + account: 37s_uuid webhook: active_uuid event: logo_assignment_km_uuid state: in_progress