diff options
| author | Jake Mannens <jake@asger.xyz> | 2024-02-05 15:33:27 +1100 |
|---|---|---|
| committer | Jake Mannens <jake@asger.xyz> | 2024-02-05 15:33:27 +1100 |
| commit | 226538299372624c10450e203cefc665fcb439a2 (patch) | |
| tree | 258c2fe4f599d8d9db5b0581cb170880c650b963 /Migrations/20231001212740_Security.cs | |
| parent | c7f2f42b07f5503e99568e288b6f27ae03ea6fa2 (diff) | |
Removed security migrations
Diffstat (limited to 'Migrations/20231001212740_Security.cs')
| -rw-r--r-- | Migrations/20231001212740_Security.cs | 312 |
1 files changed, 0 insertions, 312 deletions
diff --git a/Migrations/20231001212740_Security.cs b/Migrations/20231001212740_Security.cs deleted file mode 100644 index 0e38fde..0000000 --- a/Migrations/20231001212740_Security.cs +++ /dev/null @@ -1,312 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace HyperBooru.Migrations -{ - /// <inheritdoc /> - public partial class Security : Migration - { - /// <inheritdoc /> - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK_TagDefinitionTagDefinition_TagDefinitions_ImplicitTagsObjec~", - table: "TagDefinitionTagDefinition"); - - migrationBuilder.DropForeignKey( - name: "FK_TagDefinitionTagDefinition_TagDefinitions_TagDefinitionObje~", - table: "TagDefinitionTagDefinition"); - - migrationBuilder.DropTable( - name: "Users"); - - migrationBuilder.DropPrimaryKey( - name: "PK_TagDefinitionTagDefinition", - table: "TagDefinitionTagDefinition"); - - migrationBuilder.DeleteData( - table: "Objects", - keyColumn: "ObjectId", - keyValue: -3); - - migrationBuilder.RenameTable( - name: "TagDefinitionTagDefinition", - newName: "ImplicitTags"); - - migrationBuilder.RenameIndex( - name: "IX_TagDefinitionTagDefinition_TagDefinitionObjectId", - table: "ImplicitTags", - newName: "IX_ImplicitTags_TagDefinitionObjectId"); - - migrationBuilder.AddColumn<int>( - name: "AclId", - table: "Objects", - type: "integer", - nullable: true); - - migrationBuilder.AddColumn<byte[]>( - name: "Owner", - table: "Objects", - type: "bytea", - nullable: false, - defaultValue: new byte[] { 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0 }); - - migrationBuilder.AddPrimaryKey( - name: "PK_ImplicitTags", - table: "ImplicitTags", - columns: new[] { "ImplicitTagsObjectId", "TagDefinitionObjectId" }); - - migrationBuilder.CreateTable( - name: "Acls", - columns: table => new - { - AclId = table.Column<int>(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn) - }, - constraints: table => - { - table.PrimaryKey("PK_Acls", x => x.AclId); - }); - - migrationBuilder.CreateTable( - name: "SecurityPrincipals", - columns: table => new - { - LocalPrincipalId = table.Column<int>(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - Name = table.Column<string>(type: "text", nullable: false), - Sid = table.Column<byte[]>(type: "bytea", nullable: false), - Discriminator = table.Column<string>(type: "text", nullable: false), - PasswordHash = table.Column<string>(type: "text", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_SecurityPrincipals", x => x.LocalPrincipalId); - }); - - migrationBuilder.CreateTable( - name: "AclRules", - columns: table => new - { - AclRuleId = table.Column<int>(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - Principal = table.Column<byte[]>(type: "bytea", nullable: false), - Action = table.Column<int>(type: "integer", nullable: false), - Permissions = table.Column<long>(type: "bigint", nullable: false), - AclId = table.Column<int>(type: "integer", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_AclRules", x => x.AclRuleId); - table.ForeignKey( - name: "FK_AclRules_Acls_AclId", - column: x => x.AclId, - principalTable: "Acls", - principalColumn: "AclId"); - }); - - migrationBuilder.CreateTable( - name: "SecurityPrincipalMemberships", - columns: table => new - { - LocalPrincipalId = table.Column<int>(type: "integer", nullable: false), - MemberOfLocalPrincipalId = table.Column<int>(type: "integer", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_SecurityPrincipalMemberships", x => new { x.LocalPrincipalId, x.MemberOfLocalPrincipalId }); - table.ForeignKey( - name: "FK_SecurityPrincipalMemberships_SecurityPrincipals_LocalPrinci~", - column: x => x.LocalPrincipalId, - principalTable: "SecurityPrincipals", - principalColumn: "LocalPrincipalId", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_SecurityPrincipalMemberships_SecurityPrincipals_MemberOfLoc~", - column: x => x.MemberOfLocalPrincipalId, - principalTable: "SecurityPrincipals", - principalColumn: "LocalPrincipalId", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.UpdateData( - table: "Objects", - keyColumn: "ObjectId", - keyValue: -2, - columns: new[] { "AclId", "Owner" }, - values: new object[] { null, new byte[] { 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0 } }); - - migrationBuilder.UpdateData( - table: "Objects", - keyColumn: "ObjectId", - keyValue: -1, - columns: new[] { "AclId", "Owner" }, - values: new object[] { null, new byte[] { 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0 } }); - - migrationBuilder.InsertData( - table: "SecurityPrincipals", - columns: new[] { "LocalPrincipalId", "Discriminator", "Name", "PasswordHash", "Sid" }, - values: new object[] { -1, "LocalUser", "admin", "P4geAuE2yX/PDRHuJSq74FF5vO782rWz5c0LAQPR8m45DEYAONhu1wYnAn60PSNyjocqEBdnCeKCJfK3sKyuWw==", new byte[] { 1, 1, 0, 0, 0, 0, 0, 5, 18, 0, 0, 0 } }); - - migrationBuilder.CreateIndex( - name: "IX_Objects_AclId", - table: "Objects", - column: "AclId", - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_AclRules_AclId", - table: "AclRules", - column: "AclId"); - - migrationBuilder.CreateIndex( - name: "IX_SecurityPrincipalMemberships_MemberOfLocalPrincipalId", - table: "SecurityPrincipalMemberships", - column: "MemberOfLocalPrincipalId"); - - migrationBuilder.CreateIndex( - name: "IX_SecurityPrincipals_Name", - table: "SecurityPrincipals", - column: "Name"); - - migrationBuilder.CreateIndex( - name: "IX_SecurityPrincipals_Sid", - table: "SecurityPrincipals", - column: "Sid"); - - migrationBuilder.AddForeignKey( - name: "FK_ImplicitTags_TagDefinitions_ImplicitTagsObjectId", - table: "ImplicitTags", - column: "ImplicitTagsObjectId", - principalTable: "TagDefinitions", - principalColumn: "ObjectId", - onDelete: ReferentialAction.Cascade); - - migrationBuilder.AddForeignKey( - name: "FK_ImplicitTags_TagDefinitions_TagDefinitionObjectId", - table: "ImplicitTags", - column: "TagDefinitionObjectId", - principalTable: "TagDefinitions", - principalColumn: "ObjectId", - onDelete: ReferentialAction.Cascade); - - migrationBuilder.AddForeignKey( - name: "FK_Objects_Acls_AclId", - table: "Objects", - column: "AclId", - principalTable: "Acls", - principalColumn: "AclId"); - } - - /// <inheritdoc /> - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK_ImplicitTags_TagDefinitions_ImplicitTagsObjectId", - table: "ImplicitTags"); - - migrationBuilder.DropForeignKey( - name: "FK_ImplicitTags_TagDefinitions_TagDefinitionObjectId", - table: "ImplicitTags"); - - migrationBuilder.DropForeignKey( - name: "FK_Objects_Acls_AclId", - table: "Objects"); - - migrationBuilder.DropTable( - name: "AclRules"); - - migrationBuilder.DropTable( - name: "SecurityPrincipalMemberships"); - - migrationBuilder.DropTable( - name: "Acls"); - - migrationBuilder.DropTable( - name: "SecurityPrincipals"); - - migrationBuilder.DropIndex( - name: "IX_Objects_AclId", - table: "Objects"); - - migrationBuilder.DropPrimaryKey( - name: "PK_ImplicitTags", - table: "ImplicitTags"); - - migrationBuilder.DropColumn( - name: "AclId", - table: "Objects"); - - migrationBuilder.DropColumn( - name: "Owner", - table: "Objects"); - - migrationBuilder.RenameTable( - name: "ImplicitTags", - newName: "TagDefinitionTagDefinition"); - - migrationBuilder.RenameIndex( - name: "IX_ImplicitTags_TagDefinitionObjectId", - table: "TagDefinitionTagDefinition", - newName: "IX_TagDefinitionTagDefinition_TagDefinitionObjectId"); - - migrationBuilder.AddPrimaryKey( - name: "PK_TagDefinitionTagDefinition", - table: "TagDefinitionTagDefinition", - columns: new[] { "ImplicitTagsObjectId", "TagDefinitionObjectId" }); - - migrationBuilder.CreateTable( - name: "Users", - columns: table => new - { - ObjectId = table.Column<int>(type: "integer", nullable: false), - PasswordHash = table.Column<string>(type: "text", nullable: false), - Username = 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"); - - migrationBuilder.AddForeignKey( - name: "FK_TagDefinitionTagDefinition_TagDefinitions_ImplicitTagsObjec~", - table: "TagDefinitionTagDefinition", - column: "ImplicitTagsObjectId", - principalTable: "TagDefinitions", - principalColumn: "ObjectId", - onDelete: ReferentialAction.Cascade); - - migrationBuilder.AddForeignKey( - name: "FK_TagDefinitionTagDefinition_TagDefinitions_TagDefinitionObje~", - table: "TagDefinitionTagDefinition", - column: "TagDefinitionObjectId", - principalTable: "TagDefinitions", - principalColumn: "ObjectId", - onDelete: ReferentialAction.Cascade); - } - } -} |
