Skip to content

Commit

Permalink
added indexed column. #116
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Fenner committed Oct 15, 2018
1 parent c27acf5 commit 3372dea
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
17 changes: 17 additions & 0 deletions db/migrate/20181015152049_microseconds_in_time_columns.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
class MicrosecondsInTimeColumns < ActiveRecord::Migration[5.2]
def up
change_column :dataset, :created, :datetime, limit: 3
change_column :dataset, :updated, :datetime, limit: 3

add_column :dataset, :indexed, :datetime, limit: 3, default: '1970-01-01 00:00:00', null: false
add_index "dataset", ["created", "indexed", "updated"], name: "index_dataset_on_created_indexed_updated"
end

def down
remove_index :dataset, column: ["created", "indexed", "updated"], name: "index_dataset_on_created_indexed_updated"
remove_column :dataset, :indexed

change_column :dataset, :created, :datetime
change_column :dataset, :updated, :datetime
end
end
8 changes: 5 additions & 3 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: 2018_09_04_161700) do
ActiveRecord::Schema.define(version: 2018_10_15_152049) do

create_table "active_storage_attachments", options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t|
t.string "name", limit: 191, null: false
Expand Down Expand Up @@ -110,15 +110,15 @@
end

create_table "dataset", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT", force: :cascade do |t|
t.datetime "created"
t.datetime "created", precision: 3
t.string "doi", null: false
t.binary "is_active", limit: 1, null: false
t.binary "is_ref_quality", limit: 1
t.integer "last_landing_page_status"
t.datetime "last_landing_page_status_check"
t.json "last_landing_page_status_result"
t.string "last_metadata_status"
t.datetime "updated"
t.datetime "updated", precision: 3
t.integer "version"
t.bigint "datacentre", null: false
t.datetime "minted"
Expand All @@ -128,7 +128,9 @@
t.string "aasm_state"
t.string "reason"
t.string "source", limit: 191
t.datetime "indexed", precision: 3, default: "1970-01-01 00:00:00", null: false
t.index ["aasm_state"], name: "index_dataset_on_aasm_state"
t.index ["created", "indexed", "updated"], name: "index_dataset_on_created_indexed_updated"
t.index ["datacentre"], name: "FK5605B47847B5F5FF"
t.index ["doi"], name: "doi", unique: true
t.index ["last_landing_page_content_type"], name: "index_dataset_on_last_landing_page_content_type"
Expand Down

0 comments on commit 3372dea

Please sign in to comment.