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
This commit is contained in:
Mahad Kalam 2026-03-11 16:52:35 +00:00 committed by GitHub
parent 55a63b4ec1
commit 606bdaed01
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
117 changed files with 125 additions and 488 deletions

View file

@ -1,4 +1,4 @@
class CreateUsers < ActiveRecord::Migration[7.1]
class CreateUsers < ActiveRecord::Migration[8.1]
def change
create_table :users do |t|
t.string :slack_uid, null: false, index: { unique: true }

View file

@ -1,4 +1,4 @@
class CreateDailyLeaderboardEntries < ActiveRecord::Migration[8.0]
class CreateDailyLeaderboardEntries < ActiveRecord::Migration[8.1]
def change
create_table :daily_leaderboard_entries do |t|
t.references :daily_leaderboard, null: false, foreign_key: true

View file

@ -1,4 +1,4 @@
class RenameDailyLeaderboardTables < ActiveRecord::Migration[8.0]
class RenameDailyLeaderboardTables < ActiveRecord::Migration[8.1]
def change
rename_table :daily_leaderboards, :leaderboards
rename_table :daily_leaderboard_entries, :leaderboard_entries

View file

@ -1,4 +1,4 @@
class RemoveStatusFromLeaderboards < ActiveRecord::Migration[8.0]
class RemoveStatusFromLeaderboards < ActiveRecord::Migration[8.1]
def change
remove_column :leaderboards, :status, :integer
end

View file

@ -1,4 +1,4 @@
class AddProfileFieldsToUsers < ActiveRecord::Migration[8.0]
class AddProfileFieldsToUsers < ActiveRecord::Migration[8.1]
def change
add_column :users, :username, :string
add_column :users, :avatar_url, :string

View file

@ -1,4 +1,4 @@
class AddAdminAtToUsers < ActiveRecord::Migration[8.0]
class AddAdminAtToUsers < ActiveRecord::Migration[8.1]
def change
add_column :users, :admin_at, :datetime
end

View file

@ -1,4 +1,4 @@
class SwitchAdminAtToIsAdmin < ActiveRecord::Migration[8.0]
class SwitchAdminAtToIsAdmin < ActiveRecord::Migration[8.1]
def change
add_column :users, :is_admin, :boolean, default: false, null: false

View file

@ -1,6 +1,6 @@
# This migration creates the `versions` table, the only schema PT requires.
# All other migrations PT provides are optional.
class CreateVersions < ActiveRecord::Migration[8.0]
class CreateVersions < ActiveRecord::Migration[8.1]
# The largest text column available in all supported RDBMS is
# 1024^3 - 1 bytes, roughly one gibibyte. We specify a size
# so that MySQL will use `longtext` instead of `text`. Otherwise,

View file

@ -1,7 +1,7 @@
# This migration adds the optional `object_changes` column, in which PaperTrail
# will store the `changes` diff for each update event. See the readme for
# details.
class AddObjectChangesToVersions < ActiveRecord::Migration[8.0]
class AddObjectChangesToVersions < ActiveRecord::Migration[8.1]
# The largest text column available in all supported RDBMS.
# See `create_versions.rb` for details.
TEXT_BYTES = 1_073_741_823

View file

@ -1,4 +1,4 @@
class AddUsesSlackStatus < ActiveRecord::Migration[8.0]
class AddUsesSlackStatus < ActiveRecord::Migration[8.1]
def change
add_column :users, :uses_slack_status, :boolean, default: false, null: false
end

View file

@ -1,4 +1,4 @@
class AddSlackOauthScopesToUsers < ActiveRecord::Migration[8.0]
class AddSlackOauthScopesToUsers < ActiveRecord::Migration[8.1]
def change
add_column :users, :slack_scopes, :string, array: true, default: []
add_column :users, :slack_access_token, :text

View file

@ -1,6 +1,6 @@
# frozen_string_literal: true
class CreateGoodJobs < ActiveRecord::Migration[8.0]
class CreateGoodJobs < ActiveRecord::Migration[8.1]
def change
# Uncomment for Postgres v12 or earlier to enable gen_random_uuid() support
# enable_extension 'pgcrypto'

View file

@ -1,4 +1,4 @@
class AddFinishedGeneratingAtToLeaderboards < ActiveRecord::Migration[8.0]
class AddFinishedGeneratingAtToLeaderboards < ActiveRecord::Migration[8.1]
def change
add_column :leaderboards, :finished_generating_at, :datetime
end

View file

@ -1,4 +1,4 @@
class RemoveStartDateUniqueIndexFromLeaderboards < ActiveRecord::Migration[8.0]
class RemoveStartDateUniqueIndexFromLeaderboards < ActiveRecord::Migration[8.1]
def change
remove_index :leaderboards, :start_date
end

View file

@ -1,4 +1,4 @@
class AddDeletedAtToLeaderboards < ActiveRecord::Migration[8.0]
class AddDeletedAtToLeaderboards < ActiveRecord::Migration[8.1]
def change
add_column :leaderboards, :deleted_at, :datetime, null: true
end

View file

@ -1,4 +1,4 @@
class CreateSailorsLogs < ActiveRecord::Migration[8.0]
class CreateSailorsLogs < ActiveRecord::Migration[8.1]
def change
create_table :sailors_logs do |t|
t.string :slack_uid, null: false

View file

@ -1,4 +1,4 @@
class CreateSailorsLogNotificationPreferences < ActiveRecord::Migration[8.0]
class CreateSailorsLogNotificationPreferences < ActiveRecord::Migration[8.1]
def change
create_table :sailors_log_notification_preferences do |t|
t.string :slack_uid, null: false

View file

@ -1,4 +1,4 @@
class CreateSailorsLogSlackNotifications < ActiveRecord::Migration[8.0]
class CreateSailorsLogSlackNotifications < ActiveRecord::Migration[8.1]
def change
create_table :sailors_log_slack_notifications do |t|
t.string :slack_uid, null: false

View file

@ -1,4 +1,4 @@
class AddUniqueIndexToSailorsLogNotificationPreferences < ActiveRecord::Migration[8.0]
class AddUniqueIndexToSailorsLogNotificationPreferences < ActiveRecord::Migration[8.1]
def change
add_index :sailors_log_notification_preferences,
[ :slack_uid, :slack_channel_id ],

View file

@ -1,4 +1,4 @@
class CreateSailorsLogLeaderboards < ActiveRecord::Migration[8.0]
class CreateSailorsLogLeaderboards < ActiveRecord::Migration[8.1]
def change
create_table :sailors_log_leaderboards do |t|
t.string :slack_channel_id

View file

@ -1,4 +1,4 @@
class AddDeletedAtToSailorsLogLeaderboardJob < ActiveRecord::Migration[8.0]
class AddDeletedAtToSailorsLogLeaderboardJob < ActiveRecord::Migration[8.1]
def change
add_column :sailors_log_leaderboards, :deleted_at, :datetime, default: nil
end

View file

@ -1,4 +1,4 @@
class CreateApiKeys < ActiveRecord::Migration[8.0]
class CreateApiKeys < ActiveRecord::Migration[8.1]
def change
create_table :api_keys do |t|
t.belongs_to :user, null: false, foreign_key: true

View file

@ -1,4 +1,4 @@
class CreateHeartbeats < ActiveRecord::Migration[8.0]
class CreateHeartbeats < ActiveRecord::Migration[8.1]
def change
create_table :heartbeats do |t|
t.belongs_to :user, null: false, foreign_key: true

View file

@ -1,4 +1,4 @@
class AddExtensionTextTypeToUsers < ActiveRecord::Migration[8.0]
class AddExtensionTextTypeToUsers < ActiveRecord::Migration[8.1]
def change
add_column :users, :hackatime_extension_text_type, :integer, default: 0, null: false
end

View file

@ -1,5 +1,5 @@
class UniquenessIndexToHashOnHeartbeats < ActiveRecord::Migration[8.0]
class UniquenessIndexToHashOnHeartbeats < ActiveRecord::Migration[8.1]
def change
attributes = [
:user_id,

View file

@ -1,7 +1,7 @@
class Heartbeat < ApplicationRecord
end
class AddSourceToHeartbeats < ActiveRecord::Migration[8.0]
class AddSourceToHeartbeats < ActiveRecord::Migration[8.1]
def change
add_column :heartbeats, :source_type, :integer

View file

@ -1,5 +0,0 @@
class EnforceUniquenessIndexOnHeartbeats < ActiveRecord::Migration[8.0]
def change
add_index :heartbeats, :fields_hash, unique: true, if_not_exists: true
end
end

View file

@ -1,4 +1,4 @@
class ChangeHeartbeatsTimeToFloat8 < ActiveRecord::Migration[8.0]
class ChangeHeartbeatsTimeToFloat8 < ActiveRecord::Migration[8.1]
def change
change_column :heartbeats, :time, :float8, null: false
end

View file

@ -1,4 +1,4 @@
class RenameUserIdOnLeaderboardEntries < ActiveRecord::Migration[8.0]
class RenameUserIdOnLeaderboardEntries < ActiveRecord::Migration[8.1]
def change
rename_column :leaderboard_entries, :user_id, :slack_uid
end

View file

@ -1,4 +1,4 @@
class CreateEmailAddresses < ActiveRecord::Migration[8.0]
class CreateEmailAddresses < ActiveRecord::Migration[8.1]
def change
create_table :email_addresses do |t|
t.string :email

View file

@ -1,4 +1,4 @@
class MoveEmailsToEmailAddresses < ActiveRecord::Migration[8.0]
class MoveEmailsToEmailAddresses < ActiveRecord::Migration[8.1]
def up
execute <<-SQL
INSERT INTO email_addresses (email, user_id, created_at, updated_at)

View file

@ -1,4 +1,4 @@
class CreateSignInTokens < ActiveRecord::Migration[8.0]
class CreateSignInTokens < ActiveRecord::Migration[8.1]
def change
create_table :sign_in_tokens do |t|
t.string :token

View file

@ -1,4 +1,4 @@
class RenameAvatarUrlToSlackAvatarUrlOnUsers < ActiveRecord::Migration[8.0]
class RenameAvatarUrlToSlackAvatarUrlOnUsers < ActiveRecord::Migration[8.1]
def change
rename_column :users, :avatar_url, :slack_avatar_url
end

View file

@ -1,4 +1,4 @@
class AddPeriodTypeToLeaderboards < ActiveRecord::Migration[8.0]
class AddPeriodTypeToLeaderboards < ActiveRecord::Migration[8.1]
def change
add_column :leaderboards, :period_type, :integer, default: 0, null: false
end

View file

@ -1,4 +1,4 @@
class CreateProjectRepoMappings < ActiveRecord::Migration[8.0]
class CreateProjectRepoMappings < ActiveRecord::Migration[8.1]
def change
create_table :project_repo_mappings do |t|
t.references :user, null: false, foreign_key: true

View file

@ -1,4 +1,4 @@
class AllowNullSlackUid < ActiveRecord::Migration[8.0]
class AllowNullSlackUid < ActiveRecord::Migration[8.1]
def change
change_column_null :users, :slack_uid, true
end

View file

@ -1,4 +1,4 @@
class SwitchLeaderboardEntriesToUserId < ActiveRecord::Migration[8.0]
class SwitchLeaderboardEntriesToUserId < ActiveRecord::Migration[8.1]
def up
# Add user_id column
add_column :leaderboard_entries, :user_id, :bigint

View file

@ -1,4 +1,4 @@
class AddIpAddressToHeartbeats < ActiveRecord::Migration[8.0]
class AddIpAddressToHeartbeats < ActiveRecord::Migration[8.1]
def change
add_column :heartbeats, :ip_address, :inet
end

View file

@ -1,4 +1,4 @@
class AddIndexCategoryTimeHeartbeats < ActiveRecord::Migration[8.0]
class AddIndexCategoryTimeHeartbeats < ActiveRecord::Migration[8.1]
def change
add_index :heartbeats, [ :category, :time ], name: 'index_heartbeats_on_category_and_time'
end

View file

@ -1,4 +1,4 @@
class AddTimezoneToUsers < ActiveRecord::Migration[8.0]
class AddTimezoneToUsers < ActiveRecord::Migration[8.1]
def change
add_column :users, :timezone, :string, default: "UTC"
add_index :users, :timezone

View file

@ -1,4 +1,4 @@
class AddGitHubFieldsToUsers < ActiveRecord::Migration[8.0]
class AddGitHubFieldsToUsers < ActiveRecord::Migration[8.1]
def change
add_column :users, :github_uid, :string
add_column :users, :github_avatar_url, :string

View file

@ -1,4 +1,4 @@
class AddSlackUsernameToUsers < ActiveRecord::Migration[8.0]
class AddSlackUsernameToUsers < ActiveRecord::Migration[8.1]
def change
add_column :users, :slack_username, :string
end

View file

@ -1,4 +1,4 @@
class AddStreakCountToLeaderboardEntries < ActiveRecord::Migration[8.0]
class AddStreakCountToLeaderboardEntries < ActiveRecord::Migration[8.1]
def change
add_column :leaderboard_entries, :streak_count, :integer, default: 0
end

View file

@ -1,4 +1,4 @@
class AddYswsProgramToHeartbeats < ActiveRecord::Migration[8.0]
class AddYswsProgramToHeartbeats < ActiveRecord::Migration[8.1]
def change
add_column :heartbeats, :ysws_program, :integer, default: 0, null: false
end

View file

@ -1,4 +1,4 @@
class AddSourceToEmailAddresses < ActiveRecord::Migration[8.0]
class AddSourceToEmailAddresses < ActiveRecord::Migration[8.1]
def change
add_column :email_addresses, :source, :integer, null: true
end

View file

@ -1,62 +0,0 @@
class CreateAhoyVisitsAndEvents < ActiveRecord::Migration[8.0]
def change
create_table :ahoy_visits do |t|
t.string :visit_token
t.string :visitor_token
# the rest are recommended but optional
# simply remove any you don't want
# user
t.references :user
# standard
t.string :ip
t.text :user_agent
t.text :referrer
t.string :referring_domain
t.text :landing_page
# technology
t.string :browser
t.string :os
t.string :device_type
# location
t.string :country
t.string :region
t.string :city
t.float :latitude
t.float :longitude
# utm parameters
t.string :utm_source
t.string :utm_medium
t.string :utm_term
t.string :utm_content
t.string :utm_campaign
# native apps
t.string :app_version
t.string :os_version
t.string :platform
t.datetime :started_at
end
add_index :ahoy_visits, :visit_token, unique: true
add_index :ahoy_visits, [ :visitor_token, :started_at ]
create_table :ahoy_events do |t|
t.references :visit
t.references :user
t.string :name
t.jsonb :properties
t.datetime :time
end
add_index :ahoy_events, [ :name, :time ]
add_index :ahoy_events, :properties, using: :gin, opclass: :jsonb_path_ops
end
end

View file

@ -1,4 +1,4 @@
class CreateEmailVerificationRequests < ActiveRecord::Migration[8.0]
class CreateEmailVerificationRequests < ActiveRecord::Migration[8.1]
def change
create_table :email_verification_requests do |t|
t.string :email

View file

@ -1,4 +1,4 @@
class AddDeletedAtToEmailVerificationRequests < ActiveRecord::Migration[8.0]
class AddDeletedAtToEmailVerificationRequests < ActiveRecord::Migration[8.1]
def change
add_column :email_verification_requests, :deleted_at, :datetime
end

View file

@ -1,5 +0,0 @@
class AddSlackNeighborhoodChannelToUsers < ActiveRecord::Migration[8.0]
def change
add_column :users, :slack_neighborhood_channel, :string, null: true
end
end

View file

@ -1,4 +1,4 @@
class AddOmitFromLeaderboardToUsers < ActiveRecord::Migration[8.0]
class AddOmitFromLeaderboardToUsers < ActiveRecord::Migration[8.1]
def change
add_column :users, :omit_from_leaderboard, :boolean, default: false, null: false
end

View file

@ -1,4 +1,4 @@
class AddDeletedAtToHeartbeats < ActiveRecord::Migration[8.0]
class AddDeletedAtToHeartbeats < ActiveRecord::Migration[8.1]
def change
add_column :heartbeats, :deleted_at, :datetime
end

View file

@ -1,4 +1,4 @@
class AddPartialUniqueIndexToHeartbeatFieldsHash < ActiveRecord::Migration[8.0]
class AddPartialUniqueIndexToHeartbeatFieldsHash < ActiveRecord::Migration[8.1]
def change
# Add a partial index that only applies to non-deleted records
add_index :heartbeats, :fields_hash,

View file

@ -1,5 +0,0 @@
class RemoveFieldsHashIndexFromHeartbeats < ActiveRecord::Migration[8.0]
def change
remove_index :heartbeats, name: "index_heartbeats_on_fields_hash"
end
end

View file

@ -1,4 +1,4 @@
class AddTrustLevelToUsers < ActiveRecord::Migration[7.1]
class AddTrustLevelToUsers < ActiveRecord::Migration[8.1]
def up
add_column :users, :trust_level, :integer, default: 0, null: false

View file

@ -1,4 +1,4 @@
class AddIndexToHeartbeats < ActiveRecord::Migration[8.0]
class AddIndexToHeartbeats < ActiveRecord::Migration[8.1]
def change
add_index :heartbeats, [ :user_id, :time ],
name: "idx_heartbeats_user_time_active",

View file

@ -1,4 +1,4 @@
class AddRawDataToHeartbeats < ActiveRecord::Migration[8.0]
class AddRawDataToHeartbeats < ActiveRecord::Migration[8.1]
def change
add_column :heartbeats, :raw_data, :jsonb
end

View file

@ -1,4 +1,4 @@
class AddCountryCodeToUsers < ActiveRecord::Migration[8.0]
class AddCountryCodeToUsers < ActiveRecord::Migration[8.1]
def change
add_column :users, :country_code, :string
end

View file

@ -1,17 +0,0 @@
class CreateMailingAddresses < ActiveRecord::Migration[8.0]
def change
create_table :mailing_addresses do |t|
t.references :user, null: false, foreign_key: true
t.string :first_name, null: false
t.string :last_name, null: false
t.string :zip_code, null: false
t.string :line_1, null: false
t.string :line_2
t.string :city, null: false
t.string :state, null: false
t.string :country, null: false
t.timestamps
end
end
end

View file

@ -1,5 +0,0 @@
class AddMailingAddressOtcToUsers < ActiveRecord::Migration[8.0]
def change
add_column :users, :mailing_address_otc, :string
end
end

View file

@ -1,4 +1,4 @@
class CreateWakatimeMirrors < ActiveRecord::Migration[8.0]
class CreateWakatimeMirrors < ActiveRecord::Migration[8.1]
def change
create_table :wakatime_mirrors do |t|
t.references :user, null: false, foreign_key: true

View file

@ -1,4 +1,4 @@
class CreateRawHeartbeatUploads < ActiveRecord::Migration[8.0]
class CreateRawHeartbeatUploads < ActiveRecord::Migration[8.1]
def change
create_table :raw_heartbeat_uploads do |t|
t.jsonb :request_headers, null: false

View file

@ -1,4 +1,4 @@
class AddRawHeartbeatUploadToHeartbeats < ActiveRecord::Migration[8.0]
class AddRawHeartbeatUploadToHeartbeats < ActiveRecord::Migration[8.1]
def change
add_reference :heartbeats, :raw_heartbeat_upload, null: true, foreign_key: true
end

View file

@ -1,12 +0,0 @@
class CreatePhysicalMails < ActiveRecord::Migration[8.0]
def change
create_table :physical_mails do |t|
t.references :user, null: false, foreign_key: true
t.integer :mission_type, null: false
t.integer :status, null: false, default: 0
t.string :theseus_id
t.timestamps
end
end
end

View file

@ -1,4 +1,4 @@
class CreateRepoHostEvents < ActiveRecord::Migration[8.0]
class CreateRepoHostEvents < ActiveRecord::Migration[8.1]
def change
# id: false because we are defining a custom string primary key 'id'
create_table :repo_host_events, id: false do |t|

View file

@ -1,4 +1,4 @@
class CreateCommits < ActiveRecord::Migration[8.0]
class CreateCommits < ActiveRecord::Migration[8.1]
def change
create_table :commits, primary_key: :sha, id: :string do |t|
t.references :user, null: false, foreign_key: true

View file

@ -1,11 +0,0 @@
class CreateNeighborhoodPosts < ActiveRecord::Migration[8.0]
def change
create_table :neighborhood_posts do |t|
t.string :airtable_id, null: false
t.index :airtable_id, unique: true
t.jsonb :airtable_fields
t.timestamps
end
end
end

View file

@ -1,11 +0,0 @@
class CreateNeighborhoodApps < ActiveRecord::Migration[8.0]
def change
create_table :neighborhood_apps do |t|
t.string :airtable_id, null: false
t.index :airtable_id, unique: true
t.jsonb :airtable_fields
t.timestamps
end
end
end

View file

@ -1,11 +0,0 @@
class CreateNeighborhoodProjects < ActiveRecord::Migration[8.0]
def change
create_table :neighborhood_projects do |t|
t.string :airtable_id, null: false
t.index :airtable_id, unique: true
t.jsonb :airtable_fields
t.timestamps
end
end
end

View file

@ -1,11 +0,0 @@
class CreateNeighborhoodYswsSubmissions < ActiveRecord::Migration[8.0]
def change
create_table :neighborhood_ysws_submissions do |t|
t.string :airtable_id, null: false
t.index :airtable_id, unique: true
t.jsonb :airtable_fields
t.timestamps
end
end
end

View file

@ -1,4 +1,4 @@
class AddIndexesForActiveProjectsQuery < ActiveRecord::Migration[8.0]
class AddIndexesForActiveProjectsQuery < ActiveRecord::Migration[8.1]
def change
add_index :heartbeats, [ :source_type, :time, :user_id, :project ],
name: 'index_heartbeats_on_source_type_time_user_project'

View file

@ -1,4 +1,4 @@
class CreateRepositories < ActiveRecord::Migration[8.0]
class CreateRepositories < ActiveRecord::Migration[8.1]
def change
create_table :repositories do |t|
t.string :url

View file

@ -1,4 +1,4 @@
class UpdateProjectRepoMappingsToUseRepository < ActiveRecord::Migration[8.0]
class UpdateProjectRepoMappingsToUseRepository < ActiveRecord::Migration[8.1]
def change
# Add repository reference
add_reference :project_repo_mappings, :repository, null: true, foreign_key: true

View file

@ -1,4 +1,4 @@
class AddRepositoryToCommits < ActiveRecord::Migration[8.0]
class AddRepositoryToCommits < ActiveRecord::Migration[8.1]
def change
add_reference :commits, :repository, null: true, foreign_key: true
end

View file

@ -1,4 +1,4 @@
class AddHomepageToRepositories < ActiveRecord::Migration[8.0]
class AddHomepageToRepositories < ActiveRecord::Migration[8.1]
def change
add_column :repositories, :homepage, :string
end

View file

@ -1,4 +1,4 @@
class AddAllowPublicStatsLookupToUsers < ActiveRecord::Migration[7.0]
class AddAllowPublicStatsLookupToUsers < ActiveRecord::Migration[8.1]
def change
add_column :users, :allow_public_stats_lookup, :boolean, default: true, null: false
end

View file

@ -1,6 +1,6 @@
# frozen_string_literal: true
class CreateDoorkeeperTables < ActiveRecord::Migration[8.0]
class CreateDoorkeeperTables < ActiveRecord::Migration[8.1]
def change
create_table :oauth_applications do |t|
t.string :name, null: false

View file

@ -1,4 +1,4 @@
class AddContinueParamToSignInTokens < ActiveRecord::Migration[8.0]
class AddContinueParamToSignInTokens < ActiveRecord::Migration[8.1]
def change
add_column :sign_in_tokens, :continue_param, :string
end

View file

@ -1,4 +1,4 @@
class AddIndexToLeaderboardsStartDate < ActiveRecord::Migration[8.0]
class AddIndexToLeaderboardsStartDate < ActiveRecord::Migration[8.1]
disable_ddl_transaction!
def change

View file

@ -1,4 +1,4 @@
class AddIndexToCommitsUserIdCreatedAt < ActiveRecord::Migration[8.0]
class AddIndexToCommitsUserIdCreatedAt < ActiveRecord::Migration[8.1]
disable_ddl_transaction!
def change

View file

@ -1,7 +0,0 @@
class CreateAhoyCaptainIndexes < ActiveRecord::Migration[8.0]
def change
add_index :ahoy_visits, :started_at unless index_exists?(:ahoy_visits, :started_at)
add_index :ahoy_events, :visit_id unless index_exists?(:ahoy_events, :visit_id)
add_index :ahoy_events, :time unless index_exists?(:ahoy_events, :time)
end
end

View file

@ -1,5 +0,0 @@
class AddBetaFeaturesToUsers < ActiveRecord::Migration[8.0]
def change
add_column :users, :beta_features, :text, default: '[]'
end
end

View file

@ -1,4 +1,4 @@
class CreateFlipperTables < ActiveRecord::Migration[8.0]
class CreateFlipperTables < ActiveRecord::Migration[8.1]
def up
create_table :flipper_features do |t|
t.string :key, null: false

View file

@ -1,5 +0,0 @@
class RemoveBetaFeaturesFromUsers < ActiveRecord::Migration[8.0]
def change
remove_column :users, :beta_features, :text
end
end

View file

@ -1,5 +0,0 @@
class AddScopeToLeaderboards < ActiveRecord::Migration[8.0]
def change
add_column :leaderboards, :scope, :string
end
end

View file

@ -1,5 +0,0 @@
class RemoveScopeFromLeaderboards < ActiveRecord::Migration[8.0]
def change
remove_column :leaderboards, :scope, :string
end
end

View file

@ -1,4 +1,4 @@
class AddReturnDataToSignInTokens < ActiveRecord::Migration[8.0]
class AddReturnDataToSignInTokens < ActiveRecord::Migration[8.1]
def change
add_column :sign_in_tokens, :return_data, :jsonb
end

View file

@ -1,4 +1,4 @@
class AddIndexToGoodJobsFinishedAtWithError < ActiveRecord::Migration[8.0]
class AddIndexToGoodJobsFinishedAtWithError < ActiveRecord::Migration[8.1]
disable_ddl_transaction!
def change

View file

@ -1,11 +0,0 @@
class AddIndexToAhoyVisitsStartedAtWithReferringDomain < ActiveRecord::Migration[8.0]
disable_ddl_transaction!
def change
add_index :ahoy_visits, :started_at,
where: 'referring_domain IS NOT NULL',
algorithm: :concurrently,
name: 'index_ahoy_visits_started_at_with_referring_domain',
if_not_exists: true
end
end

View file

@ -1,4 +1,4 @@
class AddDefaultTimezoneLeaderboardToUsers < ActiveRecord::Migration[7.0]
class AddDefaultTimezoneLeaderboardToUsers < ActiveRecord::Migration[8.1]
def change
add_column :users, :default_timezone_leaderboard, :boolean, default: true, null: false, if_not_exists: true
end

View file

@ -1,4 +1,4 @@
class AddGithubIndexToUsers < ActiveRecord::Migration[8.0]
class AddGithubIndexToUsers < ActiveRecord::Migration[8.1]
def change
add_index :users, [ :github_uid, :github_access_token ],
name: "index_users_on_github_uid_and_access_token"

View file

@ -1,4 +1,4 @@
class AddIndexesForLeaderboardPerformance < ActiveRecord::Migration[8.0]
class AddIndexesForLeaderboardPerformance < ActiveRecord::Migration[8.1]
def change
add_index :heartbeats, [ :user_id, :time, :category ], name: 'index_heartbeats_on_user_time_category'
add_index :users, [ :timezone, :trust_level ], name: 'index_users_on_timezone_trust_level'

View file

@ -1,4 +1,4 @@
class CreateSolidCacheEntries < ActiveRecord::Migration[8.0]
class CreateSolidCacheEntries < ActiveRecord::Migration[8.1]
def change
create_table :solid_cache_entries do |t|
t.binary :key, limit: 1024, null: false

View file

@ -1,4 +1,4 @@
class AddIsSuperadminToUsers < ActiveRecord::Migration[8.0]
class AddIsSuperadminToUsers < ActiveRecord::Migration[8.1]
def change
add_column :users, :is_superadmin, :boolean, default: false, null: false
end

View file

@ -1,4 +1,4 @@
class CreateTrustLevelAuditLogs < ActiveRecord::Migration[8.0]
class CreateTrustLevelAuditLogs < ActiveRecord::Migration[8.1]
def change
create_table :trust_level_audit_logs do |t|
t.references :user, null: false, foreign_key: true, index: true

View file

@ -1,4 +1,4 @@
class CreateAdminApiKeys < ActiveRecord::Migration[8.0]
class CreateAdminApiKeys < ActiveRecord::Migration[8.1]
def change
create_table :admin_api_keys do |t|
t.references :user, null: false, foreign_key: true

View file

@ -1,4 +1,4 @@
class MigrateAdminLevelsOnUsers < ActiveRecord::Migration[7.0]
class MigrateAdminLevelsOnUsers < ActiveRecord::Migration[8.1]
def up
add_column :users, :admin_level, :integer, default: 0, null: false

View file

@ -1,4 +1,4 @@
class AddStatsPerformanceIndexes < ActiveRecord::Migration[8.0]
class AddStatsPerformanceIndexes < ActiveRecord::Migration[8.1]
def change
add_index :heartbeats, [ :user_id, :time, :project ],
name: "idx_heartbeats_user_time_project_stats",

View file

@ -1,4 +1,4 @@
class AddIndexToHeartbeatsProject < ActiveRecord::Migration[8.0]
class AddIndexToHeartbeatsProject < ActiveRecord::Migration[8.1]
# this is what i got from stackoverflow
disable_ddl_transaction!

View file

@ -1,4 +1,4 @@
class AddAltIdentifyingIndexes < ActiveRecord::Migration[8.0]
class AddAltIdentifyingIndexes < ActiveRecord::Migration[8.1]
def change
add_index :heartbeats, :ip_address
add_index :heartbeats, :machine

View file

@ -1,4 +1,4 @@
class AddForeignKeysToOauthAccess < ActiveRecord::Migration[8.0]
class AddForeignKeysToOauthAccess < ActiveRecord::Migration[8.1]
def change
add_foreign_key :oauth_access_grants, :users, column: :resource_owner_id
add_foreign_key :oauth_access_tokens, :users, column: :resource_owner_id

Some files were not shown because too many files have changed in this diff Show more