2020-03-05 13:08:19 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
class CreateRequirements < ActiveRecord::Migration[6.0]
|
|
|
|
include Gitlab::Database::MigrationHelpers
|
|
|
|
|
|
|
|
DOWNTIME = false
|
|
|
|
|
2020-04-21 11:21:10 -04:00
|
|
|
# rubocop:disable Migration/PreventStrings
|
2020-03-05 13:08:19 -05:00
|
|
|
def change
|
|
|
|
create_table :requirements do |t|
|
|
|
|
t.timestamps_with_timezone null: false
|
|
|
|
t.integer :project_id, null: false
|
|
|
|
t.integer :author_id
|
|
|
|
t.integer :iid, null: false
|
|
|
|
t.integer :cached_markdown_version
|
|
|
|
t.integer :state, limit: 2, default: 1, null: false
|
|
|
|
t.string :title, limit: 255, null: false
|
2020-04-21 11:21:10 -04:00
|
|
|
t.text :title_html # rubocop:disable Migration/AddLimitToTextColumns
|
2020-03-05 13:08:19 -05:00
|
|
|
|
|
|
|
t.index :project_id
|
|
|
|
t.index :author_id
|
|
|
|
t.index :title, name: "index_requirements_on_title_trigram", using: :gin, opclass: :gin_trgm_ops
|
|
|
|
t.index :state
|
|
|
|
t.index :created_at
|
|
|
|
t.index :updated_at
|
|
|
|
t.index %w(project_id iid), name: 'index_requirements_on_project_id_and_iid', where: 'project_id IS NOT NULL', unique: true, using: :btree
|
|
|
|
end
|
|
|
|
end
|
2020-04-21 11:21:10 -04:00
|
|
|
# rubocop:enable Migration/PreventStrings
|
2020-03-05 13:08:19 -05:00
|
|
|
end
|