| name | database |
| description | Database management commands and the bin/run utility for executing Ruby scripts against specific event databases. Use when the user needs to query, manipulate, or run scripts against existing databases without starting a Rails server. |
Database Management
Standard Database Commands
bin/rails db:prepare
bin/rails db:migrate
bin/rails db:seed
bin/rails db:fixtures:load
Running Scripts Against Existing Databases
The bin/run command allows you to execute Ruby scripts against any database in the project.
Basic Usage
bin/run db/2025-boston.sqlite3 path/to/script.rb
bin/run db/2025-boston.sqlite3 -e "puts Event.current.name"
bin/run test -e "puts Person.count"
Common Query Examples
bin/run db/2025-boston.sqlite3 -e "Heat.count"
bin/run db/2025-boston.sqlite3 -e "Person.where(type: 'Student').pluck(:name)"
bin/run db/2025-boston.sqlite3 -e "Studio.all.map { |s| [s.name, s.people.count] }"
How bin/run Works
The script automatically sets up:
RAILS_APP_DB environment variable from database filename
RAILS_STORAGE path for Active Storage files
- For test database: runs
db:prepare and loads fixtures
This allows you to query and manipulate any event database without starting a full Rails server.