diff options
author | Matthew Lemon <y@yulqen.org> | 2024-11-14 15:47:43 +0000 |
---|---|---|
committer | Matthew Lemon <y@yulqen.org> | 2024-11-14 15:47:43 +0000 |
commit | 6427b28c60c6ed0dfd637307d1ab4ffe65c1144d (patch) | |
tree | 156d280b94557f9606c053f6187aec2a21eb1b36 /db | |
parent | 1b64b0b709c5704de48120e20bdfad32f34b0b5d (diff) |
Adds ResourceType model
Diffstat (limited to '')
-rw-r--r-- | db/migrate/20241114152218_create_resource_types.rb | 9 | ||||
-rw-r--r-- | db/migrate/20241114152810_add_resource_type_to_pdf_resource.rb | 5 | ||||
-rw-r--r-- | db/schema.rb | 11 |
3 files changed, 24 insertions, 1 deletions
diff --git a/db/migrate/20241114152218_create_resource_types.rb b/db/migrate/20241114152218_create_resource_types.rb new file mode 100644 index 0000000..f7f9de6 --- /dev/null +++ b/db/migrate/20241114152218_create_resource_types.rb @@ -0,0 +1,9 @@ +class CreateResourceTypes < ActiveRecord::Migration[8.0] + def change + create_table :resource_types do |t| + t.string :name + + t.timestamps + end + end +end diff --git a/db/migrate/20241114152810_add_resource_type_to_pdf_resource.rb b/db/migrate/20241114152810_add_resource_type_to_pdf_resource.rb new file mode 100644 index 0000000..e1c853b --- /dev/null +++ b/db/migrate/20241114152810_add_resource_type_to_pdf_resource.rb @@ -0,0 +1,5 @@ +class AddResourceTypeToPdfResource < ActiveRecord::Migration[8.0] + def change + add_reference :pdfresources, :resource_type, foreign_key: true + end +end diff --git a/db/schema.rb b/db/schema.rb index 61a7f3a..e09d8c2 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[8.0].define(version: 2024_11_14_105702) do +ActiveRecord::Schema[8.0].define(version: 2024_11_14_152810) do create_table "active_storage_attachments", force: :cascade do |t| t.string "name", null: false t.string "record_type", null: false @@ -51,6 +51,14 @@ ActiveRecord::Schema[8.0].define(version: 2024_11_14_105702) do t.datetime "created_at", null: false t.datetime "updated_at", null: false t.integer "credits" + t.integer "resource_type_id" + t.index ["resource_type_id"], name: "index_pdfresources_on_resource_type_id" + end + + create_table "resource_types", force: :cascade do |t| + t.string "name" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false end create_table "sessions", force: :cascade do |t| @@ -75,5 +83,6 @@ ActiveRecord::Schema[8.0].define(version: 2024_11_14_105702) do add_foreign_key "active_storage_attachments", "active_storage_blobs", column: "blob_id" add_foreign_key "active_storage_variant_records", "active_storage_blobs", column: "blob_id" + add_foreign_key "pdfresources", "resource_types" add_foreign_key "sessions", "users" end |