diff --git a/app/models/access.rb b/app/models/access.rb index 27026fb87..8314cf87d 100644 --- a/app/models/access.rb +++ b/app/models/access.rb @@ -1,4 +1,4 @@ -class Access < ApplicationRecord +class Access < AccountScopedRecord belongs_to :board, touch: true belongs_to :user, touch: true diff --git a/app/models/account.rb b/app/models/account.rb index 46ba44213..279665aa8 100644 --- a/app/models/account.rb +++ b/app/models/account.rb @@ -1,4 +1,4 @@ -class Account < ApplicationRecord +class Account < AccountScopedRecord include Entropic, Seedeable has_one :join_code diff --git a/app/models/account/join_code.rb b/app/models/account/join_code.rb index 49fe9af22..3e9efc277 100644 --- a/app/models/account/join_code.rb +++ b/app/models/account/join_code.rb @@ -1,4 +1,4 @@ -class Account::JoinCode < ApplicationRecord +class Account::JoinCode < AccountScopedRecord CODE_LENGTH = 12 belongs_to :account diff --git a/app/models/account_scoped_record.rb b/app/models/account_scoped_record.rb new file mode 100644 index 000000000..9b060b01a --- /dev/null +++ b/app/models/account_scoped_record.rb @@ -0,0 +1,5 @@ +class AccountScopedRecord < ApplicationRecord + self.abstract_class = true + + include UuidPrimaryKey +end diff --git a/app/models/assignment.rb b/app/models/assignment.rb index 312bc3bf7..21cb90386 100644 --- a/app/models/assignment.rb +++ b/app/models/assignment.rb @@ -1,4 +1,4 @@ -class Assignment < ApplicationRecord +class Assignment < AccountScopedRecord belongs_to :card, touch: true belongs_to :assignee, class_name: "User" diff --git a/app/models/board.rb b/app/models/board.rb index 4b5752604..238d6929a 100644 --- a/app/models/board.rb +++ b/app/models/board.rb @@ -1,4 +1,4 @@ -class Board < ApplicationRecord +class Board < AccountScopedRecord include Accessible, AutoPostponing, Broadcastable, Cards, Entropic, Filterable, Publishable, Triageable belongs_to :account, default: -> { Current.account } diff --git a/app/models/board/accessible.rb b/app/models/board/accessible.rb index 1565e67af..5849a4257 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| { board_id: proxy_association.owner.id, user_id: user.id } } + Access.insert_all Array(users).collect { |user| { id: SecureRandom.uuid_v7, board_id: proxy_association.owner.id, user_id: user.id } } end def revoke_from(users) diff --git a/app/models/board/publication.rb b/app/models/board/publication.rb index a21fb00b6..7097dd34c 100644 --- a/app/models/board/publication.rb +++ b/app/models/board/publication.rb @@ -1,4 +1,4 @@ -class Board::Publication < ApplicationRecord +class Board::Publication < AccountScopedRecord belongs_to :board has_secure_token :key diff --git a/app/models/card.rb b/app/models/card.rb index a509b4ff2..ce3da1712 100644 --- a/app/models/card.rb +++ b/app/models/card.rb @@ -1,4 +1,4 @@ -class Card < ApplicationRecord +class Card < AccountScopedRecord include Assignable, Attachments, Broadcastable, Closeable, Colored, Entropic, Eventable, Golden, Mentions, Multistep, Pinnable, Postponable, Promptable, Readable, Searchable, Stallable, Statuses, Taggable, Triageable, Watchable diff --git a/app/models/card/activity_spike.rb b/app/models/card/activity_spike.rb index cbfbe906a..c1a2b6caf 100644 --- a/app/models/card/activity_spike.rb +++ b/app/models/card/activity_spike.rb @@ -1,3 +1,3 @@ -class Card::ActivitySpike < ApplicationRecord +class Card::ActivitySpike < AccountScopedRecord belongs_to :card, touch: true end diff --git a/app/models/card/engagement.rb b/app/models/card/engagement.rb index e9a46428f..c2de46149 100644 --- a/app/models/card/engagement.rb +++ b/app/models/card/engagement.rb @@ -1,4 +1,4 @@ -class Card::Engagement < ApplicationRecord +class Card::Engagement < AccountScopedRecord 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..bea6b75e9 100644 --- a/app/models/card/goldness.rb +++ b/app/models/card/goldness.rb @@ -1,3 +1,3 @@ -class Card::Goldness < ApplicationRecord +class Card::Goldness < AccountScopedRecord belongs_to :card, touch: true end diff --git a/app/models/card/not_now.rb b/app/models/card/not_now.rb index dcd16a86d..89549e585 100644 --- a/app/models/card/not_now.rb +++ b/app/models/card/not_now.rb @@ -1,4 +1,4 @@ -class Card::NotNow < ApplicationRecord +class Card::NotNow < AccountScopedRecord 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..813e5a23d 100644 --- a/app/models/closure.rb +++ b/app/models/closure.rb @@ -1,4 +1,4 @@ -class Closure < ApplicationRecord +class Closure < AccountScopedRecord belongs_to :card, touch: true belongs_to :user, optional: true end diff --git a/app/models/column.rb b/app/models/column.rb index 5b3815561..bca0efe8a 100644 --- a/app/models/column.rb +++ b/app/models/column.rb @@ -1,4 +1,4 @@ -class Column < ApplicationRecord +class Column < AccountScopedRecord include Colored, Positioned belongs_to :account, default: -> { Current.account } diff --git a/app/models/comment.rb b/app/models/comment.rb index b5e84d692..e6be740a7 100644 --- a/app/models/comment.rb +++ b/app/models/comment.rb @@ -1,4 +1,4 @@ -class Comment < ApplicationRecord +class Comment < AccountScopedRecord include Attachments, Eventable, Mentions, Promptable, Searchable belongs_to :account, default: -> { Current.account } diff --git a/app/models/concerns/uuid_primary_key.rb b/app/models/concerns/uuid_primary_key.rb new file mode 100644 index 000000000..32230eb35 --- /dev/null +++ b/app/models/concerns/uuid_primary_key.rb @@ -0,0 +1,14 @@ +module UuidPrimaryKey + extend ActiveSupport::Concern + + included do + before_create :generate_uuid_primary_key + end + + private + + def generate_uuid_primary_key + return if id.present? + self.id = SecureRandom.uuid_v7 + end +end diff --git a/app/models/entropy.rb b/app/models/entropy.rb index 6be6675ee..8dfe0fef9 100644 --- a/app/models/entropy.rb +++ b/app/models/entropy.rb @@ -1,4 +1,4 @@ -class Entropy < ApplicationRecord +class Entropy < AccountScopedRecord belongs_to :container, polymorphic: true after_commit -> { container.cards.touch_all } diff --git a/app/models/event.rb b/app/models/event.rb index cca00d66f..78cd3c020 100644 --- a/app/models/event.rb +++ b/app/models/event.rb @@ -1,4 +1,4 @@ -class Event < ApplicationRecord +class Event < AccountScopedRecord include Notifiable, Particulars, Promptable belongs_to :account, default: -> { Current.account } diff --git a/app/models/filter.rb b/app/models/filter.rb index 894a7ccca..d3ab61397 100644 --- a/app/models/filter.rb +++ b/app/models/filter.rb @@ -1,4 +1,4 @@ -class Filter < ApplicationRecord +class Filter < AccountScopedRecord include Fields, Params, Resources, Summarized belongs_to :account, default: -> { Current.account } diff --git a/app/models/mention.rb b/app/models/mention.rb index 54a20e0ce..9a59359d4 100644 --- a/app/models/mention.rb +++ b/app/models/mention.rb @@ -1,4 +1,4 @@ -class Mention < ApplicationRecord +class Mention < AccountScopedRecord include Notifiable belongs_to :source, polymorphic: true diff --git a/app/models/notification.rb b/app/models/notification.rb index 8e6010acd..6bc170a27 100644 --- a/app/models/notification.rb +++ b/app/models/notification.rb @@ -1,4 +1,4 @@ -class Notification < ApplicationRecord +class Notification < AccountScopedRecord include PushNotifiable belongs_to :account, default: -> { user.account } diff --git a/app/models/notification/bundle.rb b/app/models/notification/bundle.rb index a4d87e72d..78fd4eece 100644 --- a/app/models/notification/bundle.rb +++ b/app/models/notification/bundle.rb @@ -1,4 +1,4 @@ -class Notification::Bundle < ApplicationRecord +class Notification::Bundle < AccountScopedRecord belongs_to :account, default: -> { user.account } belongs_to :user diff --git a/app/models/pin.rb b/app/models/pin.rb index 425a504bf..e5710a7d8 100644 --- a/app/models/pin.rb +++ b/app/models/pin.rb @@ -1,4 +1,4 @@ -class Pin < ApplicationRecord +class Pin < AccountScopedRecord belongs_to :card belongs_to :user diff --git a/app/models/push/subscription.rb b/app/models/push/subscription.rb index 5776ef25f..492b5552a 100644 --- a/app/models/push/subscription.rb +++ b/app/models/push/subscription.rb @@ -1,4 +1,4 @@ -class Push::Subscription < ApplicationRecord +class Push::Subscription < AccountScopedRecord belongs_to :account, default: -> { Current.account } belongs_to :user diff --git a/app/models/reaction.rb b/app/models/reaction.rb index d70f8333b..15f60f4ea 100644 --- a/app/models/reaction.rb +++ b/app/models/reaction.rb @@ -1,4 +1,4 @@ -class Reaction < ApplicationRecord +class Reaction < AccountScopedRecord 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..2c5d8ccf3 100644 --- a/app/models/search/query.rb +++ b/app/models/search/query.rb @@ -1,4 +1,4 @@ -class Search::Query < ApplicationRecord +class Search::Query < AccountScopedRecord validates :terms, presence: true before_validation :sanitize_terms diff --git a/app/models/search/result.rb b/app/models/search/result.rb index 68140a6cd..10eed5f89 100644 --- a/app/models/search/result.rb +++ b/app/models/search/result.rb @@ -1,4 +1,4 @@ -class Search::Result < ApplicationRecord +class Search::Result < AccountScopedRecord belongs_to :creator, class_name: "User" belongs_to :card, foreign_key: :card_id, optional: true belongs_to :comment, foreign_key: :comment_id, optional: true diff --git a/app/models/step.rb b/app/models/step.rb index c3cf12378..51d5be20d 100644 --- a/app/models/step.rb +++ b/app/models/step.rb @@ -1,4 +1,4 @@ -class Step < ApplicationRecord +class Step < AccountScopedRecord belongs_to :account, default: -> { Current.account } belongs_to :card, touch: true diff --git a/app/models/tag.rb b/app/models/tag.rb index 192f0b86e..68b48667d 100644 --- a/app/models/tag.rb +++ b/app/models/tag.rb @@ -1,4 +1,4 @@ -class Tag < ApplicationRecord +class Tag < AccountScopedRecord include Attachable, Filterable belongs_to :account, default: -> { Current.account } diff --git a/app/models/tagging.rb b/app/models/tagging.rb index 73daa0879..d05487c44 100644 --- a/app/models/tagging.rb +++ b/app/models/tagging.rb @@ -1,4 +1,4 @@ -class Tagging < ApplicationRecord +class Tagging < AccountScopedRecord belongs_to :tag belongs_to :card, touch: true end diff --git a/app/models/user.rb b/app/models/user.rb index b940b67a0..aa49efb97 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -1,4 +1,4 @@ -class User < ApplicationRecord +class User < AccountScopedRecord include Accessor, Assignee, Attachable, Configurable, Mentionable, Named, Notifiable, Role, Searcher, Watcher include Timelined # Depends on Accessor diff --git a/app/models/user/accessor.rb b/app/models/user/accessor.rb index e6a9fbf2b..7a062cb85 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| { board_id: board_id, user_id: id } } + Access.insert_all account.boards.all_access.pluck(:id).collect { |board_id| { id: SecureRandom.uuid_v7, board_id: board_id, user_id: id } } end end diff --git a/app/models/user/settings.rb b/app/models/user/settings.rb index a381acae3..8f43e401d 100644 --- a/app/models/user/settings.rb +++ b/app/models/user/settings.rb @@ -1,4 +1,4 @@ -class User::Settings < ApplicationRecord +class User::Settings < AccountScopedRecord 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..965c57a18 100644 --- a/app/models/watch.rb +++ b/app/models/watch.rb @@ -1,4 +1,4 @@ -class Watch < ApplicationRecord +class Watch < AccountScopedRecord belongs_to :user belongs_to :card, touch: true diff --git a/app/models/webhook.rb b/app/models/webhook.rb index c8292a1f6..95eda26f1 100644 --- a/app/models/webhook.rb +++ b/app/models/webhook.rb @@ -1,4 +1,4 @@ -class Webhook < ApplicationRecord +class Webhook < AccountScopedRecord include Triggerable SLACK_WEBHOOK_URL_REGEX = %r{//hooks\.slack\.com/services/T[^\/]+/B[^\/]+/[^\/]+\Z}i diff --git a/app/models/webhook/delinquency_tracker.rb b/app/models/webhook/delinquency_tracker.rb index 1824db418..ff8ecaea0 100644 --- a/app/models/webhook/delinquency_tracker.rb +++ b/app/models/webhook/delinquency_tracker.rb @@ -1,4 +1,4 @@ -class Webhook::DelinquencyTracker < ApplicationRecord +class Webhook::DelinquencyTracker < AccountScopedRecord DELINQUENCY_THRESHOLD = 10 DELINQUENCY_DURATION = 1.hour diff --git a/app/models/webhook/delivery.rb b/app/models/webhook/delivery.rb index e90a8decb..d3c37d631 100644 --- a/app/models/webhook/delivery.rb +++ b/app/models/webhook/delivery.rb @@ -1,4 +1,4 @@ -class Webhook::Delivery < ApplicationRecord +class Webhook::Delivery < AccountScopedRecord STALE_TRESHOLD = 7.days USER_AGENT = "fizzy/1.0.0 Webhook" ENDPOINT_TIMEOUT = 7.seconds diff --git a/config/initializers/uuid_framework_models.rb b/config/initializers/uuid_framework_models.rb new file mode 100644 index 000000000..f6ffb3891 --- /dev/null +++ b/config/initializers/uuid_framework_models.rb @@ -0,0 +1,7 @@ +# Inject UUID primary key support into Rails framework models +Rails.application.config.to_prepare do + ActionText::RichText.include UuidPrimaryKey + ActiveStorage::Attachment.include UuidPrimaryKey + ActiveStorage::Blob.include UuidPrimaryKey + ActiveStorage::VariantRecord.include UuidPrimaryKey +end diff --git a/db/migrate/20251111122540_initial_schema.rb b/db/migrate/20251111122540_initial_schema.rb index b2066a670..b5378eb0f 100644 --- a/db/migrate/20251111122540_initial_schema.rb +++ b/db/migrate/20251111122540_initial_schema.rb @@ -1,20 +1,20 @@ class InitialSchema < ActiveRecord::Migration[8.2] def change - create_table "accesses", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| + create_table "accesses", id: :string, limit: 36, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| t.datetime "accessed_at" - t.bigint "board_id", null: false + t.string "board_id", limit: 36, null: false t.datetime "created_at", null: false t.string "involvement", default: "access_only", null: false t.datetime "updated_at", null: false - t.bigint "user_id", null: false + t.string "user_id", limit: 36, null: false t.index ["accessed_at"], name: "index_accesses_on_accessed_at", order: :desc 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", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| - t.integer "account_id" + create_table "account_join_codes", id: :string, limit: 36, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| + t.string "account_id", limit: 36 t.string "code", null: false t.datetime "created_at", null: false t.datetime "updated_at", null: false @@ -23,7 +23,7 @@ class InitialSchema < ActiveRecord::Migration[8.2] t.index ["code"], name: "index_account_join_codes_on_code", unique: true end - create_table "accounts", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| + create_table "accounts", id: :string, limit: 36, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| t.datetime "created_at", null: false t.integer "external_account_id" t.string "name", null: false @@ -31,27 +31,27 @@ class InitialSchema < ActiveRecord::Migration[8.2] t.index ["external_account_id"], name: "index_accounts_on_external_account_id", unique: true end - create_table "action_text_rich_texts", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| + create_table "action_text_rich_texts", id: :string, limit: 36, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| t.text "body", size: :long t.datetime "created_at", null: false t.string "name", null: false - t.bigint "record_id", null: false + t.string "record_id", limit: 36, null: false t.string "record_type", null: false t.datetime "updated_at", null: false t.index ["record_type", "record_id", "name"], name: "index_action_text_rich_texts_uniqueness", unique: true end - create_table "active_storage_attachments", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| - t.bigint "blob_id", null: false + create_table "active_storage_attachments", id: :string, limit: 36, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| + t.string "blob_id", limit: 36, null: false t.datetime "created_at", null: false t.string "name", null: false - t.bigint "record_id", null: false + t.string "record_id", limit: 36, null: false t.string "record_type", null: false 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", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| + create_table "active_storage_blobs", id: :string, limit: 36, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| t.bigint "byte_size", null: false t.string "checksum" t.string "content_type" @@ -63,38 +63,38 @@ class InitialSchema < ActiveRecord::Migration[8.2] t.index ["key"], name: "index_active_storage_blobs_on_key", unique: true end - create_table "active_storage_variant_records", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| - t.bigint "blob_id", null: false + create_table "active_storage_variant_records", id: :string, limit: 36, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| + t.string "blob_id", limit: 36, null: false t.string "variation_digest", null: false t.index ["blob_id", "variation_digest"], name: "index_active_storage_variant_records_uniqueness", unique: true end create_table "assignees_filters", id: false, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| - t.bigint "assignee_id", null: false - t.bigint "filter_id", null: false + t.string "assignee_id", limit: 36, null: false + t.string "filter_id", limit: 36, null: false t.index ["assignee_id"], name: "index_assignees_filters_on_assignee_id" t.index ["filter_id"], name: "index_assignees_filters_on_filter_id" end create_table "assigners_filters", id: false, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| - t.bigint "assigner_id", null: false - t.bigint "filter_id", null: false + t.string "assigner_id", limit: 36, null: false + t.string "filter_id", limit: 36, null: false t.index ["assigner_id"], name: "index_assigners_filters_on_assigner_id" t.index ["filter_id"], name: "index_assigners_filters_on_filter_id" end - create_table "assignments", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| - t.bigint "assignee_id", null: false - t.integer "assigner_id", null: false - t.bigint "card_id", null: false + create_table "assignments", id: :string, limit: 36, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| + t.string "assignee_id", limit: 36, null: false + t.string "assigner_id", limit: 36, null: false + t.string "card_id", limit: 36, null: false t.datetime "created_at", null: false t.datetime "updated_at", null: false 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", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| - t.bigint "board_id", null: false + create_table "board_publications", id: :string, limit: 36, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| + t.string "board_id", limit: 36, null: false t.datetime "created_at", null: false t.string "key" t.datetime "updated_at", null: false @@ -102,32 +102,32 @@ class InitialSchema < ActiveRecord::Migration[8.2] t.index ["key"], name: "index_board_publications_on_key", unique: true end - create_table "boards", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| - t.integer "account_id" + create_table "boards", id: :string, limit: 36, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| + t.string "account_id", limit: 36 t.boolean "all_access", default: false, null: false t.datetime "created_at", null: false - t.bigint "creator_id", null: false + t.string "creator_id", limit: 36, null: false t.string "name", null: false t.datetime "updated_at", null: false t.index ["creator_id"], name: "index_boards_on_creator_id" end create_table "boards_filters", id: false, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| - t.bigint "board_id", null: false - t.bigint "filter_id", null: false + t.string "board_id", limit: 36, null: false + t.string "filter_id", limit: 36, null: false t.index ["board_id"], name: "index_boards_filters_on_board_id" t.index ["filter_id"], name: "index_boards_filters_on_filter_id" end - create_table "card_activity_spikes", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| - t.bigint "card_id", null: false + create_table "card_activity_spikes", id: :string, limit: 36, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| + t.string "card_id", limit: 36, null: false t.datetime "created_at", null: false t.datetime "updated_at", null: false t.index ["card_id"], name: "index_card_activity_spikes_on_card_id" end - create_table "card_engagements", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| - t.bigint "card_id" + create_table "card_engagements", id: :string, limit: 36, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| + t.string "card_id", limit: 36 t.datetime "created_at", null: false t.string "status", default: "doing", null: false t.datetime "updated_at", null: false @@ -135,28 +135,28 @@ class InitialSchema < ActiveRecord::Migration[8.2] t.index ["status"], name: "index_card_engagements_on_status" end - create_table "card_goldnesses", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| - t.bigint "card_id", null: false + create_table "card_goldnesses", id: :string, limit: 36, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| + t.string "card_id", limit: 36, null: false t.datetime "created_at", null: false t.datetime "updated_at", null: false t.index ["card_id"], name: "index_card_goldnesses_on_card_id", unique: true end - create_table "card_not_nows", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| - t.bigint "card_id", null: false + create_table "card_not_nows", id: :string, limit: 36, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| + t.string "card_id", limit: 36, null: false t.datetime "created_at", null: false t.datetime "updated_at", null: false - t.bigint "user_id" + t.string "user_id", limit: 36 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", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| - t.integer "account_id" - t.bigint "board_id", null: false - t.bigint "column_id" + create_table "cards", id: :string, limit: 36, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| + t.string "account_id", limit: 36 + t.string "board_id", limit: 36, null: false + t.string "column_id", limit: 36 t.datetime "created_at", null: false - t.integer "creator_id", null: false + t.string "creator_id", limit: 36, null: false t.date "due_on" t.datetime "last_active_at", null: false t.string "status", default: "drafted", null: false @@ -168,25 +168,25 @@ class InitialSchema < ActiveRecord::Migration[8.2] end create_table "closers_filters", id: false, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| - t.integer "closer_id", null: false - t.integer "filter_id", null: false + t.string "closer_id", limit: 36, null: false + t.string "filter_id", limit: 36, null: false t.index ["closer_id"], name: "index_closers_filters_on_closer_id" t.index ["filter_id"], name: "index_closers_filters_on_filter_id" end - create_table "closures", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| - t.bigint "card_id", null: false + create_table "closures", id: :string, limit: 36, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| + t.string "card_id", limit: 36, null: false t.datetime "created_at", null: false t.datetime "updated_at", null: false - t.bigint "user_id" + t.string "user_id", limit: 36 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", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| - t.integer "account_id" - t.bigint "board_id", null: false + create_table "columns", id: :string, limit: 36, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| + t.string "account_id", limit: 36 + t.string "board_id", limit: 36, null: false t.string "color", null: false t.datetime "created_at", null: false t.string "name", null: false @@ -196,25 +196,25 @@ class InitialSchema < ActiveRecord::Migration[8.2] t.index ["board_id"], name: "index_columns_on_board_id" end - create_table "comments", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| - t.integer "account_id" - t.bigint "card_id", null: false + create_table "comments", id: :string, limit: 36, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| + t.string "account_id", limit: 36 + t.string "card_id", limit: 36, null: false t.datetime "created_at", null: false - t.integer "creator_id", null: false + t.string "creator_id", limit: 36, null: false t.datetime "updated_at", null: false t.index ["card_id"], name: "index_comments_on_card_id" end create_table "creators_filters", id: false, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| - t.integer "creator_id", null: false - t.integer "filter_id", null: false + t.string "creator_id", limit: 36, null: false + t.string "filter_id", limit: 36, null: false t.index ["creator_id"], name: "index_creators_filters_on_creator_id" t.index ["filter_id"], name: "index_creators_filters_on_filter_id" end - create_table "entropies", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| + create_table "entropies", id: :string, limit: 36, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| t.bigint "auto_postpone_period", default: 2592000, null: false - t.bigint "container_id", null: false + t.string "container_id", limit: 36, null: false t.string "container_type", null: false t.datetime "created_at", null: false t.datetime "updated_at", null: false @@ -222,13 +222,13 @@ class InitialSchema < ActiveRecord::Migration[8.2] t.index ["container_type", "container_id"], name: "index_entropy_configurations_on_container", unique: true end - create_table "events", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| - t.integer "account_id" + create_table "events", id: :string, limit: 36, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| + t.string "account_id", limit: 36 t.string "action", null: false - t.bigint "board_id", null: false + t.string "board_id", limit: 36, null: false t.datetime "created_at", null: false - t.bigint "creator_id", null: false - t.bigint "eventable_id", null: false + t.string "creator_id", limit: 36, null: false + t.string "eventable_id", limit: 36, null: false t.string "eventable_type", null: false t.json "particulars", default: -> { "(json_object())" } t.datetime "updated_at", null: false @@ -239,10 +239,10 @@ class InitialSchema < ActiveRecord::Migration[8.2] t.index ["eventable_type", "eventable_id"], name: "index_events_on_eventable" end - create_table "filters", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| - t.integer "account_id" + create_table "filters", id: :string, limit: 36, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| + t.string "account_id", limit: 36 t.datetime "created_at", null: false - t.bigint "creator_id", null: false + t.string "creator_id", limit: 36, null: false t.json "fields", default: -> { "(json_object())" }, null: false t.string "params_digest", null: false t.datetime "updated_at", null: false @@ -250,8 +250,8 @@ class InitialSchema < ActiveRecord::Migration[8.2] end create_table "filters_tags", id: false, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| - t.bigint "filter_id", null: false - t.bigint "tag_id", null: false + t.string "filter_id", limit: 36, null: false + t.string "tag_id", limit: 36, null: false t.index ["filter_id"], name: "index_filters_tags_on_filter_id" t.index ["tag_id"], name: "index_filters_tags_on_tag_id" end @@ -285,11 +285,11 @@ class InitialSchema < ActiveRecord::Migration[8.2] t.index ["tenant"], name: "index_memberships_on_user_tenant_and_user_id" end - create_table "mentions", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| + create_table "mentions", id: :string, limit: 36, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| t.datetime "created_at", null: false - t.bigint "mentionee_id", null: false - t.bigint "mentioner_id", null: false - t.bigint "source_id", null: false + t.string "mentionee_id", limit: 36, null: false + t.string "mentioner_id", limit: 36, null: false + t.string "source_id", limit: 36, null: false t.string "source_type", null: false t.datetime "updated_at", null: false t.index ["mentionee_id"], name: "index_mentions_on_mentionee_id" @@ -297,53 +297,53 @@ class InitialSchema < ActiveRecord::Migration[8.2] t.index ["source_type", "source_id"], name: "index_mentions_on_source" end - create_table "notification_bundles", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| - t.integer "account_id" + create_table "notification_bundles", id: :string, limit: 36, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| + t.string "account_id", limit: 36 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.bigint "user_id", null: false + t.string "user_id", limit: 36, null: false 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", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| - t.integer "account_id" + create_table "notifications", id: :string, limit: 36, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| + t.string "account_id", limit: 36 t.datetime "created_at", null: false - t.bigint "creator_id" + t.string "creator_id", limit: 36 t.datetime "read_at" - t.bigint "source_id", null: false + t.string "source_id", limit: 36, null: false t.string "source_type", null: false t.datetime "updated_at", null: false - t.bigint "user_id", null: false + t.string "user_id", limit: 36, null: false 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 } t.index ["user_id"], name: "index_notifications_on_user_id" end - create_table "pins", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| - t.bigint "card_id", null: false + create_table "pins", id: :string, limit: 36, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| + t.string "card_id", limit: 36, null: false t.datetime "created_at", null: false t.datetime "updated_at", null: false - t.bigint "user_id", null: false + t.string "user_id", limit: 36, null: false 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", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| - t.integer "account_id" + create_table "push_subscriptions", id: :string, limit: 36, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| + t.string "account_id", limit: 36 t.string "auth_key" t.datetime "created_at", null: false t.string "endpoint" t.string "p256dh_key" t.datetime "updated_at", null: false t.string "user_agent" - t.bigint "user_id", null: false + t.string "user_id", limit: 36, 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" @@ -351,27 +351,27 @@ class InitialSchema < ActiveRecord::Migration[8.2] t.index ["user_id"], name: "index_push_subscriptions_on_user_id" end - create_table "reactions", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| - t.integer "comment_id", null: false + create_table "reactions", id: :string, limit: 36, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| + t.string "comment_id", limit: 36, null: false t.string "content", limit: 16, null: false t.datetime "created_at", null: false - t.integer "reacter_id", null: false + t.string "reacter_id", limit: 36, null: false t.datetime "updated_at", null: false t.index ["comment_id"], name: "index_reactions_on_comment_id" t.index ["reacter_id"], name: "index_reactions_on_reacter_id" end - create_table "search_queries", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| + create_table "search_queries", id: :string, limit: 36, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| t.datetime "created_at", null: false t.string "terms", limit: 2000, null: false t.datetime "updated_at", null: false - t.bigint "user_id", null: false + t.string "user_id", limit: 36, null: false 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" end - create_table "search_results", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| + create_table "search_results", id: :string, limit: 36, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| t.datetime "created_at", null: false t.datetime "updated_at", null: false end @@ -385,9 +385,9 @@ class InitialSchema < ActiveRecord::Migration[8.2] t.index ["identity_id"], name: "index_sessions_on_identity_id" end - create_table "steps", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| - t.integer "account_id" - t.bigint "card_id", null: false + create_table "steps", id: :string, limit: 36, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| + t.string "account_id", limit: 36 + t.string "card_id", limit: 36, null: false t.boolean "completed", default: false, null: false t.text "content", null: false t.datetime "created_at", null: false @@ -396,35 +396,35 @@ class InitialSchema < ActiveRecord::Migration[8.2] t.index ["card_id"], name: "index_steps_on_card_id" end - create_table "taggings", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| - t.bigint "card_id", null: false + create_table "taggings", id: :string, limit: 36, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| + t.string "card_id", limit: 36, null: false t.datetime "created_at", null: false - t.bigint "tag_id", null: false + t.string "tag_id", limit: 36, null: false t.datetime "updated_at", null: false 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", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| - t.integer "account_id" + create_table "tags", id: :string, limit: 36, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| + t.string "account_id", limit: 36 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 end - create_table "user_settings", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| + create_table "user_settings", id: :string, limit: 36, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| 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.bigint "user_id", null: false + t.string "user_id", limit: 36, null: false 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", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| - t.integer "account_id" + create_table "users", id: :string, limit: 36, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| + t.string "account_id", limit: 36 t.boolean "active", default: true, null: false t.datetime "created_at", null: false t.integer "membership_id" @@ -435,42 +435,42 @@ class InitialSchema < ActiveRecord::Migration[8.2] t.index ["role"], name: "index_users_on_role" end - create_table "watches", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| - t.bigint "card_id", null: false + create_table "watches", id: :string, limit: 36, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| + t.string "card_id", limit: 36, null: false t.datetime "created_at", null: false t.datetime "updated_at", null: false - t.bigint "user_id", null: false + t.string "user_id", limit: 36, null: false t.boolean "watching", default: true, null: false 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", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| + create_table "webhook_delinquency_trackers", id: :string, limit: 36, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| 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.bigint "webhook_id", null: false + t.string "webhook_id", limit: 36, null: false t.index ["webhook_id"], name: "index_webhook_delinquency_trackers_on_webhook_id" end - create_table "webhook_deliveries", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| + create_table "webhook_deliveries", id: :string, limit: 36, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| t.datetime "created_at", null: false - t.bigint "event_id", null: false + t.string "event_id", limit: 36, null: false t.text "request" t.text "response" t.string "state", null: false t.datetime "updated_at", null: false - t.bigint "webhook_id", null: false + t.string "webhook_id", limit: 36, null: false 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", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| - t.integer "account_id" + create_table "webhooks", id: :string, limit: 36, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| + t.string "account_id", limit: 36 t.boolean "active", default: true, null: false - t.bigint "board_id", null: false + t.string "board_id", limit: 36, null: false t.datetime "created_at", null: false t.string "name" t.string "signing_secret", null: false diff --git a/db/schema.rb b/db/schema.rb index a67645407..82a298bc8 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,21 +11,21 @@ # It's strongly recommended that you check this file into your version control system. ActiveRecord::Schema[8.2].define(version: 2025_11_12_184932) do - create_table "accesses", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| + create_table "accesses", id: { type: :string, limit: 36 }, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| t.datetime "accessed_at" - t.bigint "board_id", null: false + t.string "board_id", limit: 36, null: false t.datetime "created_at", null: false t.string "involvement", default: "access_only", null: false t.datetime "updated_at", null: false - t.bigint "user_id", null: false + t.string "user_id", limit: 36, null: false t.index ["accessed_at"], name: "index_accesses_on_accessed_at", order: :desc 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", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| - t.integer "account_id" + create_table "account_join_codes", id: { type: :string, limit: 36 }, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| + t.string "account_id", limit: 36 t.string "code", null: false t.datetime "created_at", null: false t.datetime "updated_at", null: false @@ -34,7 +34,7 @@ ActiveRecord::Schema[8.2].define(version: 2025_11_12_184932) do t.index ["code"], name: "index_account_join_codes_on_code", unique: true end - create_table "accounts", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| + create_table "accounts", id: { type: :string, limit: 36 }, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| t.bigint "cards_count", default: 0, null: false t.datetime "created_at", null: false t.integer "external_account_id" @@ -43,27 +43,27 @@ ActiveRecord::Schema[8.2].define(version: 2025_11_12_184932) do t.index ["external_account_id"], name: "index_accounts_on_external_account_id", unique: true end - create_table "action_text_rich_texts", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| + create_table "action_text_rich_texts", id: { type: :string, limit: 36 }, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| t.text "body", size: :long t.datetime "created_at", null: false t.string "name", null: false - t.bigint "record_id", null: false + t.string "record_id", limit: 36, null: false t.string "record_type", null: false t.datetime "updated_at", null: false t.index ["record_type", "record_id", "name"], name: "index_action_text_rich_texts_uniqueness", unique: true end - create_table "active_storage_attachments", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| - t.bigint "blob_id", null: false + create_table "active_storage_attachments", id: { type: :string, limit: 36 }, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| + t.string "blob_id", limit: 36, null: false t.datetime "created_at", null: false t.string "name", null: false - t.bigint "record_id", null: false + t.string "record_id", limit: 36, null: false t.string "record_type", null: false 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", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| + create_table "active_storage_blobs", id: { type: :string, limit: 36 }, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| t.bigint "byte_size", null: false t.string "checksum" t.string "content_type" @@ -75,38 +75,38 @@ ActiveRecord::Schema[8.2].define(version: 2025_11_12_184932) do t.index ["key"], name: "index_active_storage_blobs_on_key", unique: true end - create_table "active_storage_variant_records", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| - t.bigint "blob_id", null: false + create_table "active_storage_variant_records", id: { type: :string, limit: 36 }, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| + t.string "blob_id", limit: 36, null: false t.string "variation_digest", null: false t.index ["blob_id", "variation_digest"], name: "index_active_storage_variant_records_uniqueness", unique: true end create_table "assignees_filters", id: false, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| - t.bigint "assignee_id", null: false - t.bigint "filter_id", null: false + t.string "assignee_id", limit: 36, null: false + t.string "filter_id", limit: 36, null: false t.index ["assignee_id"], name: "index_assignees_filters_on_assignee_id" t.index ["filter_id"], name: "index_assignees_filters_on_filter_id" end create_table "assigners_filters", id: false, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| - t.bigint "assigner_id", null: false - t.bigint "filter_id", null: false + t.string "assigner_id", limit: 36, null: false + t.string "filter_id", limit: 36, null: false t.index ["assigner_id"], name: "index_assigners_filters_on_assigner_id" t.index ["filter_id"], name: "index_assigners_filters_on_filter_id" end - create_table "assignments", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| - t.bigint "assignee_id", null: false - t.integer "assigner_id", null: false - t.bigint "card_id", null: false + create_table "assignments", id: { type: :string, limit: 36 }, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| + t.string "assignee_id", limit: 36, null: false + t.string "assigner_id", limit: 36, null: false + t.string "card_id", limit: 36, null: false t.datetime "created_at", null: false t.datetime "updated_at", null: false 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", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| - t.bigint "board_id", null: false + create_table "board_publications", id: { type: :string, limit: 36 }, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| + t.string "board_id", limit: 36, null: false t.datetime "created_at", null: false t.string "key" t.datetime "updated_at", null: false @@ -114,32 +114,32 @@ ActiveRecord::Schema[8.2].define(version: 2025_11_12_184932) do t.index ["key"], name: "index_board_publications_on_key", unique: true end - create_table "boards", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| - t.integer "account_id" + create_table "boards", id: { type: :string, limit: 36 }, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| + t.string "account_id", limit: 36 t.boolean "all_access", default: false, null: false t.datetime "created_at", null: false - t.bigint "creator_id", null: false + t.string "creator_id", limit: 36, null: false t.string "name", null: false t.datetime "updated_at", null: false t.index ["creator_id"], name: "index_boards_on_creator_id" end create_table "boards_filters", id: false, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| - t.bigint "board_id", null: false - t.bigint "filter_id", null: false + t.string "board_id", limit: 36, null: false + t.string "filter_id", limit: 36, null: false t.index ["board_id"], name: "index_boards_filters_on_board_id" t.index ["filter_id"], name: "index_boards_filters_on_filter_id" end - create_table "card_activity_spikes", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| - t.bigint "card_id", null: false + create_table "card_activity_spikes", id: { type: :string, limit: 36 }, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| + t.string "card_id", limit: 36, null: false t.datetime "created_at", null: false t.datetime "updated_at", null: false t.index ["card_id"], name: "index_card_activity_spikes_on_card_id" end - create_table "card_engagements", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| - t.bigint "card_id" + create_table "card_engagements", id: { type: :string, limit: 36 }, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| + t.string "card_id", limit: 36 t.datetime "created_at", null: false t.string "status", default: "doing", null: false t.datetime "updated_at", null: false @@ -147,28 +147,28 @@ ActiveRecord::Schema[8.2].define(version: 2025_11_12_184932) do t.index ["status"], name: "index_card_engagements_on_status" end - create_table "card_goldnesses", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| - t.bigint "card_id", null: false + create_table "card_goldnesses", id: { type: :string, limit: 36 }, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| + t.string "card_id", limit: 36, null: false t.datetime "created_at", null: false t.datetime "updated_at", null: false t.index ["card_id"], name: "index_card_goldnesses_on_card_id", unique: true end - create_table "card_not_nows", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| - t.bigint "card_id", null: false + create_table "card_not_nows", id: { type: :string, limit: 36 }, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| + t.string "card_id", limit: 36, null: false t.datetime "created_at", null: false t.datetime "updated_at", null: false - t.bigint "user_id" + t.string "user_id", limit: 36 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", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| - t.integer "account_id" - t.bigint "board_id", null: false - t.bigint "column_id" + create_table "cards", id: { type: :string, limit: 36 }, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| + t.string "account_id", limit: 36 + t.string "board_id", limit: 36, null: false + t.string "column_id", limit: 36 t.datetime "created_at", null: false - t.integer "creator_id", null: false + t.string "creator_id", limit: 36, null: false t.date "due_on" t.datetime "last_active_at", null: false t.bigint "number", null: false @@ -182,25 +182,25 @@ ActiveRecord::Schema[8.2].define(version: 2025_11_12_184932) do end create_table "closers_filters", id: false, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| - t.integer "closer_id", null: false - t.integer "filter_id", null: false + t.string "closer_id", limit: 36, null: false + t.string "filter_id", limit: 36, null: false t.index ["closer_id"], name: "index_closers_filters_on_closer_id" t.index ["filter_id"], name: "index_closers_filters_on_filter_id" end - create_table "closures", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| - t.bigint "card_id", null: false + create_table "closures", id: { type: :string, limit: 36 }, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| + t.string "card_id", limit: 36, null: false t.datetime "created_at", null: false t.datetime "updated_at", null: false - t.bigint "user_id" + t.string "user_id", limit: 36 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", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| - t.integer "account_id" - t.bigint "board_id", null: false + create_table "columns", id: { type: :string, limit: 36 }, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| + t.string "account_id", limit: 36 + t.string "board_id", limit: 36, null: false t.string "color", null: false t.datetime "created_at", null: false t.string "name", null: false @@ -210,25 +210,25 @@ ActiveRecord::Schema[8.2].define(version: 2025_11_12_184932) do t.index ["board_id"], name: "index_columns_on_board_id" end - create_table "comments", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| - t.integer "account_id" - t.bigint "card_id", null: false + create_table "comments", id: { type: :string, limit: 36 }, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| + t.string "account_id", limit: 36 + t.string "card_id", limit: 36, null: false t.datetime "created_at", null: false - t.integer "creator_id", null: false + t.string "creator_id", limit: 36, null: false t.datetime "updated_at", null: false t.index ["card_id"], name: "index_comments_on_card_id" end create_table "creators_filters", id: false, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| - t.integer "creator_id", null: false - t.integer "filter_id", null: false + t.string "creator_id", limit: 36, null: false + t.string "filter_id", limit: 36, null: false t.index ["creator_id"], name: "index_creators_filters_on_creator_id" t.index ["filter_id"], name: "index_creators_filters_on_filter_id" end - create_table "entropies", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| + create_table "entropies", id: { type: :string, limit: 36 }, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| t.bigint "auto_postpone_period", default: 2592000, null: false - t.bigint "container_id", null: false + t.string "container_id", limit: 36, null: false t.string "container_type", null: false t.datetime "created_at", null: false t.datetime "updated_at", null: false @@ -236,13 +236,13 @@ ActiveRecord::Schema[8.2].define(version: 2025_11_12_184932) do t.index ["container_type", "container_id"], name: "index_entropy_configurations_on_container", unique: true end - create_table "events", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| - t.integer "account_id" + create_table "events", id: { type: :string, limit: 36 }, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| + t.string "account_id", limit: 36 t.string "action", null: false - t.bigint "board_id", null: false + t.string "board_id", limit: 36, null: false t.datetime "created_at", null: false - t.bigint "creator_id", null: false - t.bigint "eventable_id", null: false + t.string "creator_id", limit: 36, null: false + t.string "eventable_id", limit: 36, null: false t.string "eventable_type", null: false t.json "particulars", default: -> { "(json_object())" } t.datetime "updated_at", null: false @@ -253,10 +253,10 @@ ActiveRecord::Schema[8.2].define(version: 2025_11_12_184932) do t.index ["eventable_type", "eventable_id"], name: "index_events_on_eventable" end - create_table "filters", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| - t.integer "account_id" + create_table "filters", id: { type: :string, limit: 36 }, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| + t.string "account_id", limit: 36 t.datetime "created_at", null: false - t.bigint "creator_id", null: false + t.string "creator_id", limit: 36, null: false t.json "fields", default: -> { "(json_object())" }, null: false t.string "params_digest", null: false t.datetime "updated_at", null: false @@ -264,8 +264,8 @@ ActiveRecord::Schema[8.2].define(version: 2025_11_12_184932) do end create_table "filters_tags", id: false, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| - t.bigint "filter_id", null: false - t.bigint "tag_id", null: false + t.string "filter_id", limit: 36, null: false + t.string "tag_id", limit: 36, null: false t.index ["filter_id"], name: "index_filters_tags_on_filter_id" t.index ["tag_id"], name: "index_filters_tags_on_tag_id" end @@ -298,11 +298,11 @@ ActiveRecord::Schema[8.2].define(version: 2025_11_12_184932) do t.index ["tenant"], name: "index_memberships_on_user_tenant_and_user_id" end - create_table "mentions", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| + create_table "mentions", id: { type: :string, limit: 36 }, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| t.datetime "created_at", null: false - t.bigint "mentionee_id", null: false - t.bigint "mentioner_id", null: false - t.bigint "source_id", null: false + t.string "mentionee_id", limit: 36, null: false + t.string "mentioner_id", limit: 36, null: false + t.string "source_id", limit: 36, null: false t.string "source_type", null: false t.datetime "updated_at", null: false t.index ["mentionee_id"], name: "index_mentions_on_mentionee_id" @@ -310,53 +310,53 @@ ActiveRecord::Schema[8.2].define(version: 2025_11_12_184932) do t.index ["source_type", "source_id"], name: "index_mentions_on_source" end - create_table "notification_bundles", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| - t.integer "account_id" + create_table "notification_bundles", id: { type: :string, limit: 36 }, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| + t.string "account_id", limit: 36 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.bigint "user_id", null: false + t.string "user_id", limit: 36, null: false 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", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| - t.integer "account_id" + create_table "notifications", id: { type: :string, limit: 36 }, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| + t.string "account_id", limit: 36 t.datetime "created_at", null: false - t.bigint "creator_id" + t.string "creator_id", limit: 36 t.datetime "read_at" - t.bigint "source_id", null: false + t.string "source_id", limit: 36, null: false t.string "source_type", null: false t.datetime "updated_at", null: false - t.bigint "user_id", null: false + t.string "user_id", limit: 36, null: false 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 } t.index ["user_id"], name: "index_notifications_on_user_id" end - create_table "pins", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| - t.bigint "card_id", null: false + create_table "pins", id: { type: :string, limit: 36 }, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| + t.string "card_id", limit: 36, null: false t.datetime "created_at", null: false t.datetime "updated_at", null: false - t.bigint "user_id", null: false + t.string "user_id", limit: 36, null: false 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", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| - t.integer "account_id" + create_table "push_subscriptions", id: { type: :string, limit: 36 }, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| + t.string "account_id", limit: 36 t.string "auth_key" t.datetime "created_at", null: false t.string "endpoint" t.string "p256dh_key" t.datetime "updated_at", null: false t.string "user_agent" - t.bigint "user_id", null: false + t.string "user_id", limit: 36, 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" @@ -364,11 +364,11 @@ ActiveRecord::Schema[8.2].define(version: 2025_11_12_184932) do t.index ["user_id"], name: "index_push_subscriptions_on_user_id" end - create_table "reactions", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| - t.integer "comment_id", null: false + create_table "reactions", id: { type: :string, limit: 36 }, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| + t.string "comment_id", limit: 36, null: false t.string "content", limit: 16, null: false t.datetime "created_at", null: false - t.integer "reacter_id", null: false + t.string "reacter_id", limit: 36, null: false t.datetime "updated_at", null: false t.index ["comment_id"], name: "index_reactions_on_comment_id" t.index ["reacter_id"], name: "index_reactions_on_reacter_id" @@ -566,17 +566,17 @@ ActiveRecord::Schema[8.2].define(version: 2025_11_12_184932) do t.index ["searchable_type", "searchable_id"], name: "idx_si9_type_id", unique: true end - create_table "search_queries", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| + create_table "search_queries", id: { type: :string, limit: 36 }, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| t.datetime "created_at", null: false t.string "terms", limit: 2000, null: false t.datetime "updated_at", null: false - t.bigint "user_id", null: false + t.string "user_id", limit: 36, null: false 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" end - create_table "search_results", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| + create_table "search_results", id: { type: :string, limit: 36 }, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| t.datetime "created_at", null: false t.datetime "updated_at", null: false end @@ -590,9 +590,9 @@ ActiveRecord::Schema[8.2].define(version: 2025_11_12_184932) do t.index ["identity_id"], name: "index_sessions_on_identity_id" end - create_table "steps", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| - t.integer "account_id" - t.bigint "card_id", null: false + create_table "steps", id: { type: :string, limit: 36 }, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| + t.string "account_id", limit: 36 + t.string "card_id", limit: 36, null: false t.boolean "completed", default: false, null: false t.text "content", null: false t.datetime "created_at", null: false @@ -601,35 +601,35 @@ ActiveRecord::Schema[8.2].define(version: 2025_11_12_184932) do t.index ["card_id"], name: "index_steps_on_card_id" end - create_table "taggings", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| - t.bigint "card_id", null: false + create_table "taggings", id: { type: :string, limit: 36 }, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| + t.string "card_id", limit: 36, null: false t.datetime "created_at", null: false - t.bigint "tag_id", null: false + t.string "tag_id", limit: 36, null: false t.datetime "updated_at", null: false 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", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| - t.integer "account_id" + create_table "tags", id: { type: :string, limit: 36 }, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| + t.string "account_id", limit: 36 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 end - create_table "user_settings", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| + create_table "user_settings", id: { type: :string, limit: 36 }, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| 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.bigint "user_id", null: false + t.string "user_id", limit: 36, null: false 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", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| - t.integer "account_id" + create_table "users", id: { type: :string, limit: 36 }, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| + t.string "account_id", limit: 36 t.boolean "active", default: true, null: false t.datetime "created_at", null: false t.integer "membership_id" @@ -640,42 +640,42 @@ ActiveRecord::Schema[8.2].define(version: 2025_11_12_184932) do t.index ["role"], name: "index_users_on_role" end - create_table "watches", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| - t.bigint "card_id", null: false + create_table "watches", id: { type: :string, limit: 36 }, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| + t.string "card_id", limit: 36, null: false t.datetime "created_at", null: false t.datetime "updated_at", null: false - t.bigint "user_id", null: false + t.string "user_id", limit: 36, null: false t.boolean "watching", default: true, null: false 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", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| + create_table "webhook_delinquency_trackers", id: { type: :string, limit: 36 }, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| 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.bigint "webhook_id", null: false + t.string "webhook_id", limit: 36, null: false t.index ["webhook_id"], name: "index_webhook_delinquency_trackers_on_webhook_id" end - create_table "webhook_deliveries", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| + create_table "webhook_deliveries", id: { type: :string, limit: 36 }, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| t.datetime "created_at", null: false - t.bigint "event_id", null: false + t.string "event_id", limit: 36, null: false t.text "request" t.text "response" t.string "state", null: false t.datetime "updated_at", null: false - t.bigint "webhook_id", null: false + t.string "webhook_id", limit: 36, null: false 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", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| - t.integer "account_id" + create_table "webhooks", id: { type: :string, limit: 36 }, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| + t.string "account_id", limit: 36 t.boolean "active", default: true, null: false - t.bigint "board_id", null: false + t.string "board_id", limit: 36, null: false t.datetime "created_at", null: false t.string "name" t.string "signing_secret", null: false diff --git a/script/import-sqlite-database.rb b/script/import-sqlite-database.rb index 8be7728e3..87e8c3822 100755 --- a/script/import-sqlite-database.rb +++ b/script/import-sqlite-database.rb @@ -100,6 +100,10 @@ class Import result end + def generate_uuid + SecureRandom.uuid_v7 + end + def setup_account step("Setting up account", "Account set up in %{duration}") do oldest_admin = import.users.order(id: :asc).where(role: :admin, active: true).first @@ -229,8 +233,6 @@ class Import mapping[:cards] ||= {} account.update_columns(cards_count: import.cards.maximum(:id) || 0) - next_id = (Card.maximum(:id) || 0) + 1 - activity_spikes_to_insert = [] engagements_to_insert = [] goldnesses_to_insert = [] @@ -242,8 +244,7 @@ class Import cards_to_insert = [] batch.each do |old_card| - new_id = next_id - next_id += 1 + new_id = generate_uuid mapping[:cards][old_card.id] = new_id # Map old 'creating' status to 'drafted' since it's no longer a valid enum value @@ -267,6 +268,7 @@ class Import old_activity_spike = old_card.activity_spike if old_activity_spike activity_spikes_to_insert << { + id: generate_uuid, card_id: new_id, created_at: old_activity_spike.created_at, updated_at: old_activity_spike.updated_at @@ -276,6 +278,7 @@ class Import old_engagement = old_card.engagement if old_engagement engagements_to_insert << { + id: generate_uuid, card_id: new_id, status: old_engagement.status, created_at: old_engagement.created_at, @@ -286,6 +289,7 @@ class Import old_goldness = old_card.goldness if old_goldness goldnesses_to_insert << { + id: generate_uuid, card_id: new_id, created_at: old_goldness.created_at, updated_at: old_goldness.updated_at @@ -295,6 +299,7 @@ class Import old_not_now = old_card.not_now if old_not_now not_nows_to_insert << { + id: generate_uuid, 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, @@ -304,6 +309,7 @@ class Import old_card.assignments.each do |old_assignment| assignments_to_insert << { + id: generate_uuid, card_id: new_id, assignee_id: mapping[:users][old_assignment.assignee_id], assigner_id: mapping[:users][old_assignment.assigner_id], @@ -315,6 +321,7 @@ class Import old_closure = old_card.closure if old_closure closures_to_insert << { + id: generate_uuid, card_id: new_id, user_id: old_closure.user_id ? mapping[:users][old_closure.user_id] : nil, created_at: old_closure.created_at, @@ -368,14 +375,12 @@ class Import def copy_comments step("Copying comments", "Copied %{count} comments in %{duration}") do mapping[:comments] ||= {} - next_id = (Comment.maximum(:id) || 0) + 1 import.comments.in_batches(of: 1000) do |batch| comments_to_insert = [] batch.each do |old_comment| - new_id = next_id - next_id += 1 + new_id = generate_uuid mapping[:comments][old_comment.id] = new_id comments_to_insert << { @@ -425,14 +430,12 @@ class Import def copy_accesses step("Copying accesses", "Copied %{count} accesses in %{duration}") do mapping[:accesses] ||= {} - next_id = (Access.maximum(:id) || 0) + 1 import.accesses.in_batches(of: 1000) do |batch| accesses_to_insert = [] batch.each do |old_access| - new_id = next_id - next_id += 1 + new_id = generate_uuid mapping[:accesses][old_access.id] = new_id accesses_to_insert << { @@ -456,14 +459,12 @@ class Import def copy_notifications step("Copying notifications", "Copied %{count} notifications in %{duration}") do mapping[:notifications] ||= {} - next_id = (Notification.maximum(:id) || 0) + 1 import.notifications.in_batches(of: 1000) do |batch| notifications_to_insert = [] batch.each do |old_notification| - new_id = next_id - next_id += 1 + new_id = generate_uuid mapping[:notifications][old_notification.id] = new_id notifications_to_insert << { @@ -489,14 +490,12 @@ class Import def copy_notification_bundles step("Copying notification bundles", "Copied %{count} notification bundles in %{duration}") do mapping[:notification_bundles] ||= {} - next_id = (Notification::Bundle.maximum(:id) || 0) + 1 import.notification_bundles.in_batches(of: 1000) do |batch| bundles_to_insert = [] batch.each do |old_bundle| - new_id = next_id - next_id += 1 + new_id = generate_uuid mapping[:notification_bundles][old_bundle.id] = new_id bundles_to_insert << { @@ -542,15 +541,13 @@ class Import def copy_filters step("Copying filters", "Copied %{count} filters in %{duration}") do mapping[:filters] ||= {} - next_id = (Filter.maximum(:id) || 0) + 1 # First, insert all filters import.filters.in_batches(of: 1000) do |batch| filters_to_insert = [] batch.each do |old_filter| - new_id = next_id - next_id += 1 + new_id = generate_uuid mapping[:filters][old_filter.id] = new_id filters_to_insert << { @@ -600,14 +597,12 @@ class Import def copy_events step("Copying events", "Copied %{count} events in %{duration}") do mapping[:events] ||= {} - next_id = (Event.maximum(:id) || 0) + 1 import.events.in_batches(of: 1000) do |batch| events_to_insert = [] batch.each do |old_event| - new_id = next_id - next_id += 1 + new_id = generate_uuid mapping[:events][old_event.id] = new_id events_to_insert << { @@ -765,14 +760,12 @@ class Import def copy_watches step("Copying watches", "Copied %{count} watches in %{duration}") do mapping[:watches] ||= {} - next_id = (Watch.maximum(:id) || 0) + 1 import.watches.in_batches(of: 1000) do |batch| watches_to_insert = [] batch.each do |old_watch| - new_id = next_id - next_id += 1 + new_id = generate_uuid mapping[:watches][old_watch.id] = new_id watches_to_insert << { @@ -795,14 +788,12 @@ class Import def copy_pins step("Copying pins", "Copied %{count} pins in %{duration}") do mapping[:pins] ||= {} - next_id = (Pin.maximum(:id) || 0) + 1 import.pins.in_batches(of: 1000) do |batch| pins_to_insert = [] batch.each do |old_pin| - new_id = next_id - next_id += 1 + new_id = generate_uuid mapping[:pins][old_pin.id] = new_id pins_to_insert << { diff --git a/test/fixtures/accesses.yml b/test/fixtures/accesses.yml index bdf523630..50df4355e 100644 --- a/test/fixtures/accesses.yml +++ b/test/fixtures/accesses.yml @@ -1,15 +1,19 @@ writebook_david: - board: writebook - user: david + id: <%= ActiveRecord::FixtureSet.identify("writebook_david", :uuid) %> + board: writebook_uuid + user: david_uuid writebook_jz: - board: writebook - user: jz + id: <%= ActiveRecord::FixtureSet.identify("writebook_jz", :uuid) %> + board: writebook_uuid + user: jz_uuid writebook_kevin: - board: writebook - user: kevin + id: <%= ActiveRecord::FixtureSet.identify("writebook_kevin", :uuid) %> + board: writebook_uuid + user: kevin_uuid private_kevin: - board: private - user: kevin + id: <%= ActiveRecord::FixtureSet.identify("private_kevin", :uuid) %> + board: private_uuid + user: kevin_uuid diff --git a/test/fixtures/accounts.yml b/test/fixtures/accounts.yml index fbe0333e1..c1c83ee51 100644 --- a/test/fixtures/accounts.yml +++ b/test/fixtures/accounts.yml @@ -1,9 +1,11 @@ 37s: + id: <%= ActiveRecord::FixtureSet.identify("37s", :uuid) %> name: 37signals external_account_id: <%= ActiveRecord::FixtureSet.identify("37signals") %> cards_count: 5 initech: + id: <%= ActiveRecord::FixtureSet.identify("initech", :uuid) %> name: Initech LLC external_account_id: <%= ActiveRecord::FixtureSet.identify("initech") %> cards_count: 0 diff --git a/test/fixtures/action_text/rich_texts.yml b/test/fixtures/action_text/rich_texts.yml index 28fe7c3e0..9070e14cf 100644 --- a/test/fixtures/action_text/rich_texts.yml +++ b/test/fixtures/action_text/rich_texts.yml @@ -1,15 +1,15 @@ logo_agreement_jz: - record: logo_agreement_jz (Comment) + record: logo_agreement_jz_uuid (Comment) name: body body: I agree. logo_agreement_kevin: - record: logo_agreement_kevin (Comment) + record: logo_agreement_kevin_uuid (Comment) name: body body: Same, let’s do it. layout_overflowing_david: - record: layout_overflowing_david (Comment) + record: layout_overflowing_david_uuid (Comment) name: body body: The text is overflowing the container. diff --git a/test/fixtures/assignments.yml b/test/fixtures/assignments.yml index 81e778f62..b341b2516 100644 --- a/test/fixtures/assignments.yml +++ b/test/fixtures/assignments.yml @@ -1,16 +1,19 @@ logo_jz: - assigner: david - assignee: jz - card: logo + id: <%= ActiveRecord::FixtureSet.identify("logo_jz", :uuid) %> + assigner: david_uuid + assignee: jz_uuid + card: logo_uuid created_at: <%= 1.week.ago %> logo_kevin: - assigner: david - assignee: kevin - card: logo + id: <%= ActiveRecord::FixtureSet.identify("logo_kevin", :uuid) %> + assigner: david_uuid + assignee: kevin_uuid + card: logo_uuid created_at: <%= 1.day.ago %> layout_jz: - assigner: david - assignee: jz - card: layout + id: <%= ActiveRecord::FixtureSet.identify("layout_jz", :uuid) %> + assigner: david_uuid + assignee: jz_uuid + card: layout_uuid diff --git a/test/fixtures/boards.yml b/test/fixtures/boards.yml index 6ed4fcfec..e9d6b75bf 100644 --- a/test/fixtures/boards.yml +++ b/test/fixtures/boards.yml @@ -1,17 +1,20 @@ writebook: + id: <%= ActiveRecord::FixtureSet.identify("writebook", :uuid) %> name: Writebook - creator: david + creator: david_uuid all_access: true - account: 37s + account: 37s_uuid private: + id: <%= ActiveRecord::FixtureSet.identify("private", :uuid) %> name: Private board - creator: kevin + creator: kevin_uuid all_access: false - account: 37s + account: 37s_uuid staplers: + id: <%= ActiveRecord::FixtureSet.identify("staplers", :uuid) %> name: Staplers - creator: mike + creator: mike_uuid all_access: true - account: initech + account: initech_uuid diff --git a/test/fixtures/cards.yml b/test/fixtures/cards.yml index 46a7cad6d..a94f3e3a7 100644 --- a/test/fixtures/cards.yml +++ b/test/fixtures/cards.yml @@ -1,55 +1,60 @@ logo: + id: <%= ActiveRecord::FixtureSet.identify("logo", :uuid) %> number: 1 - board: writebook - creator: david - column: writebook_triage + board: writebook_uuid + creator: david_uuid + column: writebook_triage_uuid title: The logo isn't big enough due_on: <%= 3.days.from_now %> created_at: <%= 1.week.ago %> status: published last_active_at: <%= 1.week.ago %> - account: 37s + account: 37s_uuid layout: + id: <%= ActiveRecord::FixtureSet.identify("layout", :uuid) %> number: 2 - board: writebook - creator: david - column: writebook_triage + board: writebook_uuid + creator: david_uuid + column: writebook_triage_uuid title: Layout is broken created_at: <%= 1.week.ago %> status: published last_active_at: <%= 1.week.ago %> - account: 37s + account: 37s_uuid text: + id: <%= ActiveRecord::FixtureSet.identify("text", :uuid) %> number: 3 - board: writebook - creator: kevin - column: writebook_in_progress + board: writebook_uuid + creator: kevin_uuid + column: writebook_in_progress_uuid title: The text is too small created_at: <%= 1.week.ago %> status: published last_active_at: <%= 1.week.ago %> - account: 37s + account: 37s_uuid shipping: + id: <%= ActiveRecord::FixtureSet.identify("shipping", :uuid) %> number: 4 - board: writebook - creator: kevin - column: writebook_triage + board: writebook_uuid + creator: kevin_uuid + column: writebook_triage_uuid title: We need to ship the app created_at: <%= 1.week.ago %> status: published last_active_at: <%= 1.week.ago %> - account: 37s + account: 37s_uuid buy_domain: + id: <%= ActiveRecord::FixtureSet.identify("buy_domain", :uuid) %> number: 5 - board: writebook - creator: david + board: writebook_uuid + creator: david_uuid title: Buy domain created_at: <%= 1.week.ago %> status: published last_active_at: <%= 1.week.ago %> - account: 37s + account: 37s_uuid diff --git a/test/fixtures/closures.yml b/test/fixtures/closures.yml index cf9593601..f502bb006 100644 --- a/test/fixtures/closures.yml +++ b/test/fixtures/closures.yml @@ -1,3 +1,4 @@ shipping: - card: shipping - user: kevin \ No newline at end of file + id: <%= ActiveRecord::FixtureSet.identify("shipping_closure", :uuid) %> + card: shipping_uuid + user: kevin_uuid \ No newline at end of file diff --git a/test/fixtures/columns.yml b/test/fixtures/columns.yml index 39ce731c4..ff9cfd133 100644 --- a/test/fixtures/columns.yml +++ b/test/fixtures/columns.yml @@ -1,28 +1,32 @@ # Columns for writebook board (which has qa workflow) writebook_triage: + id: <%= ActiveRecord::FixtureSet.identify("writebook_triage", :uuid) %> name: Triage color: "var(--color-card-4)" - board: writebook + board: writebook_uuid position: 0 - account: 37s + account: 37s_uuid writebook_in_progress: + id: <%= ActiveRecord::FixtureSet.identify("writebook_in_progress", :uuid) %> name: In progress color: "var(--color-card-2)" - board: writebook + board: writebook_uuid position: 1 - account: 37s + account: 37s_uuid writebook_on_hold: + id: <%= ActiveRecord::FixtureSet.identify("writebook_on_hold", :uuid) %> name: On Hold color: "var(--color-card-4)" - board: writebook + board: writebook_uuid position: 2 - account: 37s + account: 37s_uuid writebook_review: + id: <%= ActiveRecord::FixtureSet.identify("writebook_review", :uuid) %> name: Review color: "var(--color-card-3)" - board: writebook + board: writebook_uuid position: 3 - account: 37s + account: 37s_uuid diff --git a/test/fixtures/comments.yml b/test/fixtures/comments.yml index affafbd6a..7040fce69 100644 --- a/test/fixtures/comments.yml +++ b/test/fixtures/comments.yml @@ -1,49 +1,58 @@ logo_1: - card: logo - creator: system + id: <%= ActiveRecord::FixtureSet.identify("logo_1", :uuid) %> + card: logo_uuid + creator: system_uuid created_at: <%= 1.week.ago %> - account: 37s + account: 37s_uuid logo_agreement_jz: - card: logo - creator: jz + id: <%= ActiveRecord::FixtureSet.identify("logo_agreement_jz", :uuid) %> + card: logo_uuid + creator: jz_uuid created_at: <%= 2.days.ago %> - account: 37s + account: 37s_uuid logo_3: - card: logo - creator: system + id: <%= ActiveRecord::FixtureSet.identify("logo_3", :uuid) %> + card: logo_uuid + creator: system_uuid created_at: <%= 1.day.ago %> - account: 37s + account: 37s_uuid logo_agreement_kevin: - card: logo - creator: kevin + id: <%= ActiveRecord::FixtureSet.identify("logo_agreement_kevin", :uuid) %> + card: logo_uuid + creator: kevin_uuid created_at: <%= 2.hours.ago %> - account: 37s + account: 37s_uuid logo_5: - card: logo - creator: system + id: <%= ActiveRecord::FixtureSet.identify("logo_5", :uuid) %> + card: logo_uuid + creator: system_uuid created_at: <%= 1.hour.ago %> - account: 37s + account: 37s_uuid layout_1: - card: layout - creator: system - account: 37s + id: <%= ActiveRecord::FixtureSet.identify("layout_1", :uuid) %> + card: layout_uuid + creator: system_uuid + account: 37s_uuid layout_overflowing_david: - card: layout - creator: david - account: 37s + id: <%= ActiveRecord::FixtureSet.identify("layout_overflowing_david", :uuid) %> + card: layout_uuid + creator: david_uuid + account: 37s_uuid text_1: - card: text - creator: system - account: 37s + id: <%= ActiveRecord::FixtureSet.identify("text_1", :uuid) %> + card: text_uuid + creator: system_uuid + account: 37s_uuid shipping_1: - card: shipping - creator: system - account: 37s + id: <%= ActiveRecord::FixtureSet.identify("shipping_1", :uuid) %> + card: shipping_uuid + creator: system_uuid + account: 37s_uuid diff --git a/test/fixtures/entropies.yml b/test/fixtures/entropies.yml index 712214176..f294a5d91 100644 --- a/test/fixtures/entropies.yml +++ b/test/fixtures/entropies.yml @@ -1,11 +1,14 @@ 37s_account: - container: 37s (Account) + id: <%= ActiveRecord::FixtureSet.identify("37s_account", :uuid) %> + container: 37s_uuid (Account) auto_postpone_period: <%= 30.days.to_i %> writebook_board: - container: writebook (Board) + id: <%= ActiveRecord::FixtureSet.identify("writebook_board", :uuid) %> + container: writebook_uuid (Board) auto_postpone_period: <%= 90.days.to_i %> private_board: - container: private (Board) + id: <%= ActiveRecord::FixtureSet.identify("private_board", :uuid) %> + container: private_uuid (Board) auto_postpone_period: <%= 30.days.to_i %> diff --git a/test/fixtures/events.yml b/test/fixtures/events.yml index 60f8dadcc..ea4f2f465 100644 --- a/test/fixtures/events.yml +++ b/test/fixtures/events.yml @@ -1,83 +1,93 @@ logo_published: - creator: david - board: writebook - eventable: logo (Card) + id: <%= ActiveRecord::FixtureSet.identify("logo_published", :uuid) %> + creator: david_uuid + board: writebook_uuid + eventable: logo_uuid (Card) action: card_published created_at: <%= 1.week.ago %> - account: 37s + account: 37s_uuid logo_assignment_jz: - creator: david - board: writebook - eventable: logo (Card) + id: <%= ActiveRecord::FixtureSet.identify("logo_assignment_jz", :uuid) %> + creator: david_uuid + board: writebook_uuid + eventable: logo_uuid (Card) action: card_assigned - particulars: <%= { assignee_ids: [ ActiveRecord::FixtureSet.identify(:jz) ] }.to_json %> + particulars: <%= { assignee_ids: [ ActiveRecord::FixtureSet.identify("jz", :uuid) ] }.to_json %> created_at: <%= 1.week.ago + 1.hour %> - account: 37s + account: 37s_uuid logo_assignment_david: - creator: david - board: writebook - eventable: logo (Card) + id: <%= ActiveRecord::FixtureSet.identify("logo_assignment_david", :uuid) %> + creator: david_uuid + board: writebook_uuid + eventable: logo_uuid (Card) action: card_assigned - particulars: <%= { assignee_ids: [ ActiveRecord::FixtureSet.identify(:david) ] }.to_json %> + particulars: <%= { assignee_ids: [ ActiveRecord::FixtureSet.identify("david", :uuid) ] }.to_json %> created_at: <%= 1.week.ago + 1.hour %> - account: 37s + account: 37s_uuid logo_assignment_km: - creator: david - board: writebook - eventable: logo (Card) + id: <%= ActiveRecord::FixtureSet.identify("logo_assignment_km", :uuid) %> + creator: david_uuid + board: writebook_uuid + eventable: logo_uuid (Card) action: card_assigned - particulars: <%= { assignee_ids: [ ActiveRecord::FixtureSet.identify(:kevin) ] }.to_json %> + particulars: <%= { assignee_ids: [ ActiveRecord::FixtureSet.identify("kevin", :uuid) ] }.to_json %> created_at: <%= 1.day.ago %> - account: 37s + account: 37s_uuid layout_published: - creator: david - board: writebook - eventable: layout (Card) + id: <%= ActiveRecord::FixtureSet.identify("layout_published", :uuid) %> + creator: david_uuid + board: writebook_uuid + eventable: layout_uuid (Card) action: card_published created_at: <%= 1.week.ago %> - account: 37s + account: 37s_uuid layout_commented: - creator: david - board: writebook - eventable: layout_overflowing_david (Comment) + id: <%= ActiveRecord::FixtureSet.identify("layout_commented", :uuid) %> + creator: david_uuid + board: writebook_uuid + eventable: layout_overflowing_david_uuid (Comment) action: comment_created created_at: <%= 1.week.ago %> - account: 37s + account: 37s_uuid layout_assignment_jz: - creator: david - board: writebook - eventable: layout (Card) + id: <%= ActiveRecord::FixtureSet.identify("layout_assignment_jz", :uuid) %> + creator: david_uuid + board: writebook_uuid + eventable: layout_uuid (Card) action: card_assigned - particulars: <%= { assignee_ids: [ ActiveRecord::FixtureSet.identify(:jz) ] }.to_json %> + particulars: <%= { assignee_ids: [ ActiveRecord::FixtureSet.identify("jz", :uuid) ] }.to_json %> created_at: <%= 1.hour.ago %> - account: 37s + account: 37s_uuid text_published: - creator: kevin - board: writebook - eventable: text (Card) + id: <%= ActiveRecord::FixtureSet.identify("text_published", :uuid) %> + creator: kevin_uuid + board: writebook_uuid + eventable: text_uuid (Card) action: card_published created_at: <%= 1.week.ago %> - account: 37s + account: 37s_uuid shipping_published: - creator: kevin - board: writebook - eventable: shipping (Card) + id: <%= ActiveRecord::FixtureSet.identify("shipping_published", :uuid) %> + creator: kevin_uuid + board: writebook_uuid + eventable: shipping_uuid (Card) action: card_published created_at: <%= 1.week.ago %> - account: 37s + account: 37s_uuid shipping_closed: - creator: kevin - board: writebook - eventable: shipping (Card) + id: <%= ActiveRecord::FixtureSet.identify("shipping_closed", :uuid) %> + creator: kevin_uuid + board: writebook_uuid + eventable: shipping_uuid (Card) action: card_closed created_at: <%= 2.days.ago %> - account: 37s + account: 37s_uuid diff --git a/test/fixtures/filters.yml b/test/fixtures/filters.yml index 5396d37dc..3775cba54 100644 --- a/test/fixtures/filters.yml +++ b/test/fixtures/filters.yml @@ -1,7 +1,8 @@ jz_assignments: - creator: david + id: <%= ActiveRecord::FixtureSet.identify("jz_assignments", :uuid) %> + creator: david_uuid tags: mobile assignees: jz fields: <%= { indexed_by: :all, sorted_by: :newest }.to_json %> - params_digest: <%= Filter.digest_params({ indexed_by: :all, sorted_by: :newest, tag_ids: [ ActiveRecord::FixtureSet.identify(:mobile) ], assignee_ids: [ ActiveRecord::FixtureSet.identify(:jz) ] }) %> - account: 37s + params_digest: <%= Filter.digest_params({ indexed_by: :all, sorted_by: :newest, tag_ids: [ ActiveRecord::FixtureSet.identify("mobile", :uuid) ], assignee_ids: [ ActiveRecord::FixtureSet.identify("jz", :uuid) ] }) %> + account: 37s_uuid diff --git a/test/fixtures/mentions.yml b/test/fixtures/mentions.yml index 77963954c..ab1b71cea 100644 --- a/test/fixtures/mentions.yml +++ b/test/fixtures/mentions.yml @@ -1,9 +1,11 @@ logo_card_david_mention_by_jz: - source: logo (Card) - mentioner: jz - mentionee: david + id: <%= ActiveRecord::FixtureSet.identify("logo_card_david_mention_by_jz", :uuid) %> + source: logo_uuid_uuid (Card) + mentioner: jz_uuid + mentionee: david_uuid logo_comment_david_mention_by_jz: - source: logo_agreement_jz (Comment) - mentioner: jz - mentionee: david + id: <%= ActiveRecord::FixtureSet.identify("logo_comment_david_mention_by_jz", :uuid) %> + source: logo_agreement_jz_uuid (Comment) + mentioner: jz_uuid + mentionee: david_uuid diff --git a/test/fixtures/notifications.yml b/test/fixtures/notifications.yml index 2d0e20c1c..9fe7da317 100644 --- a/test/fixtures/notifications.yml +++ b/test/fixtures/notifications.yml @@ -1,34 +1,39 @@ logo_published_kevin: - user: kevin - source: logo_published (Event) + id: <%= ActiveRecord::FixtureSet.identify("logo_published_kevin", :uuid) %> + user: kevin_uuid + source: logo_published_uuid (Event) created_at: <%= 1.week.ago %> - creator: david - account: 37s + creator: david_uuid + account: 37s_uuid logo_assignment_kevin: - user: kevin - source: logo_assignment_km (Event) + id: <%= ActiveRecord::FixtureSet.identify("logo_assignment_kevin", :uuid) %> + user: kevin_uuid + source: logo_assignment_km_uuid (Event) created_at: <%= 1.week.ago %> - creator: david - account: 37s + creator: david_uuid + account: 37s_uuid layout_commented_kevin: - user: kevin - source: layout_commented (Event) + id: <%= ActiveRecord::FixtureSet.identify("layout_commented_kevin", :uuid) %> + user: kevin_uuid + source: layout_commented_uuid (Event) created_at: <%= 1.week.ago %> - creator: david - account: 37s + creator: david_uuid + account: 37s_uuid logo_card_david_mention_by_jz: - user: david - source: logo_card_david_mention_by_jz (Mention) + id: <%= ActiveRecord::FixtureSet.identify("logo_card_david_mention_by_jz_notif", :uuid) %> + user: david_uuid + source: logo_card_david_mention_by_jz_uuid (Mention) created_at: <%= 1.week.ago %> - creator: david - account: 37s + creator: david_uuid + account: 37s_uuid logo_comment_david_mention_by_jz: - user: david - source: logo_comment_david_mention_by_jz (Mention) + id: <%= ActiveRecord::FixtureSet.identify("logo_comment_david_mention_by_jz_notif", :uuid) %> + user: david_uuid + source: logo_comment_david_mention_by_jz_uuid (Mention) created_at: <%= 1.week.ago %> - creator: david - account: 37s + creator: david_uuid + account: 37s_uuid diff --git a/test/fixtures/pins.yml b/test/fixtures/pins.yml index d73e0cfb3..1d4454ff8 100644 --- a/test/fixtures/pins.yml +++ b/test/fixtures/pins.yml @@ -1,7 +1,9 @@ logo_kevin: - card: logo - user: kevin + id: <%= ActiveRecord::FixtureSet.identify("logo_kevin_pin", :uuid) %> + card: logo_uuid + user: kevin_uuid shipping_kevin: - card: shipping + id: <%= ActiveRecord::FixtureSet.identify("shipping_kevin_pin", :uuid) %> + card: shipping_uuid user: kevin \ No newline at end of file diff --git a/test/fixtures/reactions.yml b/test/fixtures/reactions.yml index a99f0b4b6..3ea29310c 100644 --- a/test/fixtures/reactions.yml +++ b/test/fixtures/reactions.yml @@ -1,9 +1,11 @@ kevin: + id: <%= ActiveRecord::FixtureSet.identify("kevin_reaction", :uuid) %> content: "πŸ‘" comment: logo_agreement_jz reacter: kevin david: + id: <%= ActiveRecord::FixtureSet.identify("david_reaction", :uuid) %> content: "πŸ‘" comment: logo_agreement_jz reacter: david diff --git a/test/fixtures/taggings.yml b/test/fixtures/taggings.yml index 23e17dd61..c68ec92be 100644 --- a/test/fixtures/taggings.yml +++ b/test/fixtures/taggings.yml @@ -1,15 +1,19 @@ logo_web: - card: logo - tag: web + id: <%= ActiveRecord::FixtureSet.identify("logo_web_tagging", :uuid) %> + card: logo_uuid + tag: web_uuid layout_web: - card: layout - tag: web + id: <%= ActiveRecord::FixtureSet.identify("layout_web_tagging", :uuid) %> + card: layout_uuid + tag: web_uuid layout_mobile: - card: layout - tag: mobile + id: <%= ActiveRecord::FixtureSet.identify("layout_mobile_tagging", :uuid) %> + card: layout_uuid + tag: mobile_uuid text_mobile: - card: text - tag: mobile + id: <%= ActiveRecord::FixtureSet.identify("text_mobile_tagging", :uuid) %> + card: text_uuid + tag: mobile_uuid diff --git a/test/fixtures/tags.yml b/test/fixtures/tags.yml index 47139cd24..c0f64bf13 100644 --- a/test/fixtures/tags.yml +++ b/test/fixtures/tags.yml @@ -1,7 +1,9 @@ web: + id: <%= ActiveRecord::FixtureSet.identify("web", :uuid) %> title: web - account: 37s + account: 37s_uuid mobile: + id: <%= ActiveRecord::FixtureSet.identify("mobile", :uuid) %> title: mobile - account: 37s + account: 37s_uuid diff --git a/test/fixtures/users.yml b/test/fixtures/users.yml index 321c4666a..87a625f72 100644 --- a/test/fixtures/users.yml +++ b/test/fixtures/users.yml @@ -1,28 +1,33 @@ david: + id: <%= ActiveRecord::FixtureSet.identify("david", :uuid) %> name: David role: member membership: david_in_37signals - account: 37s + account: 37s_uuid jz: + id: <%= ActiveRecord::FixtureSet.identify("jz", :uuid) %> name: JZ role: member membership: jz_in_37signals - account: 37s + account: 37s_uuid kevin: + id: <%= ActiveRecord::FixtureSet.identify("kevin", :uuid) %> name: Kevin role: admin membership: kevin_in_37signals - account: 37s + account: 37s_uuid system: + id: <%= ActiveRecord::FixtureSet.identify("system", :uuid) %> name: System role: system - account: 37s + account: 37s_uuid mike: + id: <%= ActiveRecord::FixtureSet.identify("mike", :uuid) %> name: Mike role: admin membership: mike_in_initech - account: initech + account: initech_uuid diff --git a/test/fixtures/watches.yml b/test/fixtures/watches.yml index 40bf28619..b668c80e0 100644 --- a/test/fixtures/watches.yml +++ b/test/fixtures/watches.yml @@ -1,44 +1,53 @@ logo_david: - card: logo - user: david + id: <%= ActiveRecord::FixtureSet.identify("logo_david_watch", :uuid) %> + card: logo_uuid + user: david_uuid watching: true logo_kevin: - card: logo - user: kevin + id: <%= ActiveRecord::FixtureSet.identify("logo_kevin_watch", :uuid) %> + card: logo_uuid + user: kevin_uuid watching: true layout_david: - card: layout - user: david + id: <%= ActiveRecord::FixtureSet.identify("layout_david_watch", :uuid) %> + card: layout_uuid + user: david_uuid watching: true layout_kevin: - card: layout - user: kevin + id: <%= ActiveRecord::FixtureSet.identify("layout_kevin_watch", :uuid) %> + card: layout_uuid + user: kevin_uuid watching: true text_david: - card: text - user: david + id: <%= ActiveRecord::FixtureSet.identify("text_david_watch", :uuid) %> + card: text_uuid + user: david_uuid watching: true text_jz: - card: text - user: jz + id: <%= ActiveRecord::FixtureSet.identify("text_jz_watch", :uuid) %> + card: text_uuid + user: jz_uuid watching: true shipping_david: - card: shipping - user: david + id: <%= ActiveRecord::FixtureSet.identify("shipping_david_watch", :uuid) %> + card: shipping_uuid + user: david_uuid watching: true shipping_jz: - card: shipping - user: jz + id: <%= ActiveRecord::FixtureSet.identify("shipping_jz_watch", :uuid) %> + card: shipping_uuid + user: jz_uuid watching: true shipping_kevin: - card: shipping - user: kevin + id: <%= ActiveRecord::FixtureSet.identify("shipping_kevin_watch", :uuid) %> + card: shipping_uuid + user: kevin_uuid watching: true diff --git a/test/fixtures/webhooks.yml b/test/fixtures/webhooks.yml index f9a6d285b..0194a5f31 100644 --- a/test/fixtures/webhooks.yml +++ b/test/fixtures/webhooks.yml @@ -1,17 +1,19 @@ active: + id: <%= ActiveRecord::FixtureSet.identify("active_webhook", :uuid) %> active: true name: Production API url: https://api.example.com/webhooks signing_secret: p94Bx2HjempCdYB4DTyZkY1b subscribed_actions: '<%= %w[ card_published card_assigned card_closed ].to_json %>' - board: writebook - account: 37s + board: writebook_uuid + account: 37s_uuid inactive: + id: <%= ActiveRecord::FixtureSet.identify("inactive_webhook", :uuid) %> active: false name: Test Webhook url: https://test.example.com/webhooks signing_secret: H8ms8ADcV92v2x17hnLEiL5m subscribed_actions: '<%= %w[ card_published card_assigned card_closed ].to_json %>' - board: private - account: 37s + board: private_uuid + account: 37s_uuid diff --git a/test/test_helper.rb b/test/test_helper.rb index 86ffce440..399bedc84 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -70,6 +70,25 @@ class ActionDispatch::SystemTestCase end end +module FixturesTestHelper + extend ActiveSupport::Concern + + class_methods do + def identify(label, column_type = :integer) + if label.to_s.end_with?("_uuid") + label_without_suffix = label.to_s.delete_suffix("_uuid") + super(label_without_suffix, :uuid) + else + super(label, column_type) + end + end + end +end + +ActiveSupport.on_load(:active_record_fixture_set) do + prepend(FixturesTestHelper) +end + unless Rails.application.config.x.oss_config load File.expand_path("../gems/fizzy-saas/test/test_helper.rb", __dir__) end