Skip to content

Commit

Permalink
Merge pull request #1343 from SplitTime/oveson/file-downloads-table
Browse files Browse the repository at this point in the history
Migration to create a file_downloads table
  • Loading branch information
moveson authored Dec 19, 2024
2 parents 315cad8 + 584a39e commit 56df2c4
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 1 deletion.
13 changes: 13 additions & 0 deletions db/migrate/20241219004057_create_file_downloads.rb
Original file line number Diff line number Diff line change
@@ -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
16 changes: 15 additions & 1 deletion db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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"
Expand Down
Binary file modified erd.pdf
Binary file not shown.

0 comments on commit 56df2c4

Please sign in to comment.