remove cities for now
This commit is contained in:
parent
a18d10f508
commit
8bd61cd7ee
385
Migrations/20221115170737_Initial.Designer.cs
generated
Normal file
385
Migrations/20221115170737_Initial.Designer.cs
generated
Normal file
|
@ -0,0 +1,385 @@
|
|||
// <auto-generated />
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using NetTopologySuite.Geometries;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
using labdb.Models;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace labdb.Migrations
|
||||
{
|
||||
[DbContext(typeof(AppDbContext))]
|
||||
[Migration("20221115170737_Initial")]
|
||||
partial class Initial
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "7.0.0")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.HasPostgresExtension(modelBuilder, "postgis");
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("labdb.Models.Country", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("id");
|
||||
|
||||
b.Property<string>("Code")
|
||||
.IsRequired()
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("code");
|
||||
|
||||
b.Property<string>("EnglishName")
|
||||
.IsRequired()
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("english_name");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("name");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_country");
|
||||
|
||||
b.HasIndex(new[] { "Name" }, "name")
|
||||
.IsUnique()
|
||||
.HasDatabaseName("ix_country_name");
|
||||
|
||||
b.HasIndex(new[] { "Name" }, "name_trgm")
|
||||
.HasDatabaseName("ix_country_name1");
|
||||
|
||||
NpgsqlIndexBuilderExtensions.HasMethod(b.HasIndex(new[] { "Name" }, "name_trgm"), "gin");
|
||||
NpgsqlIndexBuilderExtensions.HasOperators(b.HasIndex(new[] { "Name" }, "name_trgm"), new[] { "gin_trgm_ops" });
|
||||
|
||||
b.ToTable("country", (string)null);
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = new Guid("50de594a-9828-4c50-8ec0-3803cc359dc0"),
|
||||
Code = "DE",
|
||||
EnglishName = "Germany",
|
||||
Name = "Deutschland"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("b7fb8044-148f-41e6-aedc-2d982cacc4fe"),
|
||||
Code = "TEST",
|
||||
EnglishName = "TEST COUNTRY",
|
||||
Name = "TEST"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("labdb.Models.Lab", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("id");
|
||||
|
||||
b.Property<string>("AddressCity")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("address_city");
|
||||
|
||||
b.Property<string>("AddressLine1")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("address_line1");
|
||||
|
||||
b.Property<string>("AddressLine2")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("address_line2");
|
||||
|
||||
b.Property<string>("AddressPostcode")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("address_postcode");
|
||||
|
||||
b.Property<decimal>("BasicFee")
|
||||
.HasColumnType("numeric")
|
||||
.HasColumnName("basic_fee");
|
||||
|
||||
b.Property<Guid>("CountryId")
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("country_id");
|
||||
|
||||
b.Property<decimal>("DrawFee")
|
||||
.HasColumnType("numeric")
|
||||
.HasColumnName("draw_fee");
|
||||
|
||||
b.Property<string>("Email")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("email");
|
||||
|
||||
b.Property<Point>("Location")
|
||||
.HasColumnType("geometry")
|
||||
.HasColumnName("location");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("name");
|
||||
|
||||
b.Property<string>("Notes")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("notes");
|
||||
|
||||
b.Property<string>("Phone")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("phone");
|
||||
|
||||
b.Property<bool>("RequiresAppointment")
|
||||
.HasColumnType("boolean")
|
||||
.HasColumnName("requires_appointment");
|
||||
|
||||
b.Property<bool>("SelfDraw")
|
||||
.HasColumnType("boolean")
|
||||
.HasColumnName("self_draw");
|
||||
|
||||
b.Property<string>("Website")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("website");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_lab");
|
||||
|
||||
b.HasIndex("AddressPostcode")
|
||||
.HasDatabaseName("ix_lab_address_postcode");
|
||||
|
||||
b.HasIndex("BasicFee")
|
||||
.HasDatabaseName("ix_lab_basic_fee");
|
||||
|
||||
b.HasIndex("CountryId")
|
||||
.HasDatabaseName("ix_lab_country_id");
|
||||
|
||||
b.HasIndex("DrawFee")
|
||||
.HasDatabaseName("ix_lab_draw_fee");
|
||||
|
||||
b.HasIndex("RequiresAppointment")
|
||||
.HasDatabaseName("ix_lab_requires_appointment");
|
||||
|
||||
b.HasIndex("SelfDraw")
|
||||
.HasDatabaseName("ix_lab_self_draw");
|
||||
|
||||
b.HasIndex(new[] { "Name" }, "name")
|
||||
.HasDatabaseName("ix_lab_name");
|
||||
|
||||
b.HasIndex(new[] { "Name" }, "name_trgm")
|
||||
.HasDatabaseName("ix_lab_name");
|
||||
|
||||
NpgsqlIndexBuilderExtensions.HasMethod(b.HasIndex(new[] { "Name" }, "name_trgm"), "gin");
|
||||
NpgsqlIndexBuilderExtensions.HasOperators(b.HasIndex(new[] { "Name" }, "name_trgm"), new[] { "gin_trgm_ops" });
|
||||
|
||||
b.ToTable("lab", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("labdb.Models.Test", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("id");
|
||||
|
||||
b.Property<string>("Abbreviation")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("abbreviation");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("description");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("name");
|
||||
|
||||
b.Property<string>("PubchemLink")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("pubchem_link");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_test");
|
||||
|
||||
b.HasIndex(new[] { "Abbreviation" }, "abbreviation")
|
||||
.IsUnique()
|
||||
.HasDatabaseName("ix_test_abbreviation");
|
||||
|
||||
b.HasIndex(new[] { "Abbreviation" }, "abbreviation_trgm")
|
||||
.HasDatabaseName("ix_test_abbreviation1");
|
||||
|
||||
NpgsqlIndexBuilderExtensions.HasMethod(b.HasIndex(new[] { "Abbreviation" }, "abbreviation_trgm"), "gin");
|
||||
NpgsqlIndexBuilderExtensions.HasOperators(b.HasIndex(new[] { "Abbreviation" }, "abbreviation_trgm"), new[] { "gin_trgm_ops" });
|
||||
|
||||
b.HasIndex(new[] { "Name" }, "name")
|
||||
.IsUnique()
|
||||
.HasDatabaseName("ix_test_name");
|
||||
|
||||
b.HasIndex(new[] { "Name" }, "name_trgm")
|
||||
.HasDatabaseName("ix_test_name1");
|
||||
|
||||
NpgsqlIndexBuilderExtensions.HasMethod(b.HasIndex(new[] { "Name" }, "name_trgm"), "gin");
|
||||
NpgsqlIndexBuilderExtensions.HasOperators(b.HasIndex(new[] { "Name" }, "name_trgm"), new[] { "gin_trgm_ops" });
|
||||
|
||||
b.ToTable("test", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("labdb.Models.TestOffer", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("id");
|
||||
|
||||
b.Property<decimal>("BloodVolume")
|
||||
.HasColumnType("numeric")
|
||||
.HasColumnName("blood_volume");
|
||||
|
||||
b.Property<Guid>("LabId")
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("lab_id");
|
||||
|
||||
b.Property<string>("Notes")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("notes");
|
||||
|
||||
b.Property<decimal>("Price")
|
||||
.HasColumnType("numeric")
|
||||
.HasColumnName("price");
|
||||
|
||||
b.Property<string>("ServiceDirectoryLink")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("service_directory_link");
|
||||
|
||||
b.Property<Guid>("TestId")
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("test_id");
|
||||
|
||||
b.Property<string>("TestMethod")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("test_method");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_test_offer");
|
||||
|
||||
b.HasIndex("BloodVolume")
|
||||
.HasDatabaseName("ix_test_offer_blood_volume");
|
||||
|
||||
b.HasIndex("LabId")
|
||||
.HasDatabaseName("ix_test_offer_lab_id");
|
||||
|
||||
b.HasIndex("Price")
|
||||
.HasDatabaseName("ix_test_offer_price");
|
||||
|
||||
b.HasIndex("TestId")
|
||||
.HasDatabaseName("ix_test_offer_test_id");
|
||||
|
||||
b.HasIndex("TestMethod")
|
||||
.HasDatabaseName("ix_test_offer_test_method");
|
||||
|
||||
b.ToTable("test_offer", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("labdb.Models.TestSynonym", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("id");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("name");
|
||||
|
||||
b.Property<Guid>("TestId")
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("test_id");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_test_synonym");
|
||||
|
||||
b.HasIndex("TestId")
|
||||
.HasDatabaseName("ix_test_synonym_test_id");
|
||||
|
||||
b.HasIndex(new[] { "Name" }, "name")
|
||||
.IsUnique()
|
||||
.HasDatabaseName("ix_test_synonym_name");
|
||||
|
||||
b.HasIndex(new[] { "Name" }, "name_trgm")
|
||||
.HasDatabaseName("ix_test_synonym_name1");
|
||||
|
||||
NpgsqlIndexBuilderExtensions.HasMethod(b.HasIndex(new[] { "Name" }, "name_trgm"), "gin");
|
||||
NpgsqlIndexBuilderExtensions.HasOperators(b.HasIndex(new[] { "Name" }, "name_trgm"), new[] { "gin_trgm_ops" });
|
||||
|
||||
b.ToTable("test_synonym", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("labdb.Models.Lab", b =>
|
||||
{
|
||||
b.HasOne("labdb.Models.Country", "Country")
|
||||
.WithMany("Labs")
|
||||
.HasForeignKey("CountryId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired()
|
||||
.HasConstraintName("fk_lab_country_country_temp_id");
|
||||
|
||||
b.Navigation("Country");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("labdb.Models.TestOffer", b =>
|
||||
{
|
||||
b.HasOne("labdb.Models.Lab", "Lab")
|
||||
.WithMany("TestOffers")
|
||||
.HasForeignKey("LabId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired()
|
||||
.HasConstraintName("fk_test_offer_lab_lab_temp_id");
|
||||
|
||||
b.HasOne("labdb.Models.Test", "Test")
|
||||
.WithMany("TestOffers")
|
||||
.HasForeignKey("TestId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired()
|
||||
.HasConstraintName("fk_test_offer_test_test_temp_id");
|
||||
|
||||
b.Navigation("Lab");
|
||||
|
||||
b.Navigation("Test");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("labdb.Models.TestSynonym", b =>
|
||||
{
|
||||
b.HasOne("labdb.Models.Test", "Test")
|
||||
.WithMany("Synonyms")
|
||||
.HasForeignKey("TestId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired()
|
||||
.HasConstraintName("fk_test_synonym_test_test_temp_id1");
|
||||
|
||||
b.Navigation("Test");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("labdb.Models.Country", b =>
|
||||
{
|
||||
b.Navigation("Labs");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("labdb.Models.Lab", b =>
|
||||
{
|
||||
b.Navigation("TestOffers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("labdb.Models.Test", b =>
|
||||
{
|
||||
b.Navigation("Synonyms");
|
||||
|
||||
b.Navigation("TestOffers");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
276
Migrations/20221115170737_Initial.cs
Normal file
276
Migrations/20221115170737_Initial.cs
Normal file
|
@ -0,0 +1,276 @@
|
|||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using NetTopologySuite.Geometries;
|
||||
|
||||
#nullable disable
|
||||
|
||||
#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional
|
||||
|
||||
namespace labdb.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class Initial : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AlterDatabase()
|
||||
.Annotation("Npgsql:PostgresExtension:postgis", ",,");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "country",
|
||||
columns: table => new
|
||||
{
|
||||
id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
name = table.Column<string>(type: "text", nullable: false),
|
||||
englishname = table.Column<string>(name: "english_name", type: "text", nullable: false),
|
||||
code = table.Column<string>(type: "text", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("pk_country", x => x.id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "test",
|
||||
columns: table => new
|
||||
{
|
||||
id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
name = table.Column<string>(type: "text", nullable: false),
|
||||
abbreviation = table.Column<string>(type: "text", nullable: true),
|
||||
description = table.Column<string>(type: "text", nullable: true),
|
||||
pubchemlink = table.Column<string>(name: "pubchem_link", type: "text", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("pk_test", x => x.id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "lab",
|
||||
columns: table => new
|
||||
{
|
||||
id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
name = table.Column<string>(type: "text", nullable: false),
|
||||
website = table.Column<string>(type: "text", nullable: true),
|
||||
phone = table.Column<string>(type: "text", nullable: true),
|
||||
email = table.Column<string>(type: "text", nullable: true),
|
||||
addressline1 = table.Column<string>(name: "address_line1", type: "text", nullable: true),
|
||||
addressline2 = table.Column<string>(name: "address_line2", type: "text", nullable: true),
|
||||
addresspostcode = table.Column<string>(name: "address_postcode", type: "text", nullable: true),
|
||||
addresscity = table.Column<string>(name: "address_city", type: "text", nullable: true),
|
||||
countryid = table.Column<Guid>(name: "country_id", type: "uuid", nullable: false),
|
||||
location = table.Column<Point>(type: "geometry", nullable: true),
|
||||
requiresappointment = table.Column<bool>(name: "requires_appointment", type: "boolean", nullable: false),
|
||||
selfdraw = table.Column<bool>(name: "self_draw", type: "boolean", nullable: false),
|
||||
basicfee = table.Column<decimal>(name: "basic_fee", type: "numeric", nullable: false),
|
||||
drawfee = table.Column<decimal>(name: "draw_fee", type: "numeric", nullable: false),
|
||||
notes = table.Column<string>(type: "text", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("pk_lab", x => x.id);
|
||||
table.ForeignKey(
|
||||
name: "fk_lab_country_country_temp_id",
|
||||
column: x => x.countryid,
|
||||
principalTable: "country",
|
||||
principalColumn: "id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "test_synonym",
|
||||
columns: table => new
|
||||
{
|
||||
id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
testid = table.Column<Guid>(name: "test_id", type: "uuid", nullable: false),
|
||||
name = table.Column<string>(type: "text", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("pk_test_synonym", x => x.id);
|
||||
table.ForeignKey(
|
||||
name: "fk_test_synonym_test_test_temp_id1",
|
||||
column: x => x.testid,
|
||||
principalTable: "test",
|
||||
principalColumn: "id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "test_offer",
|
||||
columns: table => new
|
||||
{
|
||||
id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
labid = table.Column<Guid>(name: "lab_id", type: "uuid", nullable: false),
|
||||
testid = table.Column<Guid>(name: "test_id", type: "uuid", nullable: false),
|
||||
price = table.Column<decimal>(type: "numeric", nullable: false),
|
||||
servicedirectorylink = table.Column<string>(name: "service_directory_link", type: "text", nullable: true),
|
||||
bloodvolume = table.Column<decimal>(name: "blood_volume", type: "numeric", nullable: false),
|
||||
testmethod = table.Column<string>(name: "test_method", type: "text", nullable: true),
|
||||
notes = table.Column<string>(type: "text", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("pk_test_offer", x => x.id);
|
||||
table.ForeignKey(
|
||||
name: "fk_test_offer_lab_lab_temp_id",
|
||||
column: x => x.labid,
|
||||
principalTable: "lab",
|
||||
principalColumn: "id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "fk_test_offer_test_test_temp_id",
|
||||
column: x => x.testid,
|
||||
principalTable: "test",
|
||||
principalColumn: "id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
table: "country",
|
||||
columns: new[] { "id", "code", "english_name", "name" },
|
||||
values: new object[,]
|
||||
{
|
||||
{ new Guid("50de594a-9828-4c50-8ec0-3803cc359dc0"), "DE", "Germany", "Deutschland" },
|
||||
{ new Guid("b7fb8044-148f-41e6-aedc-2d982cacc4fe"), "TEST", "TEST COUNTRY", "TEST" }
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_country_name",
|
||||
table: "country",
|
||||
column: "name",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_country_name1",
|
||||
table: "country",
|
||||
column: "name")
|
||||
.Annotation("Npgsql:IndexMethod", "gin")
|
||||
.Annotation("Npgsql:IndexOperators", new[] { "gin_trgm_ops" });
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_lab_address_postcode",
|
||||
table: "lab",
|
||||
column: "address_postcode");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_lab_basic_fee",
|
||||
table: "lab",
|
||||
column: "basic_fee");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_lab_country_id",
|
||||
table: "lab",
|
||||
column: "country_id");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_lab_draw_fee",
|
||||
table: "lab",
|
||||
column: "draw_fee");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_lab_name",
|
||||
table: "lab",
|
||||
column: "name");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_lab_requires_appointment",
|
||||
table: "lab",
|
||||
column: "requires_appointment");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_lab_self_draw",
|
||||
table: "lab",
|
||||
column: "self_draw");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_test_abbreviation",
|
||||
table: "test",
|
||||
column: "abbreviation",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_test_abbreviation1",
|
||||
table: "test",
|
||||
column: "abbreviation")
|
||||
.Annotation("Npgsql:IndexMethod", "gin")
|
||||
.Annotation("Npgsql:IndexOperators", new[] { "gin_trgm_ops" });
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_test_name",
|
||||
table: "test",
|
||||
column: "name",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_test_name1",
|
||||
table: "test",
|
||||
column: "name")
|
||||
.Annotation("Npgsql:IndexMethod", "gin")
|
||||
.Annotation("Npgsql:IndexOperators", new[] { "gin_trgm_ops" });
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_test_offer_blood_volume",
|
||||
table: "test_offer",
|
||||
column: "blood_volume");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_test_offer_lab_id",
|
||||
table: "test_offer",
|
||||
column: "lab_id");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_test_offer_price",
|
||||
table: "test_offer",
|
||||
column: "price");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_test_offer_test_id",
|
||||
table: "test_offer",
|
||||
column: "test_id");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_test_offer_test_method",
|
||||
table: "test_offer",
|
||||
column: "test_method");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_test_synonym_name",
|
||||
table: "test_synonym",
|
||||
column: "name",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_test_synonym_name1",
|
||||
table: "test_synonym",
|
||||
column: "name")
|
||||
.Annotation("Npgsql:IndexMethod", "gin")
|
||||
.Annotation("Npgsql:IndexOperators", new[] { "gin_trgm_ops" });
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_test_synonym_test_id",
|
||||
table: "test_synonym",
|
||||
column: "test_id");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "test_offer");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "test_synonym");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "lab");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "test");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "country");
|
||||
}
|
||||
}
|
||||
}
|
382
Migrations/AppDbContextModelSnapshot.cs
Normal file
382
Migrations/AppDbContextModelSnapshot.cs
Normal file
|
@ -0,0 +1,382 @@
|
|||
// <auto-generated />
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using NetTopologySuite.Geometries;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
using labdb.Models;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace labdb.Migrations
|
||||
{
|
||||
[DbContext(typeof(AppDbContext))]
|
||||
partial class AppDbContextModelSnapshot : ModelSnapshot
|
||||
{
|
||||
protected override void BuildModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "7.0.0")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.HasPostgresExtension(modelBuilder, "postgis");
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("labdb.Models.Country", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("id");
|
||||
|
||||
b.Property<string>("Code")
|
||||
.IsRequired()
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("code");
|
||||
|
||||
b.Property<string>("EnglishName")
|
||||
.IsRequired()
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("english_name");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("name");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_country");
|
||||
|
||||
b.HasIndex(new[] { "Name" }, "name")
|
||||
.IsUnique()
|
||||
.HasDatabaseName("ix_country_name");
|
||||
|
||||
b.HasIndex(new[] { "Name" }, "name_trgm")
|
||||
.HasDatabaseName("ix_country_name1");
|
||||
|
||||
NpgsqlIndexBuilderExtensions.HasMethod(b.HasIndex(new[] { "Name" }, "name_trgm"), "gin");
|
||||
NpgsqlIndexBuilderExtensions.HasOperators(b.HasIndex(new[] { "Name" }, "name_trgm"), new[] { "gin_trgm_ops" });
|
||||
|
||||
b.ToTable("country", (string)null);
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = new Guid("50de594a-9828-4c50-8ec0-3803cc359dc0"),
|
||||
Code = "DE",
|
||||
EnglishName = "Germany",
|
||||
Name = "Deutschland"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("b7fb8044-148f-41e6-aedc-2d982cacc4fe"),
|
||||
Code = "TEST",
|
||||
EnglishName = "TEST COUNTRY",
|
||||
Name = "TEST"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("labdb.Models.Lab", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("id");
|
||||
|
||||
b.Property<string>("AddressCity")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("address_city");
|
||||
|
||||
b.Property<string>("AddressLine1")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("address_line1");
|
||||
|
||||
b.Property<string>("AddressLine2")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("address_line2");
|
||||
|
||||
b.Property<string>("AddressPostcode")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("address_postcode");
|
||||
|
||||
b.Property<decimal>("BasicFee")
|
||||
.HasColumnType("numeric")
|
||||
.HasColumnName("basic_fee");
|
||||
|
||||
b.Property<Guid>("CountryId")
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("country_id");
|
||||
|
||||
b.Property<decimal>("DrawFee")
|
||||
.HasColumnType("numeric")
|
||||
.HasColumnName("draw_fee");
|
||||
|
||||
b.Property<string>("Email")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("email");
|
||||
|
||||
b.Property<Point>("Location")
|
||||
.HasColumnType("geometry")
|
||||
.HasColumnName("location");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("name");
|
||||
|
||||
b.Property<string>("Notes")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("notes");
|
||||
|
||||
b.Property<string>("Phone")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("phone");
|
||||
|
||||
b.Property<bool>("RequiresAppointment")
|
||||
.HasColumnType("boolean")
|
||||
.HasColumnName("requires_appointment");
|
||||
|
||||
b.Property<bool>("SelfDraw")
|
||||
.HasColumnType("boolean")
|
||||
.HasColumnName("self_draw");
|
||||
|
||||
b.Property<string>("Website")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("website");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_lab");
|
||||
|
||||
b.HasIndex("AddressPostcode")
|
||||
.HasDatabaseName("ix_lab_address_postcode");
|
||||
|
||||
b.HasIndex("BasicFee")
|
||||
.HasDatabaseName("ix_lab_basic_fee");
|
||||
|
||||
b.HasIndex("CountryId")
|
||||
.HasDatabaseName("ix_lab_country_id");
|
||||
|
||||
b.HasIndex("DrawFee")
|
||||
.HasDatabaseName("ix_lab_draw_fee");
|
||||
|
||||
b.HasIndex("RequiresAppointment")
|
||||
.HasDatabaseName("ix_lab_requires_appointment");
|
||||
|
||||
b.HasIndex("SelfDraw")
|
||||
.HasDatabaseName("ix_lab_self_draw");
|
||||
|
||||
b.HasIndex(new[] { "Name" }, "name")
|
||||
.HasDatabaseName("ix_lab_name");
|
||||
|
||||
b.HasIndex(new[] { "Name" }, "name_trgm")
|
||||
.HasDatabaseName("ix_lab_name");
|
||||
|
||||
NpgsqlIndexBuilderExtensions.HasMethod(b.HasIndex(new[] { "Name" }, "name_trgm"), "gin");
|
||||
NpgsqlIndexBuilderExtensions.HasOperators(b.HasIndex(new[] { "Name" }, "name_trgm"), new[] { "gin_trgm_ops" });
|
||||
|
||||
b.ToTable("lab", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("labdb.Models.Test", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("id");
|
||||
|
||||
b.Property<string>("Abbreviation")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("abbreviation");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("description");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("name");
|
||||
|
||||
b.Property<string>("PubchemLink")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("pubchem_link");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_test");
|
||||
|
||||
b.HasIndex(new[] { "Abbreviation" }, "abbreviation")
|
||||
.IsUnique()
|
||||
.HasDatabaseName("ix_test_abbreviation");
|
||||
|
||||
b.HasIndex(new[] { "Abbreviation" }, "abbreviation_trgm")
|
||||
.HasDatabaseName("ix_test_abbreviation1");
|
||||
|
||||
NpgsqlIndexBuilderExtensions.HasMethod(b.HasIndex(new[] { "Abbreviation" }, "abbreviation_trgm"), "gin");
|
||||
NpgsqlIndexBuilderExtensions.HasOperators(b.HasIndex(new[] { "Abbreviation" }, "abbreviation_trgm"), new[] { "gin_trgm_ops" });
|
||||
|
||||
b.HasIndex(new[] { "Name" }, "name")
|
||||
.IsUnique()
|
||||
.HasDatabaseName("ix_test_name");
|
||||
|
||||
b.HasIndex(new[] { "Name" }, "name_trgm")
|
||||
.HasDatabaseName("ix_test_name1");
|
||||
|
||||
NpgsqlIndexBuilderExtensions.HasMethod(b.HasIndex(new[] { "Name" }, "name_trgm"), "gin");
|
||||
NpgsqlIndexBuilderExtensions.HasOperators(b.HasIndex(new[] { "Name" }, "name_trgm"), new[] { "gin_trgm_ops" });
|
||||
|
||||
b.ToTable("test", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("labdb.Models.TestOffer", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("id");
|
||||
|
||||
b.Property<decimal>("BloodVolume")
|
||||
.HasColumnType("numeric")
|
||||
.HasColumnName("blood_volume");
|
||||
|
||||
b.Property<Guid>("LabId")
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("lab_id");
|
||||
|
||||
b.Property<string>("Notes")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("notes");
|
||||
|
||||
b.Property<decimal>("Price")
|
||||
.HasColumnType("numeric")
|
||||
.HasColumnName("price");
|
||||
|
||||
b.Property<string>("ServiceDirectoryLink")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("service_directory_link");
|
||||
|
||||
b.Property<Guid>("TestId")
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("test_id");
|
||||
|
||||
b.Property<string>("TestMethod")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("test_method");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_test_offer");
|
||||
|
||||
b.HasIndex("BloodVolume")
|
||||
.HasDatabaseName("ix_test_offer_blood_volume");
|
||||
|
||||
b.HasIndex("LabId")
|
||||
.HasDatabaseName("ix_test_offer_lab_id");
|
||||
|
||||
b.HasIndex("Price")
|
||||
.HasDatabaseName("ix_test_offer_price");
|
||||
|
||||
b.HasIndex("TestId")
|
||||
.HasDatabaseName("ix_test_offer_test_id");
|
||||
|
||||
b.HasIndex("TestMethod")
|
||||
.HasDatabaseName("ix_test_offer_test_method");
|
||||
|
||||
b.ToTable("test_offer", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("labdb.Models.TestSynonym", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("id");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("name");
|
||||
|
||||
b.Property<Guid>("TestId")
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("test_id");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_test_synonym");
|
||||
|
||||
b.HasIndex("TestId")
|
||||
.HasDatabaseName("ix_test_synonym_test_id");
|
||||
|
||||
b.HasIndex(new[] { "Name" }, "name")
|
||||
.IsUnique()
|
||||
.HasDatabaseName("ix_test_synonym_name");
|
||||
|
||||
b.HasIndex(new[] { "Name" }, "name_trgm")
|
||||
.HasDatabaseName("ix_test_synonym_name1");
|
||||
|
||||
NpgsqlIndexBuilderExtensions.HasMethod(b.HasIndex(new[] { "Name" }, "name_trgm"), "gin");
|
||||
NpgsqlIndexBuilderExtensions.HasOperators(b.HasIndex(new[] { "Name" }, "name_trgm"), new[] { "gin_trgm_ops" });
|
||||
|
||||
b.ToTable("test_synonym", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("labdb.Models.Lab", b =>
|
||||
{
|
||||
b.HasOne("labdb.Models.Country", "Country")
|
||||
.WithMany("Labs")
|
||||
.HasForeignKey("CountryId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired()
|
||||
.HasConstraintName("fk_lab_country_country_temp_id");
|
||||
|
||||
b.Navigation("Country");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("labdb.Models.TestOffer", b =>
|
||||
{
|
||||
b.HasOne("labdb.Models.Lab", "Lab")
|
||||
.WithMany("TestOffers")
|
||||
.HasForeignKey("LabId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired()
|
||||
.HasConstraintName("fk_test_offer_lab_lab_temp_id");
|
||||
|
||||
b.HasOne("labdb.Models.Test", "Test")
|
||||
.WithMany("TestOffers")
|
||||
.HasForeignKey("TestId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired()
|
||||
.HasConstraintName("fk_test_offer_test_test_temp_id");
|
||||
|
||||
b.Navigation("Lab");
|
||||
|
||||
b.Navigation("Test");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("labdb.Models.TestSynonym", b =>
|
||||
{
|
||||
b.HasOne("labdb.Models.Test", "Test")
|
||||
.WithMany("Synonyms")
|
||||
.HasForeignKey("TestId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired()
|
||||
.HasConstraintName("fk_test_synonym_test_test_temp_id1");
|
||||
|
||||
b.Navigation("Test");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("labdb.Models.Country", b =>
|
||||
{
|
||||
b.Navigation("Labs");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("labdb.Models.Lab", b =>
|
||||
{
|
||||
b.Navigation("TestOffers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("labdb.Models.Test", b =>
|
||||
{
|
||||
b.Navigation("Synonyms");
|
||||
|
||||
b.Navigation("TestOffers");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,29 +0,0 @@
|
|||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
using NetTopologySuite.Geometries;
|
||||
|
||||
namespace labdb.Models;
|
||||
|
||||
public record CityId : EntityIdBase<CityId>;
|
||||
|
||||
public class City : EntityBase<CityId>
|
||||
{
|
||||
public string Name { get; set; } = null!;
|
||||
public string? EnglishName { get; set; }
|
||||
public CountryId CountryId { get; set; } = null!;
|
||||
public Country Country { get; set; } = null!;
|
||||
public Point Location { get; set; } = null!;
|
||||
}
|
||||
|
||||
public class CityConfiguration : EntityBaseConfiguration<City, CityId>
|
||||
{
|
||||
public override void Configure(EntityTypeBuilder<City> builder)
|
||||
{
|
||||
base.Configure(builder);
|
||||
|
||||
builder.HasIndex(x => x.Name, "name").IsUnique();
|
||||
builder.HasIndex(x => x.Name, "name_trgm").HasMethod("gin").HasOperators("gin_trgm_ops");
|
||||
builder.HasIndex(x => x.EnglishName, "english_name").IsUnique();
|
||||
builder.HasIndex(x => x.EnglishName, "english_name_trgm").HasMethod("gin").HasOperators("gin_trgm_ops");
|
||||
}
|
||||
}
|
|
@ -13,8 +13,6 @@ public class Country : EntityBase<CountryId>
|
|||
|
||||
public string Code { get; init; } = null!;
|
||||
|
||||
public List<City> Cities { get; set; } = new();
|
||||
|
||||
public List<Lab> Labs { get; set; } = new();
|
||||
}
|
||||
|
||||
|
|
54
readme.md
54
readme.md
|
@ -1,54 +0,0 @@
|
|||
# datenbankschemaLocaition<tbody></@fore@for(eachvar lab in labs) {}<tr></tr><td>
|
||||
|
||||
labs:
|
||||
|
||||
-[x] name `name` #string search index
|
||||
-[x] website `website` #string
|
||||
-[x] phone number `phone` #string
|
||||
-[x] email address `email` #string
|
||||
-[x] address line 1 `address_line1` #string
|
||||
-[x] address line 2 `address_line2` #string
|
||||
-[x] postcode `address_postcode` #string index
|
||||
-[x] city `address_city` #string index
|
||||
-[x] country (ref id) `country_id` #number foreign key
|
||||
-[x] location coordinates `location` #geography
|
||||
-[x] requires appointment `requires_appointment` #boolean index
|
||||
-[x] allows self drawing blood `self_draw` #boolean index
|
||||
-[x] basic fee `basic_fee` #number index
|
||||
-[x] blood drawing fee `draw_fee` #number index
|
||||
-[x] notes `notes` #text
|
||||
-[ ] last updated `last_updated` #datetime or something
|
||||
|
||||
tests:
|
||||
|
||||
-[x] name `name` #string search index
|
||||
-[x] abbreviation `abbreviation` #string search index
|
||||
-[x] description `description` #text
|
||||
-[x] pubchem link `pubchem_link` #string
|
||||
|
||||
tests_synonyms:
|
||||
|
||||
-[ ] test (id ref) `test_id` #number foreign key
|
||||
-[ ] synonym name `synonym` #string search index
|
||||
|
||||
labs_tests:
|
||||
|
||||
-[x] labor (id ref) `lab_id` #number foreign key
|
||||
-[x] test (id ref) `test_id` #number foreign key
|
||||
-[x] price `price` #number index
|
||||
-[x] leistungsverzeichnis link (if available) `service_directory_link` #string
|
||||
-[x] required blood volume `blood_volume` #number
|
||||
-[x] test method? `test_method` #string
|
||||
-[x] notes `notes` #text
|
||||
-[ ] last updated `last_updated` #datetime?
|
||||
|
||||
countries:
|
||||
|
||||
-[x] name `name` #string index
|
||||
|
||||
cities (for search):
|
||||
|
||||
-[x] name `name` #string index
|
||||
-[x] english name if different from german `name_english` #string index
|
||||
-[x] country (ref id) `country_id` #number foreign key
|
||||
-[x] location `location` #geography
|
Loading…
Reference in a new issue