diff --git a/bin/lint-migrations-file/README.md b/bin/lint-migrations-file/README.md index 7a6348ce110167f6a11f7288bce6cf63e0cdf594..71d445b4673193f4e781109e71449190dd8d5e76 100644 --- a/bin/lint-migrations-file/README.md +++ b/bin/lint-migrations-file/README.md @@ -9,12 +9,12 @@ namespaces while equivalent stricter ones are in `x.strict` namespaces. Run the linter with ```sh -./bin/lint-migrations-yaml.sh +./bin/lint-migrations-file.sh ``` Add some tests for the checks you add here the `test/` directory; run them with ```sh -cd bin/lint-migrations-yaml +cd bin/lint-migrations-file clojure -M:test ``` diff --git a/bin/lint-migrations-file/src/change/strict.clj b/bin/lint-migrations-file/src/change/strict.clj index aecad5dc9957f40494d349f25ad0f8e18566df93..00800a1d4f90cd805d058cea6c856dcb50c78e7d 100644 --- a/bin/lint-migrations-file/src/change/strict.clj +++ b/bin/lint-migrations-file/src/change/strict.clj @@ -1,6 +1,7 @@ (ns change.strict (:require change.common [clojure.spec.alpha :as s] + [clojure.string :as str] column.strict)) (comment change.common/keep-me @@ -29,8 +30,15 @@ ;; remarks are required for new tables in strict mode (s/keys :req-un [:change.strict.create-table/columns ::remarks]))) +;; createIndex *must* include an explicit index name. +(s/def ::indexName + #(str/starts-with? % "idx_")) + +(s/def ::createIndex + (s/keys :req-un [::indexName])) + (s/def ::change - (s/keys :opt-un [::addColumn ::createTable])) + (s/keys :opt-un [::addColumn ::createTable ::createIndex])) (s/def :change.strict.dbms-qualified-sql-change.sql/dbms string?) diff --git a/resources/migrations/000_migrations.yaml b/resources/migrations/000_migrations.yaml index 2faccf9035aea8596a78f1accd6451cc663f11ef..45fff2b8de20da286bd958b064f647b35ebd663b 100644 --- a/resources/migrations/000_migrations.yaml +++ b/resources/migrations/000_migrations.yaml @@ -8636,6 +8636,20 @@ databaseChangeLog: - column: name: card_id + - changeSet: + id: 382 + author: camsaul + comment: Added 0.41.2 Add index to ModerationReview moderated_item_type + moderated_item_id to fix performance issues (#18759) + changes: + - createIndex: + tableName: moderation_review + indexName: idx_moderation_review_item_type_item_id + columns: + - column: + name: moderated_item_type + - column: + name: moderated_item_id + - changeSet: id: v42.00-000 author: camsaul