From cb81dd170a7ca3b3d51be6688dc2cfff6ef4b1b7 Mon Sep 17 00:00:00 2001 From: Ryan Arakawa Date: Mon, 30 Jun 2025 11:38:15 -0500 Subject: [PATCH] initial commit --- Gemfile.lock | 2 - app/models/access_token.rb | 8 +- app/models/account.rb | 2 +- app/models/account_access.rb | 8 +- app/models/account_config.rb | 6 +- app/models/account_linked_account.rb | 10 +-- app/models/completed_document.rb | 2 +- app/models/completed_submitter.rb | 2 +- app/models/document_generation_event.rb | 8 +- app/models/email_event.rb | 10 +-- app/models/email_message.rb | 10 +-- app/models/encrypted_config.rb | 6 +- app/models/encrypted_user_config.rb | 6 +- app/models/submission.rb | 18 ++-- app/models/submission_event.rb | 10 +-- app/models/submitter.rb | 8 +- app/models/template.rb | 18 ++-- app/models/template_access.rb | 8 +- app/models/template_folder.rb | 10 +-- app/models/template_sharing.rb | 8 +- app/models/user.rb | 8 +- app/models/user_config.rb | 6 +- app/models/webhook_url.rb | 6 +- db/schema.rb | 115 ++++++++++-------------- 24 files changed, 136 insertions(+), 159 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 943a7d74..d38ce518 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -325,7 +325,6 @@ GEM multi_json (1.15.0) multipart-post (2.4.1) mutex_m (0.3.0) - mysql2 (0.5.6) net-http-persistent (4.0.5) connection_pool (~> 2.2) net-imap (0.5.6) @@ -619,7 +618,6 @@ DEPENDENCIES jwt letter_opener_web lograge - mysql2 oj pagy pg diff --git a/app/models/access_token.rb b/app/models/access_token.rb index 70345046..4bb16771 100644 --- a/app/models/access_token.rb +++ b/app/models/access_token.rb @@ -4,12 +4,12 @@ # # Table name: access_tokens # -# id :bigint not null, primary key -# sha256 :text not null +# id :integer not null, primary key +# sha256 :string not null # token :text not null # created_at :datetime not null # updated_at :datetime not null -# user_id :bigint not null +# user_id :integer not null # # Indexes # @@ -18,7 +18,7 @@ # # Foreign Keys # -# fk_rails_... (user_id => users.id) +# user_id (user_id => users.id) # class AccessToken < ApplicationRecord TOKEN_LENGTH = 43 diff --git a/app/models/account.rb b/app/models/account.rb index 6265734d..a050f336 100644 --- a/app/models/account.rb +++ b/app/models/account.rb @@ -4,7 +4,7 @@ # # Table name: accounts # -# id :bigint not null, primary key +# id :integer not null, primary key # archived_at :datetime # locale :string not null # name :string not null diff --git a/app/models/account_access.rb b/app/models/account_access.rb index 162c3703..67a3ca43 100644 --- a/app/models/account_access.rb +++ b/app/models/account_access.rb @@ -4,11 +4,11 @@ # # Table name: account_accesses # -# id :bigint not null, primary key +# id :integer not null, primary key # created_at :datetime not null # updated_at :datetime not null -# account_id :bigint not null -# user_id :bigint not null +# account_id :integer not null +# user_id :integer not null # # Indexes # @@ -16,7 +16,7 @@ # # Foreign Keys # -# fk_rails_... (account_id => accounts.id) +# account_id (account_id => accounts.id) # class AccountAccess < ApplicationRecord belongs_to :account diff --git a/app/models/account_config.rb b/app/models/account_config.rb index df46e547..4c2d30af 100644 --- a/app/models/account_config.rb +++ b/app/models/account_config.rb @@ -4,12 +4,12 @@ # # Table name: account_configs # -# id :bigint not null, primary key +# id :integer not null, primary key # key :string not null # value :text not null # created_at :datetime not null # updated_at :datetime not null -# account_id :bigint not null +# account_id :integer not null # # Indexes # @@ -18,7 +18,7 @@ # # Foreign Keys # -# fk_rails_... (account_id => accounts.id) +# account_id (account_id => accounts.id) # class AccountConfig < ApplicationRecord SUBMITTER_INVITATION_EMAIL_KEY = 'submitter_invitation_email' diff --git a/app/models/account_linked_account.rb b/app/models/account_linked_account.rb index 3d68aea7..096dc974 100644 --- a/app/models/account_linked_account.rb +++ b/app/models/account_linked_account.rb @@ -4,12 +4,12 @@ # # Table name: account_linked_accounts # -# id :bigint not null, primary key +# id :integer not null, primary key # account_type :text not null # created_at :datetime not null # updated_at :datetime not null -# account_id :bigint not null -# linked_account_id :bigint not null +# account_id :integer not null +# linked_account_id :integer not null # # Indexes # @@ -19,8 +19,8 @@ # # Foreign Keys # -# fk_rails_... (account_id => accounts.id) -# fk_rails_... (linked_account_id => accounts.id) +# account_id (account_id => accounts.id) +# linked_account_id (linked_account_id => accounts.id) # class AccountLinkedAccount < ApplicationRecord belongs_to :account diff --git a/app/models/completed_document.rb b/app/models/completed_document.rb index 5ec53ca4..fa08a5ae 100644 --- a/app/models/completed_document.rb +++ b/app/models/completed_document.rb @@ -4,7 +4,7 @@ # # Table name: completed_documents # -# id :bigint not null, primary key +# id :integer not null, primary key # sha256 :string not null # created_at :datetime not null # updated_at :datetime not null diff --git a/app/models/completed_submitter.rb b/app/models/completed_submitter.rb index 6ada62f3..35df279e 100644 --- a/app/models/completed_submitter.rb +++ b/app/models/completed_submitter.rb @@ -4,7 +4,7 @@ # # Table name: completed_submitters # -# id :bigint not null, primary key +# id :integer not null, primary key # completed_at :datetime not null # sms_count :integer not null # source :string not null diff --git a/app/models/document_generation_event.rb b/app/models/document_generation_event.rb index 95daafa6..60dce188 100644 --- a/app/models/document_generation_event.rb +++ b/app/models/document_generation_event.rb @@ -4,20 +4,20 @@ # # Table name: document_generation_events # -# id :bigint not null, primary key +# id :integer not null, primary key # event_name :string not null # created_at :datetime not null # updated_at :datetime not null -# submitter_id :bigint not null +# submitter_id :integer not null # # Indexes # # index_document_generation_events_on_submitter_id (submitter_id) -# index_document_generation_events_on_submitter_id_and_event_name (submitter_id,event_name) UNIQUE WHERE ((event_name)::text = ANY ((ARRAY['start'::character varying, 'complete'::character varying])::text[])) +# index_document_generation_events_on_submitter_id_and_event_name (submitter_id,event_name) UNIQUE WHERE event_name IN ('start', 'complete') # # Foreign Keys # -# fk_rails_... (submitter_id => submitters.id) +# submitter_id (submitter_id => submitters.id) # class DocumentGenerationEvent < ApplicationRecord belongs_to :submitter diff --git a/app/models/email_event.rb b/app/models/email_event.rb index ed796226..3e28712c 100644 --- a/app/models/email_event.rb +++ b/app/models/email_event.rb @@ -4,7 +4,7 @@ # # Table name: email_events # -# id :bigint not null, primary key +# id :integer not null, primary key # data :text not null # email :string not null # emailable_type :string not null @@ -12,21 +12,21 @@ # event_type :string not null # tag :string not null # created_at :datetime not null -# account_id :bigint not null -# emailable_id :bigint not null +# account_id :integer not null +# emailable_id :integer not null # message_id :string not null # # Indexes # # index_email_events_on_account_id_and_event_datetime (account_id,event_datetime) # index_email_events_on_email (email) -# index_email_events_on_email_event_types (email) WHERE ((event_type)::text = ANY ((ARRAY['bounce'::character varying, 'soft_bounce'::character varying, 'complaint'::character varying, 'soft_complaint'::character varying])::text[])) +# index_email_events_on_email_event_types (email) WHERE event_type IN ('bounce', 'soft_bounce', 'complaint', 'soft_complaint') # index_email_events_on_emailable (emailable_type,emailable_id) # index_email_events_on_message_id (message_id) # # Foreign Keys # -# fk_rails_... (account_id => accounts.id) +# account_id (account_id => accounts.id) # class EmailEvent < ApplicationRecord belongs_to :emailable, polymorphic: true diff --git a/app/models/email_message.rb b/app/models/email_message.rb index 25156d6f..4ceef9dc 100644 --- a/app/models/email_message.rb +++ b/app/models/email_message.rb @@ -4,15 +4,15 @@ # # Table name: email_messages # -# id :bigint not null, primary key +# id :integer not null, primary key # body :text not null # sha1 :string not null # subject :text not null # uuid :string not null # created_at :datetime not null # updated_at :datetime not null -# account_id :bigint not null -# author_id :bigint not null +# account_id :integer not null +# author_id :integer not null # # Indexes # @@ -22,8 +22,8 @@ # # Foreign Keys # -# fk_rails_... (account_id => accounts.id) -# fk_rails_... (author_id => users.id) +# account_id (account_id => accounts.id) +# author_id (author_id => users.id) # class EmailMessage < ApplicationRecord belongs_to :author, class_name: 'User' diff --git a/app/models/encrypted_config.rb b/app/models/encrypted_config.rb index e61923b4..940f51bc 100644 --- a/app/models/encrypted_config.rb +++ b/app/models/encrypted_config.rb @@ -4,12 +4,12 @@ # # Table name: encrypted_configs # -# id :bigint not null, primary key +# id :integer not null, primary key # key :string not null # value :text not null # created_at :datetime not null # updated_at :datetime not null -# account_id :bigint not null +# account_id :integer not null # # Indexes # @@ -18,7 +18,7 @@ # # Foreign Keys # -# fk_rails_... (account_id => accounts.id) +# account_id (account_id => accounts.id) # class EncryptedConfig < ApplicationRecord CONFIG_KEYS = [ diff --git a/app/models/encrypted_user_config.rb b/app/models/encrypted_user_config.rb index e29d7ff3..ea1f3ca8 100644 --- a/app/models/encrypted_user_config.rb +++ b/app/models/encrypted_user_config.rb @@ -4,12 +4,12 @@ # # Table name: encrypted_user_configs # -# id :bigint not null, primary key +# id :integer not null, primary key # key :string not null # value :text not null # created_at :datetime not null # updated_at :datetime not null -# user_id :bigint not null +# user_id :integer not null # # Indexes # @@ -18,7 +18,7 @@ # # Foreign Keys # -# fk_rails_... (user_id => users.id) +# user_id (user_id => users.id) # class EncryptedUserConfig < ApplicationRecord belongs_to :user diff --git a/app/models/submission.rb b/app/models/submission.rb index 002933e5..ffee6140 100644 --- a/app/models/submission.rb +++ b/app/models/submission.rb @@ -4,36 +4,36 @@ # # Table name: submissions # -# id :bigint not null, primary key +# id :integer not null, primary key # archived_at :datetime # expire_at :datetime # name :text # preferences :text not null # slug :string not null -# source :text not null +# source :string not null # submitters_order :string not null # template_fields :text # template_schema :text # template_submitters :text # created_at :datetime not null # updated_at :datetime not null -# account_id :bigint not null -# created_by_user_id :bigint -# template_id :bigint +# account_id :integer not null +# created_by_user_id :integer +# template_id :integer # # Indexes # # index_submissions_on_account_id_and_id (account_id,id) -# index_submissions_on_account_id_and_template_id_and_id (account_id,template_id,id) WHERE (archived_at IS NULL) -# index_submissions_on_account_id_and_template_id_and_id_archived (account_id,template_id,id) WHERE (archived_at IS NOT NULL) +# index_submissions_on_account_id_and_template_id_and_id (account_id,template_id,id) WHERE archived_at IS NULL +# index_submissions_on_account_id_and_template_id_and_id_archived (account_id,template_id,id) WHERE archived_at IS NOT NULL # index_submissions_on_created_by_user_id (created_by_user_id) # index_submissions_on_slug (slug) UNIQUE # index_submissions_on_template_id (template_id) # # Foreign Keys # -# fk_rails_... (created_by_user_id => users.id) -# fk_rails_... (template_id => templates.id) +# created_by_user_id (created_by_user_id => users.id) +# template_id (template_id => templates.id) # class Submission < ApplicationRecord belongs_to :template, optional: true diff --git a/app/models/submission_event.rb b/app/models/submission_event.rb index 1ae47e79..c69b896f 100644 --- a/app/models/submission_event.rb +++ b/app/models/submission_event.rb @@ -4,14 +4,14 @@ # # Table name: submission_events # -# id :bigint not null, primary key +# id :integer not null, primary key # data :text not null # event_timestamp :datetime not null # event_type :string not null # created_at :datetime not null # updated_at :datetime not null -# submission_id :bigint not null -# submitter_id :bigint +# submission_id :integer not null +# submitter_id :integer # # Indexes # @@ -21,8 +21,8 @@ # # Foreign Keys # -# fk_rails_... (submission_id => submissions.id) -# fk_rails_... (submitter_id => submitters.id) +# submission_id (submission_id => submissions.id) +# submitter_id (submitter_id => submitters.id) # class SubmissionEvent < ApplicationRecord belongs_to :submission diff --git a/app/models/submitter.rb b/app/models/submitter.rb index b684dfbe..f95677dd 100644 --- a/app/models/submitter.rb +++ b/app/models/submitter.rb @@ -4,7 +4,7 @@ # # Table name: submitters # -# id :bigint not null, primary key +# id :integer not null, primary key # completed_at :datetime # declined_at :datetime # email :string @@ -22,9 +22,9 @@ # values :text not null # created_at :datetime not null # updated_at :datetime not null -# account_id :bigint not null +# account_id :integer not null # external_id :string -# submission_id :bigint not null +# submission_id :integer not null # # Indexes # @@ -37,7 +37,7 @@ # # Foreign Keys # -# fk_rails_... (submission_id => submissions.id) +# submission_id (submission_id => submissions.id) # class Submitter < ApplicationRecord belongs_to :submission diff --git a/app/models/template.rb b/app/models/template.rb index 41b635a0..00779faa 100644 --- a/app/models/template.rb +++ b/app/models/template.rb @@ -4,7 +4,7 @@ # # Table name: templates # -# id :bigint not null, primary key +# id :integer not null, primary key # archived_at :datetime # fields :text not null # name :string not null @@ -16,16 +16,16 @@ # submitters :text not null # created_at :datetime not null # updated_at :datetime not null -# account_id :bigint not null -# author_id :bigint not null +# account_id :integer not null +# author_id :integer not null # external_id :string -# folder_id :bigint not null +# folder_id :integer not null # # Indexes # # index_templates_on_account_id (account_id) -# index_templates_on_account_id_and_folder_id_and_id (account_id,folder_id,id) WHERE (archived_at IS NULL) -# index_templates_on_account_id_and_id_archived (account_id,id) WHERE (archived_at IS NOT NULL) +# index_templates_on_account_id_and_folder_id_and_id (account_id,folder_id,id) WHERE archived_at IS NULL +# index_templates_on_account_id_and_id_archived (account_id,id) WHERE archived_at IS NOT NULL # index_templates_on_author_id (author_id) # index_templates_on_external_id (external_id) # index_templates_on_folder_id (folder_id) @@ -33,9 +33,9 @@ # # Foreign Keys # -# fk_rails_... (account_id => accounts.id) -# fk_rails_... (author_id => users.id) -# fk_rails_... (folder_id => template_folders.id) +# account_id (account_id => accounts.id) +# author_id (author_id => users.id) +# folder_id (folder_id => template_folders.id) # class Template < ApplicationRecord DEFAULT_SUBMITTER_NAME = 'First Party' diff --git a/app/models/template_access.rb b/app/models/template_access.rb index 7e459513..6c909ac5 100644 --- a/app/models/template_access.rb +++ b/app/models/template_access.rb @@ -4,11 +4,11 @@ # # Table name: template_accesses # -# id :bigint not null, primary key +# id :integer not null, primary key # created_at :datetime not null # updated_at :datetime not null -# template_id :bigint not null -# user_id :bigint not null +# template_id :integer not null +# user_id :integer not null # # Indexes # @@ -16,7 +16,7 @@ # # Foreign Keys # -# fk_rails_... (template_id => templates.id) +# template_id (template_id => templates.id) # class TemplateAccess < ApplicationRecord ADMIN_USER_ID = -1 diff --git a/app/models/template_folder.rb b/app/models/template_folder.rb index ea9401f6..26a98234 100644 --- a/app/models/template_folder.rb +++ b/app/models/template_folder.rb @@ -4,13 +4,13 @@ # # Table name: template_folders # -# id :bigint not null, primary key +# id :integer not null, primary key # archived_at :datetime # name :string not null # created_at :datetime not null # updated_at :datetime not null -# account_id :bigint not null -# author_id :bigint not null +# account_id :integer not null +# author_id :integer not null # # Indexes # @@ -19,8 +19,8 @@ # # Foreign Keys # -# fk_rails_... (account_id => accounts.id) -# fk_rails_... (author_id => users.id) +# account_id (account_id => accounts.id) +# author_id (author_id => users.id) # class TemplateFolder < ApplicationRecord DEFAULT_NAME = 'Default' diff --git a/app/models/template_sharing.rb b/app/models/template_sharing.rb index b520fd2c..7a41b519 100644 --- a/app/models/template_sharing.rb +++ b/app/models/template_sharing.rb @@ -4,12 +4,12 @@ # # Table name: template_sharings # -# id :bigint not null, primary key +# id :integer not null, primary key # ability :string not null # created_at :datetime not null # updated_at :datetime not null -# account_id :bigint not null -# template_id :bigint not null +# account_id :integer not null +# template_id :integer not null # # Indexes # @@ -18,7 +18,7 @@ # # Foreign Keys # -# fk_rails_... (template_id => templates.id) +# template_id (template_id => templates.id) # class TemplateSharing < ApplicationRecord ALL_ID = -1 diff --git a/app/models/user.rb b/app/models/user.rb index f840ca7d..a2bfcf37 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -4,7 +4,7 @@ # # Table name: users # -# id :bigint not null, primary key +# id :integer not null, primary key # archived_at :datetime # consumed_timestep :integer # current_sign_in_at :datetime @@ -25,10 +25,10 @@ # role :string not null # sign_in_count :integer default(0), not null # unlock_token :string -# uuid :text not null +# uuid :string not null # created_at :datetime not null # updated_at :datetime not null -# account_id :bigint not null +# account_id :integer not null # # Indexes # @@ -40,7 +40,7 @@ # # Foreign Keys # -# fk_rails_... (account_id => accounts.id) +# account_id (account_id => accounts.id) # class User < ApplicationRecord ROLES = [ diff --git a/app/models/user_config.rb b/app/models/user_config.rb index 87849013..898ed3e4 100644 --- a/app/models/user_config.rb +++ b/app/models/user_config.rb @@ -4,12 +4,12 @@ # # Table name: user_configs # -# id :bigint not null, primary key +# id :integer not null, primary key # key :string not null # value :text not null # created_at :datetime not null # updated_at :datetime not null -# user_id :bigint not null +# user_id :integer not null # # Indexes # @@ -18,7 +18,7 @@ # # Foreign Keys # -# fk_rails_... (user_id => users.id) +# user_id (user_id => users.id) # class UserConfig < ApplicationRecord SIGNATURE_KEY = 'signature' diff --git a/app/models/webhook_url.rb b/app/models/webhook_url.rb index 1ee046cb..8e98829f 100644 --- a/app/models/webhook_url.rb +++ b/app/models/webhook_url.rb @@ -4,14 +4,14 @@ # # Table name: webhook_urls # -# id :bigint not null, primary key +# id :integer not null, primary key # events :text not null # secret :text not null # sha1 :string not null # url :text not null # created_at :datetime not null # updated_at :datetime not null -# account_id :bigint not null +# account_id :integer not null # # Indexes # @@ -20,7 +20,7 @@ # # Foreign Keys # -# fk_rails_... (account_id => accounts.id) +# account_id (account_id => accounts.id) # class WebhookUrl < ApplicationRecord EVENTS = %w[ diff --git a/db/schema.rb b/db/schema.rb index 703b5df7..6a3f0c5f 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,14 +11,10 @@ # It's strongly recommended that you check this file into your version control system. ActiveRecord::Schema[8.0].define(version: 2025_06_18_085322) do - # These are extensions that must be enabled in order to support this database - enable_extension "btree_gin" - enable_extension "plpgsql" - create_table "access_tokens", force: :cascade do |t| - t.bigint "user_id", null: false + t.integer "user_id", null: false t.text "token", null: false - t.text "sha256", null: false + t.string "sha256", null: false t.datetime "created_at", null: false t.datetime "updated_at", null: false t.index ["sha256"], name: "index_access_tokens_on_sha256", unique: true @@ -26,15 +22,15 @@ ActiveRecord::Schema[8.0].define(version: 2025_06_18_085322) do end create_table "account_accesses", force: :cascade do |t| - t.bigint "account_id", null: false - t.bigint "user_id", null: false + t.integer "account_id", null: false + t.integer "user_id", null: false t.datetime "created_at", null: false t.datetime "updated_at", null: false t.index ["account_id", "user_id"], name: "index_account_accesses_on_account_id_and_user_id", unique: true end create_table "account_configs", force: :cascade do |t| - t.bigint "account_id", null: false + t.integer "account_id", null: false t.string "key", null: false t.text "value", null: false t.datetime "created_at", null: false @@ -44,8 +40,8 @@ ActiveRecord::Schema[8.0].define(version: 2025_06_18_085322) do end create_table "account_linked_accounts", force: :cascade do |t| - t.bigint "account_id", null: false - t.bigint "linked_account_id", null: false + t.integer "account_id", null: false + t.integer "linked_account_id", null: false t.text "account_type", null: false t.datetime "created_at", null: false t.datetime "updated_at", null: false @@ -123,8 +119,8 @@ ActiveRecord::Schema[8.0].define(version: 2025_06_18_085322) do create_table "console1984_commands", force: :cascade do |t| t.text "statements" - t.bigint "sensitive_access_id" - t.bigint "session_id", null: false + t.integer "sensitive_access_id" + t.integer "session_id", null: false t.datetime "created_at", null: false t.datetime "updated_at", null: false t.index ["sensitive_access_id"], name: "index_console1984_commands_on_sensitive_access_id" @@ -133,7 +129,7 @@ ActiveRecord::Schema[8.0].define(version: 2025_06_18_085322) do create_table "console1984_sensitive_accesses", force: :cascade do |t| t.text "justification" - t.bigint "session_id", null: false + t.integer "session_id", null: false t.datetime "created_at", null: false t.datetime "updated_at", null: false t.index ["session_id"], name: "index_console1984_sensitive_accesses_on_session_id" @@ -141,7 +137,7 @@ ActiveRecord::Schema[8.0].define(version: 2025_06_18_085322) do create_table "console1984_sessions", force: :cascade do |t| t.text "reason" - t.bigint "user_id", null: false + t.integer "user_id", null: false t.datetime "created_at", null: false t.datetime "updated_at", null: false t.index ["created_at"], name: "index_console1984_sessions_on_created_at" @@ -156,18 +152,18 @@ ActiveRecord::Schema[8.0].define(version: 2025_06_18_085322) do end create_table "document_generation_events", force: :cascade do |t| - t.bigint "submitter_id", null: false + t.integer "submitter_id", null: false t.string "event_name", null: false t.datetime "created_at", null: false t.datetime "updated_at", null: false - t.index ["submitter_id", "event_name"], name: "index_document_generation_events_on_submitter_id_and_event_name", unique: true, where: "((event_name)::text = ANY ((ARRAY['start'::character varying, 'complete'::character varying])::text[]))" + t.index ["submitter_id", "event_name"], name: "index_document_generation_events_on_submitter_id_and_event_name", unique: true, where: "event_name IN ('start', 'complete')" t.index ["submitter_id"], name: "index_document_generation_events_on_submitter_id" end create_table "email_events", force: :cascade do |t| - t.bigint "account_id", null: false + t.integer "account_id", null: false t.string "emailable_type", null: false - t.bigint "emailable_id", null: false + t.integer "emailable_id", null: false t.string "message_id", null: false t.string "tag", null: false t.string "event_type", null: false @@ -177,15 +173,15 @@ ActiveRecord::Schema[8.0].define(version: 2025_06_18_085322) do t.datetime "created_at", null: false t.index ["account_id", "event_datetime"], name: "index_email_events_on_account_id_and_event_datetime" t.index ["email"], name: "index_email_events_on_email" - t.index ["email"], name: "index_email_events_on_email_event_types", where: "((event_type)::text = ANY ((ARRAY['bounce'::character varying, 'soft_bounce'::character varying, 'complaint'::character varying, 'soft_complaint'::character varying])::text[]))" + t.index ["email"], name: "index_email_events_on_email_event_types", where: "event_type IN ('bounce', 'soft_bounce', 'complaint', 'soft_complaint')" t.index ["emailable_type", "emailable_id"], name: "index_email_events_on_emailable" t.index ["message_id"], name: "index_email_events_on_message_id" end create_table "email_messages", force: :cascade do |t| t.string "uuid", null: false - t.bigint "author_id", null: false - t.bigint "account_id", null: false + t.integer "author_id", null: false + t.integer "account_id", null: false t.text "subject", null: false t.text "body", null: false t.string "sha1", null: false @@ -197,7 +193,7 @@ ActiveRecord::Schema[8.0].define(version: 2025_06_18_085322) do end create_table "encrypted_configs", force: :cascade do |t| - t.bigint "account_id", null: false + t.integer "account_id", null: false t.string "key", null: false t.text "value", null: false t.datetime "created_at", null: false @@ -207,7 +203,7 @@ ActiveRecord::Schema[8.0].define(version: 2025_06_18_085322) do end create_table "encrypted_user_configs", force: :cascade do |t| - t.bigint "user_id", null: false + t.integer "user_id", null: false t.string "key", null: false t.text "value", null: false t.datetime "created_at", null: false @@ -217,8 +213,8 @@ ActiveRecord::Schema[8.0].define(version: 2025_06_18_085322) do end create_table "oauth_access_grants", force: :cascade do |t| - t.bigint "resource_owner_id", null: false - t.bigint "application_id", null: false + t.integer "resource_owner_id", null: false + t.integer "application_id", null: false t.string "token", null: false t.integer "expires_in", null: false t.text "redirect_uri", null: false @@ -231,8 +227,8 @@ ActiveRecord::Schema[8.0].define(version: 2025_06_18_085322) do end create_table "oauth_access_tokens", force: :cascade do |t| - t.bigint "resource_owner_id" - t.bigint "application_id", null: false + t.integer "resource_owner_id" + t.integer "application_id", null: false t.string "token", null: false t.string "refresh_token" t.integer "expires_in" @@ -258,26 +254,9 @@ ActiveRecord::Schema[8.0].define(version: 2025_06_18_085322) do t.index ["uid"], name: "index_oauth_applications_on_uid", unique: true end - create_table "search_entries", force: :cascade do |t| - t.string "record_type", null: false - t.bigint "record_id", null: false - t.bigint "account_id", null: false - t.tsvector "tsvector", null: false - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.tsvector "ngram" - t.index ["account_id", "ngram"], name: "index_search_entries_on_account_id_ngram_submission", where: "((record_type)::text = 'Submission'::text)", using: :gin - t.index ["account_id", "ngram"], name: "index_search_entries_on_account_id_ngram_submitter", where: "((record_type)::text = 'Submitter'::text)", using: :gin - t.index ["account_id", "ngram"], name: "index_search_entries_on_account_id_ngram_template", where: "((record_type)::text = 'Template'::text)", using: :gin - t.index ["account_id", "tsvector"], name: "index_search_entries_on_account_id_tsvector_submission", where: "((record_type)::text = 'Submission'::text)", using: :gin - t.index ["account_id", "tsvector"], name: "index_search_entries_on_account_id_tsvector_submitter", where: "((record_type)::text = 'Submitter'::text)", using: :gin - t.index ["account_id", "tsvector"], name: "index_search_entries_on_account_id_tsvector_template", where: "((record_type)::text = 'Template'::text)", using: :gin - t.index ["record_id", "record_type"], name: "index_search_entries_on_record_id_and_record_type", unique: true - end - create_table "submission_events", force: :cascade do |t| - t.bigint "submission_id", null: false - t.bigint "submitter_id" + t.integer "submission_id", null: false + t.integer "submitter_id" t.text "data", null: false t.string "event_type", null: false t.datetime "event_timestamp", null: false @@ -289,8 +268,8 @@ ActiveRecord::Schema[8.0].define(version: 2025_06_18_085322) do end create_table "submissions", force: :cascade do |t| - t.bigint "template_id" - t.bigint "created_by_user_id" + t.integer "template_id" + t.integer "created_by_user_id" t.datetime "archived_at" t.datetime "created_at", null: false t.datetime "updated_at", null: false @@ -301,19 +280,19 @@ ActiveRecord::Schema[8.0].define(version: 2025_06_18_085322) do t.string "submitters_order", null: false t.string "slug", null: false t.text "preferences", null: false - t.bigint "account_id", null: false + t.integer "account_id", null: false t.datetime "expire_at" t.text "name" t.index ["account_id", "id"], name: "index_submissions_on_account_id_and_id" - t.index ["account_id", "template_id", "id"], name: "index_submissions_on_account_id_and_template_id_and_id", where: "(archived_at IS NULL)" - t.index ["account_id", "template_id", "id"], name: "index_submissions_on_account_id_and_template_id_and_id_archived", where: "(archived_at IS NOT NULL)" + t.index ["account_id", "template_id", "id"], name: "index_submissions_on_account_id_and_template_id_and_id", where: "archived_at IS NULL" + t.index ["account_id", "template_id", "id"], name: "index_submissions_on_account_id_and_template_id_and_id_archived", where: "archived_at IS NOT NULL" t.index ["created_by_user_id"], name: "index_submissions_on_created_by_user_id" t.index ["slug"], name: "index_submissions_on_slug", unique: true t.index ["template_id"], name: "index_submissions_on_template_id" end create_table "submitters", force: :cascade do |t| - t.bigint "submission_id", null: false + t.integer "submission_id", null: false t.string "uuid", null: false t.string "email" t.string "slug", null: false @@ -330,7 +309,7 @@ ActiveRecord::Schema[8.0].define(version: 2025_06_18_085322) do t.string "external_id" t.text "preferences", null: false t.text "metadata", null: false - t.bigint "account_id", null: false + t.integer "account_id", null: false t.datetime "declined_at" t.string "timezone" t.index ["account_id", "id"], name: "index_submitters_on_account_id_and_id" @@ -342,8 +321,8 @@ ActiveRecord::Schema[8.0].define(version: 2025_06_18_085322) do end create_table "template_accesses", force: :cascade do |t| - t.bigint "template_id", null: false - t.bigint "user_id", null: false + t.integer "template_id", null: false + t.integer "user_id", null: false t.datetime "created_at", null: false t.datetime "updated_at", null: false t.index ["template_id", "user_id"], name: "index_template_accesses_on_template_id_and_user_id", unique: true @@ -351,8 +330,8 @@ ActiveRecord::Schema[8.0].define(version: 2025_06_18_085322) do create_table "template_folders", force: :cascade do |t| t.string "name", null: false - t.bigint "author_id", null: false - t.bigint "account_id", null: false + t.integer "author_id", null: false + t.integer "account_id", null: false t.datetime "archived_at" t.datetime "created_at", null: false t.datetime "updated_at", null: false @@ -361,8 +340,8 @@ ActiveRecord::Schema[8.0].define(version: 2025_06_18_085322) do end create_table "template_sharings", force: :cascade do |t| - t.bigint "template_id", null: false - t.bigint "account_id", null: false + t.integer "template_id", null: false + t.integer "account_id", null: false t.string "ability", null: false t.datetime "created_at", null: false t.datetime "updated_at", null: false @@ -376,18 +355,18 @@ ActiveRecord::Schema[8.0].define(version: 2025_06_18_085322) do t.text "schema", null: false t.text "fields", null: false t.text "submitters", null: false - t.bigint "author_id", null: false - t.bigint "account_id", null: false + t.integer "author_id", null: false + t.integer "account_id", null: false t.datetime "archived_at" t.datetime "created_at", null: false t.datetime "updated_at", null: false t.text "source", null: false - t.bigint "folder_id", null: false + t.integer "folder_id", null: false t.string "external_id" t.text "preferences", null: false t.boolean "shared_link", default: false, null: false - t.index ["account_id", "folder_id", "id"], name: "index_templates_on_account_id_and_folder_id_and_id", where: "(archived_at IS NULL)" - t.index ["account_id", "id"], name: "index_templates_on_account_id_and_id_archived", where: "(archived_at IS NOT NULL)" + t.index ["account_id", "folder_id", "id"], name: "index_templates_on_account_id_and_folder_id_and_id", where: "archived_at IS NULL" + t.index ["account_id", "id"], name: "index_templates_on_account_id_and_id_archived", where: "archived_at IS NOT NULL" t.index ["account_id"], name: "index_templates_on_account_id" t.index ["author_id"], name: "index_templates_on_author_id" t.index ["external_id"], name: "index_templates_on_external_id" @@ -396,7 +375,7 @@ ActiveRecord::Schema[8.0].define(version: 2025_06_18_085322) do end create_table "user_configs", force: :cascade do |t| - t.bigint "user_id", null: false + t.integer "user_id", null: false t.string "key", null: false t.text "value", null: false t.datetime "created_at", null: false @@ -411,7 +390,7 @@ ActiveRecord::Schema[8.0].define(version: 2025_06_18_085322) do t.string "email", null: false t.string "role", null: false t.string "encrypted_password", null: false - t.bigint "account_id", null: false + t.integer "account_id", null: false t.string "reset_password_token" t.datetime "reset_password_sent_at" t.datetime "remember_created_at" @@ -438,7 +417,7 @@ ActiveRecord::Schema[8.0].define(version: 2025_06_18_085322) do end create_table "webhook_urls", force: :cascade do |t| - t.bigint "account_id", null: false + t.integer "account_id", null: false t.text "url", null: false t.text "events", null: false t.string "sha1", null: false