From d03d7901554d0a66bf908f14244160694b2b395c Mon Sep 17 00:00:00 2001 From: moveson Date: Wed, 18 Dec 2024 17:43:27 -0700 Subject: [PATCH] Migration to create a file_downloads table --- .../20241219004057_create_file_downloads.rb | 11 +++++++++++ db/schema.rb | 14 +++++++++++++- erd.pdf | Bin 76461 -> 76461 bytes 3 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 db/migrate/20241219004057_create_file_downloads.rb diff --git a/db/migrate/20241219004057_create_file_downloads.rb b/db/migrate/20241219004057_create_file_downloads.rb new file mode 100644 index 000000000..e1953153a --- /dev/null +++ b/db/migrate/20241219004057_create_file_downloads.rb @@ -0,0 +1,11 @@ +class CreateFileDownloads < ActiveRecord::Migration[7.0] + def change + create_table :file_downloads do |t| + t.references :user, null: false, foreign_key: true + t.references :record, polymorphic: true, null: false + t.string :name, null: false + + t.timestamps + end + end +end diff --git a/db/schema.rb b/db/schema.rb index 1ab415af9..d8df9d61a 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[7.0].define(version: 2024_12_18_183211) do +ActiveRecord::Schema[7.0].define(version: 2024_12_19_004057) do # These are extensions that must be enabled in order to support this database enable_extension "fuzzystrmatch" enable_extension "pg_trgm" @@ -255,6 +255,17 @@ t.index ["user_id"], name: "index_export_jobs_on_user_id" end + create_table "file_downloads", force: :cascade do |t| + t.bigint "user_id", null: false + t.string "record_type", null: false + t.bigint "record_id", null: false + t.string "name", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["record_type", "record_id"], name: "index_file_downloads_on_record" + t.index ["user_id"], name: "index_file_downloads_on_user_id" + end + create_table "friendly_id_slugs", force: :cascade do |t| t.string "slug", null: false t.integer "sluggable_id", null: false @@ -769,6 +780,7 @@ add_foreign_key "events", "courses" add_foreign_key "events", "event_groups" add_foreign_key "export_jobs", "users" + add_foreign_key "file_downloads", "users" add_foreign_key "historical_facts", "organizations" add_foreign_key "historical_facts", "people" add_foreign_key "import_jobs", "users" diff --git a/erd.pdf b/erd.pdf index 18deb6942556174eaab65d796ee0e6a13bccaa57..9fbe38cbb07b53fb73b6347ae1c58ea9e36f24f8 100644 GIT binary patch delta 587 zcmV-R0<`_D)da281c0;w+b4f(!Y~-c@BJ&@WlRrilbEI=#e)hm#z3mKu|tTV21Zko zbj<&LNwtoV)A!?hdGGO2kW7>)Nyb1+nhAkLC9=9kak};z#X+{(X8?*fbN2WE13`n& z5pC_z1<-809u)^?&x6tqGbN3)pgCRU46{oJy%md zp2#}>T;o_b1WzT63n_=LFnom3wtT|aubk-eASSw)e39>%;vSb?!c0;>?csV#?#VOR z(mt=4^)OeG+A8-T-{chYMXh%{U*5?D=eB(M?b$N_0UKm>gn5D5VgR+)58Z7LK4; zMv_bO_m!MDrRcKz*wM_g43vl^mXvU?B_l#$u@a;#k)N-vB7?Wj07+YCxO%#<|Ff@N%-am+3u^nR1)BW<1RFGl&yx^{m)zkTDh490e~ z3>vd~!znKqXKTh5v3Q}YXG-Uj$zLoyMeC$LNT*Ydlxzg=x-oKRe_~u3UqM9y&Zv0A z?m`rJ6c5GT*`Y^SrY7|_myu5B6seP)?~|LlPWTnU4SMRTI92O!qx5mVOE9KR{HVPh zoYEePhvz8@Rk(%s@eURL7OZ5DU$(vP7jJN1FAn_z`nqpGm+dG49|AZqmkucbEde!` z;UfVVlW>6qmsu$RMt=fO7{&4DnixbV4k?B&`I2HN4S~?m;s*3MC~)Peuw{@*B_q