using Microsoft.EntityFrameworkCore.Migrations; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; #nullable disable namespace Bit.PostgresMigrations.Migrations; /// public partial class GrantIdWithIndexes : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.DropPrimaryKey( name: "PK_Grant", table: "Grant"); migrationBuilder.AlterColumn( name: "Type", table: "Grant", type: "character varying(50)", maxLength: 50, nullable: false, defaultValue: "", oldClrType: typeof(string), oldType: "character varying(50)", oldMaxLength: 50, oldNullable: true); migrationBuilder.AlterColumn( name: "Data", table: "Grant", type: "text", nullable: false, defaultValue: "", oldClrType: typeof(string), oldType: "text", oldNullable: true); migrationBuilder.AlterColumn( name: "ClientId", table: "Grant", type: "character varying(200)", maxLength: 200, nullable: false, defaultValue: "", oldClrType: typeof(string), oldType: "character varying(200)", oldMaxLength: 200, oldNullable: true); migrationBuilder.AddColumn( name: "Id", table: "Grant", type: "integer", nullable: false, defaultValue: 0) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); migrationBuilder.AddPrimaryKey( name: "PK_Grant", table: "Grant", column: "Id"); migrationBuilder.CreateIndex( name: "IX_Grant_Key", table: "Grant", column: "Key", unique: true); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropPrimaryKey( name: "PK_Grant", table: "Grant"); migrationBuilder.DropIndex( name: "IX_Grant_Key", table: "Grant"); migrationBuilder.DropColumn( name: "Id", table: "Grant"); migrationBuilder.AlterColumn( name: "Type", table: "Grant", type: "character varying(50)", maxLength: 50, nullable: true, oldClrType: typeof(string), oldType: "character varying(50)", oldMaxLength: 50); migrationBuilder.AlterColumn( name: "Data", table: "Grant", type: "text", nullable: true, oldClrType: typeof(string), oldType: "text"); migrationBuilder.AlterColumn( name: "ClientId", table: "Grant", type: "character varying(200)", maxLength: 200, nullable: true, oldClrType: typeof(string), oldType: "character varying(200)", oldMaxLength: 200); migrationBuilder.AddPrimaryKey( name: "PK_Grant", table: "Grant", column: "Key"); } }