mirror of
https://github.com/whoswhip/Sharpbin.git
synced 2026-12-06 02:48:43 +00:00
feat: password resets
fix: frontend docker file chore: format via csharpier again
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace SharpbinV3.Server.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class uniqueEmails : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.Sql(
|
||||
"""
|
||||
UPDATE "Users"
|
||||
SET "Email" = NULL, "EmailVerified" = 0
|
||||
WHERE "Email" IS NULL OR trim("Email") = '';
|
||||
"""
|
||||
);
|
||||
|
||||
migrationBuilder.Sql(
|
||||
"""
|
||||
UPDATE "Users"
|
||||
SET "Email" = lower(trim("Email"))
|
||||
WHERE "Email" IS NOT NULL;
|
||||
"""
|
||||
);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Users_Email",
|
||||
table: "Users",
|
||||
column: "Email",
|
||||
unique: true,
|
||||
filter: "\"Email\" IS NOT NULL");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_Users_Email",
|
||||
table: "Users");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user