-
Notifications
You must be signed in to change notification settings - Fork 74
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
Change tick columns to bigints #663
Conversation
test/dummy/db/schema.rb
Outdated
@@ -46,7 +46,7 @@ | |||
t.datetime "ended_at" | |||
t.float "time_running", default: 0.0, null: false | |||
t.integer "tick_count", default: 0, null: false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one wasn't changed somehow
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry wrong approval, please ignore.
Sorry, I'm not sure how I missed that column being wrong, or forgetting to bump the schema version. Perhaps because I staged the schema in hunks. When I run the test suite and migrations in the dummy app I see unrelated diffs like: diff --git a/test/dummy/db/schema.rb b/test/dummy/db/schema.rb
index d95da48..04f08dd 100644
--- a/test/dummy/db/schema.rb
+++ b/test/dummy/db/schema.rb
@@ -10,13 +10,12 @@
#
# It's strongly recommended that you check this file into your version control system.
-ActiveRecord::Schema.define(version: 2022_07_06_101937) do
-
+ActiveRecord::Schema[7.0].define(version: 2022_07_06_101937) do
create_table "active_storage_attachments", force: :cascade do |t|
t.string "name", null: false
t.string "record_type", null: false
t.integer "record_id", null: false
- t.bigint "blob_id", null: false
+ t.integer "blob_id", null: false
t.datetime "created_at", null: false
t.index ["blob_id"], name: "index_active_storage_attachments_on_blob_id"
t.index ["record_type", "record_id", "name", "blob_id"], name: "index_active_storage_attachments_uniqueness", unique: true
@@ -35,7 +34,7 @@ ActiveRecord::Schema.define(version: 2021_12_10_152329) do
end
create_table "active_storage_variant_records", force: :cascade do |t|
- t.bigint "blob_id", null: false
+ t.integer "blob_id", null: false
t.string "variation_digest", null: false
t.index ["blob_id", "variation_digest"], name: "index_active_storage_variant_records_uniqueness", unique: true
end
@@ -53,18 +52,18 @@ ActiveRecord::Schema.define(version: 2021_12_10_152329) do
t.string "error_class"
t.string "error_message"
t.text "backtrace"
- t.datetime "created_at", precision: 6, null: false
- t.datetime "updated_at", precision: 6, null: false
+ t.datetime "created_at", null: false
+ t.datetime "updated_at", null: false
t.text "arguments"
- t.index ["task_name", "created_at"], name: "index_maintenance_tasks_runs_on_task_name_and_created_at"
t.integer "lock_version", default: 0, null: false
+ t.index ["task_name", "created_at"], name: "index_maintenance_tasks_runs_on_task_name_and_created_at"
end
create_table "posts", force: :cascade do |t|
t.string "title"
t.string "content"
- t.datetime "created_at", precision: 6, null: false
- t.datetime "updated_at", precision: 6, null: false
+ t.datetime "created_at", null: false
+ t.datetime "updated_at", null: false
end
add_foreign_key "active_storage_attachments", "active_storage_blobs", column: "blob_id" so I'm not sure the schema/migrations are stable. I've amended the commit to include the correct columns and schema version. |
db/migrate/20220706101937_change_runs_tick_columns_to_bigints.rb
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot for your contribution!
I think we'll want to ship a 1.x version with this instead of pushing it to a 2.x.
Thanks folks! |
Change tick columns to bigints
We're using maintenance tasks on some tables with a very large number of rows and noticed that the tick_total on a batched activerecord enumerator has overflown the integer column, preventing the task from running. This is a migration to change the tick columns to bigints.