initial commit

This commit is contained in:
2026-03-20 23:52:10 +01:00
parent 05bea695bd
commit ce04cd8d77
38 changed files with 3006 additions and 52 deletions

View File

@@ -0,0 +1,81 @@
// <auto-generated />
using CityInfo.API.DbContexts;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace CityInfo.API.Migrations
{
[DbContext(typeof(CityInfoContext))]
[Migration("20260310223100_CityInfoDBInitialMigration")]
partial class CityInfoDBInitialMigration
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder.HasAnnotation("ProductVersion", "10.0.4");
modelBuilder.Entity("CityInfo.API.Entities.City", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("Description")
.HasMaxLength(200)
.HasColumnType("TEXT");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("TEXT");
b.HasKey("Id");
b.ToTable("Cities");
});
modelBuilder.Entity("CityInfo.API.Entities.PointOfInterest", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<int>("CityId")
.HasColumnType("INTEGER");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("CityId");
b.ToTable("PointsOfInterest");
});
modelBuilder.Entity("CityInfo.API.Entities.PointOfInterest", b =>
{
b.HasOne("CityInfo.API.Entities.City", "City")
.WithMany("PointsOfInterest")
.HasForeignKey("CityId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("City");
});
modelBuilder.Entity("CityInfo.API.Entities.City", b =>
{
b.Navigation("PointsOfInterest");
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -0,0 +1,63 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace CityInfo.API.Migrations
{
/// <inheritdoc />
public partial class CityInfoDBInitialMigration : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Cities",
columns: table => new
{
Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
Name = table.Column<string>(type: "TEXT", maxLength: 50, nullable: false),
Description = table.Column<string>(type: "TEXT", maxLength: 200, nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Cities", x => x.Id);
});
migrationBuilder.CreateTable(
name: "PointsOfInterest",
columns: table => new
{
Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
Name = table.Column<string>(type: "TEXT", maxLength: 50, nullable: false),
CityId = table.Column<int>(type: "INTEGER", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_PointsOfInterest", x => x.Id);
table.ForeignKey(
name: "FK_PointsOfInterest_Cities_CityId",
column: x => x.CityId,
principalTable: "Cities",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_PointsOfInterest_CityId",
table: "PointsOfInterest",
column: "CityId");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "PointsOfInterest");
migrationBuilder.DropTable(
name: "Cities");
}
}
}

View File

@@ -0,0 +1,85 @@
// <auto-generated />
using CityInfo.API.DbContexts;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace CityInfo.API.Migrations
{
[DbContext(typeof(CityInfoContext))]
[Migration("20260310223915_CityInfoDBAddPOIDescription")]
partial class CityInfoDBAddPOIDescription
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder.HasAnnotation("ProductVersion", "10.0.4");
modelBuilder.Entity("CityInfo.API.Entities.City", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("Description")
.HasMaxLength(200)
.HasColumnType("TEXT");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("TEXT");
b.HasKey("Id");
b.ToTable("Cities");
});
modelBuilder.Entity("CityInfo.API.Entities.PointOfInterest", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<int>("CityId")
.HasColumnType("INTEGER");
b.Property<string>("Description")
.HasMaxLength(200)
.HasColumnType("TEXT");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("CityId");
b.ToTable("PointsOfInterest");
});
modelBuilder.Entity("CityInfo.API.Entities.PointOfInterest", b =>
{
b.HasOne("CityInfo.API.Entities.City", "City")
.WithMany("PointsOfInterest")
.HasForeignKey("CityId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("City");
});
modelBuilder.Entity("CityInfo.API.Entities.City", b =>
{
b.Navigation("PointsOfInterest");
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -0,0 +1,29 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace CityInfo.API.Migrations
{
/// <inheritdoc />
public partial class CityInfoDBAddPOIDescription : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "Description",
table: "PointsOfInterest",
type: "TEXT",
maxLength: 200,
nullable: true);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "Description",
table: "PointsOfInterest");
}
}
}

View File

@@ -0,0 +1,149 @@
// <auto-generated />
using CityInfo.API.DbContexts;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace CityInfo.API.Migrations
{
[DbContext(typeof(CityInfoContext))]
[Migration("20260310224446_CityInfoInitialDataSeed")]
partial class CityInfoInitialDataSeed
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder.HasAnnotation("ProductVersion", "10.0.4");
modelBuilder.Entity("CityInfo.API.Entities.City", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("Description")
.HasMaxLength(200)
.HasColumnType("TEXT");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("TEXT");
b.HasKey("Id");
b.ToTable("Cities");
b.HasData(
new
{
Id = 1,
Description = "The one with that big park.",
Name = "New York City"
},
new
{
Id = 2,
Description = "The one with the cathedral that was never really finished.",
Name = "Antwerp"
},
new
{
Id = 3,
Description = "The one with that big tower.",
Name = "Paris"
});
});
modelBuilder.Entity("CityInfo.API.Entities.PointOfInterest", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<int>("CityId")
.HasColumnType("INTEGER");
b.Property<string>("Description")
.HasMaxLength(200)
.HasColumnType("TEXT");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("CityId");
b.ToTable("PointsOfInterest");
b.HasData(
new
{
Id = 1,
CityId = 1,
Description = "The most visited urban park in the United States.",
Name = "Central Park"
},
new
{
Id = 2,
CityId = 1,
Description = "A 102-story skyscraper located in Midtown Manhattan.",
Name = "Empire State Building"
},
new
{
Id = 3,
CityId = 2,
Description = "A Gothic style cathedral, conceived by architects Jan and Pieter Appelmans.",
Name = "Cathedral"
},
new
{
Id = 4,
CityId = 2,
Description = "The the finest example of railway architecture in Belgium.",
Name = "Antwerp Central Station"
},
new
{
Id = 5,
CityId = 3,
Description = "A wrought iron lattice tower on the Champ de Mars, named after engineer Gustave Eiffel.",
Name = "Eiffel Tower"
},
new
{
Id = 6,
CityId = 3,
Description = "The world's largest museum.",
Name = "The Louvre"
});
});
modelBuilder.Entity("CityInfo.API.Entities.PointOfInterest", b =>
{
b.HasOne("CityInfo.API.Entities.City", "City")
.WithMany("PointsOfInterest")
.HasForeignKey("CityId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("City");
});
modelBuilder.Entity("CityInfo.API.Entities.City", b =>
{
b.Navigation("PointsOfInterest");
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -0,0 +1,88 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional
namespace CityInfo.API.Migrations
{
/// <inheritdoc />
public partial class CityInfoInitialDataSeed : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.InsertData(
table: "Cities",
columns: new[] { "Id", "Description", "Name" },
values: new object[,]
{
{ 1, "The one with that big park.", "New York City" },
{ 2, "The one with the cathedral that was never really finished.", "Antwerp" },
{ 3, "The one with that big tower.", "Paris" }
});
migrationBuilder.InsertData(
table: "PointsOfInterest",
columns: new[] { "Id", "CityId", "Description", "Name" },
values: new object[,]
{
{ 1, 1, "The most visited urban park in the United States.", "Central Park" },
{ 2, 1, "A 102-story skyscraper located in Midtown Manhattan.", "Empire State Building" },
{ 3, 2, "A Gothic style cathedral, conceived by architects Jan and Pieter Appelmans.", "Cathedral" },
{ 4, 2, "The the finest example of railway architecture in Belgium.", "Antwerp Central Station" },
{ 5, 3, "A wrought iron lattice tower on the Champ de Mars, named after engineer Gustave Eiffel.", "Eiffel Tower" },
{ 6, 3, "The world's largest museum.", "The Louvre" }
});
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DeleteData(
table: "PointsOfInterest",
keyColumn: "Id",
keyValue: 1);
migrationBuilder.DeleteData(
table: "PointsOfInterest",
keyColumn: "Id",
keyValue: 2);
migrationBuilder.DeleteData(
table: "PointsOfInterest",
keyColumn: "Id",
keyValue: 3);
migrationBuilder.DeleteData(
table: "PointsOfInterest",
keyColumn: "Id",
keyValue: 4);
migrationBuilder.DeleteData(
table: "PointsOfInterest",
keyColumn: "Id",
keyValue: 5);
migrationBuilder.DeleteData(
table: "PointsOfInterest",
keyColumn: "Id",
keyValue: 6);
migrationBuilder.DeleteData(
table: "Cities",
keyColumn: "Id",
keyValue: 1);
migrationBuilder.DeleteData(
table: "Cities",
keyColumn: "Id",
keyValue: 2);
migrationBuilder.DeleteData(
table: "Cities",
keyColumn: "Id",
keyValue: 3);
}
}
}

View File

@@ -0,0 +1,146 @@
// <auto-generated />
using CityInfo.API.DbContexts;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace CityInfo.API.Migrations
{
[DbContext(typeof(CityInfoContext))]
partial class CityInfoContextModelSnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder.HasAnnotation("ProductVersion", "10.0.4");
modelBuilder.Entity("CityInfo.API.Entities.City", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("Description")
.HasMaxLength(200)
.HasColumnType("TEXT");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("TEXT");
b.HasKey("Id");
b.ToTable("Cities");
b.HasData(
new
{
Id = 1,
Description = "The one with that big park.",
Name = "New York City"
},
new
{
Id = 2,
Description = "The one with the cathedral that was never really finished.",
Name = "Antwerp"
},
new
{
Id = 3,
Description = "The one with that big tower.",
Name = "Paris"
});
});
modelBuilder.Entity("CityInfo.API.Entities.PointOfInterest", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<int>("CityId")
.HasColumnType("INTEGER");
b.Property<string>("Description")
.HasMaxLength(200)
.HasColumnType("TEXT");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("CityId");
b.ToTable("PointsOfInterest");
b.HasData(
new
{
Id = 1,
CityId = 1,
Description = "The most visited urban park in the United States.",
Name = "Central Park"
},
new
{
Id = 2,
CityId = 1,
Description = "A 102-story skyscraper located in Midtown Manhattan.",
Name = "Empire State Building"
},
new
{
Id = 3,
CityId = 2,
Description = "A Gothic style cathedral, conceived by architects Jan and Pieter Appelmans.",
Name = "Cathedral"
},
new
{
Id = 4,
CityId = 2,
Description = "The the finest example of railway architecture in Belgium.",
Name = "Antwerp Central Station"
},
new
{
Id = 5,
CityId = 3,
Description = "A wrought iron lattice tower on the Champ de Mars, named after engineer Gustave Eiffel.",
Name = "Eiffel Tower"
},
new
{
Id = 6,
CityId = 3,
Description = "The world's largest museum.",
Name = "The Louvre"
});
});
modelBuilder.Entity("CityInfo.API.Entities.PointOfInterest", b =>
{
b.HasOne("CityInfo.API.Entities.City", "City")
.WithMany("PointsOfInterest")
.HasForeignKey("CityId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("City");
});
modelBuilder.Entity("CityInfo.API.Entities.City", b =>
{
b.Navigation("PointsOfInterest");
});
#pragma warning restore 612, 618
}
}
}