migration/annotate updates

I didn't make any actual migration changes, looks like it's just schema changes to work with PSQL instead of SQLite/MySQL
pull/501/head
Ryan Arakawa 4 months ago
parent 39b832d47a
commit 0672cd2cb4

@ -4,7 +4,7 @@
# #
# Table name: access_tokens # Table name: access_tokens
# #
# id :integer not null, primary key # id :bigint not null, primary key
# sha256 :string not null # sha256 :string not null
# token :text not null # token :text not null
# created_at :datetime not null # created_at :datetime not null
@ -18,7 +18,7 @@
# #
# Foreign Keys # Foreign Keys
# #
# user_id (user_id => users.id) # fk_rails_... (user_id => users.id)
# #
class AccessToken < ApplicationRecord class AccessToken < ApplicationRecord
TOKEN_LENGTH = 43 TOKEN_LENGTH = 43

@ -4,7 +4,7 @@
# #
# Table name: accounts # Table name: accounts
# #
# id :integer not null, primary key # id :bigint not null, primary key
# archived_at :datetime # archived_at :datetime
# locale :string not null # locale :string not null
# name :string not null # name :string not null

@ -4,7 +4,7 @@
# #
# Table name: account_accesses # Table name: account_accesses
# #
# id :integer not null, primary key # id :bigint not null, primary key
# created_at :datetime not null # created_at :datetime not null
# updated_at :datetime not null # updated_at :datetime not null
# account_id :integer not null # account_id :integer not null
@ -16,7 +16,7 @@
# #
# Foreign Keys # Foreign Keys
# #
# account_id (account_id => accounts.id) # fk_rails_... (account_id => accounts.id)
# #
class AccountAccess < ApplicationRecord class AccountAccess < ApplicationRecord
belongs_to :account belongs_to :account

@ -4,7 +4,7 @@
# #
# Table name: account_configs # Table name: account_configs
# #
# id :integer not null, primary key # id :bigint not null, primary key
# key :string not null # key :string not null
# value :text not null # value :text not null
# created_at :datetime not null # created_at :datetime not null
@ -18,7 +18,7 @@
# #
# Foreign Keys # Foreign Keys
# #
# account_id (account_id => accounts.id) # fk_rails_... (account_id => accounts.id)
# #
class AccountConfig < ApplicationRecord class AccountConfig < ApplicationRecord
SUBMITTER_INVITATION_EMAIL_KEY = 'submitter_invitation_email' SUBMITTER_INVITATION_EMAIL_KEY = 'submitter_invitation_email'

@ -4,7 +4,7 @@
# #
# Table name: account_linked_accounts # Table name: account_linked_accounts
# #
# id :integer not null, primary key # id :bigint not null, primary key
# account_type :text not null # account_type :text not null
# created_at :datetime not null # created_at :datetime not null
# updated_at :datetime not null # updated_at :datetime not null
@ -19,8 +19,8 @@
# #
# Foreign Keys # Foreign Keys
# #
# account_id (account_id => accounts.id) # fk_rails_... (account_id => accounts.id)
# linked_account_id (linked_account_id => accounts.id) # fk_rails_... (linked_account_id => accounts.id)
# #
class AccountLinkedAccount < ApplicationRecord class AccountLinkedAccount < ApplicationRecord
belongs_to :account belongs_to :account

@ -4,7 +4,7 @@
# #
# Table name: completed_documents # Table name: completed_documents
# #
# id :integer not null, primary key # id :bigint not null, primary key
# sha256 :string not null # sha256 :string not null
# created_at :datetime not null # created_at :datetime not null
# updated_at :datetime not null # updated_at :datetime not null

@ -4,7 +4,7 @@
# #
# Table name: completed_submitters # Table name: completed_submitters
# #
# id :integer not null, primary key # id :bigint not null, primary key
# completed_at :datetime not null # completed_at :datetime not null
# sms_count :integer not null # sms_count :integer not null
# source :string not null # source :string not null

@ -4,7 +4,7 @@
# #
# Table name: document_generation_events # Table name: document_generation_events
# #
# id :integer not null, primary key # id :bigint not null, primary key
# event_name :string not null # event_name :string not null
# created_at :datetime not null # created_at :datetime not null
# updated_at :datetime not null # updated_at :datetime not null
@ -13,11 +13,11 @@
# Indexes # Indexes
# #
# index_document_generation_events_on_submitter_id (submitter_id) # 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 IN ('start', 'complete') # 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[]))
# #
# Foreign Keys # Foreign Keys
# #
# submitter_id (submitter_id => submitters.id) # fk_rails_... (submitter_id => submitters.id)
# #
class DocumentGenerationEvent < ApplicationRecord class DocumentGenerationEvent < ApplicationRecord
belongs_to :submitter belongs_to :submitter

@ -4,7 +4,7 @@
# #
# Table name: email_events # Table name: email_events
# #
# id :integer not null, primary key # id :bigint not null, primary key
# data :text not null # data :text not null
# email :string not null # email :string not null
# emailable_type :string not null # emailable_type :string not null
@ -20,13 +20,13 @@
# #
# index_email_events_on_account_id_and_event_datetime (account_id,event_datetime) # index_email_events_on_account_id_and_event_datetime (account_id,event_datetime)
# index_email_events_on_email (email) # index_email_events_on_email (email)
# index_email_events_on_email_event_types (email) WHERE event_type IN ('bounce', 'soft_bounce', 'complaint', 'soft_complaint') # 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_emailable (emailable_type,emailable_id) # index_email_events_on_emailable (emailable_type,emailable_id)
# index_email_events_on_message_id (message_id) # index_email_events_on_message_id (message_id)
# #
# Foreign Keys # Foreign Keys
# #
# account_id (account_id => accounts.id) # fk_rails_... (account_id => accounts.id)
# #
class EmailEvent < ApplicationRecord class EmailEvent < ApplicationRecord
belongs_to :emailable, polymorphic: true belongs_to :emailable, polymorphic: true

@ -4,7 +4,7 @@
# #
# Table name: email_messages # Table name: email_messages
# #
# id :integer not null, primary key # id :bigint not null, primary key
# body :text not null # body :text not null
# sha1 :string not null # sha1 :string not null
# subject :text not null # subject :text not null
@ -22,8 +22,8 @@
# #
# Foreign Keys # Foreign Keys
# #
# account_id (account_id => accounts.id) # fk_rails_... (account_id => accounts.id)
# author_id (author_id => users.id) # fk_rails_... (author_id => users.id)
# #
class EmailMessage < ApplicationRecord class EmailMessage < ApplicationRecord
belongs_to :author, class_name: 'User' belongs_to :author, class_name: 'User'

@ -4,7 +4,7 @@
# #
# Table name: encrypted_configs # Table name: encrypted_configs
# #
# id :integer not null, primary key # id :bigint not null, primary key
# key :string not null # key :string not null
# value :text not null # value :text not null
# created_at :datetime not null # created_at :datetime not null
@ -18,7 +18,7 @@
# #
# Foreign Keys # Foreign Keys
# #
# account_id (account_id => accounts.id) # fk_rails_... (account_id => accounts.id)
# #
class EncryptedConfig < ApplicationRecord class EncryptedConfig < ApplicationRecord
CONFIG_KEYS = [ CONFIG_KEYS = [

@ -4,7 +4,7 @@
# #
# Table name: encrypted_user_configs # Table name: encrypted_user_configs
# #
# id :integer not null, primary key # id :bigint not null, primary key
# key :string not null # key :string not null
# value :text not null # value :text not null
# created_at :datetime not null # created_at :datetime not null
@ -18,7 +18,7 @@
# #
# Foreign Keys # Foreign Keys
# #
# user_id (user_id => users.id) # fk_rails_... (user_id => users.id)
# #
class EncryptedUserConfig < ApplicationRecord class EncryptedUserConfig < ApplicationRecord
belongs_to :user belongs_to :user

@ -4,7 +4,7 @@
# #
# Table name: submissions # Table name: submissions
# #
# id :integer not null, primary key # id :bigint not null, primary key
# archived_at :datetime # archived_at :datetime
# expire_at :datetime # expire_at :datetime
# name :text # name :text
@ -24,16 +24,16 @@
# Indexes # Indexes
# #
# index_submissions_on_account_id_and_id (account_id,id) # 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 (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_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_created_by_user_id (created_by_user_id)
# index_submissions_on_slug (slug) UNIQUE # index_submissions_on_slug (slug) UNIQUE
# index_submissions_on_template_id (template_id) # index_submissions_on_template_id (template_id)
# #
# Foreign Keys # Foreign Keys
# #
# created_by_user_id (created_by_user_id => users.id) # fk_rails_... (created_by_user_id => users.id)
# template_id (template_id => templates.id) # fk_rails_... (template_id => templates.id)
# #
class Submission < ApplicationRecord class Submission < ApplicationRecord
belongs_to :template, optional: true belongs_to :template, optional: true

@ -4,7 +4,7 @@
# #
# Table name: submission_events # Table name: submission_events
# #
# id :integer not null, primary key # id :bigint not null, primary key
# data :text not null # data :text not null
# event_timestamp :datetime not null # event_timestamp :datetime not null
# event_type :string not null # event_type :string not null
@ -21,8 +21,8 @@
# #
# Foreign Keys # Foreign Keys
# #
# submission_id (submission_id => submissions.id) # fk_rails_... (submission_id => submissions.id)
# submitter_id (submitter_id => submitters.id) # fk_rails_... (submitter_id => submitters.id)
# #
class SubmissionEvent < ApplicationRecord class SubmissionEvent < ApplicationRecord
belongs_to :submission belongs_to :submission

@ -4,7 +4,7 @@
# #
# Table name: submitters # Table name: submitters
# #
# id :integer not null, primary key # id :bigint not null, primary key
# completed_at :datetime # completed_at :datetime
# declined_at :datetime # declined_at :datetime
# email :string # email :string
@ -37,7 +37,7 @@
# #
# Foreign Keys # Foreign Keys
# #
# submission_id (submission_id => submissions.id) # fk_rails_... (submission_id => submissions.id)
# #
class Submitter < ApplicationRecord class Submitter < ApplicationRecord
belongs_to :submission belongs_to :submission

@ -4,7 +4,7 @@
# #
# Table name: templates # Table name: templates
# #
# id :integer not null, primary key # id :bigint not null, primary key
# archived_at :datetime # archived_at :datetime
# fields :text not null # fields :text not null
# name :string not null # name :string not null
@ -24,8 +24,8 @@
# Indexes # Indexes
# #
# index_templates_on_account_id (account_id) # 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_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_id_archived (account_id,id) WHERE (archived_at IS NOT NULL)
# index_templates_on_author_id (author_id) # index_templates_on_author_id (author_id)
# index_templates_on_external_id (external_id) # index_templates_on_external_id (external_id)
# index_templates_on_folder_id (folder_id) # index_templates_on_folder_id (folder_id)
@ -33,9 +33,9 @@
# #
# Foreign Keys # Foreign Keys
# #
# account_id (account_id => accounts.id) # fk_rails_... (account_id => accounts.id)
# author_id (author_id => users.id) # fk_rails_... (author_id => users.id)
# folder_id (folder_id => template_folders.id) # fk_rails_... (folder_id => template_folders.id)
# #
class Template < ApplicationRecord class Template < ApplicationRecord
DEFAULT_SUBMITTER_NAME = 'First Party' DEFAULT_SUBMITTER_NAME = 'First Party'

@ -4,7 +4,7 @@
# #
# Table name: template_accesses # Table name: template_accesses
# #
# id :integer not null, primary key # id :bigint not null, primary key
# created_at :datetime not null # created_at :datetime not null
# updated_at :datetime not null # updated_at :datetime not null
# template_id :integer not null # template_id :integer not null
@ -16,7 +16,7 @@
# #
# Foreign Keys # Foreign Keys
# #
# template_id (template_id => templates.id) # fk_rails_... (template_id => templates.id)
# #
class TemplateAccess < ApplicationRecord class TemplateAccess < ApplicationRecord
ADMIN_USER_ID = -1 ADMIN_USER_ID = -1

@ -4,7 +4,7 @@
# #
# Table name: template_folders # Table name: template_folders
# #
# id :integer not null, primary key # id :bigint not null, primary key
# archived_at :datetime # archived_at :datetime
# name :string not null # name :string not null
# created_at :datetime not null # created_at :datetime not null
@ -19,8 +19,8 @@
# #
# Foreign Keys # Foreign Keys
# #
# account_id (account_id => accounts.id) # fk_rails_... (account_id => accounts.id)
# author_id (author_id => users.id) # fk_rails_... (author_id => users.id)
# #
class TemplateFolder < ApplicationRecord class TemplateFolder < ApplicationRecord
DEFAULT_NAME = 'Default' DEFAULT_NAME = 'Default'

@ -4,7 +4,7 @@
# #
# Table name: template_sharings # Table name: template_sharings
# #
# id :integer not null, primary key # id :bigint not null, primary key
# ability :string not null # ability :string not null
# created_at :datetime not null # created_at :datetime not null
# updated_at :datetime not null # updated_at :datetime not null
@ -18,7 +18,7 @@
# #
# Foreign Keys # Foreign Keys
# #
# template_id (template_id => templates.id) # fk_rails_... (template_id => templates.id)
# #
class TemplateSharing < ApplicationRecord class TemplateSharing < ApplicationRecord
ALL_ID = -1 ALL_ID = -1

@ -4,7 +4,7 @@
# #
# Table name: users # Table name: users
# #
# id :integer not null, primary key # id :bigint not null, primary key
# archived_at :datetime # archived_at :datetime
# consumed_timestep :integer # consumed_timestep :integer
# current_sign_in_at :datetime # current_sign_in_at :datetime
@ -40,7 +40,7 @@
# #
# Foreign Keys # Foreign Keys
# #
# account_id (account_id => accounts.id) # fk_rails_... (account_id => accounts.id)
# #
class User < ApplicationRecord class User < ApplicationRecord
ROLES = [ ROLES = [

@ -4,7 +4,7 @@
# #
# Table name: user_configs # Table name: user_configs
# #
# id :integer not null, primary key # id :bigint not null, primary key
# key :string not null # key :string not null
# value :text not null # value :text not null
# created_at :datetime not null # created_at :datetime not null
@ -18,7 +18,7 @@
# #
# Foreign Keys # Foreign Keys
# #
# user_id (user_id => users.id) # fk_rails_... (user_id => users.id)
# #
class UserConfig < ApplicationRecord class UserConfig < ApplicationRecord
SIGNATURE_KEY = 'signature' SIGNATURE_KEY = 'signature'

@ -4,7 +4,7 @@
# #
# Table name: webhook_urls # Table name: webhook_urls
# #
# id :integer not null, primary key # id :bigint not null, primary key
# events :text not null # events :text not null
# secret :text not null # secret :text not null
# sha1 :string not null # sha1 :string not null
@ -20,7 +20,7 @@
# #
# Foreign Keys # Foreign Keys
# #
# account_id (account_id => accounts.id) # fk_rails_... (account_id => accounts.id)
# #
class WebhookUrl < ApplicationRecord class WebhookUrl < ApplicationRecord
EVENTS = %w[ EVENTS = %w[

@ -11,6 +11,9 @@
# It's strongly recommended that you check this file into your version control system. # 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 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 "pg_catalog.plpgsql"
create_table "access_tokens", force: :cascade do |t| create_table "access_tokens", force: :cascade do |t|
t.integer "user_id", null: false t.integer "user_id", null: false
t.text "token", null: false t.text "token", null: false
@ -156,7 +159,7 @@ ActiveRecord::Schema[8.0].define(version: 2025_06_18_085322) do
t.string "event_name", null: false t.string "event_name", null: false
t.datetime "created_at", null: false t.datetime "created_at", null: false
t.datetime "updated_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 IN ('start', 'complete')" 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"], name: "index_document_generation_events_on_submitter_id" t.index ["submitter_id"], name: "index_document_generation_events_on_submitter_id"
end end
@ -173,7 +176,7 @@ ActiveRecord::Schema[8.0].define(version: 2025_06_18_085322) do
t.datetime "created_at", null: false t.datetime "created_at", null: false
t.index ["account_id", "event_datetime"], name: "index_email_events_on_account_id_and_event_datetime" 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"
t.index ["email"], name: "index_email_events_on_email_event_types", where: "event_type IN ('bounce', 'soft_bounce', 'complaint', 'soft_complaint')" 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 ["emailable_type", "emailable_id"], name: "index_email_events_on_emailable" t.index ["emailable_type", "emailable_id"], name: "index_email_events_on_emailable"
t.index ["message_id"], name: "index_email_events_on_message_id" t.index ["message_id"], name: "index_email_events_on_message_id"
end end
@ -284,8 +287,8 @@ ActiveRecord::Schema[8.0].define(version: 2025_06_18_085322) do
t.datetime "expire_at" t.datetime "expire_at"
t.text "name" t.text "name"
t.index ["account_id", "id"], name: "index_submissions_on_account_id_and_id" 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", 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_archived", where: "(archived_at IS NOT NULL)"
t.index ["created_by_user_id"], name: "index_submissions_on_created_by_user_id" 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 ["slug"], name: "index_submissions_on_slug", unique: true
t.index ["template_id"], name: "index_submissions_on_template_id" t.index ["template_id"], name: "index_submissions_on_template_id"
@ -365,8 +368,8 @@ ActiveRecord::Schema[8.0].define(version: 2025_06_18_085322) do
t.string "external_id" t.string "external_id"
t.text "preferences", null: false t.text "preferences", null: false
t.boolean "shared_link", default: false, 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", "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", "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 ["account_id"], name: "index_templates_on_account_id"
t.index ["author_id"], name: "index_templates_on_author_id" t.index ["author_id"], name: "index_templates_on_author_id"
t.index ["external_id"], name: "index_templates_on_external_id" t.index ["external_id"], name: "index_templates_on_external_id"

Loading…
Cancel
Save