diff options
Diffstat (limited to 'db/migrate/20200123091854_drop_analytics_repository_file_edits_table.rb')
-rw-r--r-- | db/migrate/20200123091854_drop_analytics_repository_file_edits_table.rb | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/db/migrate/20200123091854_drop_analytics_repository_file_edits_table.rb b/db/migrate/20200123091854_drop_analytics_repository_file_edits_table.rb new file mode 100644 index 00000000000..3bb026727f4 --- /dev/null +++ b/db/migrate/20200123091854_drop_analytics_repository_file_edits_table.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +class DropAnalyticsRepositoryFileEditsTable < ActiveRecord::Migration[5.2] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + def up + # Requires ExclusiveLock on the table. Not in use, no records, no FKs. + drop_table :analytics_repository_file_edits + end + + def down + create_table :analytics_repository_file_edits do |t| + t.bigint :project_id, null: false + t.index :project_id + t.bigint :analytics_repository_file_id, null: false + t.date :committed_date, null: false + t.integer :num_edits, null: false, default: 0 + end + + add_index :analytics_repository_file_edits, + [:analytics_repository_file_id, :committed_date, :project_id], + name: 'index_file_edits_on_committed_date_file_id_and_project_id', + unique: true + end +end |