Skip to content

Commit

Permalink
Add provider-specific SQL syntax in latest migration.
Browse files Browse the repository at this point in the history
  • Loading branch information
bitbound committed Jul 31, 2023
1 parent 58cf570 commit d67f02c
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ public partial class Enable_NullableReferences : Migration
protected override void Up(MigrationBuilder migrationBuilder)
{
// These relationships weren't enforced previously.
migrationBuilder.Sql("delete from ScriptResults where DeviceID is null;");
migrationBuilder.Sql("delete from ScriptResults where DeviceID not in (select ID from Devices);");
migrationBuilder.Sql("delete from ScriptResults where OrganizationID is null;");
migrationBuilder.Sql("delete from ScriptResults where OrganizationID not in (select ID from Organizations);");
migrationBuilder.Sql("delete from ScriptResults where SavedScriptId not in (select Id from SavedScripts);");
migrationBuilder.Sql("delete from ScriptRuns where OrganizationID is null;");
migrationBuilder.Sql("delete from ScriptRuns where OrganizationID not in (select ID from Organizations);");
migrationBuilder.Sql("delete from ScriptRuns where SavedScriptId not in (select Id from SavedScripts);");
migrationBuilder.Sql("delete from \"ScriptResults\" where \"DeviceID\" is null;");
migrationBuilder.Sql("delete from \"ScriptResults\" where \"DeviceID\" not in (select \"ID\" from \"Devices\");");
migrationBuilder.Sql("delete from \"ScriptResults\" where \"OrganizationID\" is null;");
migrationBuilder.Sql("delete from \"ScriptResults\" where \"OrganizationID\" not in (select \"ID\" from \"Organizations\");");
migrationBuilder.Sql("delete from \"ScriptResults\" where \"SavedScriptId\" not in (select \"Id\" from \"SavedScripts\");");
migrationBuilder.Sql("delete from \"ScriptRuns\" where \"OrganizationID\" is null;");
migrationBuilder.Sql("delete from \"ScriptRuns\" where \"OrganizationID\" not in (select \"ID\" from \"Organizations\");");
migrationBuilder.Sql("delete from \"ScriptRuns\" where \"SavedScriptId\" not in (select \"Id\" from \"SavedScripts\");");

migrationBuilder.DropForeignKey(
name: "FK_Alerts_Devices_DeviceID",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ public partial class Enable_NullableReferences : Migration
protected override void Up(MigrationBuilder migrationBuilder)
{
// These relationships weren't enforced previously.
migrationBuilder.Sql("delete from ScriptResults where DeviceID is null;");
migrationBuilder.Sql("delete from ScriptResults where DeviceID not in (select ID from Devices);");
migrationBuilder.Sql("delete from ScriptResults where OrganizationID is null;");
migrationBuilder.Sql("delete from ScriptResults where OrganizationID not in (select ID from Organizations);");
migrationBuilder.Sql("delete from ScriptResults where SavedScriptId not in (select Id from SavedScripts);");
migrationBuilder.Sql("delete from ScriptRuns where OrganizationID is null;");
migrationBuilder.Sql("delete from ScriptRuns where OrganizationID not in (select ID from Organizations);");
migrationBuilder.Sql("delete from ScriptRuns where SavedScriptId not in (select Id from SavedScripts);");
migrationBuilder.Sql("delete from [ScriptResults] where [DeviceID] is null;");
migrationBuilder.Sql("delete from [ScriptResults] where [DeviceID] not in (select [ID] from [Devices]);");
migrationBuilder.Sql("delete from [ScriptResults] where [OrganizationID] is null;");
migrationBuilder.Sql("delete from [ScriptResults] where [OrganizationID] not in (select [ID] from [Organizations]);");
migrationBuilder.Sql("delete from [ScriptResults] where [SavedScriptId] not in (select [Id] from [SavedScripts]);");
migrationBuilder.Sql("delete from [ScriptRuns] where [OrganizationID] is null;");
migrationBuilder.Sql("delete from [ScriptRuns] where [OrganizationID] not in (select [ID] from [Organizations]);");
migrationBuilder.Sql("delete from [ScriptRuns] where [SavedScriptId] not in (select [Id] from [SavedScripts]);");

migrationBuilder.DropForeignKey(
name: "FK_Alerts_Devices_DeviceID",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ public partial class Enable_NullableReferences : Migration
protected override void Up(MigrationBuilder migrationBuilder)
{
// These relationships weren't enforced previously.
migrationBuilder.Sql("delete from ScriptResults where DeviceID is null;");
migrationBuilder.Sql("delete from ScriptResults where DeviceID not in (select ID from Devices);");
migrationBuilder.Sql("delete from ScriptResults where OrganizationID is null;");
migrationBuilder.Sql("delete from ScriptResults where OrganizationID not in (select ID from Organizations);");
migrationBuilder.Sql("delete from ScriptResults where SavedScriptId not in (select Id from SavedScripts);");
migrationBuilder.Sql("delete from ScriptRuns where OrganizationID is null;");
migrationBuilder.Sql("delete from ScriptRuns where OrganizationID not in (select ID from Organizations);");
migrationBuilder.Sql("delete from ScriptRuns where SavedScriptId not in (select Id from SavedScripts);");
migrationBuilder.Sql("delete from \"ScriptResults\" where \"DeviceID\" is null;");
migrationBuilder.Sql("delete from \"ScriptResults\" where \"DeviceID\" not in (select \"ID\" from \"Devices\");");
migrationBuilder.Sql("delete from \"ScriptResults\" where \"OrganizationID\" is null;");
migrationBuilder.Sql("delete from \"ScriptResults\" where \"OrganizationID\" not in (select \"ID\" from \"Organizations\");");
migrationBuilder.Sql("delete from \"ScriptResults\" where \"SavedScriptId\" not in (select \"Id\" from \"SavedScripts\");");
migrationBuilder.Sql("delete from \"ScriptRuns\" where \"OrganizationID\" is null;");
migrationBuilder.Sql("delete from \"ScriptRuns\" where \"OrganizationID\" not in (select \"ID\" from \"Organizations\");");
migrationBuilder.Sql("delete from \"ScriptRuns\" where \"SavedScriptId\" not in (select \"Id\" from \"SavedScripts\");");

migrationBuilder.DropForeignKey(
name: "FK_Alerts_Devices_DeviceID",
Expand Down

0 comments on commit d67f02c

Please sign in to comment.