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

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

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

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

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

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

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

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

@ -4,7 +4,7 @@
#
# Table name: email_events
#
# id :integer not null, primary key
# id :bigint not null, primary key
# data :text not null
# email :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_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_message_id (message_id)
#
# Foreign Keys
#
# account_id (account_id => accounts.id)
# fk_rails_... (account_id => accounts.id)
#
class EmailEvent < ApplicationRecord
belongs_to :emailable, polymorphic: true

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

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

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

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

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

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

@ -4,7 +4,7 @@
#
# Table name: templates
#
# id :integer not null, primary key
# id :bigint not null, primary key
# archived_at :datetime
# fields :text not null
# name :string not null
@ -24,8 +24,8 @@
# 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
#
# account_id (account_id => accounts.id)
# author_id (author_id => users.id)
# folder_id (folder_id => template_folders.id)
# fk_rails_... (account_id => accounts.id)
# fk_rails_... (author_id => users.id)
# fk_rails_... (folder_id => template_folders.id)
#
class Template < ApplicationRecord
DEFAULT_SUBMITTER_NAME = 'First Party'

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

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

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

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

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

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

@ -11,6 +11,9 @@
# 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 "pg_catalog.plpgsql"
create_table "access_tokens", force: :cascade do |t|
t.integer "user_id", 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.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 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"
end
@ -173,7 +176,7 @@ 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 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 ["message_id"], name: "index_email_events_on_message_id"
end
@ -284,8 +287,8 @@ ActiveRecord::Schema[8.0].define(version: 2025_06_18_085322) do
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"
@ -365,8 +368,8 @@ ActiveRecord::Schema[8.0].define(version: 2025_06_18_085322) do
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"

Loading…
Cancel
Save