Skip to content

Commit

Permalink
Feature/1719 add support mysql (#1734)
Browse files Browse the repository at this point in the history
* init support mysql

* Add MySQL migrations + move postgres migration to new project

* update namespace Postgres + fix quartz migration MySQL

* Fix startup check connectionstring

* Add MySql Quartz scheduler configuration

* Update unit tests + startup Quartz config

* update sql Quartz migration

* Add custom mysql provider for quartz

* Remove unused directive

* Move database migrate to app configure

* Add DatabaseHelper.GetMySqlServerVersion

* Remove db migrate

* Use DatabaseHelper.GetMySqlServerVersion on MySQL PortalDbContextFactory

* Remove ef migrate of configure app

* Run ef migrate only when can connect to db

* Add unit test on DatabaseHelper.GetMySqlServerVersion

* update exception DatabaseHelper

* Update ef nuget packages on mysql/postgres migrations projects

---------

Co-authored-by: Hocine Hacherouf <hacherouf.hocine@gmail.com>
  • Loading branch information
GuillaumeM-2ISA and hocinehacherouf authored Feb 15, 2023
1 parent ee3547a commit 9964589
Show file tree
Hide file tree
Showing 75 changed files with 2,086 additions and 92 deletions.
4 changes: 4 additions & 0 deletions src/AzureIoTHub.Portal.Domain/ConfigHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,5 +70,9 @@ public abstract class ConfigHandler
public abstract string IdeasAuthenticationToken { get; }

public abstract string PostgreSQLConnectionString { get; }

public abstract string MySQLConnectionString { get; }

public abstract string DbProvider { get; }
}
}
13 changes: 13 additions & 0 deletions src/AzureIoTHub.Portal.Domain/Shared/Constants/DbProviders.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// Copyright (c) CGI France. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

namespace AzureIoTHub.Portal.Domain.Shared.Constants
{

public static class DbProviders
{
public const string PostgreSQL = "PostgreSQL";

public const string MySQL = "MySQL";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@
<PackageReference Include="Newtonsoft.Json" Version="13.0.2" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="7.0.3" />
<PackageReference Include="Polly.Extensions.Http" Version="3.0.0" />
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="7.0.0" />
<PackageReference Include="prometheus-net" Version="7.0.0" />
<PackageReference Include="Quartz" Version="3.6.0" />
<PackageReference Include="Quartz.Extensions.DependencyInjection" Version="3.6.0" />
Expand Down
2 changes: 2 additions & 0 deletions src/AzureIoTHub.Portal.Infrastructure/ConfigHandlerBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ internal abstract class ConfigHandlerBase : ConfigHandler
internal const string DPSIDScopeKey = "IoTDPS:IDScope";
internal const string UseSecurityHeadersKey = "UseSecurityHeaders";
internal const string PostgreSQLConnectionStringKey = "PostgreSQL:ConnectionString";
internal const string MySQLConnectionStringKey = "MySQL:ConnectionString";
internal const string DbProviderKey = "DbProvider";

internal const string OIDCScopeKey = "OIDC:Scope";
internal const string OIDCAuthorityKey = "OIDC:Authority";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

namespace AzureIoTHub.Portal.Infrastructure
{
using AzureIoTHub.Portal.Domain.Shared.Constants;
using Microsoft.Extensions.Configuration;

internal class DevelopmentConfigHandler : ConfigHandlerBase
Expand Down Expand Up @@ -76,5 +77,9 @@ internal DevelopmentConfigHandler(IConfiguration config)
public override string IdeasAuthenticationToken => this.config.GetValue(IdeasAuthenticationTokenKey, string.Empty);

public override string PostgreSQLConnectionString => this.config[PostgreSQLConnectionStringKey];

public override string MySQLConnectionString => this.config[MySQLConnectionStringKey];

public override string DbProvider => this.config.GetValue(DbProviderKey, DbProviders.PostgreSQL);
}
}
24 changes: 24 additions & 0 deletions src/AzureIoTHub.Portal.Infrastructure/Helpers/DatabaseHelper.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// Copyright (c) CGI France. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

namespace AzureIoTHub.Portal.Infrastructure.Helpers
{
using System;
using Microsoft.EntityFrameworkCore;

public static class DatabaseHelper
{
public static ServerVersion GetMySqlServerVersion(string mySQLConnectionString)
{
try
{
return ServerVersion.AutoDetect(mySQLConnectionString);
}
catch (ArgumentException ex)
{
Console.WriteLine(ex.Message);
return new MySqlServerVersion(new Version(8, 0, 32));
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

namespace AzureIoTHub.Portal.Infrastructure
{
using AzureIoTHub.Portal.Domain.Shared.Constants;
using Microsoft.Extensions.Configuration;

internal class ProductionConfigHandler : ConfigHandlerBase
Expand Down Expand Up @@ -38,6 +39,10 @@ internal ProductionConfigHandler(IConfiguration config)

public override string PostgreSQLConnectionString => this.config.GetConnectionString(PostgreSQLConnectionStringKey);

public override string MySQLConnectionString => this.config.GetConnectionString(MySQLConnectionStringKey);

public override string DbProvider => this.config.GetValue(DbProviderKey, DbProviders.PostgreSQL);

public override int StorageAccountDeviceModelImageMaxAge => this.config.GetValue(StorageAccountDeviceModelImageMaxAgeKey, 86400);

public override bool UseSecurityHeaders => this.config.GetValue(UseSecurityHeadersKey, true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ namespace AzureIoTHub.Portal.Infrastructure.Startup
using AzureIoTHub.Portal.Domain;
using AzureIoTHub.Portal.Domain.Options;
using AzureIoTHub.Portal.Domain.Repositories;
using AzureIoTHub.Portal.Domain.Shared.Constants;
using AzureIoTHub.Portal.Infrastructure.Extensions;
using AzureIoTHub.Portal.Infrastructure.Helpers;
using AzureIoTHub.Portal.Infrastructure.Jobs;
using AzureIoTHub.Portal.Infrastructure.Managers;
using AzureIoTHub.Portal.Infrastructure.Mappers;
Expand Down Expand Up @@ -102,23 +104,45 @@ private static IServiceCollection ConfigureDeviceRegstryDependencies(this IServi

private static IServiceCollection ConfigureDatabase(this IServiceCollection services, ConfigHandler configuration)
{
_ = services
.AddDbContextPool<PortalDbContext>(opts =>
{
_ = opts.UseNpgsql(configuration.PostgreSQLConnectionString);
_ = opts.UseExceptionProcessor();
});
var dbContextOptions = new DbContextOptionsBuilder<PortalDbContext>();

if (string.IsNullOrEmpty(configuration.PostgreSQLConnectionString))
return services;
switch (configuration.DbProvider)
{
case DbProviders.PostgreSQL:
if (string.IsNullOrEmpty(configuration.PostgreSQLConnectionString))
{
return services;
}
_ = services.AddDbContextPool<PortalDbContext>(opts =>
{
_ = opts.UseNpgsql(configuration.PostgreSQLConnectionString, x => x.MigrationsAssembly("AzureIoTHub.Portal.Postgres"));
_ = opts.UseExceptionProcessor();
});
_ = dbContextOptions.UseNpgsql(configuration.PostgreSQLConnectionString, x => x.MigrationsAssembly("AzureIoTHub.Portal.Postgres"));
break;
case DbProviders.MySQL:
if (string.IsNullOrEmpty(configuration.MySQLConnectionString))
{
return services;
}
_ = services.AddDbContextPool<PortalDbContext>(opts =>
{
_ = opts.UseMySql(configuration.MySQLConnectionString, DatabaseHelper.GetMySqlServerVersion(configuration.MySQLConnectionString), x => x.MigrationsAssembly("AzureIoTHub.Portal.MySql"));
_ = opts.UseExceptionProcessor();
});
_ = dbContextOptions.UseMySql(configuration.MySQLConnectionString, DatabaseHelper.GetMySqlServerVersion(configuration.MySQLConnectionString), x => x.MigrationsAssembly("AzureIoTHub.Portal.MySql"));
break;
default:
return services;
}

_ = services.AddScoped<IUnitOfWork, UnitOfWork<PortalDbContext>>();

var dbContextOptions = new DbContextOptionsBuilder<PortalDbContext>();
_ = dbContextOptions.UseNpgsql(configuration.PostgreSQLConnectionString);

using var ctx = new PortalDbContext(dbContextOptions.Options);
ctx.Database.Migrate();
using var portalDbContext = new PortalDbContext(dbContextOptions.Options);
if (portalDbContext.Database.CanConnect())
{
portalDbContext.Database.Migrate();
}

return services;
}
Expand Down
22 changes: 22 additions & 0 deletions src/AzureIoTHub.Portal.MySql/AzureIoTHub.Portal.MySql.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.3">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="7.0.3" />
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="7.0.0" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\AzureIoTHub.Portal.Infrastructure\AzureIoTHub.Portal.Infrastructure.csproj" />
</ItemGroup>

</Project>

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#nullable disable

namespace AzureIoTHub.Portal.Infrastructure.Migrations
namespace AzureIoTHub.Portal.MySql.Migrations
{
using Microsoft.EntityFrameworkCore.Migrations;

Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

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.MySql.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 VARCHAR(120) NOT NULL,\r\n\tJOB_NAME VARCHAR(200) NOT NULL,\r\n JOB_GROUP VARCHAR(200) NOT NULL,\r\n DESCRIPTION VARCHAR(250) NULL,\r\n JOB_CLASS_NAME VARCHAR(250) NOT NULL, \r\n IS_DURABLE BOOLEAN NOT NULL,\r\n IS_NONCONCURRENT BOOLEAN NOT NULL,\r\n IS_UPDATE_DATA BOOLEAN NOT NULL,\r\n\tREQUESTS_RECOVERY BOOLEAN NOT NULL,\r\n JOB_DATA BLOB NULL,\r\n PRIMARY KEY (SCHED_NAME,JOB_NAME,JOB_GROUP)\r\n)ENGINE=InnoDB;\r\n\r\nCREATE TABLE QRTZ_TRIGGERS\r\n (\r\n SCHED_NAME VARCHAR(120) NOT NULL,\r\n\tTRIGGER_NAME VARCHAR(200) NOT NULL,\r\n TRIGGER_GROUP VARCHAR(200) NOT NULL,\r\n JOB_NAME VARCHAR(200) NOT NULL, \r\n JOB_GROUP VARCHAR(200) NOT NULL,\r\n DESCRIPTION VARCHAR(250) NULL,\r\n NEXT_FIRE_TIME BIGINT(13) NULL,\r\n PREV_FIRE_TIME BIGINT(13) NULL,\r\n PRIORITY INTEGER NULL,\r\n TRIGGER_STATE VARCHAR(16) NOT NULL,\r\n TRIGGER_TYPE VARCHAR(8) NOT NULL,\r\n START_TIME BIGINT(13) NOT NULL,\r\n END_TIME BIGINT(13) NULL,\r\n CALENDAR_NAME VARCHAR(200) NULL,\r\n MISFIRE_INSTR SMALLINT(2) NULL,\r\n JOB_DATA BLOB 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)ENGINE=InnoDB;\r\n\r\nCREATE TABLE QRTZ_SIMPLE_TRIGGERS\r\n (\r\n SCHED_NAME VARCHAR(120) NOT NULL,\r\n\tTRIGGER_NAME VARCHAR(200) NOT NULL,\r\n TRIGGER_GROUP VARCHAR(200) NOT NULL,\r\n REPEAT_COUNT BIGINT(7) NOT NULL,\r\n REPEAT_INTERVAL BIGINT(12) NOT NULL,\r\n TIMES_TRIGGERED BIGINT(10) 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)\r\n)ENGINE=InnoDB;\r\n\r\nCREATE TABLE QRTZ_SIMPROP_TRIGGERS \r\n (\r\n SCHED_NAME VARCHAR(120) NOT NULL,\r\n TRIGGER_NAME VARCHAR(200) NOT NULL ,\r\n TRIGGER_GROUP VARCHAR(200) NOT NULL ,\r\n STR_PROP_1 VARCHAR(512) NULL,\r\n STR_PROP_2 VARCHAR(512) NULL,\r\n STR_PROP_3 VARCHAR(512) NULL,\r\n INT_PROP_1 INT NULL,\r\n INT_PROP_2 INT NULL,\r\n LONG_PROP_1 BIGINT NULL,\r\n LONG_PROP_2 BIGINT NULL,\r\n DEC_PROP_1 NUMERIC(13,4) NULL,\r\n DEC_PROP_2 NUMERIC(13,4) NULL,\r\n BOOL_PROP_1 BOOLEAN NULL,\r\n BOOL_PROP_2 BOOLEAN NULL,\r\n TIME_ZONE_ID VARCHAR(80) 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)\r\n)ENGINE=InnoDB;\r\n\r\nCREATE TABLE QRTZ_CRON_TRIGGERS\r\n (\r\n SCHED_NAME VARCHAR(120) NOT NULL,\r\n TRIGGER_NAME VARCHAR(200) NOT NULL,\r\n TRIGGER_GROUP VARCHAR(200) NOT NULL,\r\n CRON_EXPRESSION VARCHAR(120) NOT NULL,\r\n TIME_ZONE_ID VARCHAR(80),\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)\r\n)ENGINE=InnoDB;\r\n\r\nCREATE TABLE QRTZ_BLOB_TRIGGERS\r\n (\r\n SCHED_NAME VARCHAR(120) NOT NULL,\r\n TRIGGER_NAME VARCHAR(200) NOT NULL,\r\n TRIGGER_GROUP VARCHAR(200) NOT NULL,\r\n BLOB_DATA BLOB NULL,\r\n PRIMARY KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP),\r\n INDEX (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)\r\n)ENGINE=InnoDB;\r\n\r\nCREATE TABLE QRTZ_CALENDARS\r\n (\r\n SCHED_NAME VARCHAR(120) NOT NULL,\r\n CALENDAR_NAME VARCHAR(200) NOT NULL, \r\n CALENDAR BLOB NOT NULL,\r\n PRIMARY KEY (SCHED_NAME,CALENDAR_NAME)\r\n)ENGINE=InnoDB;\r\n\r\nCREATE TABLE QRTZ_PAUSED_TRIGGER_GRPS\r\n (\r\n SCHED_NAME VARCHAR(120) NOT NULL,\r\n TRIGGER_GROUP VARCHAR(200) NOT NULL, \r\n PRIMARY KEY (SCHED_NAME,TRIGGER_GROUP)\r\n)ENGINE=InnoDB;\r\n\r\nCREATE TABLE QRTZ_FIRED_TRIGGERS \r\n (\r\n SCHED_NAME VARCHAR(120) NOT NULL,\r\n ENTRY_ID VARCHAR(95) NOT NULL,\r\n TRIGGER_NAME VARCHAR(200) NOT NULL,\r\n TRIGGER_GROUP VARCHAR(200) NOT NULL,\r\n INSTANCE_NAME VARCHAR(200) NOT NULL,\r\n FIRED_TIME BIGINT(13) NOT NULL,\r\n\tSCHED_TIME BIGINT(13) NOT NULL,\r\n PRIORITY INTEGER NOT NULL,\r\n STATE VARCHAR(16) NOT NULL,\r\n JOB_NAME VARCHAR(200) NULL,\r\n JOB_GROUP VARCHAR(200) NULL,\r\n IS_NONCONCURRENT BOOLEAN NOT NULL,\r\n REQUESTS_RECOVERY BOOLEAN NULL,\r\n PRIMARY KEY (SCHED_NAME,ENTRY_ID)\r\n)ENGINE=InnoDB;\r\n\r\nCREATE TABLE QRTZ_SCHEDULER_STATE \r\n (\r\n SCHED_NAME VARCHAR(120) NOT NULL,\r\n INSTANCE_NAME VARCHAR(200) NOT NULL,\r\n LAST_CHECKIN_TIME BIGINT(13) NOT NULL,\r\n CHECKIN_INTERVAL BIGINT(13) NOT NULL,\r\n PRIMARY KEY (SCHED_NAME,INSTANCE_NAME)\r\n)ENGINE=InnoDB;\r\n\r\nCREATE TABLE QRTZ_LOCKS\r\n (\r\n SCHED_NAME VARCHAR(120) NOT NULL,\r\n LOCK_NAME VARCHAR(40) NOT NULL, \r\n PRIMARY KEY (SCHED_NAME,LOCK_NAME)\r\n)ENGINE=InnoDB;\r\n\r\nCREATE INDEX IDX_QRTZ_J_REQ_RECOVERY ON QRTZ_JOB_DETAILS(SCHED_NAME,REQUESTS_RECOVERY);\r\nCREATE INDEX IDX_QRTZ_J_GRP ON QRTZ_JOB_DETAILS(SCHED_NAME,JOB_GROUP);\r\nCREATE INDEX IDX_QRTZ_T_J ON QRTZ_TRIGGERS(SCHED_NAME,JOB_NAME,JOB_GROUP);\r\nCREATE INDEX IDX_QRTZ_T_JG ON QRTZ_TRIGGERS(SCHED_NAME,JOB_GROUP);\r\nCREATE INDEX IDX_QRTZ_T_C ON QRTZ_TRIGGERS(SCHED_NAME,CALENDAR_NAME);\r\nCREATE INDEX IDX_QRTZ_T_G ON QRTZ_TRIGGERS(SCHED_NAME,TRIGGER_GROUP);\r\nCREATE INDEX IDX_QRTZ_T_STATE ON QRTZ_TRIGGERS(SCHED_NAME,TRIGGER_STATE);\r\nCREATE INDEX IDX_QRTZ_T_N_STATE ON QRTZ_TRIGGERS(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP,TRIGGER_STATE);\r\nCREATE INDEX IDX_QRTZ_T_N_G_STATE ON QRTZ_TRIGGERS(SCHED_NAME,TRIGGER_GROUP,TRIGGER_STATE);\r\nCREATE INDEX IDX_QRTZ_T_NEXT_FIRE_TIME ON QRTZ_TRIGGERS(SCHED_NAME,NEXT_FIRE_TIME);\r\nCREATE INDEX IDX_QRTZ_T_NFT_ST ON QRTZ_TRIGGERS(SCHED_NAME,TRIGGER_STATE,NEXT_FIRE_TIME);\r\nCREATE INDEX IDX_QRTZ_T_NFT_MISFIRE ON QRTZ_TRIGGERS(SCHED_NAME,MISFIRE_INSTR,NEXT_FIRE_TIME);\r\nCREATE INDEX IDX_QRTZ_T_NFT_ST_MISFIRE ON QRTZ_TRIGGERS(SCHED_NAME,MISFIRE_INSTR,NEXT_FIRE_TIME,TRIGGER_STATE);\r\nCREATE INDEX IDX_QRTZ_T_NFT_ST_MISFIRE_GRP ON QRTZ_TRIGGERS(SCHED_NAME,MISFIRE_INSTR,NEXT_FIRE_TIME,TRIGGER_GROUP,TRIGGER_STATE);\r\nCREATE INDEX IDX_QRTZ_FT_TRIG_INST_NAME ON QRTZ_FIRED_TRIGGERS(SCHED_NAME,INSTANCE_NAME);\r\nCREATE INDEX IDX_QRTZ_FT_INST_JOB_REQ_RCVRY ON QRTZ_FIRED_TRIGGERS(SCHED_NAME,INSTANCE_NAME,REQUESTS_RECOVERY);\r\nCREATE INDEX IDX_QRTZ_FT_J_G ON QRTZ_FIRED_TRIGGERS(SCHED_NAME,JOB_NAME,JOB_GROUP);\r\nCREATE INDEX IDX_QRTZ_FT_JG ON QRTZ_FIRED_TRIGGERS(SCHED_NAME,JOB_GROUP);\r\nCREATE INDEX IDX_QRTZ_FT_T_G ON QRTZ_FIRED_TRIGGERS(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP);\r\nCREATE INDEX IDX_QRTZ_FT_TG ON QRTZ_FIRED_TRIGGERS(SCHED_NAME,TRIGGER_GROUP);\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");
}
}
}
Loading

0 comments on commit 9964589

Please sign in to comment.