Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Databases get recreated when data exists #2179

Open
SeanFarrow-RSK opened this issue Nov 6, 2023 · 4 comments
Open

Databases get recreated when data exists #2179

SeanFarrow-RSK opened this issue Nov 6, 2023 · 4 comments

Comments

@SeanFarrow-RSK
Copy link

Describe the bug
When using the sql scripts to create databases to use with the Ado job store, the databases get recreated whether or not data exists in the tables.

I suspect this is due to the way tables are checked for existence. Currently, the existence of the raw table is checked, but we don't check whether any records exist in the table that may or may not exist.
Version used
Latest in the main branch.
With which version did you encounter this behavior.
3.5.0+
To Reproduce
Run the database scripts to create a database for hte ado job store (the database provider should not matter here). Then use quartz and add some jobs and triggers. Next, re-run the program, as the tables exist they will be dropped and re-created.

Expected behavior
If tables exist with data in, I would expect them not to be dropped and recreated.

@jafin
Copy link
Contributor

jafin commented Nov 6, 2023

@SeanFarrow-RSK are you certain it is quartz doing this? AFAIK there are NO schema manipulation routines INSIDE Quartz.net. There are SQL scripts provided to execute externally, but the Quartz.NET library does not execute these at runtime.

Looking at the SQL Scripts they do perform a drop/create. So if you were to rerun the script ,

DROP TABLE [dbo].[QRTZ_LOCKS];
for example. It would destroy existing tables and recreate them. But these really only should be executed once to setup the schema.

@SeanFarrow-RSK
Copy link
Author

SeanFarrow-RSK commented Nov 6, 2023 via email

@jafin
Copy link
Contributor

jafin commented Nov 6, 2023

But I'm sure the Quartz library isn't running these scripts. I can only assume your app or external process is? Those scripts exist to setup the schema once. They shouldn't be rerun. Perhaps there is scope to submit a PR to separate drops from creates, but to your original issue, these scripts should only be run once by whatever mean you have executed them by, as per the docs https://www.quartz-scheduler.net/documentation/quartz-3.x/quick-start.html#trying-out-the-application

@SeanFarrow-RSK
Copy link
Author

SeanFarrow-RSK commented Nov 10, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants