Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@ public void Configure(EntityTypeBuilder<QuartzTrigger> builder)
.HasColumnName("END_TIME")
.HasColumnType("bigint(19)");

builder.Property(x => x.MisfireOriginalFireTime)
.HasColumnName("MISFIRE_ORIG_FIRE_TIME")
.HasColumnType("bigint(19)");

builder.Property(x => x.CalendarName)
.HasColumnName("CALENDAR_NAME")
.HasColumnType("varchar(200)");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@ public void Configure(EntityTypeBuilder<QuartzTrigger> builder)
.HasColumnName("end_time")
.HasColumnType("bigint");

builder.Property(x => x.MisfireOriginalFireTime)
.HasColumnName("misfire_orig_fire_time")
.HasColumnType("bigint");

builder.Property(x => x.CalendarName)
.HasColumnName("calendar_name")
.HasColumnType("text");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@ public void Configure(EntityTypeBuilder<QuartzTrigger> builder)
.HasColumnName("END_TIME")
.HasColumnType("bigint");

builder.Property(x => x.MisfireOriginalFireTime)
.HasColumnName("MISFIRE_ORIG_FIRE_TIME")
.HasColumnType("bigint");

builder.Property(x => x.CalendarName)
.HasColumnName("CALENDAR_NAME")
.HasColumnType("text");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,10 @@ public void Configure(EntityTypeBuilder<QuartzTrigger> builder)
.HasColumnName("END_TIME")
.HasColumnType("bigint");

builder.Property(x => x.MisfireOriginalFireTime)
.HasColumnName("MISFIRE_ORIG_FIRE_TIME")
.HasColumnType("bigint");

builder.Property(x => x.CalendarName)
.HasColumnName("CALENDAR_NAME")
.HasMaxLength(200)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public class QuartzTrigger
public string TriggerType { get; set; } = null!;
public long StartTime { get; set; }
public long? EndTime { get; set; }
public long? MisfireOriginalFireTime { get; set; }
public string? CalendarName { get; set; } = null!;
public short? MisfireInstruction { get; set; }
public byte[]? JobData { get; set; }
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
namespace AppAny.Quartz.EntityFrameworkCore.Migrations.MySql.Tests;

using AppAny.Quartz.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata;

public class QuartzTriggerModelMappingTests
{
[Fact]
public void ShouldMapMisfireOriginalFireTimeColumn()
{
var options = new DbContextOptionsBuilder<MySqlIntegrationDbContext>()
.UseMySql(
"Server=localhost;Port=3306;Database=quartz_mapping_tests;User=root;Password=password",
ServerVersion.Parse("8.0.36-mysql"))
.Options;

using var dbContext = new MySqlIntegrationDbContext(options);
var entityType = dbContext.Model.FindEntityType(typeof(QuartzTrigger));

Assert.NotNull(entityType);

var property = entityType!.FindProperty(nameof(QuartzTrigger.MisfireOriginalFireTime));
Assert.NotNull(property);

var table = StoreObjectIdentifier.Table(entityType.GetTableName()!, entityType.GetSchema());
Assert.Equal("MISFIRE_ORIG_FIRE_TIME", property!.GetColumnName(table));
Assert.Equal("bigint(19)", property.GetColumnType());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
namespace AppAny.Quartz.EntityFrameworkCore.Migrations.PostgreSQL.Tests;

using AppAny.Quartz.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata;

public class QuartzTriggerModelMappingTests
{
[Fact]
public void ShouldMapMisfireOriginalFireTimeColumn()
{
var options = new DbContextOptionsBuilder<PostgreSqlIntegrationDbContext>()
.UseNpgsql("Host=localhost;Port=5432;Database=quartz_mapping_tests;Username=postgres;Password=postgres")
.Options;

using var dbContext = new PostgreSqlIntegrationDbContext(options);
var entityType = dbContext.Model.FindEntityType(typeof(QuartzTrigger));

Assert.NotNull(entityType);

var property = entityType!.FindProperty(nameof(QuartzTrigger.MisfireOriginalFireTime));
Assert.NotNull(property);

var table = StoreObjectIdentifier.Table(entityType.GetTableName()!, entityType.GetSchema());
Assert.Equal("misfire_orig_fire_time", property!.GetColumnName(table));
Assert.Equal("bigint", property.GetColumnType());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
namespace AppAny.Quartz.EntityFrameworkCore.Migrations.SQLite.Tests;

using AppAny.Quartz.EntityFrameworkCore.Migrations;
using Microsoft.Data.Sqlite;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata;

public class QuartzTriggerModelMappingTests
{
[Fact]
public void ShouldMapMisfireOriginalFireTimeColumn()
{
var connectionString = new SqliteConnectionStringBuilder
{
Mode = SqliteOpenMode.Memory,
DataSource = ":memory:"
}.ToString();

var options = new DbContextOptionsBuilder<SQLiteIntegrationDbContext>()
.UseSqlite(connectionString)
.Options;

using var dbContext = new SQLiteIntegrationDbContext(options);
var entityType = dbContext.Model.FindEntityType(typeof(QuartzTrigger));

Assert.NotNull(entityType);

var property = entityType!.FindProperty(nameof(QuartzTrigger.MisfireOriginalFireTime));
Assert.NotNull(property);

var table = StoreObjectIdentifier.Table(entityType.GetTableName()!, entityType.GetSchema());
Assert.Equal("MISFIRE_ORIG_FIRE_TIME", property!.GetColumnName(table));
Assert.Equal("bigint", property.GetColumnType());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
namespace AppAny.Quartz.EntityFrameworkCore.Migrations.SqlServer.Tests;

using AppAny.Quartz.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata;

public class QuartzTriggerModelMappingTests
{
[Fact]
public void ShouldMapMisfireOriginalFireTimeColumn()
{
var options = new DbContextOptionsBuilder<SqlServerIntegrationDbContext>()
.UseSqlServer("Server=(localdb)\\mssqllocaldb;Database=QuartzMappingTests;Trusted_Connection=True;")
.Options;

using var dbContext = new SqlServerIntegrationDbContext(options);
var entityType = dbContext.Model.FindEntityType(typeof(QuartzTrigger));

Assert.NotNull(entityType);

var property = entityType!.FindProperty(nameof(QuartzTrigger.MisfireOriginalFireTime));
Assert.NotNull(property);

var table = StoreObjectIdentifier.Table(entityType.GetTableName()!, entityType.GetSchema());
Assert.Equal("MISFIRE_ORIG_FIRE_TIME", property!.GetColumnName(table));
Assert.Equal("bigint", property.GetColumnType());
}
}
Loading