diff --git a/db/migrate/20241219004057_create_file_downloads.rb b/db/migrate/20241219004057_create_file_downloads.rb new file mode 100644 index 000000000..10f9cf966 --- /dev/null +++ b/db/migrate/20241219004057_create_file_downloads.rb @@ -0,0 +1,13 @@ +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.string :filename, null: false + t.string :byte_size, null: false + + t.timestamps + end + end +end diff --git a/db/schema.rb b/db/schema.rb index 1ab415af9..89844e8e0 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,19 @@ 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.string "filename", null: false + t.string "byte_size", 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 +782,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 18deb6942..4befaeca8 100644 Binary files a/erd.pdf and b/erd.pdf differ