# Script Module

Script module facilitates running some code through scripts to reset/add/remove or migrate db.

# Creating a script module in smile

  • Open Mould.ksmile file and define the script module
script-module LearningScript at com.metastay.learningscript
  • Run smile command in sbt
  • refresh the project in eclipse. You will see the LearningScript.kscript file generated

# Types of triggers for a Script

# Script

  • Open LearningScript.kscript file in eclipse and define a messages
script DoSomethiing
  • Define the reaction of the processor on receiving this message in DoSomethiingCode.scala
object DoSomethiingCode {

  def execute(input: DoSomethiing.Input): Unit = {
      // Write the script code here
  }
}

# Run Script

script run <script_name> name=value

For example:

script run DoSomething