| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- using Microsoft.EntityFrameworkCore.Metadata;
- using Microsoft.EntityFrameworkCore.Migrations;
- namespace GreenTree.Strohrmann.ERP.Domain.Migrations
- {
- public partial class Titles : Migration
- {
- protected override void Up(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.AddColumn<int>(
- name: "TitleId",
- table: "Customers",
- nullable: false,
- defaultValue: 1);
- migrationBuilder.CreateTable(
- name: "Titles",
- columns: table => new
- {
- Id = table.Column<int>(nullable: false)
- .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
- Name = table.Column<string>(nullable: false)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_Titles", x => x.Id);
- });
- migrationBuilder.InsertData(
- table: "Titles",
- columns: new[] { "Id", "Name" },
- values: new object[,]
- {
- { 1, "Keiner" },
- { 2, "Herr" },
- { 3, "Frau" },
- { 4, "Firma" },
- { 5, "Familie" },
- { 6, "Eheleute" },
- { 7, "Herr und Frau" },
- { 8, "Prof." },
- { 9, "Dr." },
- { 10, "Dr. med." },
- { 11, "Prof. Dr." },
- { 12, "Prof. Dr. med." }
- });
- migrationBuilder.CreateIndex(
- name: "IX_Customers_TitleId",
- table: "Customers",
- column: "TitleId");
- migrationBuilder.AddForeignKey(
- name: "FK_Customers_Titles_TitleId",
- table: "Customers",
- column: "TitleId",
- principalTable: "Titles",
- principalColumn: "Id",
- onDelete: ReferentialAction.Restrict);
- }
- protected override void Down(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.DropForeignKey(
- name: "FK_Customers_Titles_TitleId",
- table: "Customers");
- migrationBuilder.DropTable(
- name: "Titles");
- migrationBuilder.DropIndex(
- name: "IX_Customers_TitleId",
- table: "Customers");
- migrationBuilder.DropColumn(
- name: "TitleId",
- table: "Customers");
- }
- }
- }
|