-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Martin Fenner
committed
Feb 1, 2020
1 parent
282b0f6
commit c1b7391
Showing
3 changed files
with
44 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,27 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'lhm' | ||
|
||
class AddEventsProperties < ActiveRecord::Migration[5.2] | ||
def change | ||
add_column :events, :source_doi, :text | ||
add_column :events, :target_doi, :text | ||
add_column :events, :source_relation_type_id, :string, limit: 191 | ||
add_column :events, :target_relation_type_id, :string, limit: 191 | ||
add_index :events, [:source_doi, :source_relation_type_id], name: "index_events_on_source_doi", length: { source_doi: 100, source_relation_type_id: 191 } | ||
add_index :events, [:target_doi, :target_relation_type_id], name: "index_events_on_target_doi", length: { target_doi: 100, target_relation_type_id: 191 } | ||
def up | ||
Lhm.change_table :events do |m| | ||
m.add_column :source_doi, "TEXT" | ||
m.add_column :target_doi, "TEXT" | ||
m.add_column :source_relation_type_id, "VARCHAR(191)" | ||
m.add_column :target_relation_type_id, "VARCHAR(191)" | ||
m.add_index ["source_doi(100)", "source_relation_type_id(191)"], :index_events_on_source_doi | ||
m.add_index ["target_doi(100)", "target_relation_type_id(191)"], :index_events_on_target_doi | ||
end | ||
end | ||
|
||
def down | ||
Lhm.change_table :events do |m| | ||
m.remove_column :source_doi | ||
m.remove_column :target_doi | ||
m.remove_column :source_relation_type_id | ||
m.remove_column :target_relation_type_id | ||
m.remove_index ["source_doi(100)", "source_relation_type_id(191)"], :index_events_on_source_doi | ||
m.remove_index ["target_doi(100)", "target_relation_type_id(191)"], :index_events_on_target_doi | ||
end | ||
end | ||
end |