Skip to content

Commit

Permalink
version 1.7.8 (#442)
Browse files Browse the repository at this point in the history
* d

* sqlite

* f

* f

* f

* w

* d

* a

* todo

* d

* fix runnings format

* e

* h

* update nugets

---------

Co-authored-by: jer\tsahi_a <tsahi_a@malam.com>
  • Loading branch information
atias007 and customs-il authored Nov 8, 2024
1 parent faab25e commit fe53c92
Show file tree
Hide file tree
Showing 123 changed files with 3,238 additions and 1,136 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -339,3 +339,5 @@ ASALocalRun/
# BeatPulse healthcheck temp database
healthchecksdb
/sh.exe.stackdump
/src/Planar/database.db
/src/Planar/Data/database.db
17 changes: 17 additions & 0 deletions docker/docker-compose-sqlite.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
version: '3.4'

services:
planar:
image: atias007/planar:latest
container_name: planar-service
ports:
- '2306:2306'
environment:
- TZ=Israel
- PLANAR_DB_PROVIDER=Sqlite
volumes:
- ./Planar/Data:/app/Data
depends_on:
- db

# docker-compose -f docker-compose-sqlite up -d
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ services:
- '2306:2306'
environment:
- TZ=Israel
- PLANAR_DB_PROVIDER=SqlServer
- PLANAR_DB_CONNECTION_STRING='Password=PlanarSqlPassword12345@;Persist Security Info=True;User ID=sa;Initial Catalog=Planar;Data Source=planar-db,1433;Encrypt=False'
volumes:
- ./Planar/Data:/app/Data
depends_on:
Expand Down Expand Up @@ -35,4 +37,4 @@ volumes:
networks:
planar_network:

# docker-compose -p planar up -d --remove-orphans
# docker-compose -f docker-compose-sqlserver.yml -p planar up -d --remove-orphans
2 changes: 1 addition & 1 deletion docker/docker-compose-up.bat
Original file line number Diff line number Diff line change
@@ -1 +1 @@
docker-compose -p planar up -d
docker-compose -f docker-compose-sqlite.yml -p planar up -d
2 changes: 1 addition & 1 deletion generic jobs/SqlQueryCheck/Job.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ private async Task InvokeQueryCheckInner(CheckQuery checkQuery)
using var connection = new SqlConnection(checkQuery.ConnectionString);
using var cmd = new SqlCommand(checkQuery.Query, connection)
{
CommandTimeout = (int)checkQuery.Timeout.TotalMilliseconds
CommandTimeout = (int)checkQuery.Timeout.TotalSeconds
};

await connection.OpenAsync();
Expand Down
2 changes: 1 addition & 1 deletion generic jobs/SqlTableRetention/Job.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ private async Task InvokeTableRerentionInner(Table table)
using var connection = new SqlConnection(table.ConnectionString);
using var cmd = new SqlCommand(query, connection)
{
CommandTimeout = (int)timeout.TotalMilliseconds
CommandTimeout = (int)timeout.TotalSeconds
};

await connection.OpenAsync();
Expand Down
10 changes: 5 additions & 5 deletions nuget packages/Planar.Client/Api/JobApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,7 @@ private async Task<bool> IsHistoryStatusRunning(long logId, CancellationToken ca
}
catch
{
return false;
return true;
}
}

Expand Down Expand Up @@ -608,10 +608,10 @@ private async Task<bool> IsHistoryStatusRunning(long logId, CancellationToken ca
{
return (null, null);
}
catch (PlanarRequestTimeoutException)
{
return (null, null);
}
////catch (PlanarRequestTimeoutException)
////{
//// return (null, null);
////}
catch (Exception)
{
await Task.Delay(500 + ((counter - 1) ^ 2) * 500, cancellationToken);
Expand Down
2 changes: 2 additions & 0 deletions nuget packages/Planar.Client/Entities/TriggerDetails.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ public class TriggerDetails : PausedTrigger

public string? State { get; set; }

public bool Active { get; set; }

public Dictionary<string, string?> DataMap { get; set; } = new Dictionary<string, string?>();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
<None Remove="Scripts\Planar_0061 - update_history_sp.sql" />
<None Remove="Scripts\Planar_0062 - update_last_sp.sql" />
<None Remove="Scripts\Planar_0063 - add_haswarning_index.sql" />
<None Remove="Scripts\Planar_0064 - drop_proc.sql" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Scripts\Planar_0001 - startup_v1_1_0.sql" />
Expand Down Expand Up @@ -141,6 +142,7 @@
<EmbeddedResource Include="Scripts\Planar_0061 - update_history_sp.sql" />
<EmbeddedResource Include="Scripts\Planar_0062 - update_last_sp.sql" />
<EmbeddedResource Include="Scripts\Planar_0063 - add_haswarning_index.sql" />
<EmbeddedResource Include="Scripts\Planar_0064 - drop_proc.sql" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\DbUp\dbup-sqlserver\dbup-sqlserver.csproj" />
Expand Down
59 changes: 59 additions & 0 deletions src/DatabaseMigrations.Factory/Executer.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
using DbUp;
using DbUp.Engine;
using System.Data;
using System.Reflection;

namespace DatabaseMigrations.SqlServer;

public class Executer : IExecuter
{
public static Assembly ScriptAssembly => typeof(Executer).Assembly;

public void EnsureDatabaseExists(string connectionString)
{
EnsureDatabase.For.SqlDatabase(connectionString);
}

public DatabaseUpgradeResult DemoExecute(string connectionString)
{
var builder =
DeployChanges.To
.SqlDatabase(connectionString)
.WithScriptsEmbeddedInAssembly(ScriptAssembly)
.LogToConsole()
.LogScriptOutput()
.WithTransactionAlwaysRollback();

var upgrader = builder.Build();
var result = upgrader.PerformUpgrade();
return result;
}

public DatabaseUpgradeResult Execute(string connectionString)
{
var builder =
DeployChanges.To
.SqlDatabase(connectionString)
.WithScriptsEmbeddedInAssembly(ScriptAssembly)
.LogToConsole()
.LogScriptOutput()
.WithTransaction();

var upgrader = builder.Build();
var result = upgrader.PerformUpgrade();
return result;
}

public IEnumerable<string> GetScripts(string connectionString)
{
var builder =
DeployChanges.To
.SqlDatabase(connectionString)
.WithScriptsEmbeddedInAssembly(ScriptAssembly)
.LogToConsole()
.LogScriptOutput();

var result = builder.Build().GetScriptsToExecute().Select(s => s.Name);
return result;
}
}
60 changes: 0 additions & 60 deletions src/DatabaseMigrations.Factory/Runner.cs

This file was deleted.

10 changes: 10 additions & 0 deletions src/DatabaseMigrations.Factory/Scripts/Planar_0064 - drop_proc.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
DROP PROCEDURE dbo.PersistJobInstanceLog
DROP PROCEDURE dbo.UpdateJobInstanceLogAnomaly
DROP PROCEDURE dbo.SetJobInstanceLogStatus
DROP PROCEDURE dbo.DeleteUser
DROP PROCEDURE dbo.CountFailsInHourForJob
DROP PROCEDURE dbo.CountFailsInRowForJob
DROP PROCEDURE dbo.IncreaseMonitorCounter
DROP PROCEDURE dbo.ResetMonitorCounter
DROP PROCEDURE [Statistics].[StatusCounter]
DROP PROCEDURE [Statistics].[TraceCounter]
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<Project Sdk="Microsoft.NET.Sdk">

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

<ItemGroup>
<None Remove="Scripts\Planar_0001 - startup.sql" />
</ItemGroup>

<ItemGroup>
<EmbeddedResource Include="Scripts\Planar_0001 - startup.sql" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\DbUp\dbup-sqlite\dbup-sqlite.csproj" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
using DbUp;
using DbUp.Engine;
using System.Data;
using System.Reflection;

namespace DatabaseMigrations.Sqlite;

public class Executer : IExecuter
{
public static Assembly ScriptAssembly => typeof(Executer).Assembly;

public void EnsureDatabaseExists(string connectionString)
{
// *** DO NOTHING ***
}

public DatabaseUpgradeResult DemoExecute(string connectionString)
{
var builder =
DeployChanges.To
.SQLiteDatabase(connectionString)
.WithScriptsEmbeddedInAssembly(ScriptAssembly)
.LogToConsole()
.LogScriptOutput()
.WithTransactionAlwaysRollback();

var upgrader = builder.Build();
var result = upgrader.PerformUpgrade();
return result;
}

public DatabaseUpgradeResult Execute(string connectionString)
{
var builder =
DeployChanges.To
.SQLiteDatabase(connectionString)
.WithScriptsEmbeddedInAssembly(ScriptAssembly)
.LogToConsole()
.LogScriptOutput()
.WithTransaction();

var upgrader = builder.Build();
var result = upgrader.PerformUpgrade();
return result;
}

public IEnumerable<string> GetScripts(string connectionString)
{
var builder =
DeployChanges.To
.SQLiteDatabase(connectionString)
.WithScriptsEmbeddedInAssembly(ScriptAssembly)
.LogToConsole()
.LogScriptOutput();

var result = builder.Build().GetScriptsToExecute().Select(s => s.Name);
return result;
}
}
Loading

0 comments on commit fe53c92

Please sign in to comment.