diff --git a/persistence-service-v1/persistence-service-processor-v1/src/main/resources/mongo/changelog/mongo.changelog-tenant.xml b/persistence-service-v1/persistence-service-processor-v1/src/main/resources/mongo/changelog/mongo.changelog-tenant.xml
index 688421db8..6e0590039 100644
--- a/persistence-service-v1/persistence-service-processor-v1/src/main/resources/mongo/changelog/mongo.changelog-tenant.xml
+++ b/persistence-service-v1/persistence-service-processor-v1/src/main/resources/mongo/changelog/mongo.changelog-tenant.xml
@@ -2,6 +2,6 @@
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.20.xsd">
-
-
+
+
diff --git a/persistence-service-v1/persistence-service-processor-v1/src/main/resources/mongo/changelog/tenant/1-initial-database.changelog-with-validation.xml b/persistence-service-v1/persistence-service-processor-v1/src/main/resources/mongo/changelog/tenant/1-initial-database.changelog-with-validation.xml
new file mode 100644
index 000000000..c988f71a2
--- /dev/null
+++ b/persistence-service-v1/persistence-service-processor-v1/src/main/resources/mongo/changelog/tenant/1-initial-database.changelog-with-validation.xml
@@ -0,0 +1,224 @@
+
+
+
+
+
+
+ {
+ validator: {
+ $jsonSchema: {
+ bsonType: "object",
+ required: ["entryId", "entityLogId", "type", "entryType", "state", "value", "reason", "matchedRule", "legalBasis", "containingNodeId", "closestHeadline", "section",
+ "positions", "textBefore", "textAfter", "startOffset", "endOffset", "imageHasTransparency", "dictionaryEntry", "dossierDictionaryEntry", "excluded", "changes",
+ "manualChanges", "engines", "reference", "importedRedactionIntersections", "numberOfComments"],
+ properties: {
+ entryId: {
+ bsonType: "string",
+ description: "The Entry ID"
+ },
+ entityLogId: {
+ bsonType: "string",
+ description: "The Entity Log ID"
+ },
+ type: {
+ bsonType: "string",
+ description: "The Type"
+ },
+ entryType: {
+ bsonType: "string",
+ description: "The Entry Type"
+ },
+ state: {
+ bsonType: "string",
+ description: "The Entry State"
+ },
+ value: {
+ bsonType: "string",
+ description: "The Value"
+ },
+ reason: {
+ bsonType: "string",
+ description: "The Reason"
+ },
+ matchedRule: {
+ bsonType: "string",
+ description: "The Matched Rule"
+ },
+ legalBasis: {
+ bsonType: "string",
+ description: "The Legal Basis"
+ },
+ containingNodeId: {
+ bsonType: "array",
+ items: {
+ bsonType: "int",
+ description: "The Containing Node ID"
+ }
+ },
+ closestHeadline: {
+ bsonType: "string",
+ description: "The Closest Headline"
+ },
+ section: {
+ bsonType: "string",
+ description: "The Section"
+ },
+ positions: {
+ bsonType: "array",
+ description: "The Positions",
+ items: {
+ bsonType: "object"
+ }
+ },
+ textBefore: {
+ bsonType: "string",
+ description: "Text before the entry"
+ },
+ textAfter: {
+ bsonType: "string",
+ description: "Text after the entry"
+ },
+ startOffset: {
+ bsonType: "int",
+ description: "Start offset of the entry"
+ },
+ endOffset: {
+ bsonType: "int",
+ description: "End offset of the entry"
+ },
+ imageHasTransparency: {
+ bsonType: "bool",
+ description: "Whether the image has transparency"
+ },
+ dictionaryEntry: {
+ bsonType: "bool",
+ description: "Whether it's a dictionary entry"
+ },
+ dossierDictionaryEntry: {
+ bsonType: "bool",
+ description: "Whether it's a dossier dictionary entry"
+ },
+ excluded: {
+ bsonType: "bool",
+ description: "Whether it's excluded"
+ },
+ changes: {
+ bsonType: "array",
+ description: "The Changes",
+ items: {
+ bsonType: "object"
+ }
+ },
+ manualChanges: {
+ bsonType: "array",
+ description: "The Manual Changes",
+ items: {
+ bsonType: "object"
+ }
+ },
+ engines: {
+ bsonType: "array",
+ description: "The Engines",
+ items: {
+ bsonType: "string"
+ }
+ },
+ reference: {
+ bsonType: "array",
+ description: "The Reference",
+ items: {
+ bsonType: "string"
+ }
+ },
+ importedRedactionIntersections: {
+ bsonType: "array",
+ description: "The Imported Redaction Intersections",
+ items: {
+ bsonType: "string"
+ }
+ },
+ numberOfComments: {
+ bsonType: "int",
+ description: "The Number of Comments"
+ }
+ }
+ }
+ },
+ validationAction: "warn",
+ validationLevel: "strict"
+ }
+
+
+
+
+
+ {
+ validator: {
+ $jsonSchema: {
+ bsonType: "object",
+ required: ["dossierId", "fileId", "analysisVersion", "analysisNumber", "entityLogEntryDocument", "legalBasis"],
+ properties: {
+ dossierId: {
+ bsonType: "string",
+ description: "The Dossier ID"
+ },
+ fileId: {
+ bsonType: "string",
+ description: "The File ID"
+ },
+ analysisVersion: {
+ bsonType: "long",
+ description: "The Analysis Version"
+ },
+ analysisNumber: {
+ bsonType: "int",
+ description: "The Analysis Number"
+ },
+ entityLogEntryDocument: {
+ bsonType: "array",
+ description: "The Entity Log Entry Documents",
+ items: {
+ bsonType: "objectId"
+ }
+ },
+ legalBasis: {
+ bsonType: "array",
+ description: "The Legal Basis",
+ items: {
+ bsonType: "object"
+ }
+ },
+ dictionaryVersion: {
+ bsonType: "long",
+ description: "The Dictionary Version"
+ },
+ dossierDictionaryVersion: {
+ bsonType: "long",
+ description: "The Dossier Dictionary Version"
+ },
+ rulesVersion: {
+ bsonType: "long",
+ description: "The Rules Version"
+ },
+ legalBasisVersion: {
+ bsonType: "long",
+ description: "The Legal Basis Version"
+ }
+ }
+ }
+ },
+ validationAction: "warn",
+ validationLevel: "strict"
+ }
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/persistence-service-v1/persistence-service-processor-v1/src/main/resources/mongo/changelog/tenant/1-initial-database.changelog.xml b/persistence-service-v1/persistence-service-processor-v1/src/main/resources/mongo/changelog/tenant/1-initial-database.changelog.xml
index ed643c742..c8e1cbce6 100644
--- a/persistence-service-v1/persistence-service-processor-v1/src/main/resources/mongo/changelog/tenant/1-initial-database.changelog.xml
+++ b/persistence-service-v1/persistence-service-processor-v1/src/main/resources/mongo/changelog/tenant/1-initial-database.changelog.xml
@@ -6,216 +6,11 @@
http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd">
-
-
- {
- validator: {
- $jsonSchema: {
- bsonType: "object",
- required: ["entryId", "entityLogId", "type", "entryType", "state", "value", "reason", "matchedRule", "legalBasis", "containingNodeId", "closestHeadline", "section",
- "positions", "textBefore", "textAfter", "startOffset", "endOffset", "imageHasTransparency", "dictionaryEntry", "dossierDictionaryEntry", "excluded", "changes",
- "manualChanges", "engines", "reference", "importedRedactionIntersections", "numberOfComments"],
- properties: {
- entryId: {
- bsonType: "string",
- description: "The Entry ID"
- },
- entityLogId: {
- bsonType: "string",
- description: "The Entity Log ID"
- },
- type: {
- bsonType: "string",
- description: "The Type"
- },
- entryType: {
- bsonType: "string",
- description: "The Entry Type"
- },
- state: {
- bsonType: "string",
- description: "The Entry State"
- },
- value: {
- bsonType: "string",
- description: "The Value"
- },
- reason: {
- bsonType: "string",
- description: "The Reason"
- },
- matchedRule: {
- bsonType: "string",
- description: "The Matched Rule"
- },
- legalBasis: {
- bsonType: "string",
- description: "The Legal Basis"
- },
- containingNodeId: {
- bsonType: "array",
- items: {
- bsonType: "int",
- description: "The Containing Node ID"
- }
- },
- closestHeadline: {
- bsonType: "string",
- description: "The Closest Headline"
- },
- section: {
- bsonType: "string",
- description: "The Section"
- },
- positions: {
- bsonType: "array",
- description: "The Positions",
- items: {
- bsonType: "object"
- }
- },
- textBefore: {
- bsonType: "string",
- description: "Text before the entry"
- },
- textAfter: {
- bsonType: "string",
- description: "Text after the entry"
- },
- startOffset: {
- bsonType: "int",
- description: "Start offset of the entry"
- },
- endOffset: {
- bsonType: "int",
- description: "End offset of the entry"
- },
- imageHasTransparency: {
- bsonType: "bool",
- description: "Whether the image has transparency"
- },
- dictionaryEntry: {
- bsonType: "bool",
- description: "Whether it's a dictionary entry"
- },
- dossierDictionaryEntry: {
- bsonType: "bool",
- description: "Whether it's a dossier dictionary entry"
- },
- excluded: {
- bsonType: "bool",
- description: "Whether it's excluded"
- },
- changes: {
- bsonType: "array",
- description: "The Changes",
- items: {
- bsonType: "object"
- }
- },
- manualChanges: {
- bsonType: "array",
- description: "The Manual Changes",
- items: {
- bsonType: "object"
- }
- },
- engines: {
- bsonType: "array",
- description: "The Engines",
- items: {
- bsonType: "string"
- }
- },
- reference: {
- bsonType: "array",
- description: "The Reference",
- items: {
- bsonType: "string"
- }
- },
- importedRedactionIntersections: {
- bsonType: "array",
- description: "The Imported Redaction Intersections",
- items: {
- bsonType: "string"
- }
- },
- numberOfComments: {
- bsonType: "int",
- description: "The Number of Comments"
- }
- }
- }
- },
- validationAction: "warn",
- validationLevel: "strict"
- }
-
-
-
-
- {
- validator: {
- $jsonSchema: {
- bsonType: "object",
- required: ["dossierId", "fileId", "analysisVersion", "analysisNumber", "entityLogEntryDocument", "legalBasis"],
- properties: {
- dossierId: {
- bsonType: "string",
- description: "The Dossier ID"
- },
- fileId: {
- bsonType: "string",
- description: "The File ID"
- },
- analysisVersion: {
- bsonType: "long",
- description: "The Analysis Version"
- },
- analysisNumber: {
- bsonType: "int",
- description: "The Analysis Number"
- },
- entityLogEntryDocument: {
- bsonType: "array",
- description: "The Entity Log Entry Documents",
- items: {
- bsonType: "objectId"
- }
- },
- legalBasis: {
- bsonType: "array",
- description: "The Legal Basis",
- items: {
- bsonType: "object"
- }
- },
- dictionaryVersion: {
- bsonType: "long",
- description: "The Dictionary Version"
- },
- dossierDictionaryVersion: {
- bsonType: "long",
- description: "The Dossier Dictionary Version"
- },
- rulesVersion: {
- bsonType: "long",
- description: "The Rules Version"
- },
- legalBasisVersion: {
- bsonType: "long",
- description: "The Legal Basis Version"
- }
- }
- }
- },
- validationAction: "warn",
- validationLevel: "strict"
- }
-
-
+
+
+
+
diff --git a/persistence-service-v1/persistence-service-processor-v1/src/main/resources/mongo/changelog/tenant/2-create-indices-for-entries.xml b/persistence-service-v1/persistence-service-processor-v1/src/main/resources/mongo/changelog/tenant/2-create-indices-for-entries.xml
new file mode 100644
index 000000000..5fe9ed7cf
--- /dev/null
+++ b/persistence-service-v1/persistence-service-processor-v1/src/main/resources/mongo/changelog/tenant/2-create-indices-for-entries.xml
@@ -0,0 +1,37 @@
+
+
+
+
+
+
+ {
+ "_id": 1,
+ "positions.pageNumber": 1
+ }
+
+
+ {name: "positions_pageNumber_index"}
+
+
+
+
+
+ {
+ "_id": 1,
+ "changes.analysisNumber": -1
+ }
+
+
+ {name: "changes_analysisNumber_index"}
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/persistence-service-v1/persistence-service-processor-v1/src/main/resources/mongo/changelog/tenant/2-remove-entry-number-of-comments.changelog.xml b/persistence-service-v1/persistence-service-processor-v1/src/main/resources/mongo/changelog/tenant/example-remove-entry-number-of-comments.changelog.xml
similarity index 100%
rename from persistence-service-v1/persistence-service-processor-v1/src/main/resources/mongo/changelog/tenant/2-remove-entry-number-of-comments.changelog.xml
rename to persistence-service-v1/persistence-service-processor-v1/src/main/resources/mongo/changelog/tenant/example-remove-entry-number-of-comments.changelog.xml