Add naive impl of seeding alerts

This commit is contained in:
2025-10-08 01:58:44 -07:00
parent fe0c04b971
commit a31a4413f3
5 changed files with 32 additions and 0 deletions

View File

@@ -3,6 +3,7 @@ class CreateAlerts < ActiveRecord::Migration[8.0]
create_table :alerts do |t|
t.string :category, null: false
t.text :description
t.string :identifier, null: false
t.string :park_code, null: false
t.string :title, null: false
t.string :url
@@ -11,6 +12,7 @@ class CreateAlerts < ActiveRecord::Migration[8.0]
t.timestamps
end
add_index :alerts, :identifier, unique: true
add_index :alerts, :park_code
add_foreign_key :alerts, :parks, column: :park_code, primary_key: :code
end

2
db/schema.rb generated
View File

@@ -14,12 +14,14 @@ 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 "identifier", null: false
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 ["identifier"], name: "index_alerts_on_identifier", unique: true
t.index ["park_code"], name: "index_alerts_on_park_code"
end