summaryrefslogtreecommitdiff
path: root/db/migrate/20200123091622_drop_analytics_repository_files_table.rb
blob: aa31d23920a95e6982728c199645c3b73e101312 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# frozen_string_literal: true

class DropAnalyticsRepositoryFilesTable < 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_files
  end

  def down
    create_table :analytics_repository_files do |t|
      t.bigint :project_id, null: false
      t.string :file_path, limit: 4096, null: false
    end

    add_index :analytics_repository_files, [:project_id, :file_path], unique: true
  end
end