Skip to content

Commit

Permalink
fix database migrations #616
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Fenner committed Oct 10, 2020
1 parent 1ed91d8 commit a5d54e6
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 103 deletions.
24 changes: 14 additions & 10 deletions db/migrate/20170807091814_create_all_tables.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@ def change
t.index ["symbol"], name: "symbol", unique: true
end

create_table "allocator_prefixes", primary_key: ["allocator", "prefixes"], force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
create_table "allocator_prefixes", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
t.integer "allocator", limit: 8, null: false
t.integer "prefixes", limit: 8, null: false
t.datetime "created"
t.datetime "updated"
t.index ["allocator"], name: "FKE7FBD67446EBD781"
t.index ["prefixes"], name: "FKE7FBD674AF86A1C7"
end
Expand All @@ -48,9 +50,11 @@ def change
t.index ["symbol"], name: "symbol", unique: true
end

create_table "datacentre_prefixes", primary_key: ["datacentre", "prefixes"], force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
create_table "datacentre_prefixes", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
t.integer "datacentre", limit: 8, null: false
t.integer "prefixes", limit: 8, null: false
t.datetime "created"
t.datetime "updated"
t.index ["datacentre"], name: "FK13A1B3BA47B5F5FF"
t.index ["prefixes"], name: "FK13A1B3BAAF86A1C7"
end
Expand Down Expand Up @@ -101,13 +105,13 @@ def change
t.index ["prefix"], name: "prefix", unique: true
end

add_foreign_key "allocator_prefixes", "allocator", column: "allocator", name: "FKE7FBD67446EBD781"
add_foreign_key "allocator_prefixes", "prefix", column: "prefixes", name: "FKE7FBD674AF86A1C7"
add_foreign_key "datacentre", "allocator", column: "allocator", name: "FK6695D60546EBD781"
add_foreign_key "datacentre_prefixes", "datacentre", column: "datacentre", name: "FK13A1B3BA47B5F5FF"
add_foreign_key "datacentre_prefixes", "prefix", column: "prefixes", name: "FK13A1B3BAAF86A1C7"
add_foreign_key "dataset", "datacentre", column: "datacentre", name: "FK5605B47847B5F5FF"
add_foreign_key "media", "dataset", column: "dataset", name: "FK62F6FE44D3D6B1B"
add_foreign_key "metadata", "dataset", column: "dataset", name: "FKE52D7B2F4D3D6B1B"
# add_foreign_key "allocator_prefixes", "allocator", column: "allocator", name: "FKE7FBD67446EBD781"
# add_foreign_key "allocator_prefixes", "prefix", column: "prefixes", name: "FKE7FBD674AF86A1C7"
# add_foreign_key "datacentre", "allocator", column: "allocator", name: "FK6695D60546EBD781"
# add_foreign_key "datacentre_prefixes", "datacentre", column: "datacentre", name: "FK13A1B3BA47B5F5FF"
# add_foreign_key "datacentre_prefixes", "prefix", column: "prefixes", name: "FK13A1B3BAAF86A1C7"
# add_foreign_key "dataset", "datacentre", column: "datacentre", name: "FK5605B47847B5F5FF"
# add_foreign_key "media", "dataset", column: "dataset", name: "FK62F6FE44D3D6B1B"
# add_foreign_key "metadata", "dataset", column: "dataset", name: "FKE52D7B2F4D3D6B1B"
end
end
31 changes: 0 additions & 31 deletions db/migrate/20170914055227_convert_to_has_many_through.rb

This file was deleted.

39 changes: 0 additions & 39 deletions db/migrate/20190629072238_add_researchers_table.rb

This file was deleted.

1 change: 0 additions & 1 deletion db/migrate/20200718191826_add_type_to_doi.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

class AddTypeToDoi < ActiveRecord::Migration[5.2]
def up
remove_foreign_key "dataset", "datacentre"
add_column :dataset, :type, :string, limit: 16
change_column_default :dataset, :type, "DataCiteDoi"
change_column_default :dataset, :agency, "datacite"
Expand Down
28 changes: 6 additions & 22 deletions db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

ActiveRecord::Schema.define(version: 2020_08_26_173254) do

create_table "active_storage_attachments", options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t|
create_table "active_storage_attachments", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin", force: :cascade do |t|
t.string "name", limit: 191, null: false
t.string "record_type", null: false
t.bigint "record_id", null: false
Expand All @@ -22,7 +22,7 @@
t.index ["record_type", "record_id", "name", "blob_id"], name: "index_active_storage_attachments_uniqueness", unique: true
end

create_table "active_storage_blobs", options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t|
create_table "active_storage_blobs", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin", force: :cascade do |t|
t.string "key", limit: 191, null: false
t.string "filename", limit: 191, null: false
t.string "content_type", limit: 191
Expand Down Expand Up @@ -76,14 +76,12 @@
t.string "logo_content_type"
t.bigint "logo_file_size"
t.datetime "logo_updated_at"
t.string "uid", limit: 32
t.index ["globus_uuid"], name: "index_allocator_on_globus_uuid"
t.index ["organization_type"], name: "index_allocator_organization_type"
t.index ["symbol"], name: "symbol", unique: true
t.index ["uid"], name: "index_allocator_on_uid"
end

create_table "audits", options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t|
create_table "audits", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin", force: :cascade do |t|
t.integer "auditable_id"
t.string "auditable_type"
t.integer "associated_id"
Expand Down Expand Up @@ -111,8 +109,7 @@
t.datetime "created_at"
t.datetime "updated_at"
t.bigint "provider_prefix_id"
t.string "uid"
t.index ["client_id", "prefix_id"], name: "index_client_prefixes_on_client_id_and_prefix_id", unique: true
t.string "uid", null: false
t.index ["client_id"], name: "FK13A1B3BA47B5F5FF"
t.index ["prefix_id"], name: "FK13A1B3BAAF86A1C7"
t.index ["provider_prefix_id"], name: "index_client_prefixes_on_provider_prefix_id"
Expand Down Expand Up @@ -150,12 +147,10 @@
t.string "salesforce_id", limit: 191
t.json "service_contact"
t.string "globus_uuid", limit: 191
t.string "uid", limit: 32
t.index ["allocator"], name: "FK6695D60546EBD781"
t.index ["globus_uuid"], name: "index_datacentre_on_globus_uuid"
t.index ["re3data_id"], name: "index_datacentre_on_re3data_id"
t.index ["symbol"], name: "symbol", unique: true
t.index ["uid"], name: "index_datacentre_on_uid"
t.index ["url"], name: "index_datacentre_on_url", length: 100
end

Expand Down Expand Up @@ -216,7 +211,7 @@
t.index ["url"], name: "index_dataset_on_url", length: 100
end

create_table "events", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin", force: :cascade do |t|
create_table "events", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
t.text "uuid", null: false
t.text "subj_id", null: false
t.text "obj_id"
Expand Down Expand Up @@ -276,7 +271,6 @@
create_table "prefixes", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
t.datetime "created_at"
t.string "uid", limit: 80, null: false
t.string "ra", default: "DataCite"
t.index ["uid"], name: "prefix", unique: true
end

Expand All @@ -285,19 +279,9 @@
t.bigint "prefix_id", null: false
t.datetime "created_at"
t.datetime "updated_at"
t.string "uuid"
t.string "uid"
t.string "uid", null: false
t.index ["prefix_id"], name: "FKE7FBD674AF86A1C7"
t.index ["provider_id", "prefix_id"], name: "index_provider_prefixes_on_provider_id_and_prefix_id", unique: true
t.index ["provider_id"], name: "FKE7FBD67446EBD781"
t.index ["uid"], name: "index_provider_prefixes_on_uid", length: 128
end

add_foreign_key "client_prefixes", "datacentre", column: "client_id", name: "FK13A1B3BA47B5F5FF"
add_foreign_key "client_prefixes", "prefixes", name: "FK13A1B3BAAF86A1C7"
add_foreign_key "datacentre", "allocator", column: "allocator", name: "FK6695D60546EBD781"
add_foreign_key "media", "dataset", column: "dataset", name: "FK62F6FE44D3D6B1B"
add_foreign_key "metadata", "dataset", column: "dataset", name: "FKE52D7B2F4D3D6B1B"
add_foreign_key "provider_prefixes", "allocator", column: "provider_id", name: "FKE7FBD67446EBD781"
add_foreign_key "provider_prefixes", "prefixes", name: "FKE7FBD674AF86A1C7"
end

0 comments on commit a5d54e6

Please sign in to comment.