import at.clockwork.common.domain.*
import at.clockwork.system.domain.*
import at.clockwork.generated.service.*

import grails.util.Holders

class UpdateScriptService {

	TriggerWriteService triggerWriteService = Holders.grailsApplication.mainContext.getBean 'triggerWriteService'

	def run(def connection, def dataSourceFields) {

        Script.findAllWhere(deleted:false).each { Script script ->

            if (script.trigger) {
                script.trigger.script = script
                triggerWriteService.save(script.trigger)
            }

        }

		true
	}
}