diff --git a/api/Migrations/20260314152859_InitialCreate.Designer.cs b/api/Migrations/20260314152859_InitialCreate.Designer.cs deleted file mode 100644 index 7d957ce..0000000 --- a/api/Migrations/20260314152859_InitialCreate.Designer.cs +++ /dev/null @@ -1,49 +0,0 @@ -// -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace agologum_api.Migrations -{ - [DbContext(typeof(AppDbContext))] - [Migration("20260314152859_InitialCreate")] - partial class InitialCreate - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "10.0.5") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("agologumApi.Models.User", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("Email") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("Users"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/api/Migrations/20260314152859_InitialCreate.cs b/api/Migrations/20260314152859_InitialCreate.cs deleted file mode 100644 index 2e0df2d..0000000 --- a/api/Migrations/20260314152859_InitialCreate.cs +++ /dev/null @@ -1,36 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace agologum_api.Migrations -{ - /// - public partial class InitialCreate : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "Users", - columns: table => new - { - Id = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - Name = table.Column(type: "text", nullable: false), - Email = table.Column(type: "text", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_Users", x => x.Id); - }); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "Users"); - } - } -} diff --git a/api/Migrations/20260317024844_AddUserAuthFields.Designer.cs b/api/Migrations/20260317024844_AddUserAuthFields.Designer.cs deleted file mode 100644 index 6a1cde8..0000000 --- a/api/Migrations/20260317024844_AddUserAuthFields.Designer.cs +++ /dev/null @@ -1,53 +0,0 @@ -// -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace agologum_api.Migrations -{ - [DbContext(typeof(AppDbContext))] - [Migration("20260317024844_AddUserAuthFields")] - partial class AddUserAuthFields - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "10.0.5") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("agologumApi.Models.User", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("Email") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.Property("PasswordHash") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("Users"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/api/Migrations/20260317024844_AddUserAuthFields.cs b/api/Migrations/20260317024844_AddUserAuthFields.cs deleted file mode 100644 index 4c533f6..0000000 --- a/api/Migrations/20260317024844_AddUserAuthFields.cs +++ /dev/null @@ -1,29 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace agologum_api.Migrations -{ - /// - public partial class AddUserAuthFields : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "PasswordHash", - table: "Users", - type: "text", - nullable: false, - defaultValue: ""); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "PasswordHash", - table: "Users"); - } - } -} diff --git a/api/Migrations/20260321010235_CreateExtraUserInfo.Designer.cs b/api/Migrations/20260321010235_CreateExtraUserInfo.Designer.cs deleted file mode 100644 index 6689bac..0000000 --- a/api/Migrations/20260321010235_CreateExtraUserInfo.Designer.cs +++ /dev/null @@ -1,61 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace agologum_api.Migrations -{ - [DbContext(typeof(AppDbContext))] - [Migration("20260321010235_CreateExtraUserInfo")] - partial class CreateExtraUserInfo - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "10.0.5") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("agologumApi.Models.User", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Email") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.Property("PasswordHash") - .IsRequired() - .HasColumnType("text"); - - b.Property("Role") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("Users"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/api/Migrations/20260321010235_CreateExtraUserInfo.cs b/api/Migrations/20260321010235_CreateExtraUserInfo.cs deleted file mode 100644 index 07f3d06..0000000 --- a/api/Migrations/20260321010235_CreateExtraUserInfo.cs +++ /dev/null @@ -1,41 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace agologum_api.Migrations -{ - /// - public partial class CreateExtraUserInfo : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "CreatedAt", - table: "Users", - type: "timestamp with time zone", - nullable: false, - defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); - - migrationBuilder.AddColumn( - name: "Role", - table: "Users", - type: "text", - nullable: false, - defaultValue: ""); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "CreatedAt", - table: "Users"); - - migrationBuilder.DropColumn( - name: "Role", - table: "Users"); - } - } -} diff --git a/api/Migrations/20260321203739_UseIdentityPlatform.Designer.cs b/api/Migrations/20260321203739_UseIdentityPlatform.Designer.cs deleted file mode 100644 index 7c70f29..0000000 --- a/api/Migrations/20260321203739_UseIdentityPlatform.Designer.cs +++ /dev/null @@ -1,84 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace agologum_api.Migrations -{ - [DbContext(typeof(AppDbContext))] - [Migration("20260321203739_UseIdentityPlatform")] - partial class UseIdentityPlatform - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "10.0.5") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("agologumApi.Models.User", b => - { - b.Property("Id") - .HasColumnType("text"); - - b.Property("AccessFailedCount") - .HasColumnType("integer"); - - b.Property("ConcurrencyStamp") - .HasColumnType("text"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Email") - .HasColumnType("text"); - - b.Property("EmailConfirmed") - .HasColumnType("boolean"); - - b.Property("LockoutEnabled") - .HasColumnType("boolean"); - - b.Property("LockoutEnd") - .HasColumnType("timestamp with time zone"); - - b.Property("NormalizedEmail") - .HasColumnType("text"); - - b.Property("NormalizedUserName") - .HasColumnType("text"); - - b.Property("PasswordHash") - .HasColumnType("text"); - - b.Property("PhoneNumber") - .HasColumnType("text"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("boolean"); - - b.Property("SecurityStamp") - .HasColumnType("text"); - - b.Property("TwoFactorEnabled") - .HasColumnType("boolean"); - - b.Property("UserName") - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("Users"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/api/Migrations/20260321203739_UseIdentityPlatform.cs b/api/Migrations/20260321203739_UseIdentityPlatform.cs deleted file mode 100644 index 6f022b9..0000000 --- a/api/Migrations/20260321203739_UseIdentityPlatform.cs +++ /dev/null @@ -1,221 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace agologum_api.Migrations -{ - /// - public partial class UseIdentityPlatform : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "Name", - table: "Users"); - - migrationBuilder.DropColumn( - name: "Role", - table: "Users"); - - migrationBuilder.AlterColumn( - name: "PasswordHash", - table: "Users", - type: "text", - nullable: true, - oldClrType: typeof(string), - oldType: "text"); - - migrationBuilder.AlterColumn( - name: "Email", - table: "Users", - type: "text", - nullable: true, - oldClrType: typeof(string), - oldType: "text"); - - migrationBuilder.AlterColumn( - name: "Id", - table: "Users", - type: "text", - nullable: false, - oldClrType: typeof(int), - oldType: "integer") - .OldAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - migrationBuilder.AddColumn( - name: "AccessFailedCount", - table: "Users", - type: "integer", - nullable: false, - defaultValue: 0); - - migrationBuilder.AddColumn( - name: "ConcurrencyStamp", - table: "Users", - type: "text", - nullable: true); - - migrationBuilder.AddColumn( - name: "EmailConfirmed", - table: "Users", - type: "boolean", - nullable: false, - defaultValue: false); - - migrationBuilder.AddColumn( - name: "LockoutEnabled", - table: "Users", - type: "boolean", - nullable: false, - defaultValue: false); - - migrationBuilder.AddColumn( - name: "LockoutEnd", - table: "Users", - type: "timestamp with time zone", - nullable: true); - - migrationBuilder.AddColumn( - name: "NormalizedEmail", - table: "Users", - type: "text", - nullable: true); - - migrationBuilder.AddColumn( - name: "NormalizedUserName", - table: "Users", - type: "text", - nullable: true); - - migrationBuilder.AddColumn( - name: "PhoneNumber", - table: "Users", - type: "text", - nullable: true); - - migrationBuilder.AddColumn( - name: "PhoneNumberConfirmed", - table: "Users", - type: "boolean", - nullable: false, - defaultValue: false); - - migrationBuilder.AddColumn( - name: "SecurityStamp", - table: "Users", - type: "text", - nullable: true); - - migrationBuilder.AddColumn( - name: "TwoFactorEnabled", - table: "Users", - type: "boolean", - nullable: false, - defaultValue: false); - - migrationBuilder.AddColumn( - name: "UserName", - table: "Users", - type: "text", - nullable: true); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "AccessFailedCount", - table: "Users"); - - migrationBuilder.DropColumn( - name: "ConcurrencyStamp", - table: "Users"); - - migrationBuilder.DropColumn( - name: "EmailConfirmed", - table: "Users"); - - migrationBuilder.DropColumn( - name: "LockoutEnabled", - table: "Users"); - - migrationBuilder.DropColumn( - name: "LockoutEnd", - table: "Users"); - - migrationBuilder.DropColumn( - name: "NormalizedEmail", - table: "Users"); - - migrationBuilder.DropColumn( - name: "NormalizedUserName", - table: "Users"); - - migrationBuilder.DropColumn( - name: "PhoneNumber", - table: "Users"); - - migrationBuilder.DropColumn( - name: "PhoneNumberConfirmed", - table: "Users"); - - migrationBuilder.DropColumn( - name: "SecurityStamp", - table: "Users"); - - migrationBuilder.DropColumn( - name: "TwoFactorEnabled", - table: "Users"); - - migrationBuilder.DropColumn( - name: "UserName", - table: "Users"); - - migrationBuilder.AlterColumn( - name: "PasswordHash", - table: "Users", - type: "text", - nullable: false, - defaultValue: "", - oldClrType: typeof(string), - oldType: "text", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Email", - table: "Users", - type: "text", - nullable: false, - defaultValue: "", - oldClrType: typeof(string), - oldType: "text", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Id", - table: "Users", - type: "integer", - nullable: false, - oldClrType: typeof(string), - oldType: "text") - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - migrationBuilder.AddColumn( - name: "Name", - table: "Users", - type: "text", - nullable: false, - defaultValue: ""); - - migrationBuilder.AddColumn( - name: "Role", - table: "Users", - type: "text", - nullable: false, - defaultValue: ""); - } - } -} diff --git a/api/Migrations/20260321205823_ContinuityCheck.Designer.cs b/api/Migrations/20260321205823_ContinuityCheck.Designer.cs deleted file mode 100644 index 60bf322..0000000 --- a/api/Migrations/20260321205823_ContinuityCheck.Designer.cs +++ /dev/null @@ -1,84 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace agologum_api.Migrations -{ - [DbContext(typeof(AppDbContext))] - [Migration("20260321205823_ContinuityCheck")] - partial class ContinuityCheck - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "10.0.5") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("agologumApi.Models.User", b => - { - b.Property("Id") - .HasColumnType("text"); - - b.Property("AccessFailedCount") - .HasColumnType("integer"); - - b.Property("ConcurrencyStamp") - .HasColumnType("text"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Email") - .HasColumnType("text"); - - b.Property("EmailConfirmed") - .HasColumnType("boolean"); - - b.Property("LockoutEnabled") - .HasColumnType("boolean"); - - b.Property("LockoutEnd") - .HasColumnType("timestamp with time zone"); - - b.Property("NormalizedEmail") - .HasColumnType("text"); - - b.Property("NormalizedUserName") - .HasColumnType("text"); - - b.Property("PasswordHash") - .HasColumnType("text"); - - b.Property("PhoneNumber") - .HasColumnType("text"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("boolean"); - - b.Property("SecurityStamp") - .HasColumnType("text"); - - b.Property("TwoFactorEnabled") - .HasColumnType("boolean"); - - b.Property("UserName") - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("Users"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/api/Migrations/20260321205823_ContinuityCheck.cs b/api/Migrations/20260321205823_ContinuityCheck.cs deleted file mode 100644 index 5415049..0000000 --- a/api/Migrations/20260321205823_ContinuityCheck.cs +++ /dev/null @@ -1,22 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace agologum_api.Migrations -{ - /// - public partial class ContinuityCheck : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - - } - } -} diff --git a/api/Migrations/20260321211248_AddIdentityToDbContext.Designer.cs b/api/Migrations/20260321221316_InitialCreate.Designer.cs similarity index 99% rename from api/Migrations/20260321211248_AddIdentityToDbContext.Designer.cs rename to api/Migrations/20260321221316_InitialCreate.Designer.cs index 40311ca..1008d5d 100644 --- a/api/Migrations/20260321211248_AddIdentityToDbContext.Designer.cs +++ b/api/Migrations/20260321221316_InitialCreate.Designer.cs @@ -11,8 +11,8 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; namespace agologum_api.Migrations { [DbContext(typeof(AppDbContext))] - [Migration("20260321211248_AddIdentityToDbContext")] - partial class AddIdentityToDbContext + [Migration("20260321221316_InitialCreate")] + partial class InitialCreate { /// protected override void BuildTargetModel(ModelBuilder modelBuilder) diff --git a/api/Migrations/20260321211248_AddIdentityToDbContext.cs b/api/Migrations/20260321221316_InitialCreate.cs similarity index 67% rename from api/Migrations/20260321211248_AddIdentityToDbContext.cs rename to api/Migrations/20260321221316_InitialCreate.cs index d0e4d7e..da54a51 100644 --- a/api/Migrations/20260321211248_AddIdentityToDbContext.cs +++ b/api/Migrations/20260321221316_InitialCreate.cs @@ -1,4 +1,5 @@ -using Microsoft.EntityFrameworkCore.Migrations; +using System; +using Microsoft.EntityFrameworkCore.Migrations; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; #nullable disable @@ -6,64 +7,11 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; namespace agologum_api.Migrations { /// - public partial class AddIdentityToDbContext : Migration + public partial class InitialCreate : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { - migrationBuilder.DropPrimaryKey( - name: "PK_Users", - table: "Users"); - - migrationBuilder.RenameTable( - name: "Users", - newName: "AspNetUsers"); - - migrationBuilder.AlterColumn( - name: "UserName", - table: "AspNetUsers", - type: "character varying(256)", - maxLength: 256, - nullable: true, - oldClrType: typeof(string), - oldType: "text", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "NormalizedUserName", - table: "AspNetUsers", - type: "character varying(256)", - maxLength: 256, - nullable: true, - oldClrType: typeof(string), - oldType: "text", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "NormalizedEmail", - table: "AspNetUsers", - type: "character varying(256)", - maxLength: 256, - nullable: true, - oldClrType: typeof(string), - oldType: "text", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Email", - table: "AspNetUsers", - type: "character varying(256)", - maxLength: 256, - nullable: true, - oldClrType: typeof(string), - oldType: "text", - oldNullable: true); - - migrationBuilder.AddPrimaryKey( - name: "PK_AspNetUsers", - table: "AspNetUsers", - column: "Id"); - migrationBuilder.CreateTable( name: "AspNetRoles", columns: table => new @@ -78,6 +26,53 @@ namespace agologum_api.Migrations table.PrimaryKey("PK_AspNetRoles", x => x.Id); }); + migrationBuilder.CreateTable( + name: "AspNetUsers", + columns: table => new + { + Id = table.Column(type: "text", nullable: false), + CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), + UserName = table.Column(type: "character varying(256)", maxLength: 256, nullable: true), + NormalizedUserName = table.Column(type: "character varying(256)", maxLength: 256, nullable: true), + Email = table.Column(type: "character varying(256)", maxLength: 256, nullable: true), + NormalizedEmail = table.Column(type: "character varying(256)", maxLength: 256, nullable: true), + EmailConfirmed = table.Column(type: "boolean", nullable: false), + PasswordHash = table.Column(type: "text", nullable: true), + SecurityStamp = table.Column(type: "text", nullable: true), + ConcurrencyStamp = table.Column(type: "text", nullable: true), + PhoneNumber = table.Column(type: "text", nullable: true), + PhoneNumberConfirmed = table.Column(type: "boolean", nullable: false), + TwoFactorEnabled = table.Column(type: "boolean", nullable: false), + LockoutEnd = table.Column(type: "timestamp with time zone", nullable: true), + LockoutEnabled = table.Column(type: "boolean", nullable: false), + AccessFailedCount = table.Column(type: "integer", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_AspNetUsers", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "AspNetRoleClaims", + columns: table => new + { + Id = table.Column(type: "integer", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + RoleId = table.Column(type: "text", nullable: false), + ClaimType = table.Column(type: "text", nullable: true), + ClaimValue = table.Column(type: "text", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_AspNetRoleClaims", x => x.Id); + table.ForeignKey( + name: "FK_AspNetRoleClaims_AspNetRoles_RoleId", + column: x => x.RoleId, + principalTable: "AspNetRoles", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + migrationBuilder.CreateTable( name: "AspNetUserClaims", columns: table => new @@ -119,47 +114,6 @@ namespace agologum_api.Migrations onDelete: ReferentialAction.Cascade); }); - migrationBuilder.CreateTable( - name: "AspNetUserTokens", - columns: table => new - { - UserId = table.Column(type: "text", nullable: false), - LoginProvider = table.Column(type: "text", nullable: false), - Name = table.Column(type: "text", nullable: false), - Value = table.Column(type: "text", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_AspNetUserTokens", x => new { x.UserId, x.LoginProvider, x.Name }); - table.ForeignKey( - name: "FK_AspNetUserTokens_AspNetUsers_UserId", - column: x => x.UserId, - principalTable: "AspNetUsers", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "AspNetRoleClaims", - columns: table => new - { - Id = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - RoleId = table.Column(type: "text", nullable: false), - ClaimType = table.Column(type: "text", nullable: true), - ClaimValue = table.Column(type: "text", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_AspNetRoleClaims", x => x.Id); - table.ForeignKey( - name: "FK_AspNetRoleClaims_AspNetRoles_RoleId", - column: x => x.RoleId, - principalTable: "AspNetRoles", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - migrationBuilder.CreateTable( name: "AspNetUserRoles", columns: table => new @@ -184,16 +138,25 @@ namespace agologum_api.Migrations onDelete: ReferentialAction.Cascade); }); - migrationBuilder.CreateIndex( - name: "EmailIndex", - table: "AspNetUsers", - column: "NormalizedEmail"); - - migrationBuilder.CreateIndex( - name: "UserNameIndex", - table: "AspNetUsers", - column: "NormalizedUserName", - unique: true); + migrationBuilder.CreateTable( + name: "AspNetUserTokens", + columns: table => new + { + UserId = table.Column(type: "text", nullable: false), + LoginProvider = table.Column(type: "text", nullable: false), + Name = table.Column(type: "text", nullable: false), + Value = table.Column(type: "text", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_AspNetUserTokens", x => new { x.UserId, x.LoginProvider, x.Name }); + table.ForeignKey( + name: "FK_AspNetUserTokens_AspNetUsers_UserId", + column: x => x.UserId, + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); migrationBuilder.CreateIndex( name: "IX_AspNetRoleClaims_RoleId", @@ -220,6 +183,17 @@ namespace agologum_api.Migrations name: "IX_AspNetUserRoles_RoleId", table: "AspNetUserRoles", column: "RoleId"); + + migrationBuilder.CreateIndex( + name: "EmailIndex", + table: "AspNetUsers", + column: "NormalizedEmail"); + + migrationBuilder.CreateIndex( + name: "UserNameIndex", + table: "AspNetUsers", + column: "NormalizedUserName", + unique: true); } /// @@ -243,66 +217,8 @@ namespace agologum_api.Migrations migrationBuilder.DropTable( name: "AspNetRoles"); - migrationBuilder.DropPrimaryKey( - name: "PK_AspNetUsers", - table: "AspNetUsers"); - - migrationBuilder.DropIndex( - name: "EmailIndex", - table: "AspNetUsers"); - - migrationBuilder.DropIndex( - name: "UserNameIndex", - table: "AspNetUsers"); - - migrationBuilder.RenameTable( - name: "AspNetUsers", - newName: "Users"); - - migrationBuilder.AlterColumn( - name: "UserName", - table: "Users", - type: "text", - nullable: true, - oldClrType: typeof(string), - oldType: "character varying(256)", - oldMaxLength: 256, - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "NormalizedUserName", - table: "Users", - type: "text", - nullable: true, - oldClrType: typeof(string), - oldType: "character varying(256)", - oldMaxLength: 256, - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "NormalizedEmail", - table: "Users", - type: "text", - nullable: true, - oldClrType: typeof(string), - oldType: "character varying(256)", - oldMaxLength: 256, - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Email", - table: "Users", - type: "text", - nullable: true, - oldClrType: typeof(string), - oldType: "character varying(256)", - oldMaxLength: 256, - oldNullable: true); - - migrationBuilder.AddPrimaryKey( - name: "PK_Users", - table: "Users", - column: "Id"); + migrationBuilder.DropTable( + name: "AspNetUsers"); } } } diff --git a/scripts/notes.txt b/scripts/notes.txt new file mode 100644 index 0000000..8ff218c --- /dev/null +++ b/scripts/notes.txt @@ -0,0 +1,8 @@ + +Resetting the database (for dev): +> set development evironment (specify non-docker network and db password) +> dotnet ef database drop +> dotnet ef migrations remove +> if above errors, dotnet ef database update 0 +> dotnet ef migrations add InitialCreate +