スキル一覧に戻る
rubys

database

by rubys

Ballroom Dance Showcase Scheduler

34🍴 6📅 2026年1月23日
GitHubで見るManusで実行

SKILL.md


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

# Prepare database (creates and runs migrations)
bin/rails db:prepare

# Run migrations
bin/rails db:migrate

# Load seed data
bin/rails db:seed

# Load fixtures (for test data)
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

# Run a script file against a specific database
bin/run db/2025-boston.sqlite3 path/to/script.rb

# Evaluate Ruby code directly against a database
bin/run db/2025-boston.sqlite3 -e "puts Event.current.name"

# Run against test database (automatically loads fixtures)
bin/run test -e "puts Person.count"

Common Query Examples

# Count heats
bin/run db/2025-boston.sqlite3 -e "Heat.count"

# Get all student names
bin/run db/2025-boston.sqlite3 -e "Person.where(type: 'Student').pluck(:name)"

# List studios with person counts
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.

スコア

総合スコア

60/100

リポジトリの品質指標に基づく評価

SKILL.md

SKILL.mdファイルが含まれている

+20
LICENSE

ライセンスが設定されている

+10
説明文

100文字以上の説明がある

0/10
人気

GitHub Stars 100以上

0/15
最近の活動

3ヶ月以内に更新がある

0/10
フォーク

10回以上フォークされている

0/5
Issue管理

オープンIssueが50未満

+5
言語

プログラミング言語が設定されている

+5
タグ

1つ以上のタグが設定されている

0/5

レビュー

💬

レビュー機能は近日公開予定です