mirror of
https://github.com/meysamhadeli/booking-microservices.git
synced 2026-04-14 12:48:34 +08:00
refactor: Refactor database migrations models
This commit is contained in:
parent
11fc165a80
commit
728b8a7a57
@ -48,12 +48,6 @@ public class FlightConfiguration : IEntityTypeConfiguration<Flights.Models.Fligh
|
||||
.WithMany()
|
||||
.HasForeignKey(d => d.ArriveAirportId);
|
||||
|
||||
//builder
|
||||
// .HasOne<Airport>()
|
||||
// .WithMany()
|
||||
// .HasForeignKey(d => d.DepartureAirportId.Value)
|
||||
// .HasForeignKey(a => a.ArriveAirportId.Value);
|
||||
|
||||
|
||||
builder.OwnsOne(
|
||||
x => x.DurationMinutes,
|
||||
|
||||
@ -1,303 +0,0 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Flight.Data;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Flight.Data.Migrations
|
||||
{
|
||||
[DbContext(typeof(FlightDbContext))]
|
||||
[Migration("20230331144237_Init")]
|
||||
partial class Init
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "7.0.2")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("Flight.Aircrafts.Models.Aircraft", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("id");
|
||||
|
||||
b.Property<DateTime?>("CreatedAt")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("created_at");
|
||||
|
||||
b.Property<long?>("CreatedBy")
|
||||
.HasColumnType("bigint")
|
||||
.HasColumnName("created_by");
|
||||
|
||||
b.Property<bool>("IsDeleted")
|
||||
.HasColumnType("boolean")
|
||||
.HasColumnName("is_deleted");
|
||||
|
||||
b.Property<DateTime?>("LastModified")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("last_modified");
|
||||
|
||||
b.Property<long?>("LastModifiedBy")
|
||||
.HasColumnType("bigint")
|
||||
.HasColumnName("last_modified_by");
|
||||
|
||||
b.Property<int>("ManufacturingYear")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("manufacturing_year");
|
||||
|
||||
b.Property<string>("Model")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("model");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("name");
|
||||
|
||||
b.Property<long>("Version")
|
||||
.IsConcurrencyToken()
|
||||
.HasColumnType("bigint")
|
||||
.HasColumnName("version");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_aircraft");
|
||||
|
||||
b.ToTable("aircraft", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Flight.Airports.Models.Airport", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("id");
|
||||
|
||||
b.Property<string>("Address")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("address");
|
||||
|
||||
b.Property<string>("Code")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("code");
|
||||
|
||||
b.Property<DateTime?>("CreatedAt")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("created_at");
|
||||
|
||||
b.Property<long?>("CreatedBy")
|
||||
.HasColumnType("bigint")
|
||||
.HasColumnName("created_by");
|
||||
|
||||
b.Property<bool>("IsDeleted")
|
||||
.HasColumnType("boolean")
|
||||
.HasColumnName("is_deleted");
|
||||
|
||||
b.Property<DateTime?>("LastModified")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("last_modified");
|
||||
|
||||
b.Property<long?>("LastModifiedBy")
|
||||
.HasColumnType("bigint")
|
||||
.HasColumnName("last_modified_by");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("name");
|
||||
|
||||
b.Property<long>("Version")
|
||||
.IsConcurrencyToken()
|
||||
.HasColumnType("bigint")
|
||||
.HasColumnName("version");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_airport");
|
||||
|
||||
b.ToTable("airport", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Flight.Flights.Models.Flight", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("id");
|
||||
|
||||
b.Property<Guid>("AircraftId")
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("aircraft_id");
|
||||
|
||||
b.Property<Guid>("ArriveAirportId")
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("arrive_airport_id");
|
||||
|
||||
b.Property<DateTime>("ArriveDate")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("arrive_date");
|
||||
|
||||
b.Property<DateTime?>("CreatedAt")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("created_at");
|
||||
|
||||
b.Property<long?>("CreatedBy")
|
||||
.HasColumnType("bigint")
|
||||
.HasColumnName("created_by");
|
||||
|
||||
b.Property<Guid>("DepartureAirportId")
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("departure_airport_id");
|
||||
|
||||
b.Property<DateTime>("DepartureDate")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("departure_date");
|
||||
|
||||
b.Property<decimal>("DurationMinutes")
|
||||
.HasColumnType("numeric")
|
||||
.HasColumnName("duration_minutes");
|
||||
|
||||
b.Property<DateTime>("FlightDate")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("flight_date");
|
||||
|
||||
b.Property<string>("FlightNumber")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("flight_number");
|
||||
|
||||
b.Property<bool>("IsDeleted")
|
||||
.HasColumnType("boolean")
|
||||
.HasColumnName("is_deleted");
|
||||
|
||||
b.Property<DateTime?>("LastModified")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("last_modified");
|
||||
|
||||
b.Property<long?>("LastModifiedBy")
|
||||
.HasColumnType("bigint")
|
||||
.HasColumnName("last_modified_by");
|
||||
|
||||
b.Property<decimal>("Price")
|
||||
.HasColumnType("numeric")
|
||||
.HasColumnName("price");
|
||||
|
||||
b.Property<string>("Status")
|
||||
.IsRequired()
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("text")
|
||||
.HasDefaultValue("Unknown")
|
||||
.HasColumnName("status");
|
||||
|
||||
b.Property<long>("Version")
|
||||
.IsConcurrencyToken()
|
||||
.HasColumnType("bigint")
|
||||
.HasColumnName("version");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_flight");
|
||||
|
||||
b.HasIndex("AircraftId")
|
||||
.HasDatabaseName("ix_flight_aircraft_id");
|
||||
|
||||
b.HasIndex("ArriveAirportId")
|
||||
.HasDatabaseName("ix_flight_arrive_airport_id");
|
||||
|
||||
b.ToTable("flight", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Flight.Seats.Models.Seat", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("id");
|
||||
|
||||
b.Property<string>("Class")
|
||||
.IsRequired()
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("text")
|
||||
.HasDefaultValue("Unknown")
|
||||
.HasColumnName("class");
|
||||
|
||||
b.Property<DateTime?>("CreatedAt")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("created_at");
|
||||
|
||||
b.Property<long?>("CreatedBy")
|
||||
.HasColumnType("bigint")
|
||||
.HasColumnName("created_by");
|
||||
|
||||
b.Property<Guid>("FlightId")
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("flight_id");
|
||||
|
||||
b.Property<bool>("IsDeleted")
|
||||
.HasColumnType("boolean")
|
||||
.HasColumnName("is_deleted");
|
||||
|
||||
b.Property<DateTime?>("LastModified")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("last_modified");
|
||||
|
||||
b.Property<long?>("LastModifiedBy")
|
||||
.HasColumnType("bigint")
|
||||
.HasColumnName("last_modified_by");
|
||||
|
||||
b.Property<string>("SeatNumber")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("seat_number");
|
||||
|
||||
b.Property<string>("Type")
|
||||
.IsRequired()
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("text")
|
||||
.HasDefaultValue("Unknown")
|
||||
.HasColumnName("type");
|
||||
|
||||
b.Property<long>("Version")
|
||||
.IsConcurrencyToken()
|
||||
.HasColumnType("bigint")
|
||||
.HasColumnName("version");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_seat");
|
||||
|
||||
b.HasIndex("FlightId")
|
||||
.HasDatabaseName("ix_seat_flight_id");
|
||||
|
||||
b.ToTable("seat", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Flight.Flights.Models.Flight", b =>
|
||||
{
|
||||
b.HasOne("Flight.Aircrafts.Models.Aircraft", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("AircraftId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired()
|
||||
.HasConstraintName("fk_flight_aircraft_aircraft_id");
|
||||
|
||||
b.HasOne("Flight.Airports.Models.Airport", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("ArriveAirportId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired()
|
||||
.HasConstraintName("fk_flight_airport_arrive_airport_id");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Flight.Seats.Models.Seat", b =>
|
||||
{
|
||||
b.HasOne("Flight.Flights.Models.Flight", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("FlightId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired()
|
||||
.HasConstraintName("fk_seat_flight_flight_id");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,363 +0,0 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Flight.Data;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Flight.Data.Migrations
|
||||
{
|
||||
[DbContext(typeof(FlightDbContext))]
|
||||
[Migration("20230525075149_aircraftValueObjects")]
|
||||
partial class aircraftValueObjects
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "7.0.2")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("Flight.Aircrafts.Models.Aircraft", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("id");
|
||||
|
||||
b.Property<DateTime?>("CreatedAt")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("created_at");
|
||||
|
||||
b.Property<long?>("CreatedBy")
|
||||
.HasColumnType("bigint")
|
||||
.HasColumnName("created_by");
|
||||
|
||||
b.Property<bool>("IsDeleted")
|
||||
.HasColumnType("boolean")
|
||||
.HasColumnName("is_deleted");
|
||||
|
||||
b.Property<DateTime?>("LastModified")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("last_modified");
|
||||
|
||||
b.Property<long?>("LastModifiedBy")
|
||||
.HasColumnType("bigint")
|
||||
.HasColumnName("last_modified_by");
|
||||
|
||||
b.Property<long>("Version")
|
||||
.IsConcurrencyToken()
|
||||
.HasColumnType("bigint")
|
||||
.HasColumnName("version");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_aircraft");
|
||||
|
||||
b.ToTable("aircraft", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Flight.Airports.Models.Airport", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("id");
|
||||
|
||||
b.Property<string>("Address")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("address");
|
||||
|
||||
b.Property<string>("Code")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("code");
|
||||
|
||||
b.Property<DateTime?>("CreatedAt")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("created_at");
|
||||
|
||||
b.Property<long?>("CreatedBy")
|
||||
.HasColumnType("bigint")
|
||||
.HasColumnName("created_by");
|
||||
|
||||
b.Property<bool>("IsDeleted")
|
||||
.HasColumnType("boolean")
|
||||
.HasColumnName("is_deleted");
|
||||
|
||||
b.Property<DateTime?>("LastModified")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("last_modified");
|
||||
|
||||
b.Property<long?>("LastModifiedBy")
|
||||
.HasColumnType("bigint")
|
||||
.HasColumnName("last_modified_by");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("name");
|
||||
|
||||
b.Property<long>("Version")
|
||||
.IsConcurrencyToken()
|
||||
.HasColumnType("bigint")
|
||||
.HasColumnName("version");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_airport");
|
||||
|
||||
b.ToTable("airport", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Flight.Flights.Models.Flight", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("id");
|
||||
|
||||
b.Property<Guid?>("AircraftId")
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("aircraft_id");
|
||||
|
||||
b.Property<Guid>("ArriveAirportId")
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("arrive_airport_id");
|
||||
|
||||
b.Property<DateTime>("ArriveDate")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("arrive_date");
|
||||
|
||||
b.Property<DateTime?>("CreatedAt")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("created_at");
|
||||
|
||||
b.Property<long?>("CreatedBy")
|
||||
.HasColumnType("bigint")
|
||||
.HasColumnName("created_by");
|
||||
|
||||
b.Property<Guid>("DepartureAirportId")
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("departure_airport_id");
|
||||
|
||||
b.Property<DateTime>("DepartureDate")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("departure_date");
|
||||
|
||||
b.Property<decimal>("DurationMinutes")
|
||||
.HasColumnType("numeric")
|
||||
.HasColumnName("duration_minutes");
|
||||
|
||||
b.Property<DateTime>("FlightDate")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("flight_date");
|
||||
|
||||
b.Property<string>("FlightNumber")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("flight_number");
|
||||
|
||||
b.Property<bool>("IsDeleted")
|
||||
.HasColumnType("boolean")
|
||||
.HasColumnName("is_deleted");
|
||||
|
||||
b.Property<DateTime?>("LastModified")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("last_modified");
|
||||
|
||||
b.Property<long?>("LastModifiedBy")
|
||||
.HasColumnType("bigint")
|
||||
.HasColumnName("last_modified_by");
|
||||
|
||||
b.Property<decimal>("Price")
|
||||
.HasColumnType("numeric")
|
||||
.HasColumnName("price");
|
||||
|
||||
b.Property<string>("Status")
|
||||
.IsRequired()
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("text")
|
||||
.HasDefaultValue("Unknown")
|
||||
.HasColumnName("status");
|
||||
|
||||
b.Property<long>("Version")
|
||||
.IsConcurrencyToken()
|
||||
.HasColumnType("bigint")
|
||||
.HasColumnName("version");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_flight");
|
||||
|
||||
b.HasIndex("AircraftId")
|
||||
.HasDatabaseName("ix_flight_aircraft_id");
|
||||
|
||||
b.HasIndex("ArriveAirportId")
|
||||
.HasDatabaseName("ix_flight_arrive_airport_id");
|
||||
|
||||
b.ToTable("flight", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Flight.Seats.Models.Seat", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("id");
|
||||
|
||||
b.Property<string>("Class")
|
||||
.IsRequired()
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("text")
|
||||
.HasDefaultValue("Unknown")
|
||||
.HasColumnName("class");
|
||||
|
||||
b.Property<DateTime?>("CreatedAt")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("created_at");
|
||||
|
||||
b.Property<long?>("CreatedBy")
|
||||
.HasColumnType("bigint")
|
||||
.HasColumnName("created_by");
|
||||
|
||||
b.Property<Guid>("FlightId")
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("flight_id");
|
||||
|
||||
b.Property<bool>("IsDeleted")
|
||||
.HasColumnType("boolean")
|
||||
.HasColumnName("is_deleted");
|
||||
|
||||
b.Property<DateTime?>("LastModified")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("last_modified");
|
||||
|
||||
b.Property<long?>("LastModifiedBy")
|
||||
.HasColumnType("bigint")
|
||||
.HasColumnName("last_modified_by");
|
||||
|
||||
b.Property<string>("SeatNumber")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("seat_number");
|
||||
|
||||
b.Property<string>("Type")
|
||||
.IsRequired()
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("text")
|
||||
.HasDefaultValue("Unknown")
|
||||
.HasColumnName("type");
|
||||
|
||||
b.Property<long>("Version")
|
||||
.IsConcurrencyToken()
|
||||
.HasColumnType("bigint")
|
||||
.HasColumnName("version");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_seat");
|
||||
|
||||
b.HasIndex("FlightId")
|
||||
.HasDatabaseName("ix_seat_flight_id");
|
||||
|
||||
b.ToTable("seat", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Flight.Aircrafts.Models.Aircraft", b =>
|
||||
{
|
||||
b.OwnsOne("Flight.Aircrafts.Models.ValueObjects.ManufacturingYearValue", "ManufacturingYear", b1 =>
|
||||
{
|
||||
b1.Property<Guid>("AircraftId")
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("id");
|
||||
|
||||
b1.Property<int>("Value")
|
||||
.HasMaxLength(5)
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("manufacturing_year");
|
||||
|
||||
b1.HasKey("AircraftId")
|
||||
.HasName("pk_aircraft");
|
||||
|
||||
b1.ToTable("aircraft");
|
||||
|
||||
b1.WithOwner()
|
||||
.HasForeignKey("AircraftId")
|
||||
.HasConstraintName("fk_aircraft_aircraft_id");
|
||||
});
|
||||
|
||||
b.OwnsOne("Flight.Aircrafts.Models.ValueObjects.ModelValue", "Model", b1 =>
|
||||
{
|
||||
b1.Property<Guid>("AircraftId")
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("id");
|
||||
|
||||
b1.Property<string>("Value")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("character varying(50)")
|
||||
.HasColumnName("model");
|
||||
|
||||
b1.HasKey("AircraftId")
|
||||
.HasName("pk_aircraft");
|
||||
|
||||
b1.ToTable("aircraft");
|
||||
|
||||
b1.WithOwner()
|
||||
.HasForeignKey("AircraftId")
|
||||
.HasConstraintName("fk_aircraft_aircraft_id");
|
||||
});
|
||||
|
||||
b.OwnsOne("Flight.Aircrafts.Models.ValueObjects.NameValue", "Name", b1 =>
|
||||
{
|
||||
b1.Property<Guid>("AircraftId")
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("id");
|
||||
|
||||
b1.Property<string>("Value")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("character varying(50)")
|
||||
.HasColumnName("name");
|
||||
|
||||
b1.HasKey("AircraftId")
|
||||
.HasName("pk_aircraft");
|
||||
|
||||
b1.ToTable("aircraft");
|
||||
|
||||
b1.WithOwner()
|
||||
.HasForeignKey("AircraftId")
|
||||
.HasConstraintName("fk_aircraft_aircraft_id");
|
||||
});
|
||||
|
||||
b.Navigation("ManufacturingYear");
|
||||
|
||||
b.Navigation("Model");
|
||||
|
||||
b.Navigation("Name");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Flight.Flights.Models.Flight", b =>
|
||||
{
|
||||
b.HasOne("Flight.Aircrafts.Models.Aircraft", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("AircraftId")
|
||||
.HasConstraintName("fk_flight_aircraft_aircraft_id");
|
||||
|
||||
b.HasOne("Flight.Airports.Models.Airport", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("ArriveAirportId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired()
|
||||
.HasConstraintName("fk_flight_airport_arrive_airport_id");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Flight.Seats.Models.Seat", b =>
|
||||
{
|
||||
b.HasOne("Flight.Flights.Models.Flight", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("FlightId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired()
|
||||
.HasConstraintName("fk_seat_flight_flight_id");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,120 +0,0 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Flight.Data.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class aircraftValueObjects : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "fk_flight_aircraft_aircraft_id",
|
||||
table: "flight");
|
||||
|
||||
migrationBuilder.AlterColumn<Guid>(
|
||||
name: "aircraft_id",
|
||||
table: "flight",
|
||||
type: "uuid",
|
||||
nullable: true,
|
||||
oldClrType: typeof(Guid),
|
||||
oldType: "uuid");
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "name",
|
||||
table: "aircraft",
|
||||
type: "character varying(50)",
|
||||
maxLength: 50,
|
||||
nullable: true,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "text",
|
||||
oldNullable: true);
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "model",
|
||||
table: "aircraft",
|
||||
type: "character varying(50)",
|
||||
maxLength: 50,
|
||||
nullable: true,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "text",
|
||||
oldNullable: true);
|
||||
|
||||
migrationBuilder.AlterColumn<int>(
|
||||
name: "manufacturing_year",
|
||||
table: "aircraft",
|
||||
type: "integer",
|
||||
maxLength: 5,
|
||||
nullable: true,
|
||||
oldClrType: typeof(int),
|
||||
oldType: "integer");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "fk_flight_aircraft_aircraft_id",
|
||||
table: "flight",
|
||||
column: "aircraft_id",
|
||||
principalTable: "aircraft",
|
||||
principalColumn: "id");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "fk_flight_aircraft_aircraft_id",
|
||||
table: "flight");
|
||||
|
||||
migrationBuilder.AlterColumn<Guid>(
|
||||
name: "aircraft_id",
|
||||
table: "flight",
|
||||
type: "uuid",
|
||||
nullable: false,
|
||||
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
|
||||
oldClrType: typeof(Guid),
|
||||
oldType: "uuid",
|
||||
oldNullable: true);
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "name",
|
||||
table: "aircraft",
|
||||
type: "text",
|
||||
nullable: true,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "character varying(50)",
|
||||
oldMaxLength: 50,
|
||||
oldNullable: true);
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "model",
|
||||
table: "aircraft",
|
||||
type: "text",
|
||||
nullable: true,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "character varying(50)",
|
||||
oldMaxLength: 50,
|
||||
oldNullable: true);
|
||||
|
||||
migrationBuilder.AlterColumn<int>(
|
||||
name: "manufacturing_year",
|
||||
table: "aircraft",
|
||||
type: "integer",
|
||||
nullable: false,
|
||||
defaultValue: 0,
|
||||
oldClrType: typeof(int),
|
||||
oldType: "integer",
|
||||
oldMaxLength: 5,
|
||||
oldNullable: true);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "fk_flight_aircraft_aircraft_id",
|
||||
table: "flight",
|
||||
column: "aircraft_id",
|
||||
principalTable: "aircraft",
|
||||
principalColumn: "id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,391 +0,0 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Flight.Data.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class AddValueObjectForSeatAirportFlight : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "seat_number",
|
||||
table: "seat",
|
||||
type: "character varying(50)",
|
||||
maxLength: 50,
|
||||
nullable: false,
|
||||
defaultValue: "",
|
||||
oldClrType: typeof(string),
|
||||
oldType: "text",
|
||||
oldNullable: true);
|
||||
|
||||
migrationBuilder.AlterColumn<decimal>(
|
||||
name: "price",
|
||||
table: "flight",
|
||||
type: "numeric",
|
||||
maxLength: 10,
|
||||
nullable: true,
|
||||
oldClrType: typeof(decimal),
|
||||
oldType: "numeric");
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "flight_number",
|
||||
table: "flight",
|
||||
type: "character varying(50)",
|
||||
maxLength: 50,
|
||||
nullable: true,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "text",
|
||||
oldNullable: true);
|
||||
|
||||
migrationBuilder.AlterColumn<DateTime>(
|
||||
name: "flight_date",
|
||||
table: "flight",
|
||||
type: "timestamp with time zone",
|
||||
nullable: true,
|
||||
oldClrType: typeof(DateTime),
|
||||
oldType: "timestamp with time zone");
|
||||
|
||||
migrationBuilder.AlterColumn<decimal>(
|
||||
name: "duration_minutes",
|
||||
table: "flight",
|
||||
type: "numeric",
|
||||
maxLength: 50,
|
||||
nullable: true,
|
||||
oldClrType: typeof(decimal),
|
||||
oldType: "numeric");
|
||||
|
||||
migrationBuilder.AlterColumn<DateTime>(
|
||||
name: "departure_date",
|
||||
table: "flight",
|
||||
type: "timestamp with time zone",
|
||||
nullable: true,
|
||||
oldClrType: typeof(DateTime),
|
||||
oldType: "timestamp with time zone");
|
||||
|
||||
migrationBuilder.AlterColumn<Guid>(
|
||||
name: "departure_airport_id",
|
||||
table: "flight",
|
||||
type: "uuid",
|
||||
nullable: true,
|
||||
oldClrType: typeof(Guid),
|
||||
oldType: "uuid");
|
||||
|
||||
migrationBuilder.AlterColumn<DateTime>(
|
||||
name: "arrive_date",
|
||||
table: "flight",
|
||||
type: "timestamp with time zone",
|
||||
nullable: true,
|
||||
oldClrType: typeof(DateTime),
|
||||
oldType: "timestamp with time zone");
|
||||
|
||||
migrationBuilder.AlterColumn<Guid>(
|
||||
name: "arrive_airport_id",
|
||||
table: "flight",
|
||||
type: "uuid",
|
||||
nullable: true,
|
||||
oldClrType: typeof(Guid),
|
||||
oldType: "uuid");
|
||||
|
||||
migrationBuilder.AlterColumn<Guid>(
|
||||
name: "aircraft_id",
|
||||
table: "flight",
|
||||
type: "uuid",
|
||||
nullable: false,
|
||||
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
|
||||
oldClrType: typeof(Guid),
|
||||
oldType: "uuid",
|
||||
oldNullable: true);
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "name",
|
||||
table: "airport",
|
||||
type: "character varying(50)",
|
||||
maxLength: 50,
|
||||
nullable: false,
|
||||
defaultValue: "",
|
||||
oldClrType: typeof(string),
|
||||
oldType: "text",
|
||||
oldNullable: true);
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "code",
|
||||
table: "airport",
|
||||
type: "character varying(50)",
|
||||
maxLength: 50,
|
||||
nullable: false,
|
||||
defaultValue: "",
|
||||
oldClrType: typeof(string),
|
||||
oldType: "text",
|
||||
oldNullable: true);
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "address",
|
||||
table: "airport",
|
||||
type: "character varying(50)",
|
||||
maxLength: 50,
|
||||
nullable: false,
|
||||
defaultValue: "",
|
||||
oldClrType: typeof(string),
|
||||
oldType: "text",
|
||||
oldNullable: true);
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "name",
|
||||
table: "aircraft",
|
||||
type: "character varying(50)",
|
||||
maxLength: 50,
|
||||
nullable: false,
|
||||
defaultValue: "",
|
||||
oldClrType: typeof(string),
|
||||
oldType: "character varying(50)",
|
||||
oldMaxLength: 50,
|
||||
oldNullable: true);
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "model",
|
||||
table: "aircraft",
|
||||
type: "character varying(50)",
|
||||
maxLength: 50,
|
||||
nullable: false,
|
||||
defaultValue: "",
|
||||
oldClrType: typeof(string),
|
||||
oldType: "character varying(50)",
|
||||
oldMaxLength: 50,
|
||||
oldNullable: true);
|
||||
|
||||
migrationBuilder.AlterColumn<int>(
|
||||
name: "manufacturing_year",
|
||||
table: "aircraft",
|
||||
type: "integer",
|
||||
maxLength: 5,
|
||||
nullable: false,
|
||||
defaultValue: 0,
|
||||
oldClrType: typeof(int),
|
||||
oldType: "integer",
|
||||
oldMaxLength: 5,
|
||||
oldNullable: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_flight_departure_airport_id",
|
||||
table: "flight",
|
||||
column: "departure_airport_id");
|
||||
|
||||
//migrationBuilder.AddForeignKey(
|
||||
// name: "fk_flight_aircraft_aircraft_id",
|
||||
// table: "flight",
|
||||
// column: "aircraft_id",
|
||||
// principalTable: "aircraft",
|
||||
// principalColumn: "id",
|
||||
// onDelete: ReferentialAction.Cascade);
|
||||
|
||||
//migrationBuilder.AddForeignKey(
|
||||
// name: "fk_flight_airport_arrive_airport_id",
|
||||
// table: "flight",
|
||||
// column: "arrive_airport_id",
|
||||
// principalTable: "airport",
|
||||
// principalColumn: "id");
|
||||
|
||||
//migrationBuilder.AddForeignKey(
|
||||
// name: "fk_flight_airport_departure_airport_id",
|
||||
// table: "flight",
|
||||
// column: "departure_airport_id",
|
||||
// principalTable: "airport",
|
||||
// principalColumn: "id");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "fk_flight_aircraft_aircraft_id",
|
||||
table: "flight");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "fk_flight_airport_arrive_airport_id",
|
||||
table: "flight");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "fk_flight_airport_departure_airport_id",
|
||||
table: "flight");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "ix_flight_departure_airport_id",
|
||||
table: "flight");
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "seat_number",
|
||||
table: "seat",
|
||||
type: "text",
|
||||
nullable: true,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "character varying(50)",
|
||||
oldMaxLength: 50);
|
||||
|
||||
migrationBuilder.AlterColumn<decimal>(
|
||||
name: "price",
|
||||
table: "flight",
|
||||
type: "numeric",
|
||||
nullable: false,
|
||||
defaultValue: 0m,
|
||||
oldClrType: typeof(decimal),
|
||||
oldType: "numeric",
|
||||
oldMaxLength: 10,
|
||||
oldNullable: true);
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "flight_number",
|
||||
table: "flight",
|
||||
type: "text",
|
||||
nullable: true,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "character varying(50)",
|
||||
oldMaxLength: 50,
|
||||
oldNullable: true);
|
||||
|
||||
migrationBuilder.AlterColumn<DateTime>(
|
||||
name: "flight_date",
|
||||
table: "flight",
|
||||
type: "timestamp with time zone",
|
||||
nullable: false,
|
||||
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||
oldClrType: typeof(DateTime),
|
||||
oldType: "timestamp with time zone",
|
||||
oldNullable: true);
|
||||
|
||||
migrationBuilder.AlterColumn<decimal>(
|
||||
name: "duration_minutes",
|
||||
table: "flight",
|
||||
type: "numeric",
|
||||
nullable: false,
|
||||
defaultValue: 0m,
|
||||
oldClrType: typeof(decimal),
|
||||
oldType: "numeric",
|
||||
oldMaxLength: 50,
|
||||
oldNullable: true);
|
||||
|
||||
migrationBuilder.AlterColumn<DateTime>(
|
||||
name: "departure_date",
|
||||
table: "flight",
|
||||
type: "timestamp with time zone",
|
||||
nullable: false,
|
||||
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||
oldClrType: typeof(DateTime),
|
||||
oldType: "timestamp with time zone",
|
||||
oldNullable: true);
|
||||
|
||||
migrationBuilder.AlterColumn<Guid>(
|
||||
name: "departure_airport_id",
|
||||
table: "flight",
|
||||
type: "uuid",
|
||||
nullable: false,
|
||||
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
|
||||
oldClrType: typeof(Guid),
|
||||
oldType: "uuid",
|
||||
oldNullable: true);
|
||||
|
||||
migrationBuilder.AlterColumn<DateTime>(
|
||||
name: "arrive_date",
|
||||
table: "flight",
|
||||
type: "timestamp with time zone",
|
||||
nullable: false,
|
||||
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||
oldClrType: typeof(DateTime),
|
||||
oldType: "timestamp with time zone",
|
||||
oldNullable: true);
|
||||
|
||||
migrationBuilder.AlterColumn<Guid>(
|
||||
name: "arrive_airport_id",
|
||||
table: "flight",
|
||||
type: "uuid",
|
||||
nullable: false,
|
||||
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
|
||||
oldClrType: typeof(Guid),
|
||||
oldType: "uuid",
|
||||
oldNullable: true);
|
||||
|
||||
migrationBuilder.AlterColumn<Guid>(
|
||||
name: "aircraft_id",
|
||||
table: "flight",
|
||||
type: "uuid",
|
||||
nullable: true,
|
||||
oldClrType: typeof(Guid),
|
||||
oldType: "uuid");
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "name",
|
||||
table: "airport",
|
||||
type: "text",
|
||||
nullable: true,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "character varying(50)",
|
||||
oldMaxLength: 50);
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "code",
|
||||
table: "airport",
|
||||
type: "text",
|
||||
nullable: true,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "character varying(50)",
|
||||
oldMaxLength: 50);
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "address",
|
||||
table: "airport",
|
||||
type: "text",
|
||||
nullable: true,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "character varying(50)",
|
||||
oldMaxLength: 50);
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "name",
|
||||
table: "aircraft",
|
||||
type: "character varying(50)",
|
||||
maxLength: 50,
|
||||
nullable: true,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "character varying(50)",
|
||||
oldMaxLength: 50);
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "model",
|
||||
table: "aircraft",
|
||||
type: "character varying(50)",
|
||||
maxLength: 50,
|
||||
nullable: true,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "character varying(50)",
|
||||
oldMaxLength: 50);
|
||||
|
||||
migrationBuilder.AlterColumn<int>(
|
||||
name: "manufacturing_year",
|
||||
table: "aircraft",
|
||||
type: "integer",
|
||||
maxLength: 5,
|
||||
nullable: true,
|
||||
oldClrType: typeof(int),
|
||||
oldType: "integer",
|
||||
oldMaxLength: 5);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "fk_flight_aircraft_aircraft_id",
|
||||
table: "flight",
|
||||
column: "aircraft_id",
|
||||
principalTable: "aircraft",
|
||||
principalColumn: "id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "fk_flight_airport_arrive_airport_id",
|
||||
table: "flight",
|
||||
column: "arrive_airport_id",
|
||||
principalTable: "airport",
|
||||
principalColumn: "id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -12,8 +12,8 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
namespace Flight.Data.Migrations
|
||||
{
|
||||
[DbContext(typeof(FlightDbContext))]
|
||||
[Migration("20230609154649_AddValueObjectForSeat-Airport-Flight")]
|
||||
partial class AddValueObjectForSeatAirportFlight
|
||||
[Migration("20230611213200_initial")]
|
||||
partial class initial
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
@ -109,7 +109,7 @@ namespace Flight.Data.Migrations
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("aircraft_id");
|
||||
|
||||
b.Property<Guid?>("ArriveAirportId")
|
||||
b.Property<Guid>("ArriveAirportId")
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("arrive_airport_id");
|
||||
|
||||
@ -121,7 +121,7 @@ namespace Flight.Data.Migrations
|
||||
.HasColumnType("bigint")
|
||||
.HasColumnName("created_by");
|
||||
|
||||
b.Property<Guid?>("DepartureAirportId")
|
||||
b.Property<Guid>("DepartureAirportId")
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("departure_airport_id");
|
||||
|
||||
@ -389,11 +389,15 @@ namespace Flight.Data.Migrations
|
||||
b.HasOne("Flight.Airports.Models.Airport", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("ArriveAirportId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired()
|
||||
.HasConstraintName("fk_flight_airport_arrive_airport_id");
|
||||
|
||||
b.HasOne("Flight.Airports.Models.Airport", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("DepartureAirportId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired()
|
||||
.HasConstraintName("fk_flight_airport_departure_airport_id");
|
||||
|
||||
b.OwnsOne("Flight.Flights.ValueObjects.ArriveDate", "ArriveDate", b1 =>
|
||||
@ -520,17 +524,23 @@ namespace Flight.Data.Migrations
|
||||
.HasConstraintName("fk_flight_flight_id");
|
||||
});
|
||||
|
||||
b.Navigation("ArriveDate");
|
||||
b.Navigation("ArriveDate")
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("DepartureDate");
|
||||
b.Navigation("DepartureDate")
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("DurationMinutes");
|
||||
b.Navigation("DurationMinutes")
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("FlightDate");
|
||||
b.Navigation("FlightDate")
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("FlightNumber");
|
||||
b.Navigation("FlightNumber")
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Price");
|
||||
b.Navigation("Price")
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Flight.Seats.Models.Seat", b =>
|
||||
@ -6,7 +6,7 @@ using Microsoft.EntityFrameworkCore.Migrations;
|
||||
namespace Flight.Data.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class Init : Migration
|
||||
public partial class initial : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
@ -16,9 +16,9 @@ namespace Flight.Data.Migrations
|
||||
columns: table => new
|
||||
{
|
||||
id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
name = table.Column<string>(type: "text", nullable: true),
|
||||
model = table.Column<string>(type: "text", nullable: true),
|
||||
manufacturingyear = table.Column<int>(name: "manufacturing_year", type: "integer", nullable: false),
|
||||
name = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false),
|
||||
model = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false),
|
||||
manufacturingyear = table.Column<int>(name: "manufacturing_year", type: "integer", maxLength: 5, nullable: false),
|
||||
createdat = table.Column<DateTime>(name: "created_at", type: "timestamp with time zone", nullable: true),
|
||||
createdby = table.Column<long>(name: "created_by", type: "bigint", nullable: true),
|
||||
lastmodified = table.Column<DateTime>(name: "last_modified", type: "timestamp with time zone", nullable: true),
|
||||
@ -36,9 +36,9 @@ namespace Flight.Data.Migrations
|
||||
columns: table => new
|
||||
{
|
||||
id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
name = table.Column<string>(type: "text", nullable: true),
|
||||
address = table.Column<string>(type: "text", nullable: true),
|
||||
code = table.Column<string>(type: "text", nullable: true),
|
||||
name = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false),
|
||||
address = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false),
|
||||
code = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false),
|
||||
createdat = table.Column<DateTime>(name: "created_at", type: "timestamp with time zone", nullable: true),
|
||||
createdby = table.Column<long>(name: "created_by", type: "bigint", nullable: true),
|
||||
lastmodified = table.Column<DateTime>(name: "last_modified", type: "timestamp with time zone", nullable: true),
|
||||
@ -56,16 +56,16 @@ namespace Flight.Data.Migrations
|
||||
columns: table => new
|
||||
{
|
||||
id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
flightnumber = table.Column<string>(name: "flight_number", type: "text", nullable: true),
|
||||
flightnumber = table.Column<string>(name: "flight_number", type: "character varying(50)", maxLength: 50, nullable: false),
|
||||
aircraftid = table.Column<Guid>(name: "aircraft_id", type: "uuid", nullable: false),
|
||||
departuredate = table.Column<DateTime>(name: "departure_date", type: "timestamp with time zone", nullable: false),
|
||||
departureairportid = table.Column<Guid>(name: "departure_airport_id", type: "uuid", nullable: false),
|
||||
arrivedate = table.Column<DateTime>(name: "arrive_date", type: "timestamp with time zone", nullable: false),
|
||||
arriveairportid = table.Column<Guid>(name: "arrive_airport_id", type: "uuid", nullable: false),
|
||||
durationminutes = table.Column<decimal>(name: "duration_minutes", type: "numeric", nullable: false),
|
||||
flightdate = table.Column<DateTime>(name: "flight_date", type: "timestamp with time zone", nullable: false),
|
||||
durationminutes = table.Column<decimal>(name: "duration_minutes", type: "numeric", maxLength: 50, nullable: false),
|
||||
status = table.Column<string>(type: "text", nullable: false, defaultValue: "Unknown"),
|
||||
price = table.Column<decimal>(type: "numeric", nullable: false),
|
||||
price = table.Column<decimal>(type: "numeric", maxLength: 10, nullable: false),
|
||||
arrivedate = table.Column<DateTime>(name: "arrive_date", type: "timestamp with time zone", nullable: false),
|
||||
departuredate = table.Column<DateTime>(name: "departure_date", type: "timestamp with time zone", nullable: false),
|
||||
flightdate = table.Column<DateTime>(name: "flight_date", type: "timestamp with time zone", nullable: false),
|
||||
createdat = table.Column<DateTime>(name: "created_at", type: "timestamp with time zone", nullable: true),
|
||||
createdby = table.Column<long>(name: "created_by", type: "bigint", nullable: true),
|
||||
lastmodified = table.Column<DateTime>(name: "last_modified", type: "timestamp with time zone", nullable: true),
|
||||
@ -88,6 +88,12 @@ namespace Flight.Data.Migrations
|
||||
principalTable: "airport",
|
||||
principalColumn: "id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "fk_flight_airport_departure_airport_id",
|
||||
column: x => x.departureairportid,
|
||||
principalTable: "airport",
|
||||
principalColumn: "id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
@ -95,7 +101,7 @@ namespace Flight.Data.Migrations
|
||||
columns: table => new
|
||||
{
|
||||
id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
seatnumber = table.Column<string>(name: "seat_number", type: "text", nullable: true),
|
||||
seatnumber = table.Column<string>(name: "seat_number", type: "character varying(50)", maxLength: 50, nullable: false),
|
||||
type = table.Column<string>(type: "text", nullable: false, defaultValue: "Unknown"),
|
||||
@class = table.Column<string>(name: "class", type: "text", nullable: false, defaultValue: "Unknown"),
|
||||
flightid = table.Column<Guid>(name: "flight_id", type: "uuid", nullable: false),
|
||||
@ -127,6 +133,11 @@ namespace Flight.Data.Migrations
|
||||
table: "flight",
|
||||
column: "arrive_airport_id");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_flight_departure_airport_id",
|
||||
table: "flight",
|
||||
column: "departure_airport_id");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_seat_flight_id",
|
||||
table: "seat",
|
||||
@ -106,7 +106,7 @@ namespace Flight.Data.Migrations
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("aircraft_id");
|
||||
|
||||
b.Property<Guid?>("ArriveAirportId")
|
||||
b.Property<Guid>("ArriveAirportId")
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("arrive_airport_id");
|
||||
|
||||
@ -118,7 +118,7 @@ namespace Flight.Data.Migrations
|
||||
.HasColumnType("bigint")
|
||||
.HasColumnName("created_by");
|
||||
|
||||
b.Property<Guid?>("DepartureAirportId")
|
||||
b.Property<Guid>("DepartureAirportId")
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("departure_airport_id");
|
||||
|
||||
@ -386,11 +386,15 @@ namespace Flight.Data.Migrations
|
||||
b.HasOne("Flight.Airports.Models.Airport", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("ArriveAirportId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired()
|
||||
.HasConstraintName("fk_flight_airport_arrive_airport_id");
|
||||
|
||||
b.HasOne("Flight.Airports.Models.Airport", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("DepartureAirportId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired()
|
||||
.HasConstraintName("fk_flight_airport_departure_airport_id");
|
||||
|
||||
b.OwnsOne("Flight.Flights.ValueObjects.ArriveDate", "ArriveDate", b1 =>
|
||||
@ -517,17 +521,23 @@ namespace Flight.Data.Migrations
|
||||
.HasConstraintName("fk_flight_flight_id");
|
||||
});
|
||||
|
||||
b.Navigation("ArriveDate");
|
||||
b.Navigation("ArriveDate")
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("DepartureDate");
|
||||
b.Navigation("DepartureDate")
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("DurationMinutes");
|
||||
b.Navigation("DurationMinutes")
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("FlightDate");
|
||||
b.Navigation("FlightDate")
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("FlightNumber");
|
||||
b.Navigation("FlightNumber")
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Price");
|
||||
b.Navigation("Price")
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Flight.Seats.Models.Seat", b =>
|
||||
|
||||
@ -1,2 +1,2 @@
|
||||
dotnet ef migrations add Init --context FlightDbContext -o "Data\Migrations"
|
||||
dotnet ef migrations add initial --context FlightDbContext -o "Data\Migrations"
|
||||
dotnet ef database update --context FlightDbContext
|
||||
|
||||
@ -1,83 +0,0 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
using Passenger.Data;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Passenger.Data.Migrations
|
||||
{
|
||||
[DbContext(typeof(PassengerDbContext))]
|
||||
[Migration("20230331204805_initial")]
|
||||
partial class initial
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "7.0.2")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("Passenger.Passengers.Models.Passenger", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("id");
|
||||
|
||||
b.Property<int>("Age")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("age");
|
||||
|
||||
b.Property<DateTime?>("CreatedAt")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("created_at");
|
||||
|
||||
b.Property<long?>("CreatedBy")
|
||||
.HasColumnType("bigint")
|
||||
.HasColumnName("created_by");
|
||||
|
||||
b.Property<bool>("IsDeleted")
|
||||
.HasColumnType("boolean")
|
||||
.HasColumnName("is_deleted");
|
||||
|
||||
b.Property<DateTime?>("LastModified")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("last_modified");
|
||||
|
||||
b.Property<long?>("LastModifiedBy")
|
||||
.HasColumnType("bigint")
|
||||
.HasColumnName("last_modified_by");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("name");
|
||||
|
||||
b.Property<int>("PassengerType")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("passenger_type");
|
||||
|
||||
b.Property<string>("PassportNumber")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("passport_number");
|
||||
|
||||
b.Property<long>("Version")
|
||||
.IsConcurrencyToken()
|
||||
.HasColumnType("bigint")
|
||||
.HasColumnName("version");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_passenger");
|
||||
|
||||
b.ToTable("passenger", (string)null);
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,148 +0,0 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
using Passenger.Data;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Passenger.Data.Migrations
|
||||
{
|
||||
[DbContext(typeof(PassengerDbContext))]
|
||||
[Migration("20230524195049_AddValueObject")]
|
||||
partial class AddValueObject
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "7.0.5")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("Passenger.Passengers.Models.Passenger", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("id");
|
||||
|
||||
b.Property<DateTime?>("CreatedAt")
|
||||
.HasColumnType("timestamp without time zone")
|
||||
.HasColumnName("created_at");
|
||||
|
||||
b.Property<long?>("CreatedBy")
|
||||
.HasColumnType("bigint")
|
||||
.HasColumnName("created_by");
|
||||
|
||||
b.Property<bool>("IsDeleted")
|
||||
.HasColumnType("boolean")
|
||||
.HasColumnName("is_deleted");
|
||||
|
||||
b.Property<DateTime?>("LastModified")
|
||||
.HasColumnType("timestamp without time zone")
|
||||
.HasColumnName("last_modified");
|
||||
|
||||
b.Property<long?>("LastModifiedBy")
|
||||
.HasColumnType("bigint")
|
||||
.HasColumnName("last_modified_by");
|
||||
|
||||
b.Property<string>("PassengerType")
|
||||
.IsRequired()
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("text")
|
||||
.HasDefaultValue("Unknown")
|
||||
.HasColumnName("passenger_type");
|
||||
|
||||
b.Property<long>("Version")
|
||||
.IsConcurrencyToken()
|
||||
.HasColumnType("bigint")
|
||||
.HasColumnName("version");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_passenger");
|
||||
|
||||
b.ToTable("passenger", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Passenger.Passengers.Models.Passenger", b =>
|
||||
{
|
||||
b.OwnsOne("Passenger.Passengers.Models.ValueObjects.Age", "Age", b1 =>
|
||||
{
|
||||
b1.Property<Guid>("PassengerId")
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("id");
|
||||
|
||||
b1.Property<int>("Value")
|
||||
.HasMaxLength(3)
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("age");
|
||||
|
||||
b1.HasKey("PassengerId")
|
||||
.HasName("pk_passenger");
|
||||
|
||||
b1.ToTable("passenger");
|
||||
|
||||
b1.WithOwner()
|
||||
.HasForeignKey("PassengerId")
|
||||
.HasConstraintName("fk_passenger_passenger_id");
|
||||
});
|
||||
|
||||
b.OwnsOne("Passenger.Passengers.Models.ValueObjects.Name", "Name", b1 =>
|
||||
{
|
||||
b1.Property<Guid>("PassengerId")
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("id");
|
||||
|
||||
b1.Property<string>("Value")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("character varying(50)")
|
||||
.HasColumnName("name");
|
||||
|
||||
b1.HasKey("PassengerId")
|
||||
.HasName("pk_passenger");
|
||||
|
||||
b1.ToTable("passenger");
|
||||
|
||||
b1.WithOwner()
|
||||
.HasForeignKey("PassengerId")
|
||||
.HasConstraintName("fk_passenger_passenger_id");
|
||||
});
|
||||
|
||||
b.OwnsOne("Passenger.Passengers.Models.ValueObjects.PassportNumber", "PassportNumber", b1 =>
|
||||
{
|
||||
b1.Property<Guid>("PassengerId")
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("id");
|
||||
|
||||
b1.Property<string>("Value")
|
||||
.IsRequired()
|
||||
.HasMaxLength(10)
|
||||
.HasColumnType("character varying(10)")
|
||||
.HasColumnName("passport_number");
|
||||
|
||||
b1.HasKey("PassengerId")
|
||||
.HasName("pk_passenger");
|
||||
|
||||
b1.ToTable("passenger");
|
||||
|
||||
b1.WithOwner()
|
||||
.HasForeignKey("PassengerId")
|
||||
.HasConstraintName("fk_passenger_passenger_id");
|
||||
});
|
||||
|
||||
b.Navigation("Age");
|
||||
|
||||
b.Navigation("Name");
|
||||
|
||||
b.Navigation("PassportNumber");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,133 +0,0 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Passenger.Data.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class AddValueObject : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "passport_number",
|
||||
table: "passenger",
|
||||
type: "character varying(10)",
|
||||
maxLength: 10,
|
||||
nullable: true,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "text",
|
||||
oldNullable: true);
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "passenger_type",
|
||||
table: "passenger",
|
||||
type: "text",
|
||||
nullable: false,
|
||||
defaultValue: "Unknown",
|
||||
oldClrType: typeof(int),
|
||||
oldType: "integer");
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "name",
|
||||
table: "passenger",
|
||||
type: "character varying(50)",
|
||||
maxLength: 50,
|
||||
nullable: true,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "text",
|
||||
oldNullable: true);
|
||||
|
||||
migrationBuilder.AlterColumn<DateTime>(
|
||||
name: "last_modified",
|
||||
table: "passenger",
|
||||
type: "timestamp without time zone",
|
||||
nullable: true,
|
||||
oldClrType: typeof(DateTime),
|
||||
oldType: "timestamp with time zone",
|
||||
oldNullable: true);
|
||||
|
||||
migrationBuilder.AlterColumn<DateTime>(
|
||||
name: "created_at",
|
||||
table: "passenger",
|
||||
type: "timestamp without time zone",
|
||||
nullable: true,
|
||||
oldClrType: typeof(DateTime),
|
||||
oldType: "timestamp with time zone",
|
||||
oldNullable: true);
|
||||
|
||||
migrationBuilder.AlterColumn<int>(
|
||||
name: "age",
|
||||
table: "passenger",
|
||||
type: "integer",
|
||||
maxLength: 3,
|
||||
nullable: true,
|
||||
oldClrType: typeof(int),
|
||||
oldType: "integer");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "passport_number",
|
||||
table: "passenger",
|
||||
type: "text",
|
||||
nullable: true,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "character varying(10)",
|
||||
oldMaxLength: 10,
|
||||
oldNullable: true);
|
||||
|
||||
migrationBuilder.AlterColumn<int>(
|
||||
name: "passenger_type",
|
||||
table: "passenger",
|
||||
type: "integer",
|
||||
nullable: false,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "text",
|
||||
oldDefaultValue: "Unknown");
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "name",
|
||||
table: "passenger",
|
||||
type: "text",
|
||||
nullable: true,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "character varying(50)",
|
||||
oldMaxLength: 50,
|
||||
oldNullable: true);
|
||||
|
||||
migrationBuilder.AlterColumn<DateTime>(
|
||||
name: "last_modified",
|
||||
table: "passenger",
|
||||
type: "timestamp with time zone",
|
||||
nullable: true,
|
||||
oldClrType: typeof(DateTime),
|
||||
oldType: "timestamp without time zone",
|
||||
oldNullable: true);
|
||||
|
||||
migrationBuilder.AlterColumn<DateTime>(
|
||||
name: "created_at",
|
||||
table: "passenger",
|
||||
type: "timestamp with time zone",
|
||||
nullable: true,
|
||||
oldClrType: typeof(DateTime),
|
||||
oldType: "timestamp without time zone",
|
||||
oldNullable: true);
|
||||
|
||||
migrationBuilder.AlterColumn<int>(
|
||||
name: "age",
|
||||
table: "passenger",
|
||||
type: "integer",
|
||||
nullable: false,
|
||||
defaultValue: 0,
|
||||
oldClrType: typeof(int),
|
||||
oldType: "integer",
|
||||
oldMaxLength: 3,
|
||||
oldNullable: true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,55 +0,0 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Passenger.Data.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class changebehavior : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AlterColumn<DateTime>(
|
||||
name: "last_modified",
|
||||
table: "passenger",
|
||||
type: "timestamp with time zone",
|
||||
nullable: true,
|
||||
oldClrType: typeof(DateTime),
|
||||
oldType: "timestamp without time zone",
|
||||
oldNullable: true);
|
||||
|
||||
migrationBuilder.AlterColumn<DateTime>(
|
||||
name: "created_at",
|
||||
table: "passenger",
|
||||
type: "timestamp with time zone",
|
||||
nullable: true,
|
||||
oldClrType: typeof(DateTime),
|
||||
oldType: "timestamp without time zone",
|
||||
oldNullable: true);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AlterColumn<DateTime>(
|
||||
name: "last_modified",
|
||||
table: "passenger",
|
||||
type: "timestamp without time zone",
|
||||
nullable: true,
|
||||
oldClrType: typeof(DateTime),
|
||||
oldType: "timestamp with time zone",
|
||||
oldNullable: true);
|
||||
|
||||
migrationBuilder.AlterColumn<DateTime>(
|
||||
name: "created_at",
|
||||
table: "passenger",
|
||||
type: "timestamp without time zone",
|
||||
nullable: true,
|
||||
oldClrType: typeof(DateTime),
|
||||
oldType: "timestamp with time zone",
|
||||
oldNullable: true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -12,8 +12,8 @@ using Passenger.Data;
|
||||
namespace Passenger.Data.Migrations
|
||||
{
|
||||
[DbContext(typeof(PassengerDbContext))]
|
||||
[Migration("20230526085126_change-behavior")]
|
||||
partial class changebehavior
|
||||
[Migration("20230611213031_initial")]
|
||||
partial class initial
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
@ -71,7 +71,7 @@ namespace Passenger.Data.Migrations
|
||||
|
||||
modelBuilder.Entity("Passenger.Passengers.Models.Passenger", b =>
|
||||
{
|
||||
b.OwnsOne("Passenger.Passengers.Models.ValueObjects.Age", "Age", b1 =>
|
||||
b.OwnsOne("Passenger.Passengers.ValueObjects.Age", "Age", b1 =>
|
||||
{
|
||||
b1.Property<Guid>("PassengerId")
|
||||
.HasColumnType("uuid")
|
||||
@ -92,7 +92,7 @@ namespace Passenger.Data.Migrations
|
||||
.HasConstraintName("fk_passenger_passenger_id");
|
||||
});
|
||||
|
||||
b.OwnsOne("Passenger.Passengers.Models.ValueObjects.Name", "Name", b1 =>
|
||||
b.OwnsOne("Passenger.Passengers.ValueObjects.Name", "Name", b1 =>
|
||||
{
|
||||
b1.Property<Guid>("PassengerId")
|
||||
.HasColumnType("uuid")
|
||||
@ -114,7 +114,7 @@ namespace Passenger.Data.Migrations
|
||||
.HasConstraintName("fk_passenger_passenger_id");
|
||||
});
|
||||
|
||||
b.OwnsOne("Passenger.Passengers.Models.ValueObjects.PassportNumber", "PassportNumber", b1 =>
|
||||
b.OwnsOne("Passenger.Passengers.ValueObjects.PassportNumber", "PassportNumber", b1 =>
|
||||
{
|
||||
b1.Property<Guid>("PassengerId")
|
||||
.HasColumnType("uuid")
|
||||
@ -138,9 +138,11 @@ namespace Passenger.Data.Migrations
|
||||
|
||||
b.Navigation("Age");
|
||||
|
||||
b.Navigation("Name");
|
||||
b.Navigation("Name")
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("PassportNumber");
|
||||
b.Navigation("PassportNumber")
|
||||
.IsRequired();
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
@ -16,10 +16,10 @@ namespace Passenger.Data.Migrations
|
||||
columns: table => new
|
||||
{
|
||||
id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
passportnumber = table.Column<string>(name: "passport_number", type: "text", nullable: true),
|
||||
name = table.Column<string>(type: "text", nullable: true),
|
||||
passengertype = table.Column<int>(name: "passenger_type", type: "integer", nullable: false),
|
||||
age = table.Column<int>(type: "integer", nullable: false),
|
||||
passportnumber = table.Column<string>(name: "passport_number", type: "character varying(10)", maxLength: 10, nullable: false),
|
||||
name = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false),
|
||||
passengertype = table.Column<string>(name: "passenger_type", type: "text", nullable: false, defaultValue: "Unknown"),
|
||||
age = table.Column<int>(type: "integer", maxLength: 3, nullable: true),
|
||||
createdat = table.Column<DateTime>(name: "created_at", type: "timestamp with time zone", nullable: true),
|
||||
createdby = table.Column<long>(name: "created_by", type: "bigint", nullable: true),
|
||||
lastmodified = table.Column<DateTime>(name: "last_modified", type: "timestamp with time zone", nullable: true),
|
||||
@ -68,7 +68,7 @@ namespace Passenger.Data.Migrations
|
||||
|
||||
modelBuilder.Entity("Passenger.Passengers.Models.Passenger", b =>
|
||||
{
|
||||
b.OwnsOne("Passenger.Passengers.Models.ValueObjects.Age", "Age", b1 =>
|
||||
b.OwnsOne("Passenger.Passengers.ValueObjects.Age", "Age", b1 =>
|
||||
{
|
||||
b1.Property<Guid>("PassengerId")
|
||||
.HasColumnType("uuid")
|
||||
@ -89,7 +89,7 @@ namespace Passenger.Data.Migrations
|
||||
.HasConstraintName("fk_passenger_passenger_id");
|
||||
});
|
||||
|
||||
b.OwnsOne("Passenger.Passengers.Models.ValueObjects.Name", "Name", b1 =>
|
||||
b.OwnsOne("Passenger.Passengers.ValueObjects.Name", "Name", b1 =>
|
||||
{
|
||||
b1.Property<Guid>("PassengerId")
|
||||
.HasColumnType("uuid")
|
||||
@ -111,7 +111,7 @@ namespace Passenger.Data.Migrations
|
||||
.HasConstraintName("fk_passenger_passenger_id");
|
||||
});
|
||||
|
||||
b.OwnsOne("Passenger.Passengers.Models.ValueObjects.PassportNumber", "PassportNumber", b1 =>
|
||||
b.OwnsOne("Passenger.Passengers.ValueObjects.PassportNumber", "PassportNumber", b1 =>
|
||||
{
|
||||
b1.Property<Guid>("PassengerId")
|
||||
.HasColumnType("uuid")
|
||||
@ -135,9 +135,11 @@ namespace Passenger.Data.Migrations
|
||||
|
||||
b.Navigation("Age");
|
||||
|
||||
b.Navigation("Name");
|
||||
b.Navigation("Name")
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("PassportNumber");
|
||||
b.Navigation("PassportNumber")
|
||||
.IsRequired();
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user