hackatime/db/migrate/20240316000001_create_daily_leaderboard_entries.rb
Mahad Kalam 606bdaed01
Clean up migrations + schema.rb (#1055)
* Drop unused heartbeat lookup tables and their FK columns

Remove 8 abandoned normalization tables (heartbeat_branches,
heartbeat_categories, heartbeat_editors, heartbeat_languages,
heartbeat_machines, heartbeat_operating_systems, heartbeat_projects,
heartbeat_user_agents) and their corresponding foreign key columns
from the heartbeats table. None had models, associations, or any
application code referencing them.

* Remove migrations cancelling each other out
2026-03-11 16:52:35 +00:00

13 lines
475 B
Ruby

class CreateDailyLeaderboardEntries < ActiveRecord::Migration[8.1]
def change
create_table :daily_leaderboard_entries do |t|
t.references :daily_leaderboard, null: false, foreign_key: true
t.string :user_id, null: false
t.integer :total_seconds, null: false, default: 0
t.integer :rank
t.timestamps
t.index [ :daily_leaderboard_id, :user_id ], unique: true, name: 'idx_leaderboard_entries_on_leaderboard_and_user'
end
end
end