diff --git a/bin/lint-migrations-file/src/change_set/common.clj b/bin/lint-migrations-file/src/change_set/common.clj index d3fa61992629b772c2043a03f51f2d0078dc80ed..703d1660c7ed5b15fa30fcc58961fa5bb8c686b0 100644 --- a/bin/lint-migrations-file/src/change_set/common.clj +++ b/bin/lint-migrations-file/src/change_set/common.clj @@ -1,5 +1,6 @@ (ns change-set.common - (:require [clojure.spec.alpha :as s])) + (:require [clojure.spec.alpha :as s] + [clojure.string :as str])) (s/def ::id (s/or @@ -14,5 +15,23 @@ (s/def ::author string?) +(s/def ::preConditions + (s/coll-of ::pre-condition)) + +(s/def ::pre-condition + (s/keys :opt-un [::dbms])) + +(s/def ::dbms + (s/keys :req-un [::type])) + +(s/def ::type (s/and string? ::valid-dbs)) + +(s/def ::valid-dbs + (fn [s] + (let [dbs (into #{} (map str/trim) (str/split s #","))] + (and (seq dbs) + (every? #{"h2" "mysql" "mariadb" "postgresql"} dbs))))) + (s/def ::change-set - (s/keys :req-un [::id ::author])) + (s/keys :req-un [::id ::author] + :opt-un [::preConditions])) diff --git a/resources/migrations/000_migrations.yaml b/resources/migrations/000_migrations.yaml index bfe4dc18ae689c0bc076a6a475c76728740c9275..cde440ed8b9a19216b110c0fa5edf7fe0f039f19 100644 --- a/resources/migrations/000_migrations.yaml +++ b/resources/migrations/000_migrations.yaml @@ -5341,7 +5341,8 @@ databaseChangeLog: comment: 'Added 0.32.0' preConditions: - onFail: MARK_RAN - - dbms: mysql, mariadb + - dbms: + type: mysql,mariadb changes: - modifyDataType: tableName: query_cache