Class PrerunScripts


  • public final class PrerunScripts
    extends java.lang.Object
    The reserved pre-execution script of a component (LUT-33327) : one liquibase formatted SQL file per component, at a fixed path derived from the component name,
     sql/plugins/<plugin>/plugin/prerun_db_<plugin>.sql
     sql/plugins/<plugin>/modules/<module>/plugin/prerun_db_<plugin>-<module>.sql
     
    All such files are executed in a preliminary liquibase update (db/changelog-pre.xml), BEFORE the main changelog is built and filtered, and are excluded from the main run. They hold the one-shot fix-ups that must be visible to the version resolution of the main run : typically, after a plugin rename, migrating the datastore keys (instance-prefixed forms included) and rewriting the DATABASECHANGELOG FILENAME rows to the new component directory. A formatted SQL file may hold several changesets : each release needing a fix-up appends one to the same file, which is the component's pre-execution mini-changelog. Authoring rules : such changesets run on every database state, including an empty one at first install, so each must be guarded by preconditions failing to MARK_RAN both onFail and onError (a referenced table may not exist yet) ; a fix-up already executed under another path must declare its original identity with logicalFilePath on its changeset line ; and, like any executed changeset, the body must not change afterwards without a validCheckSum declaration. Execution order between prerun files is alphabetical by path (runAfter does not apply to the preliminary run). Selection is a pure path test : no file content is read. A file named prerun_db_* that does not sit at its component's expected path is a packaging fault, reported like an unresolved component (startup aborted when liquibase.safeRun=true). Like the rest of this plugin, this class is deliberately not thread-safe : liquibase runs in the single startup thread.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static boolean any()
      Whether at least one prerun_db_* file ships in the webapp : the preliminary update runs only then.
      static java.lang.String component​(java.lang.String path)
      The component owning a well-formed pre-execution script path, or null when the path is not at the expected location or the file name does not match the component derived from the directories.
      static boolean isPrerunName​(java.lang.String path)
      Whether the file name (whatever its location) claims to be a pre-execution script.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • isPrerunName

        public static boolean isPrerunName​(java.lang.String path)
        Whether the file name (whatever its location) claims to be a pre-execution script.
      • component

        public static java.lang.String component​(java.lang.String path)
        The component owning a well-formed pre-execution script path, or null when the path is not at the expected location or the file name does not match the component derived from the directories.
      • any

        public static boolean any()
        Whether at least one prerun_db_* file ships in the webapp : the preliminary update runs only then.