summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Gay <david@davidgay.org>2023-11-03 00:46:36 -0400
committerDavid Gay <david@davidgay.org>2023-11-03 00:46:36 -0400
commit47ecf3f515ef5bd7db2c4f3bce0a872a46ca2233 (patch)
tree2d35d24c94ce69159946cde8229d04292cce3e84
parent86f9bb8a2c3a8f011ac4b9c8d726e34607ed47c1 (diff)
Adjust PokedexEntry to take a shiny boolean instead
-rw-r--r--db/migrate/20231103011455_create_pokedex_entries.rb2
-rw-r--r--db/schema.rb18
-rw-r--r--test/fixtures/pokedex_entries.yml4
3 files changed, 20 insertions, 4 deletions
diff --git a/db/migrate/20231103011455_create_pokedex_entries.rb b/db/migrate/20231103011455_create_pokedex_entries.rb
index 04232b1..aa75459 100644
--- a/db/migrate/20231103011455_create_pokedex_entries.rb
+++ b/db/migrate/20231103011455_create_pokedex_entries.rb
@@ -5,7 +5,7 @@ class CreatePokedexEntries < ActiveRecord::Migration[7.1]
t.references :run, null: false, foreign_key: true
t.references :pokemon, null: false, foreign_key: true
t.timestamp :recorded_at, null: false
- t.timestamp :recorded_shiny_at
+ t.boolean :shiny, null: false, default: false
t.timestamps
end
diff --git a/db/schema.rb b/db/schema.rb
index 0e65c84..3e64504 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[7.1].define(version: 2023_11_03_002142) do
+ActiveRecord::Schema[7.1].define(version: 2023_11_03_011455) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@@ -59,6 +59,19 @@ ActiveRecord::Schema[7.1].define(version: 2023_11_03_002142) do
t.datetime "updated_at", null: false
end
+ create_table "pokedex_entries", force: :cascade do |t|
+ t.bigint "user_id", null: false
+ t.bigint "run_id", null: false
+ t.bigint "pokemon_id", null: false
+ t.datetime "recorded_at", precision: nil, null: false
+ t.boolean "shiny", default: false, null: false
+ t.datetime "created_at", null: false
+ t.datetime "updated_at", null: false
+ t.index ["pokemon_id"], name: "index_pokedex_entries_on_pokemon_id"
+ t.index ["run_id"], name: "index_pokedex_entries_on_run_id"
+ t.index ["user_id"], name: "index_pokedex_entries_on_user_id"
+ end
+
create_table "pokemons", force: :cascade do |t|
t.string "pokedex_num", null: false
t.string "name", null: false
@@ -91,6 +104,9 @@ ActiveRecord::Schema[7.1].define(version: 2023_11_03_002142) do
add_foreign_key "active_storage_variant_records", "active_storage_blobs", column: "blob_id"
add_foreign_key "checkpoints", "runs"
add_foreign_key "checkpoints", "users"
+ add_foreign_key "pokedex_entries", "pokemons"
+ add_foreign_key "pokedex_entries", "runs"
+ add_foreign_key "pokedex_entries", "users"
add_foreign_key "runs", "games"
add_foreign_key "runs", "users"
end
diff --git a/test/fixtures/pokedex_entries.yml b/test/fixtures/pokedex_entries.yml
index 602f9d9..659bee3 100644
--- a/test/fixtures/pokedex_entries.yml
+++ b/test/fixtures/pokedex_entries.yml
@@ -5,11 +5,11 @@ one:
run: one
pokemon: one
recorded_at: 2023-11-02 21:14:55
- recorded_shiny_at: 2023-11-02 21:14:55
+ shiny: false
two:
user: two
run: two
pokemon: two
recorded_at: 2023-11-02 21:14:55
- recorded_shiny_at: 2023-11-02 21:14:55
+ shiny: true