mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-11-14 21:24:54 +08:00
19 lines
723 B
Ruby
19 lines
723 B
Ruby
# frozen_string_literal: true
|
|
|
|
require File.expand_path('app/helpers/database_helper')
|
|
|
|
class AddExternalIdToRepositories < ActiveRecord::Migration[6.1]
|
|
include DatabaseHelper
|
|
|
|
def up
|
|
add_column :repository_rows, :external_id, :string, null: true
|
|
add_index :repository_rows, :external_id, unique: true, name: 'unique_index_repository_rows_on_external_id'
|
|
add_gin_index_without_tags(:repository_rows, :external_id)
|
|
end
|
|
|
|
def down
|
|
remove_index :repository_rows, name: 'index_repository_rows_on_external_id'
|
|
remove_index :repository_rows, :external_id, unique: true, name: 'unique_index_repository_rows_on_external_id'
|
|
remove_column :repository_rows, :external_id, :string, null: true
|
|
end
|
|
end
|