Skip to content

Commit 87a95d8

Browse files
committed
fixup: toy example previously could loop forever
This is a toy example where, presumably, `username` had a NOT NULL constraint as the real `email` column does, but this makes it explicit that these are concerns for these kinds of migrations.
1 parent af9c9c9 commit 87a95d8

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

  • docs/contributing/database-migrations

docs/contributing/database-migrations/edd.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ WHILE @RowsAffected > 0
226226
BEGIN
227227
UPDATE TOP (@BatchSize) [dbo].[User]
228228
SET email = username
229-
WHERE email IS NULL;
229+
WHERE email IS NULL AND username IS NOT NULL;
230230

231231
SET @RowsAffected = @@ROWCOUNT;
232232
END

0 commit comments

Comments
 (0)