AppAny.Quartz.EntityFrameworkCore.Migrations icon indicating copy to clipboard operation
AppAny.Quartz.EntityFrameworkCore.Migrations copied to clipboard

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

Open merlinschumacher opened this issue 1 year ago • 2 comments

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'.

merlinschumacher avatar May 17 '24 16:05 merlinschumacher

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

sergeyshaykhullin avatar Jun 04 '24 17:06 sergeyshaykhullin

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

fbjerggaard avatar Jun 25 '24 09:06 fbjerggaard