123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130 |
- using Microsoft.EntityFrameworkCore.Migrations;
- #nullable disable
- namespace MTWorkHR.Infrastructure.Migrations
- {
- /// <inheritdoc />
- public partial class altrCompanyTbl : Migration
- {
- /// <inheritdoc />
- protected override void Up(MigrationBuilder migrationBuilder)
- {
-
- migrationBuilder.AlterColumn<string>(
- name: "PhoneNumber",
- table: "Companies",
- type: "nvarchar(max)",
- nullable: false,
- oldClrType: typeof(int),
- oldType: "int");
- migrationBuilder.AlterColumn<string>(
- name: "Email",
- table: "Companies",
- type: "nvarchar(max)",
- nullable: false,
- oldClrType: typeof(int),
- oldType: "int");
- migrationBuilder.AlterColumn<string>(
- name: "Address",
- table: "Companies",
- type: "nvarchar(max)",
- nullable: false,
- oldClrType: typeof(int),
- oldType: "int");
- migrationBuilder.AddColumn<long>(
- name: "CityId",
- table: "Companies",
- type: "bigint",
- nullable: true);
- migrationBuilder.AddColumn<long>(
- name: "CountryId",
- table: "Companies",
- type: "bigint",
- nullable: true);
- migrationBuilder.CreateIndex(
- name: "IX_Companies_CityId",
- table: "Companies",
- column: "CityId");
- migrationBuilder.CreateIndex(
- name: "IX_Companies_CountryId",
- table: "Companies",
- column: "CountryId");
- migrationBuilder.AddForeignKey(
- name: "FK_Companies_Cities_CityId",
- table: "Companies",
- column: "CityId",
- principalTable: "Cities",
- principalColumn: "Id");
- migrationBuilder.AddForeignKey(
- name: "FK_Companies_CountryLookups_CountryId",
- table: "Companies",
- column: "CountryId",
- principalTable: "CountryLookups",
- principalColumn: "Id");
- }
- /// <inheritdoc />
- protected override void Down(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.DropForeignKey(
- name: "FK_Companies_Cities_CityId",
- table: "Companies");
- migrationBuilder.DropForeignKey(
- name: "FK_Companies_CountryLookups_CountryId",
- table: "Companies");
- migrationBuilder.DropIndex(
- name: "IX_Companies_CityId",
- table: "Companies");
- migrationBuilder.DropIndex(
- name: "IX_Companies_CountryId",
- table: "Companies");
- migrationBuilder.DropColumn(
- name: "CityId",
- table: "Companies");
- migrationBuilder.DropColumn(
- name: "CountryId",
- table: "Companies");
- migrationBuilder.AlterColumn<int>(
- name: "PhoneNumber",
- table: "Companies",
- type: "int",
- nullable: false,
- oldClrType: typeof(string),
- oldType: "nvarchar(max)");
- migrationBuilder.AlterColumn<int>(
- name: "Email",
- table: "Companies",
- type: "int",
- nullable: false,
- oldClrType: typeof(string),
- oldType: "nvarchar(max)");
- migrationBuilder.AlterColumn<int>(
- name: "Address",
- table: "Companies",
- type: "int",
- nullable: false,
- oldClrType: typeof(string),
- oldType: "nvarchar(max)");
- }
- }
- }
|