Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix #994 by deleting duped users before we create the index.

  • Loading branch information...
commit 15520cd5afc99475fede9e11ff3c37df75620ced 1 parent e5aedff
Tim Lovell-Smith TimLovellSmith authored
Showing with 14 additions and 0 deletions.
  1. +14 −0 Website/Migrations/201303072008568_UserLookupOptimization.cs
14 Website/Migrations/201303072008568_UserLookupOptimization.cs
View
@@ -6,6 +6,20 @@ public partial class UserLookupOptimization : DbMigration
{
public override void Up()
{
+ // DELETE duplicate Users from the database
+ // Keep the OLDER User
+ Sql(@"WITH NumberedRows
+AS
+(
+
+ SELECT Row_number() OVER
+(PARTITION BY Username ORDER BY Username, [Key] ASC)
+
+ RowId, * from Users
+)
+
+DELETE * FROM NumberedRows WHERE RowId > 1");
+
AlterColumn("Users", "EmailAddress", c => c.String(maxLength: 256));
AlterColumn("Users", "UnconfirmedEmailAddress", c => c.String(maxLength: 256));
AlterColumn("Users", "HashedPassword", c => c.String(nullable: false, maxLength: 256));
Please sign in to comment.
Something went wrong with that request. Please try again.