-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix #1195 - Add Quartz.NET Tables to database migration + fix connect…
…ion string
- Loading branch information
1 parent
e346f51
commit edd2340
Showing
4 changed files
with
95 additions
and
12 deletions.
There are no files selected for viewing
59 changes: 59 additions & 0 deletions
59
...IoTHub.Portal.Infrastructure/Migrations/20220910143007_Add Quartz .NET tables.Designer.cs
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
22 changes: 22 additions & 0 deletions
22
src/AzureIoTHub.Portal.Infrastructure/Migrations/20220910143007_Add Quartz .NET tables.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// Copyright (c) CGI France. All rights reserved. | ||
// Licensed under the MIT license. See LICENSE file in the project root for full license information. | ||
|
||
#nullable disable | ||
|
||
namespace AzureIoTHub.Portal.Infrastructure.Migrations | ||
{ | ||
using Microsoft.EntityFrameworkCore.Migrations; | ||
|
||
public partial class AddQuartzNETtables : Migration | ||
{ | ||
protected override void Up(MigrationBuilder migrationBuilder) | ||
{ | ||
_ = migrationBuilder.Sql("DROP TABLE IF EXISTS qrtz_fired_triggers;\r\nDROP TABLE IF EXISTS qrtz_paused_trigger_grps;\r\nDROP TABLE IF EXISTS qrtz_scheduler_state;\r\nDROP TABLE IF EXISTS qrtz_locks;\r\nDROP TABLE IF EXISTS qrtz_simprop_triggers;\r\nDROP TABLE IF EXISTS qrtz_simple_triggers;\r\nDROP TABLE IF EXISTS qrtz_cron_triggers;\r\nDROP TABLE IF EXISTS qrtz_blob_triggers;\r\nDROP TABLE IF EXISTS qrtz_triggers;\r\nDROP TABLE IF EXISTS qrtz_job_details;\r\nDROP TABLE IF EXISTS qrtz_calendars;\r\n\r\n\r\nCREATE TABLE qrtz_job_details\r\n (\r\n sched_name TEXT NOT NULL,\r\n\tjob_name TEXT NOT NULL,\r\n job_group TEXT NOT NULL,\r\n description TEXT NULL,\r\n job_class_name TEXT NOT NULL, \r\n is_durable BOOL NOT NULL,\r\n is_nonconcurrent BOOL NOT NULL,\r\n is_update_data BOOL NOT NULL,\r\n\trequests_recovery BOOL NOT NULL,\r\n job_data BYTEA NULL,\r\n PRIMARY KEY (sched_name,job_name,job_group)\r\n);\r\n\r\nCREATE TABLE qrtz_triggers\r\n (\r\n sched_name TEXT NOT NULL,\r\n\ttrigger_name TEXT NOT NULL,\r\n trigger_group TEXT NOT NULL,\r\n job_name TEXT NOT NULL, \r\n job_group TEXT NOT NULL,\r\n description TEXT NULL,\r\n next_fire_time BIGINT NULL,\r\n prev_fire_time BIGINT NULL,\r\n priority INTEGER NULL,\r\n trigger_state TEXT NOT NULL,\r\n trigger_type TEXT NOT NULL,\r\n start_time BIGINT NOT NULL,\r\n end_time BIGINT NULL,\r\n calendar_name TEXT NULL,\r\n misfire_instr SMALLINT NULL,\r\n job_data BYTEA NULL,\r\n PRIMARY KEY (sched_name,trigger_name,trigger_group),\r\n FOREIGN KEY (sched_name,job_name,job_group) \r\n\t\tREFERENCES qrtz_job_details(sched_name,job_name,job_group) \r\n);\r\n\r\nCREATE TABLE qrtz_simple_triggers\r\n (\r\n sched_name TEXT NOT NULL,\r\n\ttrigger_name TEXT NOT NULL,\r\n trigger_group TEXT NOT NULL,\r\n repeat_count BIGINT NOT NULL,\r\n repeat_interval BIGINT NOT NULL,\r\n times_triggered BIGINT NOT NULL,\r\n PRIMARY KEY (sched_name,trigger_name,trigger_group),\r\n FOREIGN KEY (sched_name,trigger_name,trigger_group) \r\n\t\tREFERENCES qrtz_triggers(sched_name,trigger_name,trigger_group) ON DELETE CASCADE\r\n);\r\n\r\nCREATE TABLE QRTZ_SIMPROP_TRIGGERS \r\n (\r\n sched_name TEXT NOT NULL,\r\n trigger_name TEXT NOT NULL ,\r\n trigger_group TEXT NOT NULL ,\r\n str_prop_1 TEXT NULL,\r\n str_prop_2 TEXT NULL,\r\n str_prop_3 TEXT NULL,\r\n int_prop_1 INTEGER NULL,\r\n int_prop_2 INTEGER NULL,\r\n long_prop_1 BIGINT NULL,\r\n long_prop_2 BIGINT NULL,\r\n dec_prop_1 NUMERIC NULL,\r\n dec_prop_2 NUMERIC NULL,\r\n bool_prop_1 BOOL NULL,\r\n bool_prop_2 BOOL NULL,\r\n\ttime_zone_id TEXT NULL,\r\n\tPRIMARY KEY (sched_name,trigger_name,trigger_group),\r\n FOREIGN KEY (sched_name,trigger_name,trigger_group) \r\n\t\tREFERENCES qrtz_triggers(sched_name,trigger_name,trigger_group) ON DELETE CASCADE\r\n);\r\n\r\nCREATE TABLE qrtz_cron_triggers\r\n (\r\n sched_name TEXT NOT NULL,\r\n trigger_name TEXT NOT NULL,\r\n trigger_group TEXT NOT NULL,\r\n cron_expression TEXT NOT NULL,\r\n time_zone_id TEXT,\r\n PRIMARY KEY (sched_name,trigger_name,trigger_group),\r\n FOREIGN KEY (sched_name,trigger_name,trigger_group) \r\n\t\tREFERENCES qrtz_triggers(sched_name,trigger_name,trigger_group) ON DELETE CASCADE\r\n);\r\n\r\nCREATE TABLE qrtz_blob_triggers\r\n (\r\n sched_name TEXT NOT NULL,\r\n trigger_name TEXT NOT NULL,\r\n trigger_group TEXT NOT NULL,\r\n blob_data BYTEA NULL,\r\n PRIMARY KEY (sched_name,trigger_name,trigger_group),\r\n FOREIGN KEY (sched_name,trigger_name,trigger_group) \r\n\t\tREFERENCES qrtz_triggers(sched_name,trigger_name,trigger_group) ON DELETE CASCADE\r\n);\r\n\r\nCREATE TABLE qrtz_calendars\r\n (\r\n sched_name TEXT NOT NULL,\r\n calendar_name TEXT NOT NULL, \r\n calendar BYTEA NOT NULL,\r\n PRIMARY KEY (sched_name,calendar_name)\r\n);\r\n\r\nCREATE TABLE qrtz_paused_trigger_grps\r\n (\r\n sched_name TEXT NOT NULL,\r\n trigger_group TEXT NOT NULL, \r\n PRIMARY KEY (sched_name,trigger_group)\r\n);\r\n\r\nCREATE TABLE qrtz_fired_triggers \r\n (\r\n sched_name TEXT NOT NULL,\r\n entry_id TEXT NOT NULL,\r\n trigger_name TEXT NOT NULL,\r\n trigger_group TEXT NOT NULL,\r\n instance_name TEXT NOT NULL,\r\n fired_time BIGINT NOT NULL,\r\n\tsched_time BIGINT NOT NULL,\r\n priority INTEGER NOT NULL,\r\n state TEXT NOT NULL,\r\n job_name TEXT NULL,\r\n job_group TEXT NULL,\r\n is_nonconcurrent BOOL NOT NULL,\r\n requests_recovery BOOL NULL,\r\n PRIMARY KEY (sched_name,entry_id)\r\n);\r\n\r\nCREATE TABLE qrtz_scheduler_state \r\n (\r\n sched_name TEXT NOT NULL,\r\n instance_name TEXT NOT NULL,\r\n last_checkin_time BIGINT NOT NULL,\r\n checkin_interval BIGINT NOT NULL,\r\n PRIMARY KEY (sched_name,instance_name)\r\n);\r\n\r\nCREATE TABLE qrtz_locks\r\n (\r\n sched_name TEXT NOT NULL,\r\n lock_name TEXT NOT NULL, \r\n PRIMARY KEY (sched_name,lock_name)\r\n);\r\n\r\ncreate index idx_qrtz_j_req_recovery on qrtz_job_details(requests_recovery);\r\ncreate index idx_qrtz_t_next_fire_time on qrtz_triggers(next_fire_time);\r\ncreate index idx_qrtz_t_state on qrtz_triggers(trigger_state);\r\ncreate index idx_qrtz_t_nft_st on qrtz_triggers(next_fire_time,trigger_state);\r\ncreate index idx_qrtz_ft_trig_name on qrtz_fired_triggers(trigger_name);\r\ncreate index idx_qrtz_ft_trig_group on qrtz_fired_triggers(trigger_group);\r\ncreate index idx_qrtz_ft_trig_nm_gp on qrtz_fired_triggers(sched_name,trigger_name,trigger_group);\r\ncreate index idx_qrtz_ft_trig_inst_name on qrtz_fired_triggers(instance_name);\r\ncreate index idx_qrtz_ft_job_name on qrtz_fired_triggers(job_name);\r\ncreate index idx_qrtz_ft_job_group on qrtz_fired_triggers(job_group);\r\ncreate index idx_qrtz_ft_job_req_recovery on qrtz_fired_triggers(requests_recovery);\r\n"); | ||
} | ||
|
||
protected override void Down(MigrationBuilder migrationBuilder) | ||
{ | ||
_ = migrationBuilder.Sql("DROP TABLE IF EXISTS qrtz_fired_triggers;\r\nDROP TABLE IF EXISTS qrtz_paused_trigger_grps;\r\nDROP TABLE IF EXISTS qrtz_scheduler_state;\r\nDROP TABLE IF EXISTS qrtz_locks;\r\nDROP TABLE IF EXISTS qrtz_simprop_triggers;\r\nDROP TABLE IF EXISTS qrtz_simple_triggers;\r\nDROP TABLE IF EXISTS qrtz_cron_triggers;\r\nDROP TABLE IF EXISTS qrtz_blob_triggers;\r\nDROP TABLE IF EXISTS qrtz_triggers;\r\nDROP TABLE IF EXISTS qrtz_job_details;\r\nDROP TABLE IF EXISTS qrtz_calendars;\r\n"); | ||
} | ||
} | ||
} |
5 changes: 4 additions & 1 deletion
5
src/AzureIoTHub.Portal.Infrastructure/Migrations/PortalDbContextModelSnapshot.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters