add submission tracking events

This commit is contained in:
Alex Turchyn
2023-09-10 12:55:41 +03:00
parent 62cea05084
commit 8cabe31827
15 changed files with 190 additions and 4 deletions
@@ -0,0 +1,15 @@
# frozen_string_literal: true
class CreateSubmissionEvents < ActiveRecord::Migration[7.0]
def change
create_table :submission_events do |t|
t.references :submission, null: false, foreign_key: true, index: true
t.references :submitter, null: true, foreign_key: true, index: true
t.text :data, null: false
t.string :event_type, null: false
t.datetime :event_timestamp, null: false
t.timestamps
end
end
end
+15 -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_09_09_213212) do
ActiveRecord::Schema[7.0].define(version: 2023_09_10_084410) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@@ -91,6 +91,18 @@ ActiveRecord::Schema[7.0].define(version: 2023_09_09_213212) do
t.index ["account_id"], name: "index_encrypted_configs_on_account_id"
end
create_table "submission_events", force: :cascade do |t|
t.bigint "submission_id", null: false
t.bigint "submitter_id"
t.text "data", null: false
t.string "event_type", null: false
t.datetime "event_timestamp", null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["submission_id"], name: "index_submission_events_on_submission_id"
t.index ["submitter_id"], name: "index_submission_events_on_submitter_id"
end
create_table "submissions", force: :cascade do |t|
t.bigint "template_id", null: false
t.bigint "created_by_user_id"
@@ -178,6 +190,8 @@ ActiveRecord::Schema[7.0].define(version: 2023_09_09_213212) do
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 "submission_events", "submissions"
add_foreign_key "submission_events", "submitters"
add_foreign_key "submissions", "templates"
add_foreign_key "submissions", "users", column: "created_by_user_id"
add_foreign_key "submitters", "submissions"