Skip to content

Commit 4377eb9

Browse files
committed
Increase token column limit for invitations from 24 to 64 characters
1 parent 76c35b1 commit 4377eb9

File tree

2 files changed

+18
-3
lines changed

2 files changed

+18
-3
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# frozen_string_literal: true
2+
3+
class IncreaseTokenLimitForInvitations < ActiveRecord::Migration[7.1]
4+
def up
5+
# Increase token column limit from 24 to 64 characters to support longer, more secure tokens
6+
change_column :better_together_invitations, :token, :string, limit: 64, null: false
7+
change_column :better_together_platform_invitations, :token, :string, limit: 64, null: false
8+
end
9+
10+
def down
11+
# Revert back to 24 character limit (note: this could cause data loss if tokens are longer)
12+
change_column :better_together_invitations, :token, :string, limit: 24, null: false
13+
change_column :better_together_platform_invitations, :token, :string, limit: 24, null: false
14+
end
15+
end

spec/dummy/db/schema.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#
1111
# It's strongly recommended that you check this file into your version control system.
1212

13-
ActiveRecord::Schema[7.2].define(version: 2025_09_05_163813) do
13+
ActiveRecord::Schema[7.2].define(version: 2025_09_06_172911) do
1414
# These are extensions that must be enabled in order to support this database
1515
enable_extension "pgcrypto"
1616
enable_extension "plpgsql"
@@ -730,7 +730,7 @@
730730
t.datetime "last_sent"
731731
t.datetime "accepted_at"
732732
t.string "locale", limit: 5, default: "en", null: false
733-
t.string "token", limit: 24, null: false
733+
t.string "token", limit: 64, null: false
734734
t.string "invitable_type", null: false
735735
t.uuid "invitable_id", null: false
736736
t.string "inviter_type", null: false
@@ -1145,7 +1145,7 @@
11451145
t.uuid "platform_role_id"
11461146
t.string "status", limit: 20, null: false
11471147
t.string "locale", limit: 5, default: "en", null: false
1148-
t.string "token", limit: 24, null: false
1148+
t.string "token", limit: 64, null: false
11491149
t.datetime "valid_from", null: false
11501150
t.datetime "valid_until"
11511151
t.datetime "last_sent"

0 commit comments

Comments
 (0)