Skip to content

Commit

Permalink
🧹Database migration & schema update (#2063)
Browse files Browse the repository at this point in the history
For table hyrax_counter_metrics
  • Loading branch information
laritakr authored Dec 15, 2023
1 parent 76010a4 commit 2cad6b2
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 1 deletion.
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

0 comments on commit 2cad6b2

Please sign in to comment.