Fix int and string overflow during prod import

This commit is contained in:
Stanko K.R.
2025-11-17 21:52:16 +01:00
parent fc87435b6c
commit ab07488fbd
3 changed files with 16 additions and 10 deletions
@@ -0,0 +1,6 @@
class ChangeUsageLimitToBigintInAccountJoinCodes < ActiveRecord::Migration[8.2]
def change
change_column :account_join_codes, :usage_count, :bigint
change_column :account_join_codes, :usage_limit, :bigint
end
end
Generated
+3 -3
View File
@@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema[8.2].define(version: 2025_11_17_192434) do
ActiveRecord::Schema[8.2].define(version: 2025_11_17_202517) do
create_table "accesses", id: :uuid, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
t.datetime "accessed_at"
t.uuid "account_id", null: false
@@ -30,8 +30,8 @@ ActiveRecord::Schema[8.2].define(version: 2025_11_17_192434) do
t.string "code", null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.integer "usage_count", default: 0, null: false
t.integer "usage_limit", default: 10, null: false
t.bigint "usage_count", default: 0, null: false
t.bigint "usage_limit", default: 10, null: false
t.index ["account_id", "code"], name: "index_account_join_codes_on_account_id_and_code", unique: true
end
+7 -7
View File
@@ -128,11 +128,11 @@ class Import
else
@account = Account.create_with_admin_user(
account: {
external_account_id: account.external_account_id.to_s,
name: account.name
external_account_id: account.external_account_id,
name: account.name.truncate(255, omission: "")
},
owner: {
name: oldest_admin.name,
name: oldest_admin.name.truncate(255, omission: ""),
identity: new_identity
}
)
@@ -169,7 +169,7 @@ class Import
User.create!(
account: account,
identity: new_identity,
name: old_user.name,
name: old_user.name.truncate(255, omission: ""),
role: old_user.role,
active: old_user.active,
)
@@ -198,7 +198,7 @@ class Import
new_board = Board.create!(
account_id: account.id,
creator_id: mapping[:users][old_board.creator_id],
name: old_board.name,
name: old_board.name.truncate(255, omission: ""),
all_access: old_board.all_access,
created_at: old_board.created_at,
updated_at: old_board.updated_at
@@ -229,7 +229,7 @@ class Import
new_column = Column.create!(
account_id: account.id,
board_id: mapping[:boards][old_column.board_id],
name: old_column.name,
name: old_column.name.truncate(255, omission: ""),
color: old_column.color,
position: old_column.position,
created_at: old_column.created_at,
@@ -848,7 +848,7 @@ class Import
new_webhook = Webhook.create!(
account_id: account.id,
board_id: mapping[:boards][old_webhook.board_id],
name: old_webhook.name,
name: old_webhook.name.truncate(255, omission: ""),
url: old_webhook.url,
signing_secret: old_webhook.signing_secret,
subscribed_actions: subscribed_actions,