diff options
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); + } + } +} |
