Untitled
unknown
plain_text
2 years ago
6.7 kB
8
Indexable
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace EduPortal.Persistence.Migrations
{
/// <inheritdoc />
public partial class addAddressData : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Invoices_Subscribers_SubscriberId",
table: "Invoices");
migrationBuilder.AlterColumn<int>(
name: "SubscriberId",
table: "Invoices",
type: "int",
nullable: false,
defaultValue: 0,
oldClrType: typeof(int),
oldType: "int",
oldNullable: true);
migrationBuilder.CreateTable(
name: "Ad_Diskapi",
columns: table => new
{
disKapiKimlikNo = table.Column<long>(type: "bigint", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
adi = table.Column<string>(type: "nvarchar(max)", nullable: true),
sokakKimlikNo = table.Column<long>(type: "bigint", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Ad_Diskapi", x => x.disKapiKimlikNo);
});
migrationBuilder.CreateTable(
name: "Ad_IcKapi",
columns: table => new
{
icKapiKimlikNo = table.Column<long>(type: "bigint", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
adresNo = table.Column<string>(type: "nvarchar(max)", nullable: false),
disKapiKimlikNo = table.Column<long>(type: "bigint", nullable: false),
sokakKimlikNo = table.Column<long>(type: "bigint", nullable: false),
mahalleKimlikNo = table.Column<int>(type: "int", nullable: false),
ilceKimlikNo = table.Column<int>(type: "int", nullable: false),
katNo = table.Column<int>(type: "int", nullable: false),
icKapiNo = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Ad_IcKapi", x => x.icKapiKimlikNo);
});
migrationBuilder.CreateTable(
name: "Ad_Ilceler",
columns: table => new
{
ilceKimlikNo = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
adi = table.Column<string>(type: "nvarchar(max)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Ad_Ilceler", x => x.ilceKimlikNo);
});
migrationBuilder.CreateTable(
name: "Ad_Mahalleler",
columns: table => new
{
mahalleKimlikNo = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
adi = table.Column<string>(type: "nvarchar(max)", nullable: false),
ilceKimlikNo = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Ad_Mahalleler", x => x.mahalleKimlikNo);
});
migrationBuilder.CreateTable(
name: "Ad_Sayac",
columns: table => new
{
counterNumber = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
icKapiKimlikNo = table.Column<long>(type: "bigint", nullable: false),
active = table.Column<bool>(type: "bit", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Ad_Sayac", x => x.counterNumber);
});
migrationBuilder.CreateTable(
name: "Ad_Sokaklar",
columns: table => new
{
sokakKimlikNo = table.Column<long>(type: "bigint", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
adi = table.Column<string>(type: "nvarchar(max)", nullable: false),
mahalleKimlikNo = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Ad_Sokaklar", x => x.sokakKimlikNo);
});
migrationBuilder.AddForeignKey(
name: "FK_Invoices_Subscribers_SubscriberId",
table: "Invoices",
column: "SubscriberId",
principalTable: "Subscribers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Invoices_Subscribers_SubscriberId",
table: "Invoices");
migrationBuilder.DropTable(
name: "Ad_Diskapi");
migrationBuilder.DropTable(
name: "Ad_IcKapi");
migrationBuilder.DropTable(
name: "Ad_Ilceler");
migrationBuilder.DropTable(
name: "Ad_Mahalleler");
migrationBuilder.DropTable(
name: "Ad_Sayac");
migrationBuilder.DropTable(
name: "Ad_Sokaklar");
migrationBuilder.AlterColumn<int>(
name: "SubscriberId",
table: "Invoices",
type: "int",
nullable: true,
oldClrType: typeof(int),
oldType: "int");
migrationBuilder.AddForeignKey(
name: "FK_Invoices_Subscribers_SubscriberId",
table: "Invoices",
column: "SubscriberId",
principalTable: "Subscribers",
principalColumn: "Id");
}
}
}
Editor is loading...
Leave a Comment