* Migrate authentication from Clerk to BetterAuth (#322) Replaces @clerk/react-router with self-hosted better-auth to eliminate the external Clerk dependency and keep all user/session data in our own PostgreSQL database. **What changed** - New: auth.server.ts (BetterAuth config w/ Drizzle adapter, bcrypt, Resend), auth-client.ts, api.auth.$.ts handler - New: /login and /register pages with email+password and Google/Discord OAuth; open-redirect guard on redirectTo param - New: UserMenu component replacing Clerk's UserButton - Schema: sessions, accounts, verifications tables; emailVerified column; clerkId made nullable - Migrations 0081 (BetterAuth tables) and 0082 (accounts extra columns for v1.6.9) - All ~30 route files: getAuth → auth.api.getSession, isUserAdminByClerkId → isUserAdmin - root.tsx: isAdmin read directly from session.user.isAdmin (no extra DB query) - useDraftAuthRecovery: removed Clerk JWT refresh logic; replaced with cookie-session check - models/user.ts: removed findUserByClerkId, findOrCreateUser, updateUserByClerkId (webhook pattern) - Deleted: app/routes/api/webhooks/clerk.ts; uninstalled @clerk/react-router, @clerk/themes, svix - scripts/migrate.mjs: extended with idempotent Clerk → BetterAuth data migration (FK conversion, email_verified, OAuth accounts) - scripts/migrate-clerk-passwords.mjs: one-time script to import bcrypt hashes from Clerk CSV export - BETTERAUTH_MIGRATION.md: dev and production runbooks - All test mocks updated: vi.mock('~/lib/auth.server') instead of @clerk/react-router/server - Test fixtures: added emailVerified field **Follow-up (post-stable)** - Rename actor_clerk_id column → actor_user_id in commissioner_audit_log - Drop clerk_id column from users once migration confirmed Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * Add .npmrc with legacy-peer-deps for better-auth/drizzle peer dep conflict better-auth@1.6.9 declares peerOptional deps on drizzle-orm ^0.45.2 and drizzle-kit >=0.31.4, but we run drizzle-orm ~0.36.3 / drizzle-kit ~0.28.1. The adapter works correctly at runtime with our versions — the peer dep is only for stricter type checking. This unblocks npm ci in CI without a risky drizzle major-version upgrade. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
587 lines
No EOL
12 KiB
JSON
587 lines
No EOL
12 KiB
JSON
{
|
|
"version": "7",
|
|
"dialect": "postgresql",
|
|
"entries": [
|
|
{
|
|
"idx": 0,
|
|
"version": "7",
|
|
"when": 1732076135211,
|
|
"tag": "0000_short_donald_blake",
|
|
"breakpoints": true
|
|
},
|
|
{
|
|
"idx": 1,
|
|
"version": "7",
|
|
"when": 1760165302772,
|
|
"tag": "0001_serious_la_nuit",
|
|
"breakpoints": true
|
|
},
|
|
{
|
|
"idx": 2,
|
|
"version": "7",
|
|
"when": 1760166775427,
|
|
"tag": "0002_tired_iron_man",
|
|
"breakpoints": true
|
|
},
|
|
{
|
|
"idx": 3,
|
|
"version": "7",
|
|
"when": 1760167848365,
|
|
"tag": "0003_public_shadowcat",
|
|
"breakpoints": true
|
|
},
|
|
{
|
|
"idx": 4,
|
|
"version": "7",
|
|
"when": 1760168383812,
|
|
"tag": "0004_spicy_zarda",
|
|
"breakpoints": true
|
|
},
|
|
{
|
|
"idx": 5,
|
|
"version": "7",
|
|
"when": 1760169537260,
|
|
"tag": "0005_abnormal_thunderbird",
|
|
"breakpoints": true
|
|
},
|
|
{
|
|
"idx": 6,
|
|
"version": "7",
|
|
"when": 1760241924414,
|
|
"tag": "0006_needy_junta",
|
|
"breakpoints": true
|
|
},
|
|
{
|
|
"idx": 7,
|
|
"version": "7",
|
|
"when": 1760327817376,
|
|
"tag": "0007_pink_nebula",
|
|
"breakpoints": true
|
|
},
|
|
{
|
|
"idx": 8,
|
|
"version": "7",
|
|
"when": 1760375514773,
|
|
"tag": "0008_salty_trauma",
|
|
"breakpoints": true
|
|
},
|
|
{
|
|
"idx": 9,
|
|
"version": "7",
|
|
"when": 1760392647508,
|
|
"tag": "0009_fuzzy_korvac",
|
|
"breakpoints": true
|
|
},
|
|
{
|
|
"idx": 10,
|
|
"version": "7",
|
|
"when": 1760469105799,
|
|
"tag": "0010_complex_the_stranger",
|
|
"breakpoints": true
|
|
},
|
|
{
|
|
"idx": 11,
|
|
"version": "7",
|
|
"when": 1760501621605,
|
|
"tag": "0011_gifted_mystique",
|
|
"breakpoints": true
|
|
},
|
|
{
|
|
"idx": 12,
|
|
"version": "7",
|
|
"when": 1760504208398,
|
|
"tag": "0012_yielding_phil_sheldon",
|
|
"breakpoints": true
|
|
},
|
|
{
|
|
"idx": 13,
|
|
"version": "7",
|
|
"when": 1760543654915,
|
|
"tag": "0013_pink_the_order",
|
|
"breakpoints": true
|
|
},
|
|
{
|
|
"idx": 14,
|
|
"version": "7",
|
|
"when": 1760588333462,
|
|
"tag": "0014_lowly_gateway",
|
|
"breakpoints": true
|
|
},
|
|
{
|
|
"idx": 15,
|
|
"version": "7",
|
|
"when": 1760589195551,
|
|
"tag": "0015_exotic_loners",
|
|
"breakpoints": true
|
|
},
|
|
{
|
|
"idx": 16,
|
|
"version": "7",
|
|
"when": 1760590495868,
|
|
"tag": "0016_majestic_roulette",
|
|
"breakpoints": true
|
|
},
|
|
{
|
|
"idx": 17,
|
|
"version": "7",
|
|
"when": 1760599350154,
|
|
"tag": "0017_calm_zarda",
|
|
"breakpoints": true
|
|
},
|
|
{
|
|
"idx": 18,
|
|
"version": "7",
|
|
"when": 1760996053371,
|
|
"tag": "0018_numerous_stardust",
|
|
"breakpoints": true
|
|
},
|
|
{
|
|
"idx": 19,
|
|
"version": "7",
|
|
"when": 1761112236540,
|
|
"tag": "0019_acoustic_ben_grimm",
|
|
"breakpoints": true
|
|
},
|
|
{
|
|
"idx": 20,
|
|
"version": "7",
|
|
"when": 1761719248881,
|
|
"tag": "0020_slim_spacker_dave",
|
|
"breakpoints": true
|
|
},
|
|
{
|
|
"idx": 21,
|
|
"version": "7",
|
|
"when": 1762190473418,
|
|
"tag": "0021_fair_ser_duncan",
|
|
"breakpoints": true
|
|
},
|
|
{
|
|
"idx": 22,
|
|
"version": "7",
|
|
"when": 1762191156317,
|
|
"tag": "0022_shiny_mother_askani",
|
|
"breakpoints": true
|
|
},
|
|
{
|
|
"idx": 23,
|
|
"version": "7",
|
|
"when": 1762200550705,
|
|
"tag": "0023_cynical_jack_power",
|
|
"breakpoints": true
|
|
},
|
|
{
|
|
"idx": 24,
|
|
"version": "7",
|
|
"when": 1763276901482,
|
|
"tag": "0024_faithful_mesmero",
|
|
"breakpoints": true
|
|
},
|
|
{
|
|
"idx": 25,
|
|
"version": "7",
|
|
"when": 1763277000000,
|
|
"tag": "0025_rename_participant_ev_season_to_sports_season",
|
|
"breakpoints": true
|
|
},
|
|
{
|
|
"idx": 26,
|
|
"version": "7",
|
|
"when": 1763278000000,
|
|
"tag": "0026_add_source_odds_to_participant_ev",
|
|
"breakpoints": true
|
|
},
|
|
{
|
|
"idx": 27,
|
|
"version": "7",
|
|
"when": 1763279000000,
|
|
"tag": "0027_add_projected_points_to_team_standings",
|
|
"breakpoints": true
|
|
},
|
|
{
|
|
"idx": 28,
|
|
"version": "7",
|
|
"when": 1763280000000,
|
|
"tag": "0028_add_tournament_groups",
|
|
"breakpoints": true
|
|
},
|
|
{
|
|
"idx": 29,
|
|
"version": "7",
|
|
"when": 1763281000000,
|
|
"tag": "0029_change_participant_ev_to_decimal",
|
|
"breakpoints": true
|
|
},
|
|
{
|
|
"idx": 30,
|
|
"version": "7",
|
|
"when": 1763282000000,
|
|
"tag": "0030_add_draft_picks_unique_slot",
|
|
"breakpoints": true
|
|
},
|
|
{
|
|
"idx": 31,
|
|
"version": "7",
|
|
"when": 1763283000000,
|
|
"tag": "0031_add_autodraft_queue_only",
|
|
"breakpoints": true
|
|
},
|
|
{
|
|
"idx": 32,
|
|
"version": "7",
|
|
"when": 1763284000000,
|
|
"tag": "0032_consolidate_playoff_pattern",
|
|
"breakpoints": true
|
|
},
|
|
{
|
|
"idx": 33,
|
|
"version": "7",
|
|
"when": 1763285000000,
|
|
"tag": "0033_add_schedule_event_type",
|
|
"breakpoints": true
|
|
},
|
|
{
|
|
"idx": 34,
|
|
"version": "7",
|
|
"when": 1763286000000,
|
|
"tag": "0034_add_ev_snapshots",
|
|
"breakpoints": true
|
|
},
|
|
{
|
|
"idx": 35,
|
|
"version": "7",
|
|
"when": 1763287000000,
|
|
"tag": "0035_increase_prob_precision",
|
|
"breakpoints": true
|
|
},
|
|
{
|
|
"idx": 36,
|
|
"version": "7",
|
|
"when": 1763288000000,
|
|
"tag": "0036_increase_ev_precision",
|
|
"breakpoints": true
|
|
},
|
|
{
|
|
"idx": 37,
|
|
"version": "7",
|
|
"when": 1763289000000,
|
|
"tag": "0037_add_simulator_type_to_sports",
|
|
"breakpoints": true
|
|
},
|
|
{
|
|
"idx": 38,
|
|
"version": "7",
|
|
"when": 1773122866361,
|
|
"tag": "0038_sad_wilson_fisk",
|
|
"breakpoints": true
|
|
},
|
|
{
|
|
"idx": 39,
|
|
"version": "7",
|
|
"when": 1773200000000,
|
|
"tag": "0039_add_ucl_bracket_simulator_type",
|
|
"breakpoints": true
|
|
},
|
|
{
|
|
"idx": 40,
|
|
"version": "7",
|
|
"when": 1773262080928,
|
|
"tag": "0040_fat_puma",
|
|
"breakpoints": true
|
|
},
|
|
{
|
|
"idx": 41,
|
|
"version": "7",
|
|
"when": 1773557500336,
|
|
"tag": "0041_great_magma",
|
|
"breakpoints": true
|
|
},
|
|
{
|
|
"idx": 42,
|
|
"version": "7",
|
|
"when": 1773600000000,
|
|
"tag": "0042_migrate_event_date_to_starts_at",
|
|
"breakpoints": true
|
|
},
|
|
{
|
|
"idx": 43,
|
|
"version": "7",
|
|
"when": 1773634394633,
|
|
"tag": "0043_demonic_vanisher",
|
|
"breakpoints": true
|
|
},
|
|
{
|
|
"idx": 44,
|
|
"version": "7",
|
|
"when": 1773700000000,
|
|
"tag": "0044_add_ncaam_bracket_simulator_type",
|
|
"breakpoints": true
|
|
},
|
|
{
|
|
"idx": 45,
|
|
"version": "7",
|
|
"when": 1773710000000,
|
|
"tag": "0045_add_ncaaw_bracket_simulator_type",
|
|
"breakpoints": true
|
|
},
|
|
{
|
|
"idx": 46,
|
|
"version": "7",
|
|
"when": 1773720000000,
|
|
"tag": "0046_add_nba_bracket_simulator_type",
|
|
"breakpoints": true
|
|
},
|
|
{
|
|
"idx": 47,
|
|
"version": "7",
|
|
"when": 1773730000000,
|
|
"tag": "0047_fix_nba_bracket_simulator_type",
|
|
"breakpoints": true
|
|
},
|
|
{
|
|
"idx": 48,
|
|
"version": "7",
|
|
"when": 1773765768905,
|
|
"tag": "0048_eager_songbird",
|
|
"breakpoints": true
|
|
},
|
|
{
|
|
"idx": 49,
|
|
"version": "7",
|
|
"when": 1773800000000,
|
|
"tag": "0049_add_admin_picked_by_type",
|
|
"breakpoints": true
|
|
},
|
|
{
|
|
"idx": 50,
|
|
"version": "7",
|
|
"when": 1773821310661,
|
|
"tag": "0050_chief_peter_quill",
|
|
"breakpoints": true
|
|
},
|
|
{
|
|
"idx": 51,
|
|
"version": "7",
|
|
"when": 1773900000000,
|
|
"tag": "0051_add_standings_snapshot_unique_index",
|
|
"breakpoints": true
|
|
},
|
|
{
|
|
"idx": 52,
|
|
"version": "7",
|
|
"when": 1773897678653,
|
|
"tag": "0052_new_warbird",
|
|
"breakpoints": true
|
|
},
|
|
{
|
|
"idx": 53,
|
|
"version": "7",
|
|
"when": 1773903201189,
|
|
"tag": "0053_smooth_kingpin",
|
|
"breakpoints": true
|
|
},
|
|
{
|
|
"idx": 54,
|
|
"version": "7",
|
|
"when": 1774070769112,
|
|
"tag": "0054_massive_vulcan",
|
|
"breakpoints": true
|
|
},
|
|
{
|
|
"idx": 55,
|
|
"version": "7",
|
|
"when": 1774072156237,
|
|
"tag": "0055_special_vampiro",
|
|
"breakpoints": true
|
|
},
|
|
{
|
|
"idx": 56,
|
|
"version": "7",
|
|
"when": 1774167142673,
|
|
"tag": "0056_jittery_the_fallen",
|
|
"breakpoints": true
|
|
},
|
|
{
|
|
"idx": 57,
|
|
"version": "7",
|
|
"when": 1774239259550,
|
|
"tag": "0057_cultured_doctor_doom",
|
|
"breakpoints": true
|
|
},
|
|
{
|
|
"idx": 58,
|
|
"version": "7",
|
|
"when": 1774310000000,
|
|
"tag": "0058_add_unique_participant_ev",
|
|
"breakpoints": true
|
|
},
|
|
{
|
|
"idx": 59,
|
|
"version": "7",
|
|
"when": 1774329951326,
|
|
"tag": "0059_mysterious_jack_murdock",
|
|
"breakpoints": true
|
|
},
|
|
{
|
|
"idx": 60,
|
|
"version": "7",
|
|
"when": 1774330910098,
|
|
"tag": "0060_omniscient_outlaw_kid",
|
|
"breakpoints": true
|
|
},
|
|
{
|
|
"idx": 61,
|
|
"version": "7",
|
|
"when": 1774410244601,
|
|
"tag": "0061_violet_mephistopheles",
|
|
"breakpoints": true
|
|
},
|
|
{
|
|
"idx": 62,
|
|
"version": "7",
|
|
"when": 1774500000000,
|
|
"tag": "0062_add_mlb_bracket_simulator_type",
|
|
"breakpoints": true
|
|
},
|
|
{
|
|
"idx": 63,
|
|
"version": "7",
|
|
"when": 1774504559479,
|
|
"tag": "0063_bored_ultimo",
|
|
"breakpoints": true
|
|
},
|
|
{
|
|
"idx": 64,
|
|
"version": "7",
|
|
"when": 1774598151282,
|
|
"tag": "0064_fuzzy_wolfsbane",
|
|
"breakpoints": true
|
|
},
|
|
{
|
|
"idx": 65,
|
|
"version": "7",
|
|
"when": 1774719902130,
|
|
"tag": "0065_kind_mantis",
|
|
"breakpoints": true
|
|
},
|
|
{
|
|
"idx": 66,
|
|
"version": "7",
|
|
"when": 1774802533652,
|
|
"tag": "0066_stiff_siren",
|
|
"breakpoints": true
|
|
},
|
|
{
|
|
"idx": 67,
|
|
"version": "7",
|
|
"when": 1774900000000,
|
|
"tag": "0067_darts_bracket",
|
|
"breakpoints": true
|
|
},
|
|
{
|
|
"idx": 68,
|
|
"version": "7",
|
|
"when": 1775485575205,
|
|
"tag": "0068_cs2_major_simulator",
|
|
"breakpoints": true
|
|
},
|
|
{
|
|
"idx": 69,
|
|
"version": "7",
|
|
"when": 1775485599229,
|
|
"tag": "0069_draft_window",
|
|
"breakpoints": true
|
|
},
|
|
{
|
|
"idx": 70,
|
|
"version": "7",
|
|
"when": 1775485630297,
|
|
"tag": "0070_verify_migrations",
|
|
"breakpoints": true
|
|
},
|
|
{
|
|
"idx": 71,
|
|
"version": "7",
|
|
"when": 1775528386356,
|
|
"tag": "0071_many_nico_minoru",
|
|
"breakpoints": true
|
|
},
|
|
{
|
|
"idx": 72,
|
|
"version": "7",
|
|
"when": 1775652883157,
|
|
"tag": "0072_jittery_steve_rogers",
|
|
"breakpoints": true
|
|
},
|
|
{
|
|
"idx": 73,
|
|
"version": "7",
|
|
"when": 1775679862606,
|
|
"tag": "0073_blushing_lady_vermin",
|
|
"breakpoints": true
|
|
},
|
|
{
|
|
"idx": 74,
|
|
"version": "7",
|
|
"when": 1775699707816,
|
|
"tag": "0074_clammy_tiger_shark",
|
|
"breakpoints": true
|
|
},
|
|
{
|
|
"idx": 75,
|
|
"version": "7",
|
|
"when": 1776101579459,
|
|
"tag": "0075_chubby_stephen_strange",
|
|
"breakpoints": true
|
|
},
|
|
{
|
|
"idx": 76,
|
|
"version": "7",
|
|
"when": 1776226761564,
|
|
"tag": "0076_heavy_zemo",
|
|
"breakpoints": true
|
|
},
|
|
{
|
|
"idx": 77,
|
|
"version": "7",
|
|
"when": 1776312815334,
|
|
"tag": "0077_lively_wolfpack",
|
|
"breakpoints": true
|
|
},
|
|
{
|
|
"idx": 78,
|
|
"version": "7",
|
|
"when": 1776314387095,
|
|
"tag": "0078_striped_rick_jones",
|
|
"breakpoints": true
|
|
},
|
|
{
|
|
"idx": 79,
|
|
"version": "7",
|
|
"when": 1776316296907,
|
|
"tag": "0079_wide_trauma",
|
|
"breakpoints": true
|
|
},
|
|
{
|
|
"idx": 80,
|
|
"version": "7",
|
|
"when": 1776318182740,
|
|
"tag": "0080_chemical_gorilla_man",
|
|
"breakpoints": true
|
|
},
|
|
{
|
|
"idx": 81,
|
|
"version": "7",
|
|
"when": 1777067050669,
|
|
"tag": "0081_careless_magdalene",
|
|
"breakpoints": true
|
|
},
|
|
{
|
|
"idx": 82,
|
|
"version": "7",
|
|
"when": 1777090754037,
|
|
"tag": "0082_stale_pride",
|
|
"breakpoints": true
|
|
}
|
|
]
|
|
} |