using System; using Microsoft.EntityFrameworkCore.Migrations; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; namespace UnivateProperties_API.Migrations { public partial class IsDeleted : Migration { protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.AddColumn( name: "IsDeleted", table: "Weeks", nullable: false, defaultValue: false); migrationBuilder.AddColumn( name: "IsDeleted", table: "Users", nullable: false, defaultValue: false); migrationBuilder.AddColumn( name: "IsDeleted", table: "UserDefinedGroups", nullable: false, defaultValue: false); migrationBuilder.AddColumn( name: "IsDeleted", table: "UserDefinedFields", nullable: false, defaultValue: false); migrationBuilder.AddColumn( name: "IsDeleted", table: "UnitConfigurationTypes", nullable: false, defaultValue: false); migrationBuilder.AddColumn( name: "IsDeleted", table: "UnitConfigurations", nullable: false, defaultValue: false); migrationBuilder.AddColumn( name: "IsDeleted", table: "Suburbs", nullable: false, defaultValue: false); migrationBuilder.AddColumn( name: "IsDeleted", table: "Status", nullable: false, defaultValue: false); migrationBuilder.AddColumn( name: "IsDeleted", table: "Seasons", nullable: false, defaultValue: false); migrationBuilder.AddColumn( name: "IsDeleted", table: "SearchLogs", nullable: false, defaultValue: false); migrationBuilder.AddColumn( name: "IsDeleted", table: "Provinces", nullable: false, defaultValue: false); migrationBuilder.AddColumn( name: "IsDeleted", table: "PropertyUserFields", nullable: false, defaultValue: false); migrationBuilder.AddColumn( name: "IsDeleted", table: "PropertyTypes", nullable: false, defaultValue: false); migrationBuilder.AddColumn( name: "IsDeleted", table: "PropertyImages", nullable: false, defaultValue: false); migrationBuilder.AddColumn( name: "IsDeleted", table: "Properties", nullable: false, defaultValue: false); migrationBuilder.AddColumn( name: "IsDeleted", table: "ProcessFlows", nullable: false, defaultValue: false); migrationBuilder.AddColumn( name: "IsDeleted", table: "Individuals", nullable: false, defaultValue: false); migrationBuilder.AddColumn( name: "IsDeleted", table: "Hosts", nullable: false, defaultValue: false); migrationBuilder.AddColumn( name: "IsDeleted", table: "Emails", nullable: false, defaultValue: false); migrationBuilder.AddColumn( name: "IsDeleted", table: "Cities", nullable: false, defaultValue: false); migrationBuilder.AddColumn( name: "IsDeleted", table: "BidItems", nullable: false, defaultValue: false); migrationBuilder.AddColumn( name: "IsDeleted", table: "Banks", nullable: false, defaultValue: false); migrationBuilder.AddColumn( name: "IsDeleted", table: "BankAccounts", nullable: false, defaultValue: false); migrationBuilder.AddColumn( name: "IsDeleted", table: "Agents", nullable: false, defaultValue: false); migrationBuilder.AddColumn( name: "IsDeleted", table: "Agencies", nullable: false, defaultValue: false); migrationBuilder.AddColumn( name: "IsDeleted", table: "Addresses", nullable: false, defaultValue: false); migrationBuilder.AddColumn( name: "IsDeleted", table: "Accounts", nullable: false, defaultValue: false); migrationBuilder.CreateTable( name: "Person", columns: table => new { Id = table.Column(nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn), Created = table.Column(nullable: false), Modified = table.Column(nullable: false), ModifiedBy = table.Column(nullable: true), IsDeleted = table.Column(nullable: false), UserId = table.Column(nullable: true), Name = table.Column(nullable: true), Surname = table.Column(nullable: true), Email = table.Column(nullable: true), Telephone = table.Column(nullable: true), CellNumber = table.Column(nullable: true) }, constraints: table => { table.PrimaryKey("PK_Person", x => x.Id); table.ForeignKey( name: "FK_Person_Users_UserId", column: x => x.UserId, principalTable: "Users", principalColumn: "Id", onDelete: ReferentialAction.Restrict); }); migrationBuilder.CreateIndex( name: "IX_Person_UserId", table: "Person", column: "UserId"); } protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "Person"); migrationBuilder.DropColumn( name: "IsDeleted", table: "Weeks"); migrationBuilder.DropColumn( name: "IsDeleted", table: "Users"); migrationBuilder.DropColumn( name: "IsDeleted", table: "UserDefinedGroups"); migrationBuilder.DropColumn( name: "IsDeleted", table: "UserDefinedFields"); migrationBuilder.DropColumn( name: "IsDeleted", table: "UnitConfigurationTypes"); migrationBuilder.DropColumn( name: "IsDeleted", table: "UnitConfigurations"); migrationBuilder.DropColumn( name: "IsDeleted", table: "Suburbs"); migrationBuilder.DropColumn( name: "IsDeleted", table: "Status"); migrationBuilder.DropColumn( name: "IsDeleted", table: "Seasons"); migrationBuilder.DropColumn( name: "IsDeleted", table: "SearchLogs"); migrationBuilder.DropColumn( name: "IsDeleted", table: "Provinces"); migrationBuilder.DropColumn( name: "IsDeleted", table: "PropertyUserFields"); migrationBuilder.DropColumn( name: "IsDeleted", table: "PropertyTypes"); migrationBuilder.DropColumn( name: "IsDeleted", table: "PropertyImages"); migrationBuilder.DropColumn( name: "IsDeleted", table: "Properties"); migrationBuilder.DropColumn( name: "IsDeleted", table: "ProcessFlows"); migrationBuilder.DropColumn( name: "IsDeleted", table: "Individuals"); migrationBuilder.DropColumn( name: "IsDeleted", table: "Hosts"); migrationBuilder.DropColumn( name: "IsDeleted", table: "Emails"); migrationBuilder.DropColumn( name: "IsDeleted", table: "Cities"); migrationBuilder.DropColumn( name: "IsDeleted", table: "BidItems"); migrationBuilder.DropColumn( name: "IsDeleted", table: "Banks"); migrationBuilder.DropColumn( name: "IsDeleted", table: "BankAccounts"); migrationBuilder.DropColumn( name: "IsDeleted", table: "Agents"); migrationBuilder.DropColumn( name: "IsDeleted", table: "Agencies"); migrationBuilder.DropColumn( name: "IsDeleted", table: "Addresses"); migrationBuilder.DropColumn( name: "IsDeleted", table: "Accounts"); } } }