using System; using Microsoft.EntityFrameworkCore.Migrations; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; #nullable disable namespace LibraryAPI.Migrations { public partial class AddUser : Migration { protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.AlterColumn( name: "Title", table: "Books", type: "character varying(128)", maxLength: 128, nullable: false, defaultValue: "", oldClrType: typeof(string), oldType: "text", oldNullable: true); migrationBuilder.AlterColumn( name: "ISBN", table: "Books", type: "text", nullable: false, defaultValue: "", oldClrType: typeof(string), oldType: "text", oldNullable: true); migrationBuilder.AlterColumn( name: "Genres", table: "Books", type: "text[]", nullable: false, defaultValue: new string[0], oldClrType: typeof(string[]), oldType: "text[]", oldNullable: true); migrationBuilder.AlterColumn( name: "languages", table: "Authors", type: "text[]", nullable: false, defaultValue: new string[0], oldClrType: typeof(string[]), oldType: "text[]", oldNullable: true); migrationBuilder.AlterColumn( name: "Name", table: "Authors", type: "character varying(64)", maxLength: 64, nullable: false, defaultValue: "", oldClrType: typeof(string), oldType: "text", oldNullable: true); migrationBuilder.AlterColumn( name: "Country", table: "Authors", type: "text", nullable: false, defaultValue: "", oldClrType: typeof(string), oldType: "text", oldNullable: true); migrationBuilder.CreateTable( name: "Users", columns: table => new { Id = table.Column(type: "bigint", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), Email = table.Column(type: "text", nullable: false), Password = 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"); migrationBuilder.AlterColumn( name: "Title", table: "Books", type: "text", nullable: true, oldClrType: typeof(string), oldType: "character varying(128)", oldMaxLength: 128); migrationBuilder.AlterColumn( name: "ISBN", table: "Books", type: "text", nullable: true, oldClrType: typeof(string), oldType: "text"); migrationBuilder.AlterColumn( name: "Genres", table: "Books", type: "text[]", nullable: true, oldClrType: typeof(string[]), oldType: "text[]"); migrationBuilder.AlterColumn( name: "languages", table: "Authors", type: "text[]", nullable: true, oldClrType: typeof(string[]), oldType: "text[]"); migrationBuilder.AlterColumn( name: "Name", table: "Authors", type: "text", nullable: true, oldClrType: typeof(string), oldType: "character varying(64)", oldMaxLength: 64); migrationBuilder.AlterColumn( name: "Country", table: "Authors", type: "text", nullable: true, oldClrType: typeof(string), oldType: "text"); } } }