Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migration to create a file_downloads table #1343

Merged
merged 2 commits into from
Dec 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
Loading