mirror of
https://github.com/System-End/hackatime.git
synced 2026-04-19 22:15:14 +00:00
* 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
15 lines
512 B
Ruby
15 lines
512 B
Ruby
class CreateApiKeys < ActiveRecord::Migration[8.1]
|
|
def change
|
|
create_table :api_keys do |t|
|
|
t.belongs_to :user, null: false, foreign_key: true
|
|
t.text :name, null: false
|
|
t.text :token, null: false, index: { unique: true }
|
|
|
|
t.timestamps
|
|
end
|
|
|
|
add_index :api_keys, :token, unique: true, if_not_exists: true
|
|
add_index :api_keys, [ :user_id, :token ], unique: true, if_not_exists: true
|
|
add_index :api_keys, [ :user_id, :name ], unique: true, if_not_exists: true
|
|
end
|
|
end
|