2019-10-08 19:38:57 +08:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2020-01-17 00:14:20 +08:00
|
|
|
require File.expand_path('app/helpers/database_helper')
|
|
|
|
|
2019-10-08 19:38:57 +08:00
|
|
|
class CreateRepositoryStatusItems < ActiveRecord::Migration[6.0]
|
2020-01-17 00:14:20 +08:00
|
|
|
include DatabaseHelper
|
|
|
|
|
2020-01-16 22:30:19 +08:00
|
|
|
def up
|
2019-10-08 19:38:57 +08:00
|
|
|
create_table :repository_status_items do |t|
|
2020-01-16 22:30:19 +08:00
|
|
|
t.string :status, null: false
|
2019-10-08 19:38:57 +08:00
|
|
|
t.string :icon, null: false
|
|
|
|
t.references :repository, null: false, foreign_key: true
|
|
|
|
t.references :repository_column, null: false, foreign_key: true
|
|
|
|
t.references :created_by, index: true, foreign_key: { to_table: :users }, null: true
|
|
|
|
t.references :last_modified_by, index: true, foreign_key: { to_table: :users }, null: true
|
|
|
|
|
|
|
|
t.timestamps
|
|
|
|
end
|
2020-01-16 22:30:19 +08:00
|
|
|
|
2020-01-16 23:05:49 +08:00
|
|
|
add_gin_index_without_tags :repository_status_items, :status
|
2020-01-16 22:30:19 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
def down
|
|
|
|
drop_table :repository_status_items
|
2019-10-08 19:38:57 +08:00
|
|
|
end
|
|
|
|
end
|