diff options
| author | Jake Mannens <jake@asger.xyz> | 2023-09-14 14:41:40 +1000 |
|---|---|---|
| committer | Jake Mannens <jake@asger.xyz> | 2023-09-14 14:41:40 +1000 |
| commit | 604ef537e0fabfbcc3abf9d7473b22f08dc549a6 (patch) | |
| tree | e3ba3b1c54c245f10ca8b2abbc4fe24d648868f8 /Migrations/20230914040737_Users.cs | |
| parent | b3654a2764873cef9f171bb6ccd6726feae3e796 (diff) | |
Finalised login functionality
Diffstat (limited to 'Migrations/20230914040737_Users.cs')
| -rw-r--r-- | Migrations/20230914040737_Users.cs | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/Migrations/20230914040737_Users.cs b/Migrations/20230914040737_Users.cs new file mode 100644 index 0000000..3c77a28 --- /dev/null +++ b/Migrations/20230914040737_Users.cs @@ -0,0 +1,61 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace HyperBooru.Migrations +{ + /// <inheritdoc /> + public partial class Users : Migration + { + /// <inheritdoc /> + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "Users", + columns: table => new + { + ObjectId = table.Column<int>(type: "integer", nullable: false), + Username = table.Column<string>(type: "text", nullable: false), + PasswordHash = table.Column<string>(type: "text", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Users", x => x.ObjectId); + table.ForeignKey( + name: "FK_Users_Objects_ObjectId", + column: x => x.ObjectId, + principalTable: "Objects", + principalColumn: "ObjectId", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.InsertData( + table: "Objects", + columns: new[] { "ObjectId", "Guid" }, + values: new object[] { -3, new Guid("4fa948f4-7c45-4f81-bb6b-e417491e6c96") }); + + migrationBuilder.InsertData( + table: "Users", + columns: new[] { "ObjectId", "PasswordHash", "Username" }, + values: new object[] { -3, "P4geAuE2yX/PDRHuJSq74FF5vO782rWz5c0LAQPR8m45DEYAONhu1wYnAn60PSNyjocqEBdnCeKCJfK3sKyuWw==", "admin" }); + + migrationBuilder.CreateIndex( + name: "IX_Users_Username", + table: "Users", + column: "Username"); + } + + /// <inheritdoc /> + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "Users"); + + migrationBuilder.DeleteData( + table: "Objects", + keyColumn: "ObjectId", + keyValue: -3); + } + } +} |
