diff options
| author | Jake Mannens <jake@asger.xyz> | 2023-09-20 15:53:05 +1000 |
|---|---|---|
| committer | Jake Mannens <jake@asger.xyz> | 2023-09-25 16:02:18 +1000 |
| commit | 39eead0052215d7be4f49906e987fef7fb0c700b (patch) | |
| tree | a7381d06ee6cab9d4ce72d1e2a7121bc93193c6d /Migrations/20230920014958_Security.cs | |
| parent | fbaa4e43709a96774ebe42b7ec5908c1c0f310d7 (diff) | |
Fixed migration and began adding ACL edit dialog
Diffstat (limited to 'Migrations/20230920014958_Security.cs')
| -rw-r--r-- | Migrations/20230920014958_Security.cs | 194 |
1 files changed, 0 insertions, 194 deletions
diff --git a/Migrations/20230920014958_Security.cs b/Migrations/20230920014958_Security.cs deleted file mode 100644 index ed7def8..0000000 --- a/Migrations/20230920014958_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.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<decimal>(type: "numeric(20,0)", 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("bf62bd4c-806e-4d1b-a62d-0efffce8628a")); - - 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); - - migrationBuilder.DropColumn( - name: "Username", - table: "Users"); - } - - /// <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); - } - } -} |
