Skip to content

Commit

Permalink
Merge pull request #409 from datacite/new-events-properties
Browse files Browse the repository at this point in the history
db migrations for associations with events #388
  • Loading branch information
Martin Fenner authored Feb 1, 2020
2 parents 6d7fe9b + 7c3ea89 commit ba1397f
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 13 deletions.
2 changes: 1 addition & 1 deletion config/initializers/_lograge.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@
uid: event.payload[:uid],
}
end
end
end
8 changes: 0 additions & 8 deletions db/migrate/20200121101841_add_foreign_key_to_events.rb

This file was deleted.

2 changes: 2 additions & 0 deletions db/migrate/20200122153731_add_globus_uuid.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

class AddGlobusUuid < ActiveRecord::Migration[5.2]
def change
add_column :datacentre, :globus_uuid, :string, limit: 191
Expand Down
12 changes: 12 additions & 0 deletions db/migrate/20200131180609_add_events_properties.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# frozen_string_literal: true

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 }
end
end
13 changes: 9 additions & 4 deletions db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 2020_01_22_153731) do
ActiveRecord::Schema.define(version: 2020_01_31_180609) do

create_table "active_storage_attachments", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin", force: :cascade do |t|
t.string "name", limit: 191, null: false
Expand Down Expand Up @@ -229,7 +229,6 @@
t.text "uuid", null: false
t.text "subj_id", null: false
t.text "obj_id"
t.string "source_id", limit: 191
t.string "aasm_state"
t.string "state_event"
t.text "callback"
Expand All @@ -246,10 +245,16 @@
t.integer "total", default: 1
t.string "license", limit: 191
t.text "doi_id"
t.text "source_doi"
t.text "target_doi"
t.string "source_relation_type_id", limit: 191
t.string "target_relation_type_id", limit: 191
t.index ["created_at", "indexed_at", "updated_at"], name: "index_events_on_created_indexed_updated"
t.index ["created_at"], name: "index_events_on_source_id_created_at"
t.index ["relation_type_id"], name: "index_events_on_doi_id"
t.index ["source_id", "created_at"], name: "index_events_on_source_id_created_at"
t.index ["subj_id", "obj_id", "source_id", "relation_type_id"], name: "index_events_on_multiple_columns", unique: true, length: { subj_id: 191, obj_id: 191 }
t.index ["source_doi", "source_relation_type_id"], name: "index_events_on_source_doi", length: { source_doi: 100 }
t.index ["subj_id", "obj_id", "relation_type_id"], name: "index_events_on_multiple_columns", unique: true, length: { subj_id: 191, obj_id: 191 }
t.index ["target_doi", "target_relation_type_id"], name: "index_events_on_target_doi", length: { target_doi: 100 }
t.index ["updated_at"], name: "index_events_on_updated_at"
t.index ["uuid"], name: "index_events_on_uuid", unique: true, length: 36
end
Expand Down

0 comments on commit ba1397f

Please sign in to comment.