Class PrerunScripts
java.lang.Object
fr.paris.lutece.plugins.liquibase.filters.PrerunScripts
The reserved pre-execution script of a component (LUT-33326) : 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>.sqlAll 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, and a runAfter directive is never read from a prerun file (a plugin declares it in an ordinary script). 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
Modifier and TypeMethodDescriptionstatic booleanany()Whether at least one prerun_db_* file ships in the webapp : the preliminary update runs only then.static StringThe 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 booleanisPrerunName(String path) Whether the file name (whatever its location) claims to be a pre-execution script.
-
Method Details
-
isPrerunName
Whether the file name (whatever its location) claims to be a pre-execution script. The reserved name is defined once, in library-sql-utils, so that the runAfter ordering (which never reads a directive from such a file) and this plugin agree on it. -
component
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.
-