Update to latest packages and show examples
This commit is contained in:
@@ -0,0 +1,87 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace GerstITS.Examples.Data.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class InitialCreate : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.EnsureSchema(
|
||||
name: "examples");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Customers",
|
||||
schema: "examples",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityAlwaysColumn),
|
||||
FirstName = table.Column<string>(type: "character varying(100)", maxLength: 100, nullable: false),
|
||||
LastName = table.Column<string>(type: "character varying(100)", maxLength: 100, nullable: false),
|
||||
EMail = table.Column<string>(type: "character varying(250)", maxLength: 250, nullable: false),
|
||||
IsActive = table.Column<bool>(type: "boolean", nullable: false),
|
||||
Deactivated = table.Column<DateTime>(type: "timestamp with time zone", nullable: true),
|
||||
DeactivatedBy = table.Column<string>(type: "character varying(100)", maxLength: 100, nullable: true),
|
||||
Created = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
||||
CreatedBy = table.Column<string>(type: "character varying(100)", maxLength: 100, nullable: true),
|
||||
Modified = table.Column<DateTime>(type: "timestamp with time zone", nullable: true),
|
||||
ModifiedBy = table.Column<string>(type: "character varying(100)", maxLength: 100, nullable: true),
|
||||
Version = table.Column<int>(type: "integer", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Customers", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "CustomerNotes",
|
||||
schema: "examples",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityAlwaysColumn),
|
||||
CustomerId = table.Column<int>(type: "integer", nullable: false),
|
||||
Text = table.Column<string>(type: "character varying(2000)", maxLength: 2000, nullable: false),
|
||||
Created = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
||||
CreatedBy = table.Column<string>(type: "character varying(100)", maxLength: 100, nullable: true),
|
||||
HistorySet = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: true),
|
||||
ValidFrom = table.Column<DateTime>(type: "timestamp with time zone", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_CustomerNotes", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_CustomerNotes_Customers_CustomerId",
|
||||
column: x => x.CustomerId,
|
||||
principalSchema: "examples",
|
||||
principalTable: "Customers",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_CustomerNotes_CustomerId",
|
||||
schema: "examples",
|
||||
table: "CustomerNotes",
|
||||
column: "CustomerId");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "CustomerNotes",
|
||||
schema: "examples");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Customers",
|
||||
schema: "examples");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user