fix(timetable): widen artist_engagements.portal_token to varchar(64)

PortalTokenController stores hash('sha256', \$plainToken) — a 64-char
hex digest. RFC v0.2 §5.3's "ULID unique nullable" annotation is loose;
in practice the column holds a hash, not a ULID. char(26) silently
truncates under MySQL strict mode (1406 Data too long) — surfaced
when PortalTokenSecurityTest exercised the auth path against the new
schema. Widen to varchar(64) to fit the hash.

Schema dump regenerated against crewli_test.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-08 19:15:02 +02:00
parent 4e5671daa9
commit eb6d396672
2 changed files with 16 additions and 13 deletions

View File

@@ -44,8 +44,11 @@ return new class extends Migration
$table->datetime('advance_open_from')->nullable();
$table->datetime('advance_open_to')->nullable();
// Portal access
$table->ulid('portal_token')->nullable()->unique();
// Portal access. Stored as hashed token (sha256 hex, 64 chars).
// RFC v0.2 §5.3 says "ULID unique nullable"; in practice the
// PortalTokenController hashes the plain token and stores the
// 64-char hex digest. Widen the column to fit.
$table->string('portal_token', 64)->nullable()->unique();
// Advancing aggregates (recomputed in Session 3)
$table->integer('advancing_completed_count')->default(0);

View File

@@ -121,7 +121,7 @@ CREATE TABLE `artist_engagements` (
`option_expires_at` datetime DEFAULT NULL,
`advance_open_from` datetime DEFAULT NULL,
`advance_open_to` datetime DEFAULT NULL,
`portal_token` char(26) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`portal_token` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`advancing_completed_count` int NOT NULL DEFAULT '0',
`advancing_total_count` int NOT NULL DEFAULT '0',
`notes` text COLLATE utf8mb4_unicode_ci,
@@ -1934,13 +1934,13 @@ INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (122,'2026_04_28_14
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (123,'2026_04_28_180000_create_form_submission_action_failure_retry_attempts_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (124,'2026_04_28_181000_add_exception_trace_to_form_submission_action_failures',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (125,'2026_05_08_000001_add_failure_response_code_to_form_submissions',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (136,'2026_05_08_100000_create_genres_table',2);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (137,'2026_05_08_100001_create_artists_table',2);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (138,'2026_05_08_100002_add_handles_buma_to_companies_table',2);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (139,'2026_05_08_100003_create_artist_contacts_table',2);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (140,'2026_05_08_100004_create_stages_table',2);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (141,'2026_05_08_100005_create_stage_days_table',2);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (142,'2026_05_08_100006_create_artist_engagements_table',2);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (143,'2026_05_08_100007_create_performances_table',2);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (144,'2026_05_08_100008_create_advance_sections_table',2);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (145,'2026_05_08_100009_create_advance_submissions_table',2);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (126,'2026_05_08_100000_create_genres_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (127,'2026_05_08_100001_create_artists_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (128,'2026_05_08_100002_add_handles_buma_to_companies_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (129,'2026_05_08_100003_create_artist_contacts_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (130,'2026_05_08_100004_create_stages_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (131,'2026_05_08_100005_create_stage_days_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (132,'2026_05_08_100006_create_artist_engagements_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (133,'2026_05_08_100007_create_performances_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (134,'2026_05_08_100008_create_advance_sections_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (135,'2026_05_08_100009_create_advance_submissions_table',1);