diff options
Diffstat (limited to 'Migrations/20230920052204_Security.cs')
| -rw-r--r-- | Migrations/20230920052204_Security.cs | 194 |
1 files changed, 0 insertions, 194 deletions
diff --git a/Migrations/20230920052204_Security.cs b/Migrations/20230920052204_Security.cs deleted file mode 100644 index 982cb97..0000000 --- a/Migrations/20230920052204_Security.cs +++ /dev/null @@ -1,194 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace HyperBooru.Migrations -{ - /// <inheritdoc /> - public partial class Security : Migration - { - /// <inheritdoc /> - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK_Users_Objects_ObjectId", - table: "Users"); - - migrationBuilder.DropIndex( - name: "IX_Users_Username", - table: "Users"); - - migrationBuilder.DropColumn( - name: "Username", - table: "Users"); - - migrationBuilder.CreateTable( - name: "Acls", - columns: table => new - { - ObjectId = table.Column<int>(type: "integer", nullable: false), - SubjectTempId1 = table.Column<int>(type: "integer", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_Acls", x => x.ObjectId); - table.ForeignKey( - name: "FK_Acls_Objects_ObjectId", - column: x => x.ObjectId, - principalTable: "Objects", - principalColumn: "ObjectId", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "Principals", - columns: table => new - { - ObjectId = table.Column<int>(type: "integer", nullable: false), - Name = table.Column<string>(type: "text", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_Principals", x => x.ObjectId); - }); - - migrationBuilder.CreateTable( - name: "AclRules", - columns: table => new - { - ObjectId = table.Column<int>(type: "integer", nullable: false), - PrincipalObjectId = table.Column<int>(type: "integer", nullable: false), - Action = table.Column<int>(type: "integer", nullable: false), - Permissions = table.Column<long>(type: "bigint", nullable: false), - AclObjectId = table.Column<int>(type: "integer", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_AclRules", x => x.ObjectId); - table.ForeignKey( - name: "FK_AclRules_Acls_AclObjectId", - column: x => x.AclObjectId, - principalTable: "Acls", - principalColumn: "ObjectId"); - table.ForeignKey( - name: "FK_AclRules_Principals_PrincipalObjectId", - column: x => x.PrincipalObjectId, - principalTable: "Principals", - principalColumn: "ObjectId", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "Groups", - columns: table => new - { - ObjectId = table.Column<int>(type: "integer", nullable: false), - HBPrincipalObjectId = table.Column<int>(type: "integer", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_Groups", x => x.ObjectId); - table.ForeignKey( - name: "FK_Groups_Principals_HBPrincipalObjectId", - column: x => x.HBPrincipalObjectId, - principalTable: "Principals", - principalColumn: "ObjectId"); - }); - - migrationBuilder.UpdateData( - table: "Objects", - keyColumn: "ObjectId", - keyValue: -3, - column: "Guid", - value: new Guid("8fbbc2e9-0609-460a-ab3a-c3bdd10ab793")); - - migrationBuilder.InsertData( - table: "Principals", - columns: new[] { "ObjectId", "Name" }, - values: new object[] { -3, "admin" }); - - migrationBuilder.CreateIndex( - name: "IX_AclRules_AclObjectId", - table: "AclRules", - column: "AclObjectId"); - - migrationBuilder.CreateIndex( - name: "IX_AclRules_PrincipalObjectId", - table: "AclRules", - column: "PrincipalObjectId"); - - migrationBuilder.CreateIndex( - name: "IX_Groups_HBPrincipalObjectId", - table: "Groups", - column: "HBPrincipalObjectId"); - - migrationBuilder.CreateIndex( - name: "IX_Principals_Name", - table: "Principals", - column: "Name"); - - migrationBuilder.AddForeignKey( - name: "FK_Users_Principals_ObjectId", - table: "Users", - column: "ObjectId", - principalTable: "Principals", - principalColumn: "ObjectId", - onDelete: ReferentialAction.Cascade); - } - - /// <inheritdoc /> - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK_Users_Principals_ObjectId", - table: "Users"); - - migrationBuilder.DropTable( - name: "AclRules"); - - migrationBuilder.DropTable( - name: "Groups"); - - migrationBuilder.DropTable( - name: "Acls"); - - migrationBuilder.DropTable( - name: "Principals"); - - migrationBuilder.AddColumn<string>( - name: "Username", - table: "Users", - type: "text", - nullable: false, - defaultValue: ""); - - migrationBuilder.UpdateData( - table: "Objects", - keyColumn: "ObjectId", - keyValue: -3, - column: "Guid", - value: new Guid("4fa948f4-7c45-4f81-bb6b-e417491e6c96")); - - migrationBuilder.UpdateData( - table: "Users", - keyColumn: "ObjectId", - keyValue: -3, - column: "Username", - value: "admin"); - - migrationBuilder.CreateIndex( - name: "IX_Users_Username", - table: "Users", - column: "Username"); - - migrationBuilder.AddForeignKey( - name: "FK_Users_Objects_ObjectId", - table: "Users", - column: "ObjectId", - principalTable: "Objects", - principalColumn: "ObjectId", - onDelete: ReferentialAction.Cascade); - } - } -} |
