using Microsoft.EntityFrameworkCore.Migrations; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; #nullable disable namespace DatabaseImplement.Migrations { /// public partial class AddCategories : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.AlterColumn( name: "Category", table: "Products", type: "text", nullable: false, oldClrType: typeof(int), oldType: "integer"); migrationBuilder.CreateTable( name: "Categories", columns: table => new { Id = table.Column(type: "integer", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), Name = table.Column(type: "text", nullable: false) }, constraints: table => { table.PrimaryKey("PK_Categories", x => x.Id); }); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "Categories"); migrationBuilder.AlterColumn( name: "Category", table: "Products", type: "integer", nullable: false, oldClrType: typeof(string), oldType: "text"); } } }