appany / AppAny.Quartz.EntityFrameworkCore.Migrations

EntityFrameworkCore PostgreSQL migrations for Quartz.NET
MIT License
68 stars 18 forks source link

The default schema name for Sql Server doesn't match Quartz.NET #66

Open merlinschumacher opened 3 months ago

merlinschumacher commented 3 months ago

When using this library to create the tables for Quartz.NET the library uses the schema "quartz" by default. But Quartz.NET itself uses "dbo". The migrations only work when setting the schema manually, because Quartz.NET doesn't find the tables and . See https://github.com/quartznet/quartznet/blob/main/database/tables/tables_sqlServer.sql

The following error occurs:

2024-05-17 17:29:22.9494|ERROR|Microsoft.Extensions.Hosting.Internal.Host|Hosting failed to start|Quartz.SchedulerException: Database schema validation failed. Make sure you have created the database tables that Quartz requires using the database schema scripts. You can disable this check by setting quartz.jobStore.performSchemaValidation to false
 ---> Quartz.JobPersistenceException: Unable to query against table QRTZ_JOB_DETAILS: Invalid object name 'QRTZ_JOB_DETAILS'.
sergeyshaykhullin commented 2 months ago

@merlinschumacher Could you please provide a PR for this fix?

fbjerggaard commented 2 months ago

This is also an issue for PostgreSQL. It can be solved with the following configuration:

          q.UsePersistentStore(c =>
                {
                    c.UsePostgres(po =>
                    {
                        po.UseDriverDelegate<PostgreSQLDelegate>();
                        po.ConnectionStringName = "Database";
                        po.TablePrefix = "quartz.qrtz_";
                    });
                    c.UseNewtonsoftJsonSerializer();
                });

But that's not really pretty