Initial COmmit

This commit is contained in:
Husky
2020-02-12 13:12:55 +01:00
commit 2f508df281
18 changed files with 638 additions and 0 deletions

View File

@@ -0,0 +1,124 @@
// <auto-generated />
using System;
using KanSan;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace KanSan.Migrations
{
[DbContext(typeof(KanSanContext))]
[Migration("20200212120350_InitialCreate")]
partial class InitialCreate
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "3.1.1");
modelBuilder.Entity("KanSan.Baustelle", b =>
{
b.Property<Guid>("BaustelleID")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT");
b.Property<Guid?>("KundenID")
.HasColumnType("TEXT");
b.Property<string>("Ort")
.HasColumnType("TEXT");
b.Property<string>("Strasse")
.HasColumnType("TEXT");
b.HasKey("BaustelleID");
b.HasIndex("KundenID");
b.ToTable("Baustellen");
});
modelBuilder.Entity("KanSan.Kunden", b =>
{
b.Property<Guid>("KundenID")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT");
b.Property<string>("Nachname")
.HasColumnType("TEXT");
b.Property<string>("Vorname")
.HasColumnType("TEXT");
b.HasKey("KundenID");
b.ToTable("Kunden");
});
modelBuilder.Entity("KanSan.LeistungsverzeichnisBaustelle", b =>
{
b.Property<int>("LeistungsverzeichnisBaustelleID")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<Guid?>("BaustelleID")
.HasColumnType("TEXT");
b.Property<Guid?>("LeistungsverzeichnissID")
.HasColumnType("TEXT");
b.HasKey("LeistungsverzeichnisBaustelleID");
b.HasIndex("BaustelleID");
b.HasIndex("LeistungsverzeichnissID");
b.ToTable("leistungsverzeichnisBaustelle");
});
modelBuilder.Entity("KanSan.Leistungsverzeichniss", b =>
{
b.Property<Guid>("LeistungsverzeichnissID")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT");
b.Property<string>("Position")
.HasColumnType("TEXT");
b.Property<string>("PositionBeschreibung")
.HasColumnType("TEXT");
b.Property<string>("PositionEinheit")
.HasColumnType("TEXT");
b.Property<decimal>("PositionEinheitspreis")
.HasColumnType("TEXT");
b.HasKey("LeistungsverzeichnissID");
b.ToTable("Leistungsverzeichnisses");
});
modelBuilder.Entity("KanSan.Baustelle", b =>
{
b.HasOne("KanSan.Kunden", null)
.WithMany("Baustellen")
.HasForeignKey("KundenID");
});
modelBuilder.Entity("KanSan.LeistungsverzeichnisBaustelle", b =>
{
b.HasOne("KanSan.Baustelle", "Baustelle")
.WithMany()
.HasForeignKey("BaustelleID");
b.HasOne("KanSan.Leistungsverzeichniss", "Leistungsverzeichniss")
.WithMany()
.HasForeignKey("LeistungsverzeichnissID");
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -0,0 +1,115 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
namespace KanSan.Migrations
{
public partial class InitialCreate : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Kunden",
columns: table => new
{
KundenID = table.Column<Guid>(nullable: false),
Vorname = table.Column<string>(nullable: true),
Nachname = table.Column<string>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Kunden", x => x.KundenID);
});
migrationBuilder.CreateTable(
name: "Leistungsverzeichnisses",
columns: table => new
{
LeistungsverzeichnissID = table.Column<Guid>(nullable: false),
Position = table.Column<string>(nullable: true),
PositionBeschreibung = table.Column<string>(nullable: true),
PositionEinheit = table.Column<string>(nullable: true),
PositionEinheitspreis = table.Column<decimal>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Leistungsverzeichnisses", x => x.LeistungsverzeichnissID);
});
migrationBuilder.CreateTable(
name: "Baustellen",
columns: table => new
{
BaustelleID = table.Column<Guid>(nullable: false),
Ort = table.Column<string>(nullable: true),
Strasse = table.Column<string>(nullable: true),
KundenID = table.Column<Guid>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Baustellen", x => x.BaustelleID);
table.ForeignKey(
name: "FK_Baustellen_Kunden_KundenID",
column: x => x.KundenID,
principalTable: "Kunden",
principalColumn: "KundenID",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateTable(
name: "leistungsverzeichnisBaustelle",
columns: table => new
{
LeistungsverzeichnisBaustelleID = table.Column<int>(nullable: false)
.Annotation("Sqlite:Autoincrement", true),
BaustelleID = table.Column<Guid>(nullable: true),
LeistungsverzeichnissID = table.Column<Guid>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_leistungsverzeichnisBaustelle", x => x.LeistungsverzeichnisBaustelleID);
table.ForeignKey(
name: "FK_leistungsverzeichnisBaustelle_Baustellen_BaustelleID",
column: x => x.BaustelleID,
principalTable: "Baustellen",
principalColumn: "BaustelleID",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_leistungsverzeichnisBaustelle_Leistungsverzeichnisses_LeistungsverzeichnissID",
column: x => x.LeistungsverzeichnissID,
principalTable: "Leistungsverzeichnisses",
principalColumn: "LeistungsverzeichnissID",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateIndex(
name: "IX_Baustellen_KundenID",
table: "Baustellen",
column: "KundenID");
migrationBuilder.CreateIndex(
name: "IX_leistungsverzeichnisBaustelle_BaustelleID",
table: "leistungsverzeichnisBaustelle",
column: "BaustelleID");
migrationBuilder.CreateIndex(
name: "IX_leistungsverzeichnisBaustelle_LeistungsverzeichnissID",
table: "leistungsverzeichnisBaustelle",
column: "LeistungsverzeichnissID");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "leistungsverzeichnisBaustelle");
migrationBuilder.DropTable(
name: "Baustellen");
migrationBuilder.DropTable(
name: "Leistungsverzeichnisses");
migrationBuilder.DropTable(
name: "Kunden");
}
}
}

View File

@@ -0,0 +1,122 @@
// <auto-generated />
using System;
using KanSan;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace KanSan.Migrations
{
[DbContext(typeof(KanSanContext))]
partial class KanSanContextModelSnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "3.1.1");
modelBuilder.Entity("KanSan.Baustelle", b =>
{
b.Property<Guid>("BaustelleID")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT");
b.Property<Guid?>("KundenID")
.HasColumnType("TEXT");
b.Property<string>("Ort")
.HasColumnType("TEXT");
b.Property<string>("Strasse")
.HasColumnType("TEXT");
b.HasKey("BaustelleID");
b.HasIndex("KundenID");
b.ToTable("Baustellen");
});
modelBuilder.Entity("KanSan.Kunden", b =>
{
b.Property<Guid>("KundenID")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT");
b.Property<string>("Nachname")
.HasColumnType("TEXT");
b.Property<string>("Vorname")
.HasColumnType("TEXT");
b.HasKey("KundenID");
b.ToTable("Kunden");
});
modelBuilder.Entity("KanSan.LeistungsverzeichnisBaustelle", b =>
{
b.Property<int>("LeistungsverzeichnisBaustelleID")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<Guid?>("BaustelleID")
.HasColumnType("TEXT");
b.Property<Guid?>("LeistungsverzeichnissID")
.HasColumnType("TEXT");
b.HasKey("LeistungsverzeichnisBaustelleID");
b.HasIndex("BaustelleID");
b.HasIndex("LeistungsverzeichnissID");
b.ToTable("leistungsverzeichnisBaustelle");
});
modelBuilder.Entity("KanSan.Leistungsverzeichniss", b =>
{
b.Property<Guid>("LeistungsverzeichnissID")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT");
b.Property<string>("Position")
.HasColumnType("TEXT");
b.Property<string>("PositionBeschreibung")
.HasColumnType("TEXT");
b.Property<string>("PositionEinheit")
.HasColumnType("TEXT");
b.Property<decimal>("PositionEinheitspreis")
.HasColumnType("TEXT");
b.HasKey("LeistungsverzeichnissID");
b.ToTable("Leistungsverzeichnisses");
});
modelBuilder.Entity("KanSan.Baustelle", b =>
{
b.HasOne("KanSan.Kunden", null)
.WithMany("Baustellen")
.HasForeignKey("KundenID");
});
modelBuilder.Entity("KanSan.LeistungsverzeichnisBaustelle", b =>
{
b.HasOne("KanSan.Baustelle", "Baustelle")
.WithMany()
.HasForeignKey("BaustelleID");
b.HasOne("KanSan.Leistungsverzeichniss", "Leistungsverzeichniss")
.WithMany()
.HasForeignKey("LeistungsverzeichnissID");
});
#pragma warning restore 612, 618
}
}
}