mirror of
https://github.com/meysamhadeli/booking-microservices.git
synced 2026-05-08 15:31:13 +08:00
some change in inMemoryTestHarness masstransit
This commit is contained in:
parent
63d48215ea
commit
3a2f555561
@ -7,7 +7,6 @@ using Microsoft.AspNetCore.Authentication;
|
|||||||
using Serilog;
|
using Serilog;
|
||||||
|
|
||||||
var builder = WebApplication.CreateBuilder(args);
|
var builder = WebApplication.CreateBuilder(args);
|
||||||
var configuration = builder.Configuration;
|
|
||||||
|
|
||||||
var appOptions = builder.Services.GetOptions<AppOptions>("AppOptions");
|
var appOptions = builder.Services.GetOptions<AppOptions>("AppOptions");
|
||||||
Console.WriteLine(FiggleFonts.Standard.Render(appOptions.Name));
|
Console.WriteLine(FiggleFonts.Standard.Render(appOptions.Name));
|
||||||
|
|||||||
@ -1,4 +1,6 @@
|
|||||||
using Microsoft.AspNetCore.Builder;
|
using Microsoft.AspNetCore.Builder;
|
||||||
|
using Microsoft.AspNetCore.Hosting;
|
||||||
|
using Microsoft.Extensions.Hosting;
|
||||||
using Serilog;
|
using Serilog;
|
||||||
using Serilog.Enrichers.Span;
|
using Serilog.Enrichers.Span;
|
||||||
using Serilog.Events;
|
using Serilog.Events;
|
||||||
@ -10,13 +12,15 @@ public static class Extensions
|
|||||||
{
|
{
|
||||||
public static WebApplicationBuilder AddCustomSerilog(this WebApplicationBuilder builder)
|
public static WebApplicationBuilder AddCustomSerilog(this WebApplicationBuilder builder)
|
||||||
{
|
{
|
||||||
|
|
||||||
Log.Logger = new LoggerConfiguration()
|
Log.Logger = new LoggerConfiguration()
|
||||||
.WriteTo.Console()
|
.WriteTo.Console()
|
||||||
.CreateBootstrapLogger();
|
.CreateBootstrapLogger();
|
||||||
|
|
||||||
builder.Host.UseSerilog((ctx, lc) => lc
|
builder.Host.UseSerilog((ctx, lc) => lc
|
||||||
.WriteTo.Console()
|
.WriteTo.Console()
|
||||||
.WriteTo.SpectreConsole("{Timestamp:HH:mm:ss} [{Level:u4}] {Message:lj}{NewLine}{Exception}", LogEventLevel.Error)
|
.WriteTo.SpectreConsole("{Timestamp:HH:mm:ss} [{Level:u4}] {Message:lj}{NewLine}{Exception}",
|
||||||
|
LogEventLevel.Error)
|
||||||
.MinimumLevel.Override("Microsoft.EntityFrameworkCore", LogEventLevel.Error)
|
.MinimumLevel.Override("Microsoft.EntityFrameworkCore", LogEventLevel.Error)
|
||||||
.Enrich.WithSpan()
|
.Enrich.WithSpan()
|
||||||
.Enrich.FromLogContext()
|
.Enrich.FromLogContext()
|
||||||
|
|||||||
@ -3,7 +3,9 @@ using BuildingBlocks.Domain.Event;
|
|||||||
using BuildingBlocks.Utils;
|
using BuildingBlocks.Utils;
|
||||||
using Humanizer;
|
using Humanizer;
|
||||||
using MassTransit;
|
using MassTransit;
|
||||||
|
using Microsoft.AspNetCore.Hosting;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using Microsoft.Extensions.Hosting;
|
||||||
|
|
||||||
namespace BuildingBlocks.MassTransit;
|
namespace BuildingBlocks.MassTransit;
|
||||||
|
|
||||||
@ -15,7 +17,9 @@ public static class Extensions
|
|||||||
bool.TryParse(Environment.GetEnvironmentVariable("DOTNET_RUNNING_IN_CONTAINER"), out var inContainer) &&
|
bool.TryParse(Environment.GetEnvironmentVariable("DOTNET_RUNNING_IN_CONTAINER"), out var inContainer) &&
|
||||||
inContainer;
|
inContainer;
|
||||||
|
|
||||||
public static IServiceCollection AddCustomMassTransit(this IServiceCollection services, Assembly assembly)
|
public static IServiceCollection AddCustomMassTransit(this IServiceCollection services, Assembly assembly, IWebHostEnvironment env)
|
||||||
|
{
|
||||||
|
if (!env.IsEnvironment("test"))
|
||||||
{
|
{
|
||||||
services.AddMassTransit(configure =>
|
services.AddMassTransit(configure =>
|
||||||
{
|
{
|
||||||
@ -65,6 +69,7 @@ public static class Extensions
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
return services;
|
return services;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -23,6 +23,7 @@ using Serilog;
|
|||||||
|
|
||||||
var builder = WebApplication.CreateBuilder(args);
|
var builder = WebApplication.CreateBuilder(args);
|
||||||
var configuration = builder.Configuration;
|
var configuration = builder.Configuration;
|
||||||
|
var env = builder.Environment;
|
||||||
|
|
||||||
var appOptions = builder.Services.GetOptions<AppOptions>("AppOptions");
|
var appOptions = builder.Services.GetOptions<AppOptions>("AppOptions");
|
||||||
builder.Services.Configure<GrpcOptions>(options => configuration.GetSection("Grpc").Bind(options));
|
builder.Services.Configure<GrpcOptions>(options => configuration.GetSection("Grpc").Bind(options));
|
||||||
@ -46,7 +47,7 @@ builder.Services.AddHttpContextAccessor();
|
|||||||
builder.Services.AddTransient<IEventMapper, EventMapper>();
|
builder.Services.AddTransient<IEventMapper, EventMapper>();
|
||||||
builder.Services.AddTransient<IBusPublisher, BusPublisher>();
|
builder.Services.AddTransient<IBusPublisher, BusPublisher>();
|
||||||
|
|
||||||
builder.Services.AddCustomMassTransit(typeof(BookingRoot).Assembly);
|
builder.Services.AddCustomMassTransit(typeof(BookingRoot).Assembly, env);
|
||||||
builder.Services.AddCustomOpenTelemetry();
|
builder.Services.AddCustomOpenTelemetry();
|
||||||
builder.Services.AddTransient<AuthHeaderHandler>();
|
builder.Services.AddTransient<AuthHeaderHandler>();
|
||||||
SnowFlakIdGenerator.Configure(3);
|
SnowFlakIdGenerator.Configure(3);
|
||||||
|
|||||||
@ -7,7 +7,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"ConnectionStrings": {
|
"ConnectionStrings": {
|
||||||
"BookingConnection": "Server=db;Database=BookingDB;User ID=sa;Password=@Aa123456"
|
"DefaultConnection": "Server=db;Database=BookingDB;User ID=sa;Password=@Aa123456"
|
||||||
},
|
},
|
||||||
"RabbitMq": {
|
"RabbitMq": {
|
||||||
"HostName": "rabbitmq",
|
"HostName": "rabbitmq",
|
||||||
|
|||||||
@ -8,6 +8,7 @@ using BuildingBlocks.Jwt;
|
|||||||
using BuildingBlocks.Logging;
|
using BuildingBlocks.Logging;
|
||||||
using BuildingBlocks.Mapster;
|
using BuildingBlocks.Mapster;
|
||||||
using BuildingBlocks.MassTransit;
|
using BuildingBlocks.MassTransit;
|
||||||
|
using BuildingBlocks.Mongo;
|
||||||
using BuildingBlocks.OpenTelemetry;
|
using BuildingBlocks.OpenTelemetry;
|
||||||
using BuildingBlocks.Swagger;
|
using BuildingBlocks.Swagger;
|
||||||
using BuildingBlocks.Utils;
|
using BuildingBlocks.Utils;
|
||||||
@ -23,59 +24,50 @@ using Microsoft.AspNetCore.Mvc.ApiExplorer;
|
|||||||
using Prometheus;
|
using Prometheus;
|
||||||
using Serilog;
|
using Serilog;
|
||||||
|
|
||||||
|
|
||||||
var builder = WebApplication.CreateBuilder(args);
|
var builder = WebApplication.CreateBuilder(args);
|
||||||
|
|
||||||
RegisterServices(builder);
|
|
||||||
|
|
||||||
var app = builder.Build();
|
|
||||||
|
|
||||||
ConfigureApplication(app);
|
|
||||||
|
|
||||||
app.Run();
|
|
||||||
|
|
||||||
static void RegisterServices(WebApplicationBuilder builder)
|
|
||||||
{
|
|
||||||
var configuration = builder.Configuration;
|
var configuration = builder.Configuration;
|
||||||
var services = builder.Services;
|
var env = builder.Environment;
|
||||||
|
|
||||||
var appOptions = services.GetOptions<AppOptions>("AppOptions");
|
var appOptions = builder.Services.GetOptions<AppOptions>("AppOptions");
|
||||||
Console.WriteLine(FiggleFonts.Standard.Render(appOptions.Name));
|
Console.WriteLine(FiggleFonts.Standard.Render(appOptions.Name));
|
||||||
|
|
||||||
|
builder.Services.AddCustomDbContext<FlightDbContext>(configuration, typeof(FlightRoot).Assembly);
|
||||||
|
builder.Services.AddMongoDbContext<FlightReadDbContext>(configuration);
|
||||||
|
|
||||||
|
builder.Services.AddScoped<IDataSeeder, FlightDataSeeder>();
|
||||||
builder.AddCustomSerilog();
|
builder.AddCustomSerilog();
|
||||||
|
builder.Services.AddJwt();
|
||||||
|
builder.Services.AddControllers();
|
||||||
|
builder.Services.AddCustomSwagger(builder.Configuration, typeof(FlightRoot).Assembly);
|
||||||
|
builder.Services.AddCustomVersioning();
|
||||||
|
builder.Services.AddCustomMediatR();
|
||||||
|
builder.Services.AddValidatorsFromAssembly(typeof(FlightRoot).Assembly);
|
||||||
|
builder.Services.AddCustomProblemDetails();
|
||||||
|
builder.Services.AddCustomMapster(typeof(FlightRoot).Assembly);
|
||||||
|
builder.Services.AddHttpContextAccessor();
|
||||||
|
builder.Services.AddTransient<IEventMapper, EventMapper>();
|
||||||
|
builder.Services.AddCustomMassTransit(typeof(FlightRoot).Assembly, env);
|
||||||
|
builder.Services.AddCustomOpenTelemetry();
|
||||||
|
builder.Services.AddRouting(options => options.LowercaseUrls = true);
|
||||||
|
|
||||||
services.AddCustomDbContext<FlightDbContext>(configuration, typeof(FlightRoot).Assembly);
|
builder.Services.AddGrpc(options =>
|
||||||
services.AddScoped<IDataSeeder, FlightDataSeeder>();
|
|
||||||
services.AddJwt();
|
|
||||||
services.AddControllers();
|
|
||||||
services.AddCustomSwagger(builder.Configuration, typeof(FlightRoot).Assembly);
|
|
||||||
services.AddCustomVersioning();
|
|
||||||
services.AddCustomMediatR();
|
|
||||||
services.AddValidatorsFromAssembly(typeof(FlightRoot).Assembly);
|
|
||||||
services.AddCustomProblemDetails();
|
|
||||||
services.AddCustomMapster(typeof(FlightRoot).Assembly);
|
|
||||||
services.AddHttpContextAccessor();
|
|
||||||
services.AddTransient<IEventMapper, EventMapper>();
|
|
||||||
services.AddCustomMassTransit(typeof(FlightRoot).Assembly);
|
|
||||||
services.AddCustomOpenTelemetry();
|
|
||||||
services.AddRouting(options => options.LowercaseUrls = true);
|
|
||||||
|
|
||||||
services.AddGrpc(options =>
|
|
||||||
{
|
{
|
||||||
options.Interceptors.Add<GrpcExceptionInterceptor>();
|
options.Interceptors.Add<GrpcExceptionInterceptor>();
|
||||||
});
|
});
|
||||||
|
|
||||||
services.AddMagicOnion();
|
builder.Services.AddMagicOnion();
|
||||||
|
|
||||||
SnowFlakIdGenerator.Configure(1);
|
SnowFlakIdGenerator.Configure(1);
|
||||||
|
|
||||||
services.AddCachingRequest(new List<Assembly> {typeof(FlightRoot).Assembly});
|
builder.Services.AddCachingRequest(new List<Assembly>
|
||||||
|
|
||||||
services.AddEasyCaching(options => { options.UseInMemory(configuration, "mem"); });
|
|
||||||
}
|
|
||||||
|
|
||||||
static void ConfigureApplication(WebApplication app)
|
|
||||||
{
|
{
|
||||||
var appOptions = app.GetOptions<AppOptions>("AppOptions");
|
typeof(FlightRoot).Assembly
|
||||||
|
});
|
||||||
|
|
||||||
|
builder.Services.AddEasyCaching(options => { options.UseInMemory(configuration, "mem"); });
|
||||||
|
|
||||||
|
var app = builder.Build();
|
||||||
|
|
||||||
if (app.Environment.IsDevelopment())
|
if (app.Environment.IsDevelopment())
|
||||||
{
|
{
|
||||||
@ -93,6 +85,8 @@ static void ConfigureApplication(WebApplication app)
|
|||||||
app.UseAuthentication();
|
app.UseAuthentication();
|
||||||
app.UseAuthorization();
|
app.UseAuthorization();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
app.UseEndpoints(endpoints =>
|
app.UseEndpoints(endpoints =>
|
||||||
{
|
{
|
||||||
endpoints.MapControllers();
|
endpoints.MapControllers();
|
||||||
@ -101,6 +95,6 @@ static void ConfigureApplication(WebApplication app)
|
|||||||
});
|
});
|
||||||
|
|
||||||
app.MapGet("/", x => x.Response.WriteAsync(appOptions.Name));
|
app.MapGet("/", x => x.Response.WriteAsync(appOptions.Name));
|
||||||
}
|
app.Run();
|
||||||
|
|
||||||
public partial class Program {}
|
public partial class Program {}
|
||||||
|
|||||||
@ -7,7 +7,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"ConnectionStrings": {
|
"ConnectionStrings": {
|
||||||
"FlightConnection": "Server=db;Database=FlightDB;User ID=sa;Password=@Aa123456"
|
"DefaultConnection": "Server=db;Database=FlightDB;User ID=sa;Password=@Aa123456"
|
||||||
},
|
},
|
||||||
"Jwt": {
|
"Jwt": {
|
||||||
"Authority": "https://localhost:5005",
|
"Authority": "https://localhost:5005",
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"ConnectionStrings": {
|
"ConnectionStrings": {
|
||||||
"FlightConnection": "Server=db;Database=FlightDB;User ID=sa;Password=@Aa123456"
|
"DefaultConnection": "Server=.\\sqlexpress;Database=FlightDBTest;Trusted_Connection=True;MultipleActiveResultSets=true"
|
||||||
},
|
},
|
||||||
"RabbitMq": {
|
"RabbitMq": {
|
||||||
"HostName": "rabbitmq",
|
"HostName": "rabbitmq",
|
||||||
|
|||||||
@ -1,221 +0,0 @@
|
|||||||
// <auto-generated />
|
|
||||||
using System;
|
|
||||||
using Flight.Data;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
|
||||||
using Microsoft.EntityFrameworkCore.Metadata;
|
|
||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
|
||||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
namespace Flight.Data.Migrations
|
|
||||||
{
|
|
||||||
[DbContext(typeof(FlightDbContext))]
|
|
||||||
[Migration("20220303140107_Init")]
|
|
||||||
partial class Init
|
|
||||||
{
|
|
||||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
|
||||||
{
|
|
||||||
#pragma warning disable 612, 618
|
|
||||||
modelBuilder
|
|
||||||
.HasAnnotation("ProductVersion", "6.0.1")
|
|
||||||
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
|
||||||
|
|
||||||
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1);
|
|
||||||
|
|
||||||
modelBuilder.Entity("BuildingBlocks.Outbox.OutboxMessage", b =>
|
|
||||||
{
|
|
||||||
b.Property<Guid>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("uniqueidentifier");
|
|
||||||
|
|
||||||
b.Property<string>("CorrelationId")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("Data")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("EventType")
|
|
||||||
.IsRequired()
|
|
||||||
.HasMaxLength(50)
|
|
||||||
.IsUnicode(false)
|
|
||||||
.HasColumnType("varchar(50)");
|
|
||||||
|
|
||||||
b.Property<string>("Name")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<DateTime>("OccurredOn")
|
|
||||||
.HasColumnType("datetime2");
|
|
||||||
|
|
||||||
b.Property<DateTime?>("ProcessedOn")
|
|
||||||
.HasColumnType("datetime2");
|
|
||||||
|
|
||||||
b.Property<string>("Type")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.ToTable("OutboxMessages", (string)null);
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Flight.Aircraft.Models.Aircraft", b =>
|
|
||||||
{
|
|
||||||
b.Property<long>("Id")
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
b.Property<bool>("IsDeleted")
|
|
||||||
.HasColumnType("bit");
|
|
||||||
|
|
||||||
b.Property<DateTime>("LastModified")
|
|
||||||
.HasColumnType("datetime2");
|
|
||||||
|
|
||||||
b.Property<int>("ManufacturingYear")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<string>("Model")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("Name")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.ToTable("Aircraft", "dbo");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Flight.Airport.Models.Airport", b =>
|
|
||||||
{
|
|
||||||
b.Property<long>("Id")
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
b.Property<string>("Address")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("Code")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<bool>("IsDeleted")
|
|
||||||
.HasColumnType("bit");
|
|
||||||
|
|
||||||
b.Property<DateTime>("LastModified")
|
|
||||||
.HasColumnType("datetime2");
|
|
||||||
|
|
||||||
b.Property<string>("Name")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.ToTable("Airport", "dbo");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Flight.Flight.Models.Flight", b =>
|
|
||||||
{
|
|
||||||
b.Property<long>("Id")
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
b.Property<long>("AircraftId")
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
b.Property<long>("ArriveAirportId")
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
b.Property<DateTime>("ArriveDate")
|
|
||||||
.HasColumnType("datetime2");
|
|
||||||
|
|
||||||
b.Property<long>("DepartureAirportId")
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
b.Property<DateTime>("DepartureDate")
|
|
||||||
.HasColumnType("datetime2");
|
|
||||||
|
|
||||||
b.Property<decimal>("DurationMinutes")
|
|
||||||
.HasColumnType("decimal(18,2)");
|
|
||||||
|
|
||||||
b.Property<DateTime>("FlightDate")
|
|
||||||
.HasColumnType("datetime2");
|
|
||||||
|
|
||||||
b.Property<string>("FlightNumber")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<bool>("IsDeleted")
|
|
||||||
.HasColumnType("bit");
|
|
||||||
|
|
||||||
b.Property<DateTime>("LastModified")
|
|
||||||
.HasColumnType("datetime2");
|
|
||||||
|
|
||||||
b.Property<decimal>("Price")
|
|
||||||
.HasColumnType("decimal(18,2)");
|
|
||||||
|
|
||||||
b.Property<int>("Status")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.HasIndex("AircraftId");
|
|
||||||
|
|
||||||
b.HasIndex("ArriveAirportId");
|
|
||||||
|
|
||||||
b.ToTable("Flight", "dbo");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Flight.Flight.Models.Seat", b =>
|
|
||||||
{
|
|
||||||
b.Property<long>("Id")
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
b.Property<int>("Class")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<long>("FlightId")
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
b.Property<bool>("IsDeleted")
|
|
||||||
.HasColumnType("bit");
|
|
||||||
|
|
||||||
b.Property<DateTime>("LastModified")
|
|
||||||
.HasColumnType("datetime2");
|
|
||||||
|
|
||||||
b.Property<string>("SeatNumber")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<int>("Type")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.HasIndex("FlightId");
|
|
||||||
|
|
||||||
b.ToTable("Seat", "dbo");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Flight.Flight.Models.Flight", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("Flight.Aircraft.Models.Aircraft", null)
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("AircraftId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.HasOne("Flight.Airport.Models.Airport", null)
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("ArriveAirportId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Flight.Flight.Models.Seat", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("Flight.Flight.Models.Flight", null)
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("FlightId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
});
|
|
||||||
#pragma warning restore 612, 618
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,233 +0,0 @@
|
|||||||
// <auto-generated />
|
|
||||||
using System;
|
|
||||||
using Flight.Data;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
|
||||||
using Microsoft.EntityFrameworkCore.Metadata;
|
|
||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
|
||||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
namespace Flight.Data.Migrations
|
|
||||||
{
|
|
||||||
[DbContext(typeof(FlightDbContext))]
|
|
||||||
[Migration("20220303172333_ModifiedBy-to-entities")]
|
|
||||||
partial class ModifiedBytoentities
|
|
||||||
{
|
|
||||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
|
||||||
{
|
|
||||||
#pragma warning disable 612, 618
|
|
||||||
modelBuilder
|
|
||||||
.HasAnnotation("ProductVersion", "6.0.1")
|
|
||||||
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
|
||||||
|
|
||||||
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1);
|
|
||||||
|
|
||||||
modelBuilder.Entity("BuildingBlocks.Outbox.OutboxMessage", b =>
|
|
||||||
{
|
|
||||||
b.Property<Guid>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("uniqueidentifier");
|
|
||||||
|
|
||||||
b.Property<string>("CorrelationId")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("Data")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("EventType")
|
|
||||||
.IsRequired()
|
|
||||||
.HasMaxLength(50)
|
|
||||||
.IsUnicode(false)
|
|
||||||
.HasColumnType("varchar(50)");
|
|
||||||
|
|
||||||
b.Property<string>("Name")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<DateTime>("OccurredOn")
|
|
||||||
.HasColumnType("datetime2");
|
|
||||||
|
|
||||||
b.Property<DateTime?>("ProcessedOn")
|
|
||||||
.HasColumnType("datetime2");
|
|
||||||
|
|
||||||
b.Property<string>("Type")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.ToTable("OutboxMessages", (string)null);
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Flight.Aircraft.Models.Aircraft", b =>
|
|
||||||
{
|
|
||||||
b.Property<long>("Id")
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
b.Property<bool>("IsDeleted")
|
|
||||||
.HasColumnType("bit");
|
|
||||||
|
|
||||||
b.Property<DateTime>("LastModified")
|
|
||||||
.HasColumnType("datetime2");
|
|
||||||
|
|
||||||
b.Property<int>("ManufacturingYear")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<string>("Model")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<int?>("ModifiedBy")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<string>("Name")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.ToTable("Aircraft", "dbo");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Flight.Airport.Models.Airport", b =>
|
|
||||||
{
|
|
||||||
b.Property<long>("Id")
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
b.Property<string>("Address")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("Code")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<bool>("IsDeleted")
|
|
||||||
.HasColumnType("bit");
|
|
||||||
|
|
||||||
b.Property<DateTime>("LastModified")
|
|
||||||
.HasColumnType("datetime2");
|
|
||||||
|
|
||||||
b.Property<int?>("ModifiedBy")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<string>("Name")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.ToTable("Airport", "dbo");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Flight.Flight.Models.Flight", b =>
|
|
||||||
{
|
|
||||||
b.Property<long>("Id")
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
b.Property<long>("AircraftId")
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
b.Property<long>("ArriveAirportId")
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
b.Property<DateTime>("ArriveDate")
|
|
||||||
.HasColumnType("datetime2");
|
|
||||||
|
|
||||||
b.Property<long>("DepartureAirportId")
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
b.Property<DateTime>("DepartureDate")
|
|
||||||
.HasColumnType("datetime2");
|
|
||||||
|
|
||||||
b.Property<decimal>("DurationMinutes")
|
|
||||||
.HasColumnType("decimal(18,2)");
|
|
||||||
|
|
||||||
b.Property<DateTime>("FlightDate")
|
|
||||||
.HasColumnType("datetime2");
|
|
||||||
|
|
||||||
b.Property<string>("FlightNumber")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<bool>("IsDeleted")
|
|
||||||
.HasColumnType("bit");
|
|
||||||
|
|
||||||
b.Property<DateTime>("LastModified")
|
|
||||||
.HasColumnType("datetime2");
|
|
||||||
|
|
||||||
b.Property<int?>("ModifiedBy")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<decimal>("Price")
|
|
||||||
.HasColumnType("decimal(18,2)");
|
|
||||||
|
|
||||||
b.Property<int>("Status")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.HasIndex("AircraftId");
|
|
||||||
|
|
||||||
b.HasIndex("ArriveAirportId");
|
|
||||||
|
|
||||||
b.ToTable("Flight", "dbo");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Flight.Flight.Models.Seat", b =>
|
|
||||||
{
|
|
||||||
b.Property<long>("Id")
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
b.Property<int>("Class")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<long>("FlightId")
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
b.Property<bool>("IsDeleted")
|
|
||||||
.HasColumnType("bit");
|
|
||||||
|
|
||||||
b.Property<DateTime>("LastModified")
|
|
||||||
.HasColumnType("datetime2");
|
|
||||||
|
|
||||||
b.Property<int?>("ModifiedBy")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<string>("SeatNumber")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<int>("Type")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.HasIndex("FlightId");
|
|
||||||
|
|
||||||
b.ToTable("Seat", "dbo");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Flight.Flight.Models.Flight", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("Flight.Aircraft.Models.Aircraft", null)
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("AircraftId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.HasOne("Flight.Airport.Models.Airport", null)
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("ArriveAirportId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Flight.Flight.Models.Seat", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("Flight.Flight.Models.Flight", null)
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("FlightId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
});
|
|
||||||
#pragma warning restore 612, 618
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,63 +0,0 @@
|
|||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
namespace Flight.Data.Migrations
|
|
||||||
{
|
|
||||||
public partial class ModifiedBytoentities : Migration
|
|
||||||
{
|
|
||||||
protected override void Up(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.AddColumn<int>(
|
|
||||||
name: "ModifiedBy",
|
|
||||||
schema: "dbo",
|
|
||||||
table: "Seat",
|
|
||||||
type: "int",
|
|
||||||
nullable: true);
|
|
||||||
|
|
||||||
migrationBuilder.AddColumn<int>(
|
|
||||||
name: "ModifiedBy",
|
|
||||||
schema: "dbo",
|
|
||||||
table: "Flight",
|
|
||||||
type: "int",
|
|
||||||
nullable: true);
|
|
||||||
|
|
||||||
migrationBuilder.AddColumn<int>(
|
|
||||||
name: "ModifiedBy",
|
|
||||||
schema: "dbo",
|
|
||||||
table: "Airport",
|
|
||||||
type: "int",
|
|
||||||
nullable: true);
|
|
||||||
|
|
||||||
migrationBuilder.AddColumn<int>(
|
|
||||||
name: "ModifiedBy",
|
|
||||||
schema: "dbo",
|
|
||||||
table: "Aircraft",
|
|
||||||
type: "int",
|
|
||||||
nullable: true);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void Down(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.DropColumn(
|
|
||||||
name: "ModifiedBy",
|
|
||||||
schema: "dbo",
|
|
||||||
table: "Seat");
|
|
||||||
|
|
||||||
migrationBuilder.DropColumn(
|
|
||||||
name: "ModifiedBy",
|
|
||||||
schema: "dbo",
|
|
||||||
table: "Flight");
|
|
||||||
|
|
||||||
migrationBuilder.DropColumn(
|
|
||||||
name: "ModifiedBy",
|
|
||||||
schema: "dbo",
|
|
||||||
table: "Airport");
|
|
||||||
|
|
||||||
migrationBuilder.DropColumn(
|
|
||||||
name: "ModifiedBy",
|
|
||||||
schema: "dbo",
|
|
||||||
table: "Aircraft");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,233 +0,0 @@
|
|||||||
// <auto-generated />
|
|
||||||
using System;
|
|
||||||
using Flight.Data;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
|
||||||
using Microsoft.EntityFrameworkCore.Metadata;
|
|
||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
|
||||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
namespace Flight.Data.Migrations
|
|
||||||
{
|
|
||||||
[DbContext(typeof(FlightDbContext))]
|
|
||||||
[Migration("20220303182534_Change-corrolationId-type-outbox")]
|
|
||||||
partial class ChangecorrolationIdtypeoutbox
|
|
||||||
{
|
|
||||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
|
||||||
{
|
|
||||||
#pragma warning disable 612, 618
|
|
||||||
modelBuilder
|
|
||||||
.HasAnnotation("ProductVersion", "6.0.1")
|
|
||||||
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
|
||||||
|
|
||||||
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1);
|
|
||||||
|
|
||||||
modelBuilder.Entity("BuildingBlocks.Outbox.OutboxMessage", b =>
|
|
||||||
{
|
|
||||||
b.Property<Guid>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("uniqueidentifier");
|
|
||||||
|
|
||||||
b.Property<Guid?>("CorrelationId")
|
|
||||||
.HasColumnType("uniqueidentifier");
|
|
||||||
|
|
||||||
b.Property<string>("Data")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("EventType")
|
|
||||||
.IsRequired()
|
|
||||||
.HasMaxLength(50)
|
|
||||||
.IsUnicode(false)
|
|
||||||
.HasColumnType("varchar(50)");
|
|
||||||
|
|
||||||
b.Property<string>("Name")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<DateTime>("OccurredOn")
|
|
||||||
.HasColumnType("datetime2");
|
|
||||||
|
|
||||||
b.Property<DateTime?>("ProcessedOn")
|
|
||||||
.HasColumnType("datetime2");
|
|
||||||
|
|
||||||
b.Property<string>("Type")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.ToTable("OutboxMessages", (string)null);
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Flight.Aircraft.Models.Aircraft", b =>
|
|
||||||
{
|
|
||||||
b.Property<long>("Id")
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
b.Property<bool>("IsDeleted")
|
|
||||||
.HasColumnType("bit");
|
|
||||||
|
|
||||||
b.Property<DateTime>("LastModified")
|
|
||||||
.HasColumnType("datetime2");
|
|
||||||
|
|
||||||
b.Property<int>("ManufacturingYear")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<string>("Model")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<int?>("ModifiedBy")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<string>("Name")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.ToTable("Aircraft", "dbo");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Flight.Airport.Models.Airport", b =>
|
|
||||||
{
|
|
||||||
b.Property<long>("Id")
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
b.Property<string>("Address")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("Code")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<bool>("IsDeleted")
|
|
||||||
.HasColumnType("bit");
|
|
||||||
|
|
||||||
b.Property<DateTime>("LastModified")
|
|
||||||
.HasColumnType("datetime2");
|
|
||||||
|
|
||||||
b.Property<int?>("ModifiedBy")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<string>("Name")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.ToTable("Airport", "dbo");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Flight.Flight.Models.Flight", b =>
|
|
||||||
{
|
|
||||||
b.Property<long>("Id")
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
b.Property<long>("AircraftId")
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
b.Property<long>("ArriveAirportId")
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
b.Property<DateTime>("ArriveDate")
|
|
||||||
.HasColumnType("datetime2");
|
|
||||||
|
|
||||||
b.Property<long>("DepartureAirportId")
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
b.Property<DateTime>("DepartureDate")
|
|
||||||
.HasColumnType("datetime2");
|
|
||||||
|
|
||||||
b.Property<decimal>("DurationMinutes")
|
|
||||||
.HasColumnType("decimal(18,2)");
|
|
||||||
|
|
||||||
b.Property<DateTime>("FlightDate")
|
|
||||||
.HasColumnType("datetime2");
|
|
||||||
|
|
||||||
b.Property<string>("FlightNumber")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<bool>("IsDeleted")
|
|
||||||
.HasColumnType("bit");
|
|
||||||
|
|
||||||
b.Property<DateTime>("LastModified")
|
|
||||||
.HasColumnType("datetime2");
|
|
||||||
|
|
||||||
b.Property<int?>("ModifiedBy")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<decimal>("Price")
|
|
||||||
.HasColumnType("decimal(18,2)");
|
|
||||||
|
|
||||||
b.Property<int>("Status")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.HasIndex("AircraftId");
|
|
||||||
|
|
||||||
b.HasIndex("ArriveAirportId");
|
|
||||||
|
|
||||||
b.ToTable("Flight", "dbo");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Flight.Flight.Models.Seat", b =>
|
|
||||||
{
|
|
||||||
b.Property<long>("Id")
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
b.Property<int>("Class")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<long>("FlightId")
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
b.Property<bool>("IsDeleted")
|
|
||||||
.HasColumnType("bit");
|
|
||||||
|
|
||||||
b.Property<DateTime>("LastModified")
|
|
||||||
.HasColumnType("datetime2");
|
|
||||||
|
|
||||||
b.Property<int?>("ModifiedBy")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<string>("SeatNumber")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<int>("Type")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.HasIndex("FlightId");
|
|
||||||
|
|
||||||
b.ToTable("Seat", "dbo");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Flight.Flight.Models.Flight", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("Flight.Aircraft.Models.Aircraft", null)
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("AircraftId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.HasOne("Flight.Airport.Models.Airport", null)
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("ArriveAirportId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Flight.Flight.Models.Seat", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("Flight.Flight.Models.Flight", null)
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("FlightId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
});
|
|
||||||
#pragma warning restore 612, 618
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,34 +0,0 @@
|
|||||||
using System;
|
|
||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
namespace Flight.Data.Migrations
|
|
||||||
{
|
|
||||||
public partial class ChangecorrolationIdtypeoutbox : Migration
|
|
||||||
{
|
|
||||||
protected override void Up(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.AlterColumn<Guid>(
|
|
||||||
name: "CorrelationId",
|
|
||||||
table: "OutboxMessages",
|
|
||||||
type: "uniqueidentifier",
|
|
||||||
nullable: true,
|
|
||||||
oldClrType: typeof(string),
|
|
||||||
oldType: "nvarchar(max)",
|
|
||||||
oldNullable: true);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void Down(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.AlterColumn<string>(
|
|
||||||
name: "CorrelationId",
|
|
||||||
table: "OutboxMessages",
|
|
||||||
type: "nvarchar(max)",
|
|
||||||
nullable: true,
|
|
||||||
oldClrType: typeof(Guid),
|
|
||||||
oldType: "uniqueidentifier",
|
|
||||||
oldNullable: true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,245 +0,0 @@
|
|||||||
// <auto-generated />
|
|
||||||
using System;
|
|
||||||
using Flight.Data;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
|
||||||
using Microsoft.EntityFrameworkCore.Metadata;
|
|
||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
|
||||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
namespace Flight.Data.Migrations
|
|
||||||
{
|
|
||||||
[DbContext(typeof(FlightDbContext))]
|
|
||||||
[Migration("20220415203349_Add-Versening")]
|
|
||||||
partial class AddVersening
|
|
||||||
{
|
|
||||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
|
||||||
{
|
|
||||||
#pragma warning disable 612, 618
|
|
||||||
modelBuilder
|
|
||||||
.HasAnnotation("ProductVersion", "6.0.1")
|
|
||||||
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
|
||||||
|
|
||||||
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1);
|
|
||||||
|
|
||||||
modelBuilder.Entity("BuildingBlocks.Outbox.OutboxMessage", b =>
|
|
||||||
{
|
|
||||||
b.Property<Guid>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("uniqueidentifier");
|
|
||||||
|
|
||||||
b.Property<Guid?>("CorrelationId")
|
|
||||||
.HasColumnType("uniqueidentifier");
|
|
||||||
|
|
||||||
b.Property<string>("Data")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("EventType")
|
|
||||||
.IsRequired()
|
|
||||||
.HasMaxLength(50)
|
|
||||||
.IsUnicode(false)
|
|
||||||
.HasColumnType("varchar(50)");
|
|
||||||
|
|
||||||
b.Property<string>("Name")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<DateTime>("OccurredOn")
|
|
||||||
.HasColumnType("datetime2");
|
|
||||||
|
|
||||||
b.Property<DateTime?>("ProcessedOn")
|
|
||||||
.HasColumnType("datetime2");
|
|
||||||
|
|
||||||
b.Property<string>("Type")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.ToTable("OutboxMessages", (string)null);
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Flight.Aircraft.Models.Aircraft", b =>
|
|
||||||
{
|
|
||||||
b.Property<long>("Id")
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
b.Property<bool>("IsDeleted")
|
|
||||||
.HasColumnType("bit");
|
|
||||||
|
|
||||||
b.Property<DateTime>("LastModified")
|
|
||||||
.HasColumnType("datetime2");
|
|
||||||
|
|
||||||
b.Property<int>("ManufacturingYear")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<string>("Model")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<int?>("ModifiedBy")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<string>("Name")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<long>("Version")
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.ToTable("Aircraft", "dbo");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Flight.Airport.Models.Airport", b =>
|
|
||||||
{
|
|
||||||
b.Property<long>("Id")
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
b.Property<string>("Address")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("Code")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<bool>("IsDeleted")
|
|
||||||
.HasColumnType("bit");
|
|
||||||
|
|
||||||
b.Property<DateTime>("LastModified")
|
|
||||||
.HasColumnType("datetime2");
|
|
||||||
|
|
||||||
b.Property<int?>("ModifiedBy")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<string>("Name")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<long>("Version")
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.ToTable("Airport", "dbo");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Flight.Flight.Models.Flight", b =>
|
|
||||||
{
|
|
||||||
b.Property<long>("Id")
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
b.Property<long>("AircraftId")
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
b.Property<long>("ArriveAirportId")
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
b.Property<DateTime>("ArriveDate")
|
|
||||||
.HasColumnType("datetime2");
|
|
||||||
|
|
||||||
b.Property<long>("DepartureAirportId")
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
b.Property<DateTime>("DepartureDate")
|
|
||||||
.HasColumnType("datetime2");
|
|
||||||
|
|
||||||
b.Property<decimal>("DurationMinutes")
|
|
||||||
.HasColumnType("decimal(18,2)");
|
|
||||||
|
|
||||||
b.Property<DateTime>("FlightDate")
|
|
||||||
.HasColumnType("datetime2");
|
|
||||||
|
|
||||||
b.Property<string>("FlightNumber")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<bool>("IsDeleted")
|
|
||||||
.HasColumnType("bit");
|
|
||||||
|
|
||||||
b.Property<DateTime>("LastModified")
|
|
||||||
.HasColumnType("datetime2");
|
|
||||||
|
|
||||||
b.Property<int?>("ModifiedBy")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<decimal>("Price")
|
|
||||||
.HasColumnType("decimal(18,2)");
|
|
||||||
|
|
||||||
b.Property<int>("Status")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<long>("Version")
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.HasIndex("AircraftId");
|
|
||||||
|
|
||||||
b.HasIndex("ArriveAirportId");
|
|
||||||
|
|
||||||
b.ToTable("Flight", "dbo");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Flight.Flight.Models.Seat", b =>
|
|
||||||
{
|
|
||||||
b.Property<long>("Id")
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
b.Property<int>("Class")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<long>("FlightId")
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
b.Property<bool>("IsDeleted")
|
|
||||||
.HasColumnType("bit");
|
|
||||||
|
|
||||||
b.Property<DateTime>("LastModified")
|
|
||||||
.HasColumnType("datetime2");
|
|
||||||
|
|
||||||
b.Property<int?>("ModifiedBy")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<string>("SeatNumber")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<int>("Type")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<long>("Version")
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.HasIndex("FlightId");
|
|
||||||
|
|
||||||
b.ToTable("Seat", "dbo");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Flight.Flight.Models.Flight", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("Flight.Aircraft.Models.Aircraft", null)
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("AircraftId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.HasOne("Flight.Airport.Models.Airport", null)
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("ArriveAirportId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Flight.Flight.Models.Seat", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("Flight.Flight.Models.Flight", null)
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("FlightId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
});
|
|
||||||
#pragma warning restore 612, 618
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,67 +0,0 @@
|
|||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
namespace Flight.Data.Migrations
|
|
||||||
{
|
|
||||||
public partial class AddVersening : Migration
|
|
||||||
{
|
|
||||||
protected override void Up(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.AddColumn<long>(
|
|
||||||
name: "Version",
|
|
||||||
schema: "dbo",
|
|
||||||
table: "Seat",
|
|
||||||
type: "bigint",
|
|
||||||
nullable: false,
|
|
||||||
defaultValue: 0L);
|
|
||||||
|
|
||||||
migrationBuilder.AddColumn<long>(
|
|
||||||
name: "Version",
|
|
||||||
schema: "dbo",
|
|
||||||
table: "Flight",
|
|
||||||
type: "bigint",
|
|
||||||
nullable: false,
|
|
||||||
defaultValue: 0L);
|
|
||||||
|
|
||||||
migrationBuilder.AddColumn<long>(
|
|
||||||
name: "Version",
|
|
||||||
schema: "dbo",
|
|
||||||
table: "Airport",
|
|
||||||
type: "bigint",
|
|
||||||
nullable: false,
|
|
||||||
defaultValue: 0L);
|
|
||||||
|
|
||||||
migrationBuilder.AddColumn<long>(
|
|
||||||
name: "Version",
|
|
||||||
schema: "dbo",
|
|
||||||
table: "Aircraft",
|
|
||||||
type: "bigint",
|
|
||||||
nullable: false,
|
|
||||||
defaultValue: 0L);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void Down(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.DropColumn(
|
|
||||||
name: "Version",
|
|
||||||
schema: "dbo",
|
|
||||||
table: "Seat");
|
|
||||||
|
|
||||||
migrationBuilder.DropColumn(
|
|
||||||
name: "Version",
|
|
||||||
schema: "dbo",
|
|
||||||
table: "Flight");
|
|
||||||
|
|
||||||
migrationBuilder.DropColumn(
|
|
||||||
name: "Version",
|
|
||||||
schema: "dbo",
|
|
||||||
table: "Airport");
|
|
||||||
|
|
||||||
migrationBuilder.DropColumn(
|
|
||||||
name: "Version",
|
|
||||||
schema: "dbo",
|
|
||||||
table: "Aircraft");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,269 +0,0 @@
|
|||||||
// <auto-generated />
|
|
||||||
using System;
|
|
||||||
using Flight.Data;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
|
||||||
using Microsoft.EntityFrameworkCore.Metadata;
|
|
||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
|
||||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
namespace Flight.Data.Migrations
|
|
||||||
{
|
|
||||||
[DbContext(typeof(FlightDbContext))]
|
|
||||||
[Migration("20220416172637_Add-Audit")]
|
|
||||||
partial class AddAudit
|
|
||||||
{
|
|
||||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
|
||||||
{
|
|
||||||
#pragma warning disable 612, 618
|
|
||||||
modelBuilder
|
|
||||||
.HasAnnotation("ProductVersion", "6.0.1")
|
|
||||||
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
|
||||||
|
|
||||||
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1);
|
|
||||||
|
|
||||||
modelBuilder.Entity("BuildingBlocks.Outbox.OutboxMessage", b =>
|
|
||||||
{
|
|
||||||
b.Property<Guid>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("uniqueidentifier");
|
|
||||||
|
|
||||||
b.Property<Guid?>("CorrelationId")
|
|
||||||
.HasColumnType("uniqueidentifier");
|
|
||||||
|
|
||||||
b.Property<string>("Data")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("EventType")
|
|
||||||
.IsRequired()
|
|
||||||
.HasMaxLength(50)
|
|
||||||
.IsUnicode(false)
|
|
||||||
.HasColumnType("varchar(50)");
|
|
||||||
|
|
||||||
b.Property<string>("Name")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<DateTime>("OccurredOn")
|
|
||||||
.HasColumnType("datetime2");
|
|
||||||
|
|
||||||
b.Property<DateTime?>("ProcessedOn")
|
|
||||||
.HasColumnType("datetime2");
|
|
||||||
|
|
||||||
b.Property<string>("Type")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.ToTable("OutboxMessages", (string)null);
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Flight.Aircrafts.Models.Aircraft", b =>
|
|
||||||
{
|
|
||||||
b.Property<long>("Id")
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
b.Property<DateTime?>("CreatedAt")
|
|
||||||
.HasColumnType("datetime2");
|
|
||||||
|
|
||||||
b.Property<int?>("CreatedBy")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<bool>("IsDeleted")
|
|
||||||
.HasColumnType("bit");
|
|
||||||
|
|
||||||
b.Property<DateTime?>("LastModified")
|
|
||||||
.HasColumnType("datetime2");
|
|
||||||
|
|
||||||
b.Property<int?>("LastModifiedBy")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<int>("ManufacturingYear")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<string>("Model")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("Name")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<long>("Version")
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.ToTable("Aircraft", "dbo");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Flight.Airports.Models.Airport", b =>
|
|
||||||
{
|
|
||||||
b.Property<long>("Id")
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
b.Property<string>("Address")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("Code")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<DateTime?>("CreatedAt")
|
|
||||||
.HasColumnType("datetime2");
|
|
||||||
|
|
||||||
b.Property<int?>("CreatedBy")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<bool>("IsDeleted")
|
|
||||||
.HasColumnType("bit");
|
|
||||||
|
|
||||||
b.Property<DateTime?>("LastModified")
|
|
||||||
.HasColumnType("datetime2");
|
|
||||||
|
|
||||||
b.Property<int?>("LastModifiedBy")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<string>("Name")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<long>("Version")
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.ToTable("Airport", "dbo");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Flight.Flights.Models.Flight", b =>
|
|
||||||
{
|
|
||||||
b.Property<long>("Id")
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
b.Property<long>("AircraftId")
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
b.Property<long>("ArriveAirportId")
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
b.Property<DateTime>("ArriveDate")
|
|
||||||
.HasColumnType("datetime2");
|
|
||||||
|
|
||||||
b.Property<DateTime?>("CreatedAt")
|
|
||||||
.HasColumnType("datetime2");
|
|
||||||
|
|
||||||
b.Property<int?>("CreatedBy")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<long>("DepartureAirportId")
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
b.Property<DateTime>("DepartureDate")
|
|
||||||
.HasColumnType("datetime2");
|
|
||||||
|
|
||||||
b.Property<decimal>("DurationMinutes")
|
|
||||||
.HasColumnType("decimal(18,2)");
|
|
||||||
|
|
||||||
b.Property<DateTime>("FlightDate")
|
|
||||||
.HasColumnType("datetime2");
|
|
||||||
|
|
||||||
b.Property<string>("FlightNumber")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<bool>("IsDeleted")
|
|
||||||
.HasColumnType("bit");
|
|
||||||
|
|
||||||
b.Property<DateTime?>("LastModified")
|
|
||||||
.HasColumnType("datetime2");
|
|
||||||
|
|
||||||
b.Property<int?>("LastModifiedBy")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<decimal>("Price")
|
|
||||||
.HasColumnType("decimal(18,2)");
|
|
||||||
|
|
||||||
b.Property<int>("Status")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<long>("Version")
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.HasIndex("AircraftId");
|
|
||||||
|
|
||||||
b.HasIndex("ArriveAirportId");
|
|
||||||
|
|
||||||
b.ToTable("Flight", "dbo");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Flight.Seats.Models.Seat", b =>
|
|
||||||
{
|
|
||||||
b.Property<long>("Id")
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
b.Property<int>("Class")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<DateTime?>("CreatedAt")
|
|
||||||
.HasColumnType("datetime2");
|
|
||||||
|
|
||||||
b.Property<int?>("CreatedBy")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<long>("FlightId")
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
b.Property<bool>("IsDeleted")
|
|
||||||
.HasColumnType("bit");
|
|
||||||
|
|
||||||
b.Property<DateTime?>("LastModified")
|
|
||||||
.HasColumnType("datetime2");
|
|
||||||
|
|
||||||
b.Property<int?>("LastModifiedBy")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<string>("SeatNumber")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<int>("Type")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<long>("Version")
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.HasIndex("FlightId");
|
|
||||||
|
|
||||||
b.ToTable("Seat", "dbo");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Flight.Flights.Models.Flight", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("Flight.Aircrafts.Models.Aircraft", null)
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("AircraftId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.HasOne("Flight.Airports.Models.Airport", null)
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("ArriveAirportId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Flight.Seats.Models.Seat", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("Flight.Flights.Models.Flight", null)
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("FlightId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
});
|
|
||||||
#pragma warning restore 612, 618
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,240 +0,0 @@
|
|||||||
using System;
|
|
||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
namespace Flight.Data.Migrations
|
|
||||||
{
|
|
||||||
public partial class AddAudit : Migration
|
|
||||||
{
|
|
||||||
protected override void Up(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.RenameColumn(
|
|
||||||
name: "ModifiedBy",
|
|
||||||
schema: "dbo",
|
|
||||||
table: "Seat",
|
|
||||||
newName: "LastModifiedBy");
|
|
||||||
|
|
||||||
migrationBuilder.RenameColumn(
|
|
||||||
name: "ModifiedBy",
|
|
||||||
schema: "dbo",
|
|
||||||
table: "Flight",
|
|
||||||
newName: "LastModifiedBy");
|
|
||||||
|
|
||||||
migrationBuilder.RenameColumn(
|
|
||||||
name: "ModifiedBy",
|
|
||||||
schema: "dbo",
|
|
||||||
table: "Airport",
|
|
||||||
newName: "LastModifiedBy");
|
|
||||||
|
|
||||||
migrationBuilder.RenameColumn(
|
|
||||||
name: "ModifiedBy",
|
|
||||||
schema: "dbo",
|
|
||||||
table: "Aircraft",
|
|
||||||
newName: "LastModifiedBy");
|
|
||||||
|
|
||||||
migrationBuilder.AlterColumn<DateTime>(
|
|
||||||
name: "LastModified",
|
|
||||||
schema: "dbo",
|
|
||||||
table: "Seat",
|
|
||||||
type: "datetime2",
|
|
||||||
nullable: true,
|
|
||||||
oldClrType: typeof(DateTime),
|
|
||||||
oldType: "datetime2");
|
|
||||||
|
|
||||||
migrationBuilder.AddColumn<DateTime>(
|
|
||||||
name: "CreatedAt",
|
|
||||||
schema: "dbo",
|
|
||||||
table: "Seat",
|
|
||||||
type: "datetime2",
|
|
||||||
nullable: true);
|
|
||||||
|
|
||||||
migrationBuilder.AddColumn<int>(
|
|
||||||
name: "CreatedBy",
|
|
||||||
schema: "dbo",
|
|
||||||
table: "Seat",
|
|
||||||
type: "int",
|
|
||||||
nullable: true);
|
|
||||||
|
|
||||||
migrationBuilder.AlterColumn<DateTime>(
|
|
||||||
name: "LastModified",
|
|
||||||
schema: "dbo",
|
|
||||||
table: "Flight",
|
|
||||||
type: "datetime2",
|
|
||||||
nullable: true,
|
|
||||||
oldClrType: typeof(DateTime),
|
|
||||||
oldType: "datetime2");
|
|
||||||
|
|
||||||
migrationBuilder.AddColumn<DateTime>(
|
|
||||||
name: "CreatedAt",
|
|
||||||
schema: "dbo",
|
|
||||||
table: "Flight",
|
|
||||||
type: "datetime2",
|
|
||||||
nullable: true);
|
|
||||||
|
|
||||||
migrationBuilder.AddColumn<int>(
|
|
||||||
name: "CreatedBy",
|
|
||||||
schema: "dbo",
|
|
||||||
table: "Flight",
|
|
||||||
type: "int",
|
|
||||||
nullable: true);
|
|
||||||
|
|
||||||
migrationBuilder.AlterColumn<DateTime>(
|
|
||||||
name: "LastModified",
|
|
||||||
schema: "dbo",
|
|
||||||
table: "Airport",
|
|
||||||
type: "datetime2",
|
|
||||||
nullable: true,
|
|
||||||
oldClrType: typeof(DateTime),
|
|
||||||
oldType: "datetime2");
|
|
||||||
|
|
||||||
migrationBuilder.AddColumn<DateTime>(
|
|
||||||
name: "CreatedAt",
|
|
||||||
schema: "dbo",
|
|
||||||
table: "Airport",
|
|
||||||
type: "datetime2",
|
|
||||||
nullable: true);
|
|
||||||
|
|
||||||
migrationBuilder.AddColumn<int>(
|
|
||||||
name: "CreatedBy",
|
|
||||||
schema: "dbo",
|
|
||||||
table: "Airport",
|
|
||||||
type: "int",
|
|
||||||
nullable: true);
|
|
||||||
|
|
||||||
migrationBuilder.AlterColumn<DateTime>(
|
|
||||||
name: "LastModified",
|
|
||||||
schema: "dbo",
|
|
||||||
table: "Aircraft",
|
|
||||||
type: "datetime2",
|
|
||||||
nullable: true,
|
|
||||||
oldClrType: typeof(DateTime),
|
|
||||||
oldType: "datetime2");
|
|
||||||
|
|
||||||
migrationBuilder.AddColumn<DateTime>(
|
|
||||||
name: "CreatedAt",
|
|
||||||
schema: "dbo",
|
|
||||||
table: "Aircraft",
|
|
||||||
type: "datetime2",
|
|
||||||
nullable: true);
|
|
||||||
|
|
||||||
migrationBuilder.AddColumn<int>(
|
|
||||||
name: "CreatedBy",
|
|
||||||
schema: "dbo",
|
|
||||||
table: "Aircraft",
|
|
||||||
type: "int",
|
|
||||||
nullable: true);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void Down(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.DropColumn(
|
|
||||||
name: "CreatedAt",
|
|
||||||
schema: "dbo",
|
|
||||||
table: "Seat");
|
|
||||||
|
|
||||||
migrationBuilder.DropColumn(
|
|
||||||
name: "CreatedBy",
|
|
||||||
schema: "dbo",
|
|
||||||
table: "Seat");
|
|
||||||
|
|
||||||
migrationBuilder.DropColumn(
|
|
||||||
name: "CreatedAt",
|
|
||||||
schema: "dbo",
|
|
||||||
table: "Flight");
|
|
||||||
|
|
||||||
migrationBuilder.DropColumn(
|
|
||||||
name: "CreatedBy",
|
|
||||||
schema: "dbo",
|
|
||||||
table: "Flight");
|
|
||||||
|
|
||||||
migrationBuilder.DropColumn(
|
|
||||||
name: "CreatedAt",
|
|
||||||
schema: "dbo",
|
|
||||||
table: "Airport");
|
|
||||||
|
|
||||||
migrationBuilder.DropColumn(
|
|
||||||
name: "CreatedBy",
|
|
||||||
schema: "dbo",
|
|
||||||
table: "Airport");
|
|
||||||
|
|
||||||
migrationBuilder.DropColumn(
|
|
||||||
name: "CreatedAt",
|
|
||||||
schema: "dbo",
|
|
||||||
table: "Aircraft");
|
|
||||||
|
|
||||||
migrationBuilder.DropColumn(
|
|
||||||
name: "CreatedBy",
|
|
||||||
schema: "dbo",
|
|
||||||
table: "Aircraft");
|
|
||||||
|
|
||||||
migrationBuilder.RenameColumn(
|
|
||||||
name: "LastModifiedBy",
|
|
||||||
schema: "dbo",
|
|
||||||
table: "Seat",
|
|
||||||
newName: "ModifiedBy");
|
|
||||||
|
|
||||||
migrationBuilder.RenameColumn(
|
|
||||||
name: "LastModifiedBy",
|
|
||||||
schema: "dbo",
|
|
||||||
table: "Flight",
|
|
||||||
newName: "ModifiedBy");
|
|
||||||
|
|
||||||
migrationBuilder.RenameColumn(
|
|
||||||
name: "LastModifiedBy",
|
|
||||||
schema: "dbo",
|
|
||||||
table: "Airport",
|
|
||||||
newName: "ModifiedBy");
|
|
||||||
|
|
||||||
migrationBuilder.RenameColumn(
|
|
||||||
name: "LastModifiedBy",
|
|
||||||
schema: "dbo",
|
|
||||||
table: "Aircraft",
|
|
||||||
newName: "ModifiedBy");
|
|
||||||
|
|
||||||
migrationBuilder.AlterColumn<DateTime>(
|
|
||||||
name: "LastModified",
|
|
||||||
schema: "dbo",
|
|
||||||
table: "Seat",
|
|
||||||
type: "datetime2",
|
|
||||||
nullable: false,
|
|
||||||
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
|
||||||
oldClrType: typeof(DateTime),
|
|
||||||
oldType: "datetime2",
|
|
||||||
oldNullable: true);
|
|
||||||
|
|
||||||
migrationBuilder.AlterColumn<DateTime>(
|
|
||||||
name: "LastModified",
|
|
||||||
schema: "dbo",
|
|
||||||
table: "Flight",
|
|
||||||
type: "datetime2",
|
|
||||||
nullable: false,
|
|
||||||
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
|
||||||
oldClrType: typeof(DateTime),
|
|
||||||
oldType: "datetime2",
|
|
||||||
oldNullable: true);
|
|
||||||
|
|
||||||
migrationBuilder.AlterColumn<DateTime>(
|
|
||||||
name: "LastModified",
|
|
||||||
schema: "dbo",
|
|
||||||
table: "Airport",
|
|
||||||
type: "datetime2",
|
|
||||||
nullable: false,
|
|
||||||
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
|
||||||
oldClrType: typeof(DateTime),
|
|
||||||
oldType: "datetime2",
|
|
||||||
oldNullable: true);
|
|
||||||
|
|
||||||
migrationBuilder.AlterColumn<DateTime>(
|
|
||||||
name: "LastModified",
|
|
||||||
schema: "dbo",
|
|
||||||
table: "Aircraft",
|
|
||||||
type: "datetime2",
|
|
||||||
nullable: false,
|
|
||||||
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
|
||||||
oldClrType: typeof(DateTime),
|
|
||||||
oldType: "datetime2",
|
|
||||||
oldNullable: true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,175 +0,0 @@
|
|||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
namespace Flight.Data.Migrations
|
|
||||||
{
|
|
||||||
public partial class UpdateAudit : Migration
|
|
||||||
{
|
|
||||||
protected override void Up(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.AlterColumn<long>(
|
|
||||||
name: "LastModifiedBy",
|
|
||||||
schema: "dbo",
|
|
||||||
table: "Seat",
|
|
||||||
type: "bigint",
|
|
||||||
nullable: true,
|
|
||||||
oldClrType: typeof(int),
|
|
||||||
oldType: "int",
|
|
||||||
oldNullable: true);
|
|
||||||
|
|
||||||
migrationBuilder.AlterColumn<long>(
|
|
||||||
name: "CreatedBy",
|
|
||||||
schema: "dbo",
|
|
||||||
table: "Seat",
|
|
||||||
type: "bigint",
|
|
||||||
nullable: true,
|
|
||||||
oldClrType: typeof(int),
|
|
||||||
oldType: "int",
|
|
||||||
oldNullable: true);
|
|
||||||
|
|
||||||
migrationBuilder.AlterColumn<long>(
|
|
||||||
name: "LastModifiedBy",
|
|
||||||
schema: "dbo",
|
|
||||||
table: "Flight",
|
|
||||||
type: "bigint",
|
|
||||||
nullable: true,
|
|
||||||
oldClrType: typeof(int),
|
|
||||||
oldType: "int",
|
|
||||||
oldNullable: true);
|
|
||||||
|
|
||||||
migrationBuilder.AlterColumn<long>(
|
|
||||||
name: "CreatedBy",
|
|
||||||
schema: "dbo",
|
|
||||||
table: "Flight",
|
|
||||||
type: "bigint",
|
|
||||||
nullable: true,
|
|
||||||
oldClrType: typeof(int),
|
|
||||||
oldType: "int",
|
|
||||||
oldNullable: true);
|
|
||||||
|
|
||||||
migrationBuilder.AlterColumn<long>(
|
|
||||||
name: "LastModifiedBy",
|
|
||||||
schema: "dbo",
|
|
||||||
table: "Airport",
|
|
||||||
type: "bigint",
|
|
||||||
nullable: true,
|
|
||||||
oldClrType: typeof(int),
|
|
||||||
oldType: "int",
|
|
||||||
oldNullable: true);
|
|
||||||
|
|
||||||
migrationBuilder.AlterColumn<long>(
|
|
||||||
name: "CreatedBy",
|
|
||||||
schema: "dbo",
|
|
||||||
table: "Airport",
|
|
||||||
type: "bigint",
|
|
||||||
nullable: true,
|
|
||||||
oldClrType: typeof(int),
|
|
||||||
oldType: "int",
|
|
||||||
oldNullable: true);
|
|
||||||
|
|
||||||
migrationBuilder.AlterColumn<long>(
|
|
||||||
name: "LastModifiedBy",
|
|
||||||
schema: "dbo",
|
|
||||||
table: "Aircraft",
|
|
||||||
type: "bigint",
|
|
||||||
nullable: true,
|
|
||||||
oldClrType: typeof(int),
|
|
||||||
oldType: "int",
|
|
||||||
oldNullable: true);
|
|
||||||
|
|
||||||
migrationBuilder.AlterColumn<long>(
|
|
||||||
name: "CreatedBy",
|
|
||||||
schema: "dbo",
|
|
||||||
table: "Aircraft",
|
|
||||||
type: "bigint",
|
|
||||||
nullable: true,
|
|
||||||
oldClrType: typeof(int),
|
|
||||||
oldType: "int",
|
|
||||||
oldNullable: true);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void Down(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.AlterColumn<int>(
|
|
||||||
name: "LastModifiedBy",
|
|
||||||
schema: "dbo",
|
|
||||||
table: "Seat",
|
|
||||||
type: "int",
|
|
||||||
nullable: true,
|
|
||||||
oldClrType: typeof(long),
|
|
||||||
oldType: "bigint",
|
|
||||||
oldNullable: true);
|
|
||||||
|
|
||||||
migrationBuilder.AlterColumn<int>(
|
|
||||||
name: "CreatedBy",
|
|
||||||
schema: "dbo",
|
|
||||||
table: "Seat",
|
|
||||||
type: "int",
|
|
||||||
nullable: true,
|
|
||||||
oldClrType: typeof(long),
|
|
||||||
oldType: "bigint",
|
|
||||||
oldNullable: true);
|
|
||||||
|
|
||||||
migrationBuilder.AlterColumn<int>(
|
|
||||||
name: "LastModifiedBy",
|
|
||||||
schema: "dbo",
|
|
||||||
table: "Flight",
|
|
||||||
type: "int",
|
|
||||||
nullable: true,
|
|
||||||
oldClrType: typeof(long),
|
|
||||||
oldType: "bigint",
|
|
||||||
oldNullable: true);
|
|
||||||
|
|
||||||
migrationBuilder.AlterColumn<int>(
|
|
||||||
name: "CreatedBy",
|
|
||||||
schema: "dbo",
|
|
||||||
table: "Flight",
|
|
||||||
type: "int",
|
|
||||||
nullable: true,
|
|
||||||
oldClrType: typeof(long),
|
|
||||||
oldType: "bigint",
|
|
||||||
oldNullable: true);
|
|
||||||
|
|
||||||
migrationBuilder.AlterColumn<int>(
|
|
||||||
name: "LastModifiedBy",
|
|
||||||
schema: "dbo",
|
|
||||||
table: "Airport",
|
|
||||||
type: "int",
|
|
||||||
nullable: true,
|
|
||||||
oldClrType: typeof(long),
|
|
||||||
oldType: "bigint",
|
|
||||||
oldNullable: true);
|
|
||||||
|
|
||||||
migrationBuilder.AlterColumn<int>(
|
|
||||||
name: "CreatedBy",
|
|
||||||
schema: "dbo",
|
|
||||||
table: "Airport",
|
|
||||||
type: "int",
|
|
||||||
nullable: true,
|
|
||||||
oldClrType: typeof(long),
|
|
||||||
oldType: "bigint",
|
|
||||||
oldNullable: true);
|
|
||||||
|
|
||||||
migrationBuilder.AlterColumn<int>(
|
|
||||||
name: "LastModifiedBy",
|
|
||||||
schema: "dbo",
|
|
||||||
table: "Aircraft",
|
|
||||||
type: "int",
|
|
||||||
nullable: true,
|
|
||||||
oldClrType: typeof(long),
|
|
||||||
oldType: "bigint",
|
|
||||||
oldNullable: true);
|
|
||||||
|
|
||||||
migrationBuilder.AlterColumn<int>(
|
|
||||||
name: "CreatedBy",
|
|
||||||
schema: "dbo",
|
|
||||||
table: "Aircraft",
|
|
||||||
type: "int",
|
|
||||||
nullable: true,
|
|
||||||
oldClrType: typeof(long),
|
|
||||||
oldType: "bigint",
|
|
||||||
oldNullable: true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,301 +0,0 @@
|
|||||||
// <auto-generated />
|
|
||||||
using System;
|
|
||||||
using Flight.Data;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
|
||||||
using Microsoft.EntityFrameworkCore.Metadata;
|
|
||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
|
||||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
namespace Flight.Data.Migrations
|
|
||||||
{
|
|
||||||
[DbContext(typeof(FlightDbContext))]
|
|
||||||
[Migration("20220421195137_Add-Internal-Messages")]
|
|
||||||
partial class AddInternalMessages
|
|
||||||
{
|
|
||||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
|
||||||
{
|
|
||||||
#pragma warning disable 612, 618
|
|
||||||
modelBuilder
|
|
||||||
.HasAnnotation("ProductVersion", "6.0.1")
|
|
||||||
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
|
||||||
|
|
||||||
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1);
|
|
||||||
|
|
||||||
modelBuilder.Entity("BuildingBlocks.InternalProcessor.InternalMessage", b =>
|
|
||||||
{
|
|
||||||
b.Property<Guid>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("uniqueidentifier");
|
|
||||||
|
|
||||||
b.Property<string>("CommandType")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<Guid?>("CorrelationId")
|
|
||||||
.HasColumnType("uniqueidentifier");
|
|
||||||
|
|
||||||
b.Property<string>("Data")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("Name")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<DateTime>("OccurredOn")
|
|
||||||
.HasColumnType("datetime2");
|
|
||||||
|
|
||||||
b.Property<DateTime?>("ProcessedOn")
|
|
||||||
.HasColumnType("datetime2");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.ToTable("InternalMessages", (string)null);
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("BuildingBlocks.Outbox.OutboxMessage", b =>
|
|
||||||
{
|
|
||||||
b.Property<Guid>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("uniqueidentifier");
|
|
||||||
|
|
||||||
b.Property<Guid?>("CorrelationId")
|
|
||||||
.HasColumnType("uniqueidentifier");
|
|
||||||
|
|
||||||
b.Property<string>("Data")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("EventType")
|
|
||||||
.IsRequired()
|
|
||||||
.HasMaxLength(50)
|
|
||||||
.IsUnicode(false)
|
|
||||||
.HasColumnType("varchar(50)");
|
|
||||||
|
|
||||||
b.Property<string>("Name")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<DateTime>("OccurredOn")
|
|
||||||
.HasColumnType("datetime2");
|
|
||||||
|
|
||||||
b.Property<DateTime?>("ProcessedOn")
|
|
||||||
.HasColumnType("datetime2");
|
|
||||||
|
|
||||||
b.Property<string>("Type")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.ToTable("OutboxMessages", (string)null);
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Flight.Aircrafts.Models.Aircraft", b =>
|
|
||||||
{
|
|
||||||
b.Property<long>("Id")
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
b.Property<DateTime?>("CreatedAt")
|
|
||||||
.HasColumnType("datetime2");
|
|
||||||
|
|
||||||
b.Property<long?>("CreatedBy")
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
b.Property<bool>("IsDeleted")
|
|
||||||
.HasColumnType("bit");
|
|
||||||
|
|
||||||
b.Property<DateTime?>("LastModified")
|
|
||||||
.HasColumnType("datetime2");
|
|
||||||
|
|
||||||
b.Property<long?>("LastModifiedBy")
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
b.Property<int>("ManufacturingYear")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<string>("Model")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("Name")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<long>("Version")
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.ToTable("Aircraft", "dbo");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Flight.Airports.Models.Airport", b =>
|
|
||||||
{
|
|
||||||
b.Property<long>("Id")
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
b.Property<string>("Address")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("Code")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<DateTime?>("CreatedAt")
|
|
||||||
.HasColumnType("datetime2");
|
|
||||||
|
|
||||||
b.Property<long?>("CreatedBy")
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
b.Property<bool>("IsDeleted")
|
|
||||||
.HasColumnType("bit");
|
|
||||||
|
|
||||||
b.Property<DateTime?>("LastModified")
|
|
||||||
.HasColumnType("datetime2");
|
|
||||||
|
|
||||||
b.Property<long?>("LastModifiedBy")
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
b.Property<string>("Name")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<long>("Version")
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.ToTable("Airport", "dbo");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Flight.Flights.Models.Flight", b =>
|
|
||||||
{
|
|
||||||
b.Property<long>("Id")
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
b.Property<long>("AircraftId")
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
b.Property<long>("ArriveAirportId")
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
b.Property<DateTime>("ArriveDate")
|
|
||||||
.HasColumnType("datetime2");
|
|
||||||
|
|
||||||
b.Property<DateTime?>("CreatedAt")
|
|
||||||
.HasColumnType("datetime2");
|
|
||||||
|
|
||||||
b.Property<long?>("CreatedBy")
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
b.Property<long>("DepartureAirportId")
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
b.Property<DateTime>("DepartureDate")
|
|
||||||
.HasColumnType("datetime2");
|
|
||||||
|
|
||||||
b.Property<decimal>("DurationMinutes")
|
|
||||||
.HasColumnType("decimal(18,2)");
|
|
||||||
|
|
||||||
b.Property<DateTime>("FlightDate")
|
|
||||||
.HasColumnType("datetime2");
|
|
||||||
|
|
||||||
b.Property<string>("FlightNumber")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<bool>("IsDeleted")
|
|
||||||
.HasColumnType("bit");
|
|
||||||
|
|
||||||
b.Property<DateTime?>("LastModified")
|
|
||||||
.HasColumnType("datetime2");
|
|
||||||
|
|
||||||
b.Property<long?>("LastModifiedBy")
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
b.Property<decimal>("Price")
|
|
||||||
.HasColumnType("decimal(18,2)");
|
|
||||||
|
|
||||||
b.Property<int>("Status")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<long>("Version")
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.HasIndex("AircraftId");
|
|
||||||
|
|
||||||
b.HasIndex("ArriveAirportId");
|
|
||||||
|
|
||||||
b.ToTable("Flight", "dbo");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Flight.Seats.Models.Seat", b =>
|
|
||||||
{
|
|
||||||
b.Property<long>("Id")
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
b.Property<int>("Class")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<DateTime?>("CreatedAt")
|
|
||||||
.HasColumnType("datetime2");
|
|
||||||
|
|
||||||
b.Property<long?>("CreatedBy")
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
b.Property<long>("FlightId")
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
b.Property<bool>("IsDeleted")
|
|
||||||
.HasColumnType("bit");
|
|
||||||
|
|
||||||
b.Property<DateTime?>("LastModified")
|
|
||||||
.HasColumnType("datetime2");
|
|
||||||
|
|
||||||
b.Property<long?>("LastModifiedBy")
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
b.Property<string>("SeatNumber")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<int>("Type")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<long>("Version")
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.HasIndex("FlightId");
|
|
||||||
|
|
||||||
b.ToTable("Seat", "dbo");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Flight.Flights.Models.Flight", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("Flight.Aircrafts.Models.Aircraft", null)
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("AircraftId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.HasOne("Flight.Airports.Models.Airport", null)
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("ArriveAirportId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Flight.Seats.Models.Seat", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("Flight.Flights.Models.Flight", null)
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("FlightId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
});
|
|
||||||
#pragma warning restore 612, 618
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,36 +0,0 @@
|
|||||||
using System;
|
|
||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
namespace Flight.Data.Migrations
|
|
||||||
{
|
|
||||||
public partial class AddInternalMessages : Migration
|
|
||||||
{
|
|
||||||
protected override void Up(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.CreateTable(
|
|
||||||
name: "InternalMessages",
|
|
||||||
columns: table => new
|
|
||||||
{
|
|
||||||
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
|
||||||
Name = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
|
||||||
OccurredOn = table.Column<DateTime>(type: "datetime2", nullable: false),
|
|
||||||
CommandType = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
|
||||||
Data = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
|
||||||
ProcessedOn = table.Column<DateTime>(type: "datetime2", nullable: true),
|
|
||||||
CorrelationId = table.Column<Guid>(type: "uniqueidentifier", nullable: true)
|
|
||||||
},
|
|
||||||
constraints: table =>
|
|
||||||
{
|
|
||||||
table.PrimaryKey("PK_InternalMessages", x => x.Id);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void Down(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.DropTable(
|
|
||||||
name: "InternalMessages");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,301 +0,0 @@
|
|||||||
// <auto-generated />
|
|
||||||
using System;
|
|
||||||
using Flight.Data;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
|
||||||
using Microsoft.EntityFrameworkCore.Metadata;
|
|
||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
|
||||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
namespace Flight.Data.Migrations
|
|
||||||
{
|
|
||||||
[DbContext(typeof(FlightDbContext))]
|
|
||||||
[Migration("20220422121403_Update-EventId")]
|
|
||||||
partial class UpdateEventId
|
|
||||||
{
|
|
||||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
|
||||||
{
|
|
||||||
#pragma warning disable 612, 618
|
|
||||||
modelBuilder
|
|
||||||
.HasAnnotation("ProductVersion", "6.0.1")
|
|
||||||
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
|
||||||
|
|
||||||
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1);
|
|
||||||
|
|
||||||
modelBuilder.Entity("BuildingBlocks.InternalProcessor.InternalMessage", b =>
|
|
||||||
{
|
|
||||||
b.Property<Guid>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("uniqueidentifier");
|
|
||||||
|
|
||||||
b.Property<string>("CommandType")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<Guid?>("CorrelationId")
|
|
||||||
.HasColumnType("uniqueidentifier");
|
|
||||||
|
|
||||||
b.Property<string>("Data")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("Name")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<DateTime>("OccurredOn")
|
|
||||||
.HasColumnType("datetime2");
|
|
||||||
|
|
||||||
b.Property<DateTime?>("ProcessedOn")
|
|
||||||
.HasColumnType("datetime2");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.ToTable("InternalMessages", (string)null);
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("BuildingBlocks.Outbox.OutboxMessage", b =>
|
|
||||||
{
|
|
||||||
b.Property<Guid>("EventId")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("uniqueidentifier");
|
|
||||||
|
|
||||||
b.Property<Guid?>("CorrelationId")
|
|
||||||
.HasColumnType("uniqueidentifier");
|
|
||||||
|
|
||||||
b.Property<string>("Data")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("EventType")
|
|
||||||
.IsRequired()
|
|
||||||
.HasMaxLength(50)
|
|
||||||
.IsUnicode(false)
|
|
||||||
.HasColumnType("varchar(50)");
|
|
||||||
|
|
||||||
b.Property<string>("Name")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<DateTime>("OccurredOn")
|
|
||||||
.HasColumnType("datetime2");
|
|
||||||
|
|
||||||
b.Property<DateTime?>("ProcessedOn")
|
|
||||||
.HasColumnType("datetime2");
|
|
||||||
|
|
||||||
b.Property<string>("Type")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.HasKey("EventId");
|
|
||||||
|
|
||||||
b.ToTable("OutboxMessages", (string)null);
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Flight.Aircrafts.Models.Aircraft", b =>
|
|
||||||
{
|
|
||||||
b.Property<long>("Id")
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
b.Property<DateTime?>("CreatedAt")
|
|
||||||
.HasColumnType("datetime2");
|
|
||||||
|
|
||||||
b.Property<long?>("CreatedBy")
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
b.Property<bool>("IsDeleted")
|
|
||||||
.HasColumnType("bit");
|
|
||||||
|
|
||||||
b.Property<DateTime?>("LastModified")
|
|
||||||
.HasColumnType("datetime2");
|
|
||||||
|
|
||||||
b.Property<long?>("LastModifiedBy")
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
b.Property<int>("ManufacturingYear")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<string>("Model")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("Name")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<long>("Version")
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.ToTable("Aircraft", "dbo");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Flight.Airports.Models.Airport", b =>
|
|
||||||
{
|
|
||||||
b.Property<long>("Id")
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
b.Property<string>("Address")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("Code")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<DateTime?>("CreatedAt")
|
|
||||||
.HasColumnType("datetime2");
|
|
||||||
|
|
||||||
b.Property<long?>("CreatedBy")
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
b.Property<bool>("IsDeleted")
|
|
||||||
.HasColumnType("bit");
|
|
||||||
|
|
||||||
b.Property<DateTime?>("LastModified")
|
|
||||||
.HasColumnType("datetime2");
|
|
||||||
|
|
||||||
b.Property<long?>("LastModifiedBy")
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
b.Property<string>("Name")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<long>("Version")
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.ToTable("Airport", "dbo");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Flight.Flights.Models.Flight", b =>
|
|
||||||
{
|
|
||||||
b.Property<long>("Id")
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
b.Property<long>("AircraftId")
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
b.Property<long>("ArriveAirportId")
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
b.Property<DateTime>("ArriveDate")
|
|
||||||
.HasColumnType("datetime2");
|
|
||||||
|
|
||||||
b.Property<DateTime?>("CreatedAt")
|
|
||||||
.HasColumnType("datetime2");
|
|
||||||
|
|
||||||
b.Property<long?>("CreatedBy")
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
b.Property<long>("DepartureAirportId")
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
b.Property<DateTime>("DepartureDate")
|
|
||||||
.HasColumnType("datetime2");
|
|
||||||
|
|
||||||
b.Property<decimal>("DurationMinutes")
|
|
||||||
.HasColumnType("decimal(18,2)");
|
|
||||||
|
|
||||||
b.Property<DateTime>("FlightDate")
|
|
||||||
.HasColumnType("datetime2");
|
|
||||||
|
|
||||||
b.Property<string>("FlightNumber")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<bool>("IsDeleted")
|
|
||||||
.HasColumnType("bit");
|
|
||||||
|
|
||||||
b.Property<DateTime?>("LastModified")
|
|
||||||
.HasColumnType("datetime2");
|
|
||||||
|
|
||||||
b.Property<long?>("LastModifiedBy")
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
b.Property<decimal>("Price")
|
|
||||||
.HasColumnType("decimal(18,2)");
|
|
||||||
|
|
||||||
b.Property<int>("Status")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<long>("Version")
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.HasIndex("AircraftId");
|
|
||||||
|
|
||||||
b.HasIndex("ArriveAirportId");
|
|
||||||
|
|
||||||
b.ToTable("Flight", "dbo");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Flight.Seats.Models.Seat", b =>
|
|
||||||
{
|
|
||||||
b.Property<long>("Id")
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
b.Property<int>("Class")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<DateTime?>("CreatedAt")
|
|
||||||
.HasColumnType("datetime2");
|
|
||||||
|
|
||||||
b.Property<long?>("CreatedBy")
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
b.Property<long>("FlightId")
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
b.Property<bool>("IsDeleted")
|
|
||||||
.HasColumnType("bit");
|
|
||||||
|
|
||||||
b.Property<DateTime?>("LastModified")
|
|
||||||
.HasColumnType("datetime2");
|
|
||||||
|
|
||||||
b.Property<long?>("LastModifiedBy")
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
b.Property<string>("SeatNumber")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<int>("Type")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<long>("Version")
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.HasIndex("FlightId");
|
|
||||||
|
|
||||||
b.ToTable("Seat", "dbo");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Flight.Flights.Models.Flight", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("Flight.Aircrafts.Models.Aircraft", null)
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("AircraftId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.HasOne("Flight.Airports.Models.Airport", null)
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("ArriveAirportId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Flight.Seats.Models.Seat", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("Flight.Flights.Models.Flight", null)
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("FlightId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
});
|
|
||||||
#pragma warning restore 612, 618
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,25 +0,0 @@
|
|||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
namespace Flight.Data.Migrations
|
|
||||||
{
|
|
||||||
public partial class UpdateEventId : Migration
|
|
||||||
{
|
|
||||||
protected override void Up(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.RenameColumn(
|
|
||||||
name: "Id",
|
|
||||||
table: "OutboxMessages",
|
|
||||||
newName: "EventId");
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void Down(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.RenameColumn(
|
|
||||||
name: "EventId",
|
|
||||||
table: "OutboxMessages",
|
|
||||||
newName: "Id");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,301 +0,0 @@
|
|||||||
// <auto-generated />
|
|
||||||
using System;
|
|
||||||
using Flight.Data;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
|
||||||
using Microsoft.EntityFrameworkCore.Metadata;
|
|
||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
|
||||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
namespace Flight.Data.Migrations
|
|
||||||
{
|
|
||||||
[DbContext(typeof(FlightDbContext))]
|
|
||||||
[Migration("20220422122146_Update-Internal")]
|
|
||||||
partial class UpdateInternal
|
|
||||||
{
|
|
||||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
|
||||||
{
|
|
||||||
#pragma warning disable 612, 618
|
|
||||||
modelBuilder
|
|
||||||
.HasAnnotation("ProductVersion", "6.0.1")
|
|
||||||
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
|
||||||
|
|
||||||
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1);
|
|
||||||
|
|
||||||
modelBuilder.Entity("BuildingBlocks.InternalProcessor.InternalMessage", b =>
|
|
||||||
{
|
|
||||||
b.Property<Guid>("EventId")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("uniqueidentifier");
|
|
||||||
|
|
||||||
b.Property<string>("CommandType")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<Guid?>("CorrelationId")
|
|
||||||
.HasColumnType("uniqueidentifier");
|
|
||||||
|
|
||||||
b.Property<string>("Data")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("Name")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<DateTime>("OccurredOn")
|
|
||||||
.HasColumnType("datetime2");
|
|
||||||
|
|
||||||
b.Property<DateTime?>("ProcessedOn")
|
|
||||||
.HasColumnType("datetime2");
|
|
||||||
|
|
||||||
b.HasKey("EventId");
|
|
||||||
|
|
||||||
b.ToTable("InternalMessages", (string)null);
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("BuildingBlocks.Outbox.OutboxMessage", b =>
|
|
||||||
{
|
|
||||||
b.Property<Guid>("EventId")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("uniqueidentifier");
|
|
||||||
|
|
||||||
b.Property<Guid?>("CorrelationId")
|
|
||||||
.HasColumnType("uniqueidentifier");
|
|
||||||
|
|
||||||
b.Property<string>("Data")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("EventType")
|
|
||||||
.IsRequired()
|
|
||||||
.HasMaxLength(50)
|
|
||||||
.IsUnicode(false)
|
|
||||||
.HasColumnType("varchar(50)");
|
|
||||||
|
|
||||||
b.Property<string>("Name")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<DateTime>("OccurredOn")
|
|
||||||
.HasColumnType("datetime2");
|
|
||||||
|
|
||||||
b.Property<DateTime?>("ProcessedOn")
|
|
||||||
.HasColumnType("datetime2");
|
|
||||||
|
|
||||||
b.Property<string>("Type")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.HasKey("EventId");
|
|
||||||
|
|
||||||
b.ToTable("OutboxMessages", (string)null);
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Flight.Aircrafts.Models.Aircraft", b =>
|
|
||||||
{
|
|
||||||
b.Property<long>("Id")
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
b.Property<DateTime?>("CreatedAt")
|
|
||||||
.HasColumnType("datetime2");
|
|
||||||
|
|
||||||
b.Property<long?>("CreatedBy")
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
b.Property<bool>("IsDeleted")
|
|
||||||
.HasColumnType("bit");
|
|
||||||
|
|
||||||
b.Property<DateTime?>("LastModified")
|
|
||||||
.HasColumnType("datetime2");
|
|
||||||
|
|
||||||
b.Property<long?>("LastModifiedBy")
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
b.Property<int>("ManufacturingYear")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<string>("Model")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("Name")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<long>("Version")
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.ToTable("Aircraft", "dbo");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Flight.Airports.Models.Airport", b =>
|
|
||||||
{
|
|
||||||
b.Property<long>("Id")
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
b.Property<string>("Address")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("Code")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<DateTime?>("CreatedAt")
|
|
||||||
.HasColumnType("datetime2");
|
|
||||||
|
|
||||||
b.Property<long?>("CreatedBy")
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
b.Property<bool>("IsDeleted")
|
|
||||||
.HasColumnType("bit");
|
|
||||||
|
|
||||||
b.Property<DateTime?>("LastModified")
|
|
||||||
.HasColumnType("datetime2");
|
|
||||||
|
|
||||||
b.Property<long?>("LastModifiedBy")
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
b.Property<string>("Name")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<long>("Version")
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.ToTable("Airport", "dbo");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Flight.Flights.Models.Flight", b =>
|
|
||||||
{
|
|
||||||
b.Property<long>("Id")
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
b.Property<long>("AircraftId")
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
b.Property<long>("ArriveAirportId")
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
b.Property<DateTime>("ArriveDate")
|
|
||||||
.HasColumnType("datetime2");
|
|
||||||
|
|
||||||
b.Property<DateTime?>("CreatedAt")
|
|
||||||
.HasColumnType("datetime2");
|
|
||||||
|
|
||||||
b.Property<long?>("CreatedBy")
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
b.Property<long>("DepartureAirportId")
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
b.Property<DateTime>("DepartureDate")
|
|
||||||
.HasColumnType("datetime2");
|
|
||||||
|
|
||||||
b.Property<decimal>("DurationMinutes")
|
|
||||||
.HasColumnType("decimal(18,2)");
|
|
||||||
|
|
||||||
b.Property<DateTime>("FlightDate")
|
|
||||||
.HasColumnType("datetime2");
|
|
||||||
|
|
||||||
b.Property<string>("FlightNumber")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<bool>("IsDeleted")
|
|
||||||
.HasColumnType("bit");
|
|
||||||
|
|
||||||
b.Property<DateTime?>("LastModified")
|
|
||||||
.HasColumnType("datetime2");
|
|
||||||
|
|
||||||
b.Property<long?>("LastModifiedBy")
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
b.Property<decimal>("Price")
|
|
||||||
.HasColumnType("decimal(18,2)");
|
|
||||||
|
|
||||||
b.Property<int>("Status")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<long>("Version")
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.HasIndex("AircraftId");
|
|
||||||
|
|
||||||
b.HasIndex("ArriveAirportId");
|
|
||||||
|
|
||||||
b.ToTable("Flight", "dbo");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Flight.Seats.Models.Seat", b =>
|
|
||||||
{
|
|
||||||
b.Property<long>("Id")
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
b.Property<int>("Class")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<DateTime?>("CreatedAt")
|
|
||||||
.HasColumnType("datetime2");
|
|
||||||
|
|
||||||
b.Property<long?>("CreatedBy")
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
b.Property<long>("FlightId")
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
b.Property<bool>("IsDeleted")
|
|
||||||
.HasColumnType("bit");
|
|
||||||
|
|
||||||
b.Property<DateTime?>("LastModified")
|
|
||||||
.HasColumnType("datetime2");
|
|
||||||
|
|
||||||
b.Property<long?>("LastModifiedBy")
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
b.Property<string>("SeatNumber")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<int>("Type")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<long>("Version")
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.HasIndex("FlightId");
|
|
||||||
|
|
||||||
b.ToTable("Seat", "dbo");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Flight.Flights.Models.Flight", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("Flight.Aircrafts.Models.Aircraft", null)
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("AircraftId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.HasOne("Flight.Airports.Models.Airport", null)
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("ArriveAirportId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Flight.Seats.Models.Seat", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("Flight.Flights.Models.Flight", null)
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("FlightId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
});
|
|
||||||
#pragma warning restore 612, 618
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,25 +0,0 @@
|
|||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
namespace Flight.Data.Migrations
|
|
||||||
{
|
|
||||||
public partial class UpdateInternal : Migration
|
|
||||||
{
|
|
||||||
protected override void Up(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.RenameColumn(
|
|
||||||
name: "Id",
|
|
||||||
table: "InternalMessages",
|
|
||||||
newName: "EventId");
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void Down(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.RenameColumn(
|
|
||||||
name: "EventId",
|
|
||||||
table: "InternalMessages",
|
|
||||||
newName: "Id");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -12,8 +12,8 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
|||||||
namespace Flight.Data.Migrations
|
namespace Flight.Data.Migrations
|
||||||
{
|
{
|
||||||
[DbContext(typeof(FlightDbContext))]
|
[DbContext(typeof(FlightDbContext))]
|
||||||
[Migration("20220418195957_Update-Audit")]
|
[Migration("20220509213249_Init")]
|
||||||
partial class UpdateAudit
|
partial class Init
|
||||||
{
|
{
|
||||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||||
{
|
{
|
||||||
@ -24,44 +24,6 @@ namespace Flight.Data.Migrations
|
|||||||
|
|
||||||
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1);
|
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1);
|
||||||
|
|
||||||
modelBuilder.Entity("BuildingBlocks.Outbox.OutboxMessage", b =>
|
|
||||||
{
|
|
||||||
b.Property<Guid>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("uniqueidentifier");
|
|
||||||
|
|
||||||
b.Property<Guid?>("CorrelationId")
|
|
||||||
.HasColumnType("uniqueidentifier");
|
|
||||||
|
|
||||||
b.Property<string>("Data")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("EventType")
|
|
||||||
.IsRequired()
|
|
||||||
.HasMaxLength(50)
|
|
||||||
.IsUnicode(false)
|
|
||||||
.HasColumnType("varchar(50)");
|
|
||||||
|
|
||||||
b.Property<string>("Name")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<DateTime>("OccurredOn")
|
|
||||||
.HasColumnType("datetime2");
|
|
||||||
|
|
||||||
b.Property<DateTime?>("ProcessedOn")
|
|
||||||
.HasColumnType("datetime2");
|
|
||||||
|
|
||||||
b.Property<string>("Type")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.ToTable("OutboxMessages", (string)null);
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Flight.Aircrafts.Models.Aircraft", b =>
|
modelBuilder.Entity("Flight.Aircrafts.Models.Aircraft", b =>
|
||||||
{
|
{
|
||||||
b.Property<long>("Id")
|
b.Property<long>("Id")
|
||||||
@ -21,7 +21,11 @@ namespace Flight.Data.Migrations
|
|||||||
Name = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
Name = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||||
Model = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
Model = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||||
ManufacturingYear = table.Column<int>(type: "int", nullable: false),
|
ManufacturingYear = table.Column<int>(type: "int", nullable: false),
|
||||||
LastModified = table.Column<DateTime>(type: "datetime2", nullable: false),
|
CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: true),
|
||||||
|
CreatedBy = table.Column<long>(type: "bigint", nullable: true),
|
||||||
|
LastModified = table.Column<DateTime>(type: "datetime2", nullable: true),
|
||||||
|
LastModifiedBy = table.Column<long>(type: "bigint", nullable: true),
|
||||||
|
Version = table.Column<long>(type: "bigint", nullable: false),
|
||||||
IsDeleted = table.Column<bool>(type: "bit", nullable: false)
|
IsDeleted = table.Column<bool>(type: "bit", nullable: false)
|
||||||
},
|
},
|
||||||
constraints: table =>
|
constraints: table =>
|
||||||
@ -38,7 +42,11 @@ namespace Flight.Data.Migrations
|
|||||||
Name = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
Name = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||||
Address = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
Address = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||||
Code = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
Code = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||||
LastModified = table.Column<DateTime>(type: "datetime2", nullable: false),
|
CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: true),
|
||||||
|
CreatedBy = table.Column<long>(type: "bigint", nullable: true),
|
||||||
|
LastModified = table.Column<DateTime>(type: "datetime2", nullable: true),
|
||||||
|
LastModifiedBy = table.Column<long>(type: "bigint", nullable: true),
|
||||||
|
Version = table.Column<long>(type: "bigint", nullable: false),
|
||||||
IsDeleted = table.Column<bool>(type: "bit", nullable: false)
|
IsDeleted = table.Column<bool>(type: "bit", nullable: false)
|
||||||
},
|
},
|
||||||
constraints: table =>
|
constraints: table =>
|
||||||
@ -46,24 +54,6 @@ namespace Flight.Data.Migrations
|
|||||||
table.PrimaryKey("PK_Airport", x => x.Id);
|
table.PrimaryKey("PK_Airport", x => x.Id);
|
||||||
});
|
});
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
|
||||||
name: "OutboxMessages",
|
|
||||||
columns: table => new
|
|
||||||
{
|
|
||||||
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
|
||||||
Name = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
|
||||||
OccurredOn = table.Column<DateTime>(type: "datetime2", nullable: false),
|
|
||||||
Type = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
|
||||||
Data = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
|
||||||
ProcessedOn = table.Column<DateTime>(type: "datetime2", nullable: true),
|
|
||||||
EventType = table.Column<string>(type: "varchar(50)", unicode: false, maxLength: 50, nullable: false),
|
|
||||||
CorrelationId = table.Column<string>(type: "nvarchar(max)", nullable: true)
|
|
||||||
},
|
|
||||||
constraints: table =>
|
|
||||||
{
|
|
||||||
table.PrimaryKey("PK_OutboxMessages", x => x.Id);
|
|
||||||
});
|
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
migrationBuilder.CreateTable(
|
||||||
name: "Flight",
|
name: "Flight",
|
||||||
schema: "dbo",
|
schema: "dbo",
|
||||||
@ -80,7 +70,11 @@ namespace Flight.Data.Migrations
|
|||||||
FlightDate = table.Column<DateTime>(type: "datetime2", nullable: false),
|
FlightDate = table.Column<DateTime>(type: "datetime2", nullable: false),
|
||||||
Status = table.Column<int>(type: "int", nullable: false),
|
Status = table.Column<int>(type: "int", nullable: false),
|
||||||
Price = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
|
Price = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
|
||||||
LastModified = table.Column<DateTime>(type: "datetime2", nullable: false),
|
CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: true),
|
||||||
|
CreatedBy = table.Column<long>(type: "bigint", nullable: true),
|
||||||
|
LastModified = table.Column<DateTime>(type: "datetime2", nullable: true),
|
||||||
|
LastModifiedBy = table.Column<long>(type: "bigint", nullable: true),
|
||||||
|
Version = table.Column<long>(type: "bigint", nullable: false),
|
||||||
IsDeleted = table.Column<bool>(type: "bit", nullable: false)
|
IsDeleted = table.Column<bool>(type: "bit", nullable: false)
|
||||||
},
|
},
|
||||||
constraints: table =>
|
constraints: table =>
|
||||||
@ -112,7 +106,11 @@ namespace Flight.Data.Migrations
|
|||||||
Type = table.Column<int>(type: "int", nullable: false),
|
Type = table.Column<int>(type: "int", nullable: false),
|
||||||
Class = table.Column<int>(type: "int", nullable: false),
|
Class = table.Column<int>(type: "int", nullable: false),
|
||||||
FlightId = table.Column<long>(type: "bigint", nullable: false),
|
FlightId = table.Column<long>(type: "bigint", nullable: false),
|
||||||
LastModified = table.Column<DateTime>(type: "datetime2", nullable: false),
|
CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: true),
|
||||||
|
CreatedBy = table.Column<long>(type: "bigint", nullable: true),
|
||||||
|
LastModified = table.Column<DateTime>(type: "datetime2", nullable: true),
|
||||||
|
LastModifiedBy = table.Column<long>(type: "bigint", nullable: true),
|
||||||
|
Version = table.Column<long>(type: "bigint", nullable: false),
|
||||||
IsDeleted = table.Column<bool>(type: "bit", nullable: false)
|
IsDeleted = table.Column<bool>(type: "bit", nullable: false)
|
||||||
},
|
},
|
||||||
constraints: table =>
|
constraints: table =>
|
||||||
@ -148,9 +146,6 @@ namespace Flight.Data.Migrations
|
|||||||
|
|
||||||
protected override void Down(MigrationBuilder migrationBuilder)
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
{
|
{
|
||||||
migrationBuilder.DropTable(
|
|
||||||
name: "OutboxMessages");
|
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
migrationBuilder.DropTable(
|
||||||
name: "Seat",
|
name: "Seat",
|
||||||
schema: "dbo");
|
schema: "dbo");
|
||||||
@ -22,76 +22,6 @@ namespace Flight.Data.Migrations
|
|||||||
|
|
||||||
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1);
|
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1);
|
||||||
|
|
||||||
modelBuilder.Entity("BuildingBlocks.InternalProcessor.InternalMessage", b =>
|
|
||||||
{
|
|
||||||
b.Property<Guid>("EventId")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("uniqueidentifier");
|
|
||||||
|
|
||||||
b.Property<string>("CommandType")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<Guid?>("CorrelationId")
|
|
||||||
.HasColumnType("uniqueidentifier");
|
|
||||||
|
|
||||||
b.Property<string>("Data")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("Name")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<DateTime>("OccurredOn")
|
|
||||||
.HasColumnType("datetime2");
|
|
||||||
|
|
||||||
b.Property<DateTime?>("ProcessedOn")
|
|
||||||
.HasColumnType("datetime2");
|
|
||||||
|
|
||||||
b.HasKey("EventId");
|
|
||||||
|
|
||||||
b.ToTable("InternalMessages", (string)null);
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("BuildingBlocks.Outbox.OutboxMessage", b =>
|
|
||||||
{
|
|
||||||
b.Property<Guid>("EventId")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("uniqueidentifier");
|
|
||||||
|
|
||||||
b.Property<Guid?>("CorrelationId")
|
|
||||||
.HasColumnType("uniqueidentifier");
|
|
||||||
|
|
||||||
b.Property<string>("Data")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("EventType")
|
|
||||||
.IsRequired()
|
|
||||||
.HasMaxLength(50)
|
|
||||||
.IsUnicode(false)
|
|
||||||
.HasColumnType("varchar(50)");
|
|
||||||
|
|
||||||
b.Property<string>("Name")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<DateTime>("OccurredOn")
|
|
||||||
.HasColumnType("datetime2");
|
|
||||||
|
|
||||||
b.Property<DateTime?>("ProcessedOn")
|
|
||||||
.HasColumnType("datetime2");
|
|
||||||
|
|
||||||
b.Property<string>("Type")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.HasKey("EventId");
|
|
||||||
|
|
||||||
b.ToTable("OutboxMessages", (string)null);
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Flight.Aircrafts.Models.Aircraft", b =>
|
modelBuilder.Entity("Flight.Aircrafts.Models.Aircraft", b =>
|
||||||
{
|
{
|
||||||
b.Property<long>("Id")
|
b.Property<long>("Id")
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
using System;
|
using System.Threading.Tasks;
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace Integration.Test;
|
namespace Integration.Test;
|
||||||
@ -12,9 +11,9 @@ public class DeleteTests
|
|||||||
public DeleteTests(TestFixture fixture) => _fixture = fixture;
|
public DeleteTests(TestFixture fixture) => _fixture = fixture;
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public async Task Should_delete_flight()
|
public Task Should_delete_flight()
|
||||||
{
|
{
|
||||||
var b = 2;
|
return Task.CompletedTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,70 +0,0 @@
|
|||||||
using System.Linq;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Ductus.FluentDocker.Builders;
|
|
||||||
using Ductus.FluentDocker.Services;
|
|
||||||
using Ductus.FluentDocker.Services.Extensions;
|
|
||||||
|
|
||||||
namespace Integration.Test.DockerTestUtilities;
|
|
||||||
|
|
||||||
public static class DockerDatabaseUtilities
|
|
||||||
{
|
|
||||||
private const string ACCEPT_EULA = "Y";
|
|
||||||
private const string SA_PASSWORD = "@Aa123456";
|
|
||||||
private const string DB_CONTAINER_NAME = "sqldb";
|
|
||||||
private static readonly ImageTag ImageTagForOs = new("mcr.microsoft.com/mssql/server", "2017-latest");
|
|
||||||
|
|
||||||
public static async Task<int> EnsureDockerStartedAndGetPortPortAsync()
|
|
||||||
{
|
|
||||||
await DockerUtilities.CleanupRunningContainers(DB_CONTAINER_NAME);
|
|
||||||
await DockerUtilities.CleanupRunningVolumes(DB_CONTAINER_NAME);
|
|
||||||
|
|
||||||
var hosts = new Hosts().Discover();
|
|
||||||
var docker = hosts.FirstOrDefault(x => x.IsNative) ?? hosts.FirstOrDefault(x => x.Name == "default");
|
|
||||||
|
|
||||||
// create container, if one doesn't already exist
|
|
||||||
var existingContainer = docker?.GetContainers().FirstOrDefault(c => c.Name == DB_CONTAINER_NAME);
|
|
||||||
|
|
||||||
if (existingContainer == null)
|
|
||||||
{
|
|
||||||
var container = new Builder().UseContainer()
|
|
||||||
.WithName(DB_CONTAINER_NAME)
|
|
||||||
.UseImage($"{ImageTagForOs.Image}:{ImageTagForOs.Tag}")
|
|
||||||
.ExposePort(1433, 1433)
|
|
||||||
.WithEnvironment(
|
|
||||||
$"SA_PASSWORD={SA_PASSWORD}",
|
|
||||||
$"ACCEPT_EULA={ACCEPT_EULA}")
|
|
||||||
.WaitForPort("1433/tcp", 30000 /*30s*/)
|
|
||||||
.Build();
|
|
||||||
|
|
||||||
container.Start();
|
|
||||||
|
|
||||||
await DockerUtilities.WaitUntilDatabaseAvailableAsync(GetSqlConnectionString());
|
|
||||||
}
|
|
||||||
|
|
||||||
return existingContainer.ToHostExposedEndpoint("1433/tcp").Port;
|
|
||||||
}
|
|
||||||
|
|
||||||
// SQL Server 2019 does not work on macOS + M1 chip. So we use SQL Edge as a workaround until SQL Server 2022 is GA.
|
|
||||||
// See https://github.com/pdevito3/craftsman/issues/53 for details.
|
|
||||||
private static ImageTag GetImageTagForOs()
|
|
||||||
{
|
|
||||||
var sqlServerImageTag = new ImageTag("mcr.microsoft.com/mssql/server", "2019-latest");
|
|
||||||
var sqlEdgeImageTag = new ImageTag("mcr.microsoft.com/azure-sql-edge", "latest");
|
|
||||||
return IsRunningOnMacOsArm64() ? sqlEdgeImageTag : sqlServerImageTag;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static bool IsRunningOnMacOsArm64()
|
|
||||||
{
|
|
||||||
var isMacOs = RuntimeInformation.IsOSPlatform(OSPlatform.OSX);
|
|
||||||
var cpuArch = RuntimeInformation.ProcessArchitecture;
|
|
||||||
return isMacOs && cpuArch == Architecture.Arm64;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static string GetSqlConnectionString()
|
|
||||||
{
|
|
||||||
return DockerUtilities.GetSqlConnectionString();
|
|
||||||
}
|
|
||||||
|
|
||||||
private record ImageTag(string Image, string Tag);
|
|
||||||
}
|
|
||||||
@ -1,135 +0,0 @@
|
|||||||
// based on https://blog.dangl.me/archive/running-sql-server-integration-tests-in-net-core-projects-via-docker/
|
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Net;
|
|
||||||
using System.Net.Sockets;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Docker.DotNet;
|
|
||||||
using Docker.DotNet.Models;
|
|
||||||
using Microsoft.Data.SqlClient;
|
|
||||||
|
|
||||||
namespace Integration.Test.DockerTestUtilities;
|
|
||||||
|
|
||||||
public static class DockerUtilities
|
|
||||||
{
|
|
||||||
private static bool IsRunningOnWindows()
|
|
||||||
{
|
|
||||||
return Environment.OSVersion.Platform == PlatformID.Win32NT;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static DockerClient GetDockerClient()
|
|
||||||
{
|
|
||||||
var dockerUri = IsRunningOnWindows()
|
|
||||||
? "npipe://./pipe/docker_engine"
|
|
||||||
: "unix:///var/run/docker.sock";
|
|
||||||
return new DockerClientConfiguration(new Uri(dockerUri))
|
|
||||||
.CreateClient();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static async Task CleanupRunningContainers(string containerName, int hoursTillExpiration = -24)
|
|
||||||
{
|
|
||||||
var dockerClient = GetDockerClient();
|
|
||||||
|
|
||||||
var runningContainers = await dockerClient.Containers
|
|
||||||
.ListContainersAsync(new ContainersListParameters());
|
|
||||||
|
|
||||||
foreach (var runningContainer in
|
|
||||||
runningContainers.Where(cont => cont.Names.Any(n => n.Contains(containerName))))
|
|
||||||
{
|
|
||||||
// Stopping all test containers that are older than 24 hours
|
|
||||||
var expiration = hoursTillExpiration > 0
|
|
||||||
? hoursTillExpiration * -1
|
|
||||||
: hoursTillExpiration;
|
|
||||||
if (runningContainer.Created < DateTime.UtcNow.AddHours(expiration))
|
|
||||||
try
|
|
||||||
{
|
|
||||||
await EnsureDockerContainersStoppedAndRemovedAsync(runningContainer.ID);
|
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
// Ignoring failures to stop running containers
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static async Task CleanupRunningVolumes(string volumeName, int hoursTillExpiration = -24)
|
|
||||||
{
|
|
||||||
var dockerClient = GetDockerClient();
|
|
||||||
|
|
||||||
var runningVolumes = await dockerClient.Volumes.ListAsync();
|
|
||||||
|
|
||||||
foreach (var runningVolume in runningVolumes.Volumes.Where(v => v.Name == volumeName))
|
|
||||||
{
|
|
||||||
// Stopping all test volumes that are older than 24 hours
|
|
||||||
var expiration = hoursTillExpiration > 0
|
|
||||||
? hoursTillExpiration * -1
|
|
||||||
: hoursTillExpiration;
|
|
||||||
if (DateTime.Parse(runningVolume.CreatedAt) < DateTime.UtcNow.AddHours(expiration))
|
|
||||||
try
|
|
||||||
{
|
|
||||||
await EnsureDockerVolumesRemovedAsync(runningVolume.Name);
|
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
// Ignoring failures to stop running containers
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static async Task EnsureDockerContainersStoppedAndRemovedAsync(string dockerContainerId)
|
|
||||||
{
|
|
||||||
var dockerClient = GetDockerClient();
|
|
||||||
await dockerClient.Containers
|
|
||||||
.StopContainerAsync(dockerContainerId, new ContainerStopParameters());
|
|
||||||
await dockerClient.Containers
|
|
||||||
.RemoveContainerAsync(dockerContainerId, new ContainerRemoveParameters());
|
|
||||||
}
|
|
||||||
|
|
||||||
public static async Task EnsureDockerVolumesRemovedAsync(string volumeName)
|
|
||||||
{
|
|
||||||
var dockerClient = GetDockerClient();
|
|
||||||
await dockerClient.Volumes.RemoveAsync(volumeName);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static async Task WaitUntilDatabaseAvailableAsync(string connectionString)
|
|
||||||
{
|
|
||||||
var start = DateTime.UtcNow;
|
|
||||||
const int maxWaitTimeSeconds = 60;
|
|
||||||
var connectionEstablished = false;
|
|
||||||
while (!connectionEstablished && start.AddSeconds(maxWaitTimeSeconds) > DateTime.UtcNow)
|
|
||||||
try
|
|
||||||
{
|
|
||||||
using var sqlConnection = new SqlConnection(connectionString);
|
|
||||||
await sqlConnection.OpenAsync();
|
|
||||||
connectionEstablished = true;
|
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
// If opening the SQL connection fails, SQL Server is not ready yet
|
|
||||||
await Task.Delay(500);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!connectionEstablished)
|
|
||||||
throw new Exception(
|
|
||||||
$"Connection to the SQL docker database could not be established within {maxWaitTimeSeconds} seconds.");
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int GetFreePort()
|
|
||||||
{
|
|
||||||
// From https://stackoverflow.com/a/150974/4190785
|
|
||||||
var tcpListener = new TcpListener(IPAddress.Loopback, 0);
|
|
||||||
tcpListener.Start();
|
|
||||||
var port = ((IPEndPoint) tcpListener.LocalEndpoint).Port;
|
|
||||||
tcpListener.Stop();
|
|
||||||
return port;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static string GetSqlConnectionString()
|
|
||||||
{
|
|
||||||
return new SqlConnectionStringBuilder()
|
|
||||||
{
|
|
||||||
ConnectionString = "Server=db;Database=FlightDB;User ID=sa;Password=@Aa123456"
|
|
||||||
}.ToString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,14 +1,25 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using BuildingBlocks.Domain.Model;
|
using BuildingBlocks.Domain.Model;
|
||||||
using Flight.Data;
|
using Flight.Data;
|
||||||
|
using MassTransit;
|
||||||
|
using MassTransit.Testing;
|
||||||
using MediatR;
|
using MediatR;
|
||||||
|
using Microsoft.AspNetCore.Hosting;
|
||||||
|
using Microsoft.AspNetCore.Http;
|
||||||
using Microsoft.AspNetCore.Mvc.Testing;
|
using Microsoft.AspNetCore.Mvc.Testing;
|
||||||
|
using Microsoft.AspNetCore.TestHost;
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using Microsoft.Extensions.DependencyInjection.Extensions;
|
||||||
|
using Microsoft.Extensions.Hosting;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using Moq;
|
||||||
using Respawn;
|
using Respawn;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
using Xunit.Abstractions;
|
||||||
|
|
||||||
namespace Integration.Test;
|
namespace Integration.Test;
|
||||||
|
|
||||||
@ -18,51 +29,72 @@ public class SliceFixtureCollection : ICollectionFixture<TestFixture>
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ref: https://github.com/jbogard/ContosoUniversityDotNetCore-Pages/blob/master/ContosoUniversity.IntegrationTests/SliceFixture.cs
|
// ref: https://github.com/jbogard/ContosoUniversityDotNetCore-Pages/blob/master/ContosoUniversity.IntegrationTests/SliceFixture.cs
|
||||||
|
// ref: https://github.com/MassTransit/MassTransit/blob/00d6992286911a437b63b93c89a56e920b053c11/src/MassTransit.TestFramework/InMemoryTestFixture.cs
|
||||||
|
// ref: https://wrapt.dev/blog/building-an-event-driven-dotnet-application-integration-testing
|
||||||
public class TestFixture : IAsyncLifetime
|
public class TestFixture : IAsyncLifetime
|
||||||
{
|
{
|
||||||
private readonly Checkpoint _checkpoint;
|
private readonly Checkpoint _checkpoint;
|
||||||
private readonly IConfiguration _configuration;
|
private readonly IConfiguration _configuration;
|
||||||
private readonly WebApplicationFactory<Program> _factory;
|
private readonly WebApplicationFactory<Program> _factory;
|
||||||
private readonly IServiceScopeFactory _scopeFactory;
|
private readonly IServiceScopeFactory _scopeFactory;
|
||||||
|
private static InMemoryTestHarness _harness;
|
||||||
|
public ITestOutputHelper Output { get; set; }
|
||||||
|
|
||||||
public TestFixture()
|
public TestFixture()
|
||||||
{
|
{
|
||||||
var factory = FlightTestApplicationFactory();
|
_factory = FlightTestApplicationFactory();
|
||||||
|
|
||||||
_configuration = factory.Services.GetRequiredService<IConfiguration>();
|
_configuration = _factory.Services.GetRequiredService<IConfiguration>();
|
||||||
_scopeFactory = factory.Services.GetRequiredService<IServiceScopeFactory>();
|
_scopeFactory = _factory.Services.GetRequiredService<IServiceScopeFactory>();
|
||||||
|
|
||||||
_checkpoint = new Checkpoint();
|
_checkpoint = new Checkpoint();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public WebApplicationFactory<Program> FlightTestApplicationFactory()
|
||||||
|
{
|
||||||
|
Environment.SetEnvironmentVariable("ASPNETCORE_ENVIRONMENT", "test");
|
||||||
|
|
||||||
|
return new WebApplicationFactory<Program>()
|
||||||
|
.WithWebHostBuilder(builder =>
|
||||||
|
{
|
||||||
|
builder.ConfigureTestServices((services) =>
|
||||||
|
{
|
||||||
|
services.RemoveAll(typeof(IHostedService));
|
||||||
|
});
|
||||||
|
|
||||||
|
builder.ConfigureServices(services =>
|
||||||
|
{
|
||||||
|
builder.ConfigureLogging(logging =>
|
||||||
|
{
|
||||||
|
logging.ClearProviders(); // Remove other loggers
|
||||||
|
});
|
||||||
|
|
||||||
|
var httpContextAccessorService = services.FirstOrDefault(d =>
|
||||||
|
d.ServiceType == typeof(IHttpContextAccessor));
|
||||||
|
|
||||||
|
services.Remove(httpContextAccessorService);
|
||||||
|
services.AddSingleton(_ => Mock.Of<IHttpContextAccessor>());
|
||||||
|
|
||||||
|
services.AddScoped<InMemoryTestHarness>();
|
||||||
|
var provider = services.BuildServiceProvider();
|
||||||
|
var serviceScopeFactory = provider.GetService<IServiceScopeFactory>();
|
||||||
|
|
||||||
|
// MassTransit Start Setup -- Do Not Delete Comment
|
||||||
|
_harness = serviceScopeFactory?.CreateScope().ServiceProvider.GetRequiredService<InMemoryTestHarness>();
|
||||||
|
_harness?.Start().GetAwaiter().GetResult();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
public Task InitializeAsync()
|
public Task InitializeAsync()
|
||||||
{
|
{
|
||||||
return _checkpoint.Reset(_configuration.GetConnectionString("DefaultConnection"));
|
return _checkpoint.Reset(_configuration.GetConnectionString("DefaultConnection"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task DisposeAsync()
|
public async Task DisposeAsync()
|
||||||
{
|
{
|
||||||
_factory?.Dispose();
|
await _harness.Stop();
|
||||||
return Task.CompletedTask;
|
await _factory.DisposeAsync();
|
||||||
}
|
|
||||||
|
|
||||||
public WebApplicationFactory<Program> FlightTestApplicationFactory()
|
|
||||||
{
|
|
||||||
return new WebApplicationFactory<Program>()
|
|
||||||
.WithWebHostBuilder(builder =>
|
|
||||||
{
|
|
||||||
builder.ConfigureAppConfiguration((_, configBuilder) =>
|
|
||||||
{
|
|
||||||
configBuilder.AddInMemoryCollection(new Dictionary<string, string>
|
|
||||||
{
|
|
||||||
{
|
|
||||||
"ConnectionStrings:DefaultConnection",
|
|
||||||
"Server=db;Database=FlightDB;User ID=sa;Password=@Aa123456"
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task ExecuteScopeAsync(Func<IServiceProvider, Task> action)
|
public async Task ExecuteScopeAsync(Func<IServiceProvider, Task> action)
|
||||||
@ -227,4 +259,65 @@ public class TestFixture : IAsyncLifetime
|
|||||||
return mediator.Send(request);
|
return mediator.Send(request);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// MassTransit Methods -- Do Not Delete Comment
|
||||||
|
/// <summary>
|
||||||
|
/// Publishes a message to the bus, and waits for the specified response.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="message">The message that should be published.</param>
|
||||||
|
/// <typeparam name="TMessage">The message that should be published.</typeparam>
|
||||||
|
public static async Task PublishMessage<TMessage>(object message)
|
||||||
|
where TMessage : class
|
||||||
|
{
|
||||||
|
await _harness.Bus.Publish<TMessage>(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Confirm if there was a fault when publishing for this harness.
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="TMessage">The message that should be published.</typeparam>
|
||||||
|
/// <returns>A boolean of true if there was a fault for a message of the given type when published.</returns>
|
||||||
|
public Task<bool> IsFaultyPublished<TMessage>()
|
||||||
|
where TMessage : class
|
||||||
|
{
|
||||||
|
return _harness.Published.Any<Fault<TMessage>>();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Confirm that a message has been published for this harness.
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="TMessage">The message that should be published.</typeparam>
|
||||||
|
/// <returns>A boolean of true if a message of the given type has been published.</returns>
|
||||||
|
public Task<bool> IsPublished<TMessage>()
|
||||||
|
where TMessage : class
|
||||||
|
{
|
||||||
|
return _harness.Published.Any<TMessage>();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Confirm that a message has been consumed for this harness.
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="TMessage">The message that should be consumed.</typeparam>
|
||||||
|
/// <returns>A boolean of true if a message of the given type has been consumed.</returns>
|
||||||
|
public Task<bool> IsConsumed<TMessage>()
|
||||||
|
where TMessage : class
|
||||||
|
{
|
||||||
|
return _harness.Consumed.Any<TMessage>();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The desired consumer consumed the message.
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="TMessage">The message that should be consumed.</typeparam>
|
||||||
|
/// <typeparam name="TConsumedBy">The consumer of the message.</typeparam>
|
||||||
|
/// <returns>A boolean of true if a message of the given type has been consumed by the given consumer.</returns>
|
||||||
|
public Task<bool> IsConsumed<TMessage, TConsumedBy>()
|
||||||
|
where TMessage : class
|
||||||
|
where TConsumedBy : class, IConsumer
|
||||||
|
{
|
||||||
|
using var scope = _scopeFactory.CreateScope();
|
||||||
|
var consumerHarness = scope.ServiceProvider.GetRequiredService<IConsumerTestHarness<TConsumedBy>>();
|
||||||
|
return consumerHarness.Consumed.Any<TMessage>();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -45,7 +45,7 @@ builder.Services.AddScoped<IDataSeeder, IdentityDataSeeder>();
|
|||||||
builder.Services.AddTransient<IEventMapper, EventMapper>();
|
builder.Services.AddTransient<IEventMapper, EventMapper>();
|
||||||
builder.Services.AddTransient<IBusPublisher, BusPublisher>();
|
builder.Services.AddTransient<IBusPublisher, BusPublisher>();
|
||||||
|
|
||||||
builder.Services.AddCustomMassTransit(typeof(IdentityRoot).Assembly);
|
builder.Services.AddCustomMassTransit(typeof(IdentityRoot).Assembly, env);
|
||||||
builder.Services.AddCustomOpenTelemetry();
|
builder.Services.AddCustomOpenTelemetry();
|
||||||
|
|
||||||
builder.Services.AddIdentityServer(env);
|
builder.Services.AddIdentityServer(env);
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"App": "Identity-Service",
|
"App": "Identity-Service",
|
||||||
"ConnectionStrings": {
|
"ConnectionStrings": {
|
||||||
"IdentityConnection": "Server=db;Database=IdentityDB;User ID=sa;Password=@Aa123456"
|
"DefaultConnection": "Server=db;Database=IdentityDB;User ID=sa;Password=@Aa123456"
|
||||||
},
|
},
|
||||||
"RabbitMq": {
|
"RabbitMq": {
|
||||||
"HostName": "rabbitmq",
|
"HostName": "rabbitmq",
|
||||||
|
|||||||
@ -22,6 +22,7 @@ using Serilog;
|
|||||||
|
|
||||||
var builder = WebApplication.CreateBuilder(args);
|
var builder = WebApplication.CreateBuilder(args);
|
||||||
var configuration = builder.Configuration;
|
var configuration = builder.Configuration;
|
||||||
|
var env = builder.Environment;
|
||||||
|
|
||||||
var appOptions = builder.Services.GetOptions<AppOptions>("AppOptions");
|
var appOptions = builder.Services.GetOptions<AppOptions>("AppOptions");
|
||||||
Console.WriteLine(FiggleFonts.Standard.Render(appOptions.Name));
|
Console.WriteLine(FiggleFonts.Standard.Render(appOptions.Name));
|
||||||
@ -41,7 +42,7 @@ builder.Services.AddHttpContextAccessor();
|
|||||||
builder.Services.AddTransient<IEventMapper, EventMapper>();
|
builder.Services.AddTransient<IEventMapper, EventMapper>();
|
||||||
builder.Services.AddTransient<IBusPublisher, BusPublisher>();
|
builder.Services.AddTransient<IBusPublisher, BusPublisher>();
|
||||||
|
|
||||||
builder.Services.AddCustomMassTransit(typeof(PassengerRoot).Assembly);
|
builder.Services.AddCustomMassTransit(typeof(PassengerRoot).Assembly, env);
|
||||||
builder.Services.AddCustomOpenTelemetry();
|
builder.Services.AddCustomOpenTelemetry();
|
||||||
builder.Services.AddGrpc(options =>
|
builder.Services.AddGrpc(options =>
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"App": "Passenger-Service",
|
"App": "Passenger-Service",
|
||||||
"ConnectionStrings": {
|
"ConnectionStrings": {
|
||||||
"PassengerConnection": "Server=db;Database=PassengerDB;User ID=sa;Password=@Aa123456"
|
"DefaultConnection": "Server=db;Database=PassengerDB;User ID=sa;Password=@Aa123456"
|
||||||
},
|
},
|
||||||
"Jwt": {
|
"Jwt": {
|
||||||
"Authority": "https://localhost:5005",
|
"Authority": "https://localhost:5005",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user