mirror of
https://github.com/ryankazokas/turbovault-app.git
synced 2026-04-16 18:42:52 +00:00
Moves seed genres to migration
This commit is contained in:
20
db/migrate/20260413115611_seed_genres.rb
Normal file
20
db/migrate/20260413115611_seed_genres.rb
Normal file
@@ -0,0 +1,20 @@
|
||||
class SeedGenres < ActiveRecord::Migration[8.1]
|
||||
def change
|
||||
# Create Genres
|
||||
puts "Creating genres..."
|
||||
genres = [
|
||||
"Action", "Adventure", "RPG", "JRPG", "Strategy", "Simulation",
|
||||
"Platformer", "Fighting", "Racing", "Sports", "Puzzle", "Horror",
|
||||
"Stealth", "Shooter", "FPS", "TPS", "Rhythm", "Visual Novel",
|
||||
"Roguelike", "Metroidvania", "Sandbox", "MMO", "Turn-Based",
|
||||
"Real-Time Strategy", "Tower Defense", "Card Game", "Party Game",
|
||||
"Educational", "Survival", "Battle Royale"
|
||||
]
|
||||
|
||||
genres.each do |genre_name|
|
||||
Genre.find_or_create_by!(name: genre_name)
|
||||
end
|
||||
|
||||
puts "Created #{Genre.count} genres"
|
||||
end
|
||||
end
|
||||
2
db/schema.rb
generated
2
db/schema.rb
generated
@@ -10,7 +10,7 @@
|
||||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema[8.1].define(version: 2026_03_28_222034) do
|
||||
ActiveRecord::Schema[8.1].define(version: 2026_04_13_115611) do
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "pg_catalog.plpgsql"
|
||||
|
||||
|
||||
70
db/seeds.rb
70
db/seeds.rb
@@ -1,75 +1,5 @@
|
||||
puts "Seeding database..."
|
||||
|
||||
# Create Platforms
|
||||
puts "Creating platforms..."
|
||||
platforms_data = [
|
||||
# Nintendo
|
||||
{ name: "Nintendo Entertainment System", abbreviation: "NES", manufacturer: "Nintendo" },
|
||||
{ name: "Super Nintendo Entertainment System", abbreviation: "SNES", manufacturer: "Nintendo" },
|
||||
{ name: "Nintendo 64", abbreviation: "N64", manufacturer: "Nintendo" },
|
||||
{ name: "GameCube", abbreviation: "GCN", manufacturer: "Nintendo" },
|
||||
{ name: "Wii", abbreviation: "Wii", manufacturer: "Nintendo" },
|
||||
{ name: "Wii U", abbreviation: "Wii U", manufacturer: "Nintendo" },
|
||||
{ name: "Nintendo Switch", abbreviation: "Switch", manufacturer: "Nintendo" },
|
||||
{ name: "Game Boy", abbreviation: "GB", manufacturer: "Nintendo" },
|
||||
{ name: "Game Boy Color", abbreviation: "GBC", manufacturer: "Nintendo" },
|
||||
{ name: "Game Boy Advance", abbreviation: "GBA", manufacturer: "Nintendo" },
|
||||
{ name: "Nintendo DS", abbreviation: "DS", manufacturer: "Nintendo" },
|
||||
{ name: "Nintendo 3DS", abbreviation: "3DS", manufacturer: "Nintendo" },
|
||||
|
||||
# Sony
|
||||
{ name: "PlayStation", abbreviation: "PS1", manufacturer: "Sony" },
|
||||
{ name: "PlayStation 2", abbreviation: "PS2", manufacturer: "Sony" },
|
||||
{ name: "PlayStation 3", abbreviation: "PS3", manufacturer: "Sony" },
|
||||
{ name: "PlayStation 4", abbreviation: "PS4", manufacturer: "Sony" },
|
||||
{ name: "PlayStation 5", abbreviation: "PS5", manufacturer: "Sony" },
|
||||
{ name: "PlayStation Portable", abbreviation: "PSP", manufacturer: "Sony" },
|
||||
{ name: "PlayStation Vita", abbreviation: "PS Vita", manufacturer: "Sony" },
|
||||
|
||||
# Microsoft
|
||||
{ name: "Xbox", abbreviation: "Xbox", manufacturer: "Microsoft" },
|
||||
{ name: "Xbox 360", abbreviation: "X360", manufacturer: "Microsoft" },
|
||||
{ name: "Xbox One", abbreviation: "XB1", manufacturer: "Microsoft" },
|
||||
{ name: "Xbox Series X/S", abbreviation: "Series X/S", manufacturer: "Microsoft" },
|
||||
|
||||
# Sega
|
||||
{ name: "Sega Genesis", abbreviation: "Genesis", manufacturer: "Sega" },
|
||||
{ name: "Sega Saturn", abbreviation: "Saturn", manufacturer: "Sega" },
|
||||
{ name: "Sega Dreamcast", abbreviation: "Dreamcast", manufacturer: "Sega" },
|
||||
{ name: "Sega Game Gear", abbreviation: "Game Gear", manufacturer: "Sega" },
|
||||
|
||||
# Other
|
||||
{ name: "PC", abbreviation: "PC", manufacturer: nil },
|
||||
{ name: "Mobile (iOS)", abbreviation: "iOS", manufacturer: "Apple" },
|
||||
{ name: "Mobile (Android)", abbreviation: "Android", manufacturer: "Google" },
|
||||
{ name: "Arcade", abbreviation: "Arcade", manufacturer: nil }
|
||||
]
|
||||
|
||||
platforms_data.each do |platform_data|
|
||||
Platform.find_or_create_by!(name: platform_data[:name]) do |platform|
|
||||
platform.abbreviation = platform_data[:abbreviation]
|
||||
platform.manufacturer = platform_data[:manufacturer]
|
||||
end
|
||||
end
|
||||
|
||||
puts "Created #{Platform.count} platforms"
|
||||
|
||||
# Create Genres
|
||||
puts "Creating genres..."
|
||||
genres = [
|
||||
"Action", "Adventure", "RPG", "JRPG", "Strategy", "Simulation",
|
||||
"Platformer", "Fighting", "Racing", "Sports", "Puzzle", "Horror",
|
||||
"Stealth", "Shooter", "FPS", "TPS", "Rhythm", "Visual Novel",
|
||||
"Roguelike", "Metroidvania", "Sandbox", "MMO", "Turn-Based",
|
||||
"Real-Time Strategy", "Tower Defense", "Card Game", "Party Game",
|
||||
"Educational", "Survival", "Battle Royale"
|
||||
]
|
||||
|
||||
genres.each do |genre_name|
|
||||
Genre.find_or_create_by!(name: genre_name)
|
||||
end
|
||||
|
||||
puts "Created #{Genre.count} genres"
|
||||
|
||||
# Create demo user and sample games for development
|
||||
if Rails.env.development?
|
||||
|
||||
Reference in New Issue
Block a user