hackatime/db/migrate/20250305194250_add_source_to_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

13 lines
332 B
Ruby

class Heartbeat < ApplicationRecord
end
class AddSourceToHeartbeats < ActiveRecord::Migration[8.1]
def change
add_column :heartbeats, :source_type, :integer
Heartbeat.update_all(source_type: 1)
change_column_null :heartbeats, :source_type, false
change_column_default :heartbeats, :source_type, to: 0
end
end