hackatime/db/migrate/20250305061242_uniqueness_index_to_hash_on_heartbeats.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

34 lines
681 B
Ruby

class UniquenessIndexToHashOnHeartbeats < ActiveRecord::Migration[8.1]
def change
attributes = [
:user_id,
:branch,
:category,
:dependencies,
:editor,
:entity,
:language,
:machine,
:operating_system,
:project,
:type,
:user_agent,
:line_additions,
:line_deletions,
:lineno,
:lines,
:cursorpos,
:project_root_count,
:time,
:is_write
]
# clean up the index from ./20250303180842_create_heartbeats.rb
remove_index :heartbeats,
attributes,
unique: true
add_column :heartbeats, :fields_hash, :text
end
end