synchronize documents generation

This commit is contained in:
Alex Turchyn
2023-07-01 13:16:07 +03:00
parent e55b5b47cd
commit 4180d02a1b
15 changed files with 148 additions and 12 deletions
@@ -0,0 +1,14 @@
# frozen_string_literal: true
class CreateDocumentGenerationEvents < ActiveRecord::Migration[7.0]
def change
create_table :document_generation_events do |t|
t.references :submitter, null: false, foreign_key: true, index: true
t.string :event_name, null: false
t.index %i[submitter_id event_name], unique: true, where: "event_name IN ('start', 'complete')"
t.timestamps
end
end
end
+11 -1
View File
@@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema[7.0].define(version: 2023_06_12_182744) do
ActiveRecord::Schema[7.0].define(version: 2023_07_01_075115) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@@ -52,6 +52,15 @@ ActiveRecord::Schema[7.0].define(version: 2023_06_12_182744) do
t.index ["blob_id", "variation_digest"], name: "index_active_storage_variant_records_uniqueness", unique: true
end
create_table "document_generation_events", force: :cascade do |t|
t.bigint "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"], name: "index_document_generation_events_on_submitter_id"
end
create_table "encrypted_configs", force: :cascade do |t|
t.bigint "account_id", null: false
t.string "key", null: false
@@ -135,6 +144,7 @@ ActiveRecord::Schema[7.0].define(version: 2023_06_12_182744) do
add_foreign_key "active_storage_attachments", "active_storage_blobs", column: "blob_id"
add_foreign_key "active_storage_variant_records", "active_storage_blobs", column: "blob_id"
add_foreign_key "document_generation_events", "submitters"
add_foreign_key "encrypted_configs", "accounts"
add_foreign_key "submissions", "templates"
add_foreign_key "submissions", "users", column: "created_by_user_id"