Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hyrax 5 upgrade db migrations #2063

Merged
merged 1 commit into from
Dec 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions db/migrate/20231215215705_create_hyrax_counter_metrics.hyrax.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
class CreateHyraxCounterMetrics < ActiveRecord::Migration[6.1]
def change
create_table :hyrax_counter_metrics do |t|
t.string :worktype
t.string :resource_type
t.integer :work_id
t.date :date
t.integer :total_item_investigations
t.integer :total_item_requests

t.timestamps
end
end
end
5 changes: 5 additions & 0 deletions db/migrate/20231215215706_change_work_id_to_string.hyrax.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class ChangeWorkIdToString < ActiveRecord::Migration[6.1]
def change
change_column :hyrax_counter_metrics, :work_id, :string
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
class AddIndicesToHyraxCounterMetrics < ActiveRecord::Migration[6.1]
def change
add_index :hyrax_counter_metrics, :worktype
add_index :hyrax_counter_metrics, :resource_type
add_index :hyrax_counter_metrics, :work_id
add_index :hyrax_counter_metrics, :date
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
class AddFieldsToCounterMetric < ActiveRecord::Migration[6.1]
def change
add_column :hyrax_counter_metrics, :title, :string
add_column :hyrax_counter_metrics, :year_of_publication, :integer, index: true
add_column :hyrax_counter_metrics, :publisher, :string, index: true
add_column :hyrax_counter_metrics, :author, :string, index: true
end
end
21 changes: 20 additions & 1 deletion 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: 2023_08_04_073106) do
ActiveRecord::Schema.define(version: 2023_12_15_215708) do

# These are extensions that must be enabled in order to support this database
enable_extension "hstore"
Expand Down Expand Up @@ -372,6 +372,25 @@
t.index ["machine_id"], name: "index_hyrax_collection_types_on_machine_id", unique: true
end

create_table "hyrax_counter_metrics", force: :cascade do |t|
t.string "worktype"
t.string "resource_type"
t.string "work_id"
t.date "date"
t.integer "total_item_investigations"
t.integer "total_item_requests"
t.datetime "created_at", precision: 6, null: false
t.datetime "updated_at", precision: 6, null: false
t.string "title"
t.integer "year_of_publication"
t.string "publisher"
t.string "author"
t.index ["date"], name: "index_hyrax_counter_metrics_on_date"
t.index ["resource_type"], name: "index_hyrax_counter_metrics_on_resource_type"
t.index ["work_id"], name: "index_hyrax_counter_metrics_on_work_id"
t.index ["worktype"], name: "index_hyrax_counter_metrics_on_worktype"
end

create_table "hyrax_default_administrative_set", force: :cascade do |t|
t.string "default_admin_set_id", null: false
t.datetime "created_at", null: false
Expand Down
Loading