Add alert model

This commit is contained in:
2025-10-08 00:07:36 -07:00
parent 7c6936b9c2
commit 6b5d069729
4 changed files with 39 additions and 1 deletions

View File

@@ -0,0 +1,17 @@
class CreateAlerts < ActiveRecord::Migration[8.0]
def change
create_table :alerts do |t|
t.string :category, null: false
t.text :description
t.string :park_code, null: false
t.string :title, null: false
t.string :url
t.timestamp :indexed_date
t.timestamps
end
add_index :alerts, :park_code
add_foreign_key :alerts, :parks, column: :park_code, primary_key: :code
end
end

16
db/schema.rb generated
View File

@@ -10,7 +10,19 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema[8.0].define(version: 2025_10_08_044109) do
ActiveRecord::Schema[8.0].define(version: 2025_10_08_063847) do
create_table "alerts", force: :cascade do |t|
t.string "category", null: false
t.text "description"
t.string "park_code", null: false
t.string "title", null: false
t.string "url"
t.datetime "indexed_date"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["park_code"], name: "index_alerts_on_park_code"
end
create_table "parks", force: :cascade do |t|
t.string "code", null: false
t.string "name", null: false
@@ -20,4 +32,6 @@ ActiveRecord::Schema[8.0].define(version: 2025_10_08_044109) do
t.datetime "updated_at", null: false
t.index ["code"], name: "index_parks_on_code", unique: true
end
add_foreign_key "alerts", "parks", column: "park_code", primary_key: "code"
end