Skip to content

Commit

Permalink
refactors
Browse files Browse the repository at this point in the history
  • Loading branch information
mgoworko committed Dec 31, 2024
1 parent 2c916bc commit 1fb1348
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 17 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package db.migration

import com.typesafe.scalalogging.LazyLogging
import db.migration.V1_060__PeriodicDeploymentManagerTablesDefinition.Definitions
import db.migration.V1_059__PeriodicDeploymentManagerTablesDefinition.Definitions
import pl.touk.nussknacker.ui.db.migration.SlickMigration
import slick.jdbc.JdbcProfile
import slick.lifted.ProvenShape
Expand All @@ -11,7 +11,7 @@ import java.time.LocalDateTime
import java.util.UUID
import scala.concurrent.ExecutionContext.Implicits.global

trait V1_060__PeriodicDeploymentManagerTablesDefinition extends SlickMigration with LazyLogging {
trait V1_059__PeriodicDeploymentManagerTablesDefinition extends SlickMigration with LazyLogging {

import profile.api._

Expand All @@ -20,21 +20,22 @@ trait V1_060__PeriodicDeploymentManagerTablesDefinition extends SlickMigration w
override def migrateActions: DBIOAction[Any, NoStream, Effect.All] = {
logger.info("Starting migration V1_056__CreateScenarioActivitiesDefinition")
for {
_ <- definitions.periodicProcessesTable.schema.create
_ <- definitions.periodicProcessDeploymentsTable.schema.create
_ <- definitions.periodicScenariosTable.schema.create
_ <- definitions.periodicScenarioDeploymentsTable.schema.create
} yield ()
}

}

object V1_060__PeriodicDeploymentManagerTablesDefinition {
object V1_059__PeriodicDeploymentManagerTablesDefinition {

class Definitions(val profile: JdbcProfile) {

import profile.api._

val periodicProcessDeploymentsTable = TableQuery[PeriodicProcessDeploymentsTable]
val periodicScenarioDeploymentsTable = TableQuery[PeriodicScenarioDeploymentsTable]

class PeriodicProcessDeploymentsTable(tag: Tag)
class PeriodicScenarioDeploymentsTable(tag: Tag)
extends Table[PeriodicProcessDeploymentEntity](tag, "periodic_scenario_deployments") {

def id: Rep[Long] = column[Long]("id", O.PrimaryKey, O.AutoInc)
Expand All @@ -57,6 +58,12 @@ object V1_060__PeriodicDeploymentManagerTablesDefinition {

def status: Rep[String] = column[String]("status", NotNull)

def periodicProcessIdIndex = index("periodic_scenario_deployments_periodic_process_id_idx", periodicProcessId)

def createdAtIndex = index("periodic_scenario_deployments_created_at_id_idx", createdAt)

def runAtIndex = index("periodic_scenario_deployments_run_at_id_idx", runAt)

override def * : ProvenShape[PeriodicProcessDeploymentEntity] = (
id,
periodicProcessId,
Expand Down Expand Up @@ -86,9 +93,9 @@ object V1_060__PeriodicDeploymentManagerTablesDefinition {
status: String
)

val periodicProcessesTable = TableQuery[PeriodicProcessesTable]
val periodicScenariosTable = TableQuery[PeriodicScenariosTable]

class PeriodicProcessesTable(tag: Tag) extends Table[PeriodicProcessEntity](tag, "periodic_scenarios") {
class PeriodicScenariosTable(tag: Tag) extends Table[PeriodicProcessEntity](tag, "periodic_scenarios") {

def periodicProcessId: Rep[Long] = column[Long]("id", O.Unique, O.AutoInc)

Expand All @@ -112,6 +119,14 @@ object V1_060__PeriodicDeploymentManagerTablesDefinition {

def inputConfigDuringExecutionJson: Rep[String] = column[String]("input_config_during_execution", NotNull)

def processNameAndActiveIndex = index("periodic_scenarios_process_name_active_idx", (processName, active))

def processIdIndex = index("periodic_scenarios_process_id_idx", processId)

def createdAtIndex = index("periodic_scenarios_created_at_idx", createdAt)

def processingTypeIndex = index("periodic_scenarios_processing_type_idx", processingType)

override def * : ProvenShape[PeriodicProcessEntity] = (
periodicProcessId,
processId,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package db.migration.hsql

import db.migration.V1_060__PeriodicDeploymentManagerTablesDefinition
import db.migration.V1_059__PeriodicDeploymentManagerTablesDefinition
import slick.jdbc.{HsqldbProfile, JdbcProfile}

class V1_060__PeriodicDeploymentManagerTables extends V1_060__PeriodicDeploymentManagerTablesDefinition {
class V1_059__PeriodicDeploymentManagerTables extends V1_059__PeriodicDeploymentManagerTablesDefinition {
override protected lazy val profile: JdbcProfile = HsqldbProfile
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package db.migration.postgres

import db.migration.V1_060__PeriodicDeploymentManagerTablesDefinition
import db.migration.V1_059__PeriodicDeploymentManagerTablesDefinition
import slick.jdbc.{JdbcProfile, PostgresProfile}

class V1_060__PeriodicDeploymentManagerTables extends V1_060__PeriodicDeploymentManagerTablesDefinition {
class V1_059__PeriodicDeploymentManagerTables extends V1_059__PeriodicDeploymentManagerTablesDefinition {
override protected lazy val profile: JdbcProfile = PostgresProfile
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package pl.touk.nussknacker.ui.process.repository

import _root_.db.util.DBIOActionInstances
import db.util.DBIOActionInstances
import cats.Monad
import com.github.tminglei.slickpg.ExPostgresProfile
import com.typesafe.scalalogging.LazyLogging
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package pl.touk.nussknacker.test.mock

import _root_.sttp.client3.testing.SttpBackendStub
import akka.actor.ActorSystem
import cats.data.Validated.valid
import cats.data.ValidatedNel
import com.google.common.collect.LinkedHashMultimap
import com.typesafe.config.Config
import sttp.client3.testing.SttpBackendStub
import pl.touk.nussknacker.engine._
import pl.touk.nussknacker.engine.api.definition.{
NotBlankParameterValidator,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package pl.touk.nussknacker.ui.process.periodic

import _root_.db.util.DBIOActionInstances.DB
import com.cronutils.builder.CronBuilder
import com.cronutils.model.CronType
import com.cronutils.model.definition.CronDefinitionBuilder
import com.cronutils.model.field.expression.FieldExpressionFactory.{on, questionMark}
import com.typesafe.config.{Config, ConfigFactory}
import com.typesafe.scalalogging.LazyLogging
import db.util.DBIOActionInstances.DB
import org.scalatest.LoneElement._
import org.scalatest.OptionValues
import org.scalatest.concurrent.ScalaFutures
Expand Down
Empty file removed designer/server/work/.gitkeep
Empty file.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package pl.touk.nussknacker.engine.management.streaming

import _root_.sttp.client3.asynchttpclient.future.AsyncHttpClientFutureBackend
import akka.actor.ActorSystem
import org.asynchttpclient.DefaultAsyncHttpClientConfig
import sttp.client3.asynchttpclient.future.AsyncHttpClientFutureBackend
import pl.touk.nussknacker.engine._
import pl.touk.nussknacker.engine.api.component.DesignerWideComponentId
import pl.touk.nussknacker.engine.api.deployment.periodic.NoOpPeriodicProcessesManagerProvider
Expand Down

0 comments on commit 1fb1348

Please sign in to comment.