RED-8702: Explore document databases to store entityLog
* liquibase collection initialization first draft
This commit is contained in:
parent
dd37c56e41
commit
e2b0d841ad
@ -2,6 +2,6 @@
|
|||||||
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
|
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
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">
|
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.20.xsd">
|
||||||
<include file="mongo/changelog/tenant/1-initial-database.changelog.xml"/>
|
<include file="/mongo/liquibase/changelog/tenant/1-initial-database.changelog.xml"/>
|
||||||
<include file="mongo/changelog/tenant/2-remove-entry-number-of-comments.changelog.xml"/>
|
<include file="/mongo/liquibase/changelog/tenant/2-create-indices-for-entries.xml"/>
|
||||||
</databaseChangeLog>
|
</databaseChangeLog>
|
||||||
|
|||||||
@ -0,0 +1,224 @@
|
|||||||
|
<databaseChangeLog
|
||||||
|
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
|
||||||
|
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.20.xsd
|
||||||
|
http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd">
|
||||||
|
|
||||||
|
<changeSet id="createEntityLogEntryCollection" author="maverick">
|
||||||
|
|
||||||
|
<ext:createCollection collectionName="entity-log-entries">
|
||||||
|
<ext:options>
|
||||||
|
{
|
||||||
|
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"
|
||||||
|
}
|
||||||
|
</ext:options>
|
||||||
|
</ext:createCollection>
|
||||||
|
|
||||||
|
<ext:createCollection collectionName="entity-logs">
|
||||||
|
<ext:options>
|
||||||
|
{
|
||||||
|
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"
|
||||||
|
}
|
||||||
|
</ext:options>
|
||||||
|
</ext:createCollection>
|
||||||
|
|
||||||
|
</changeSet>
|
||||||
|
|
||||||
|
|
||||||
|
</databaseChangeLog>
|
||||||
@ -6,216 +6,11 @@
|
|||||||
http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd">
|
http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd">
|
||||||
|
|
||||||
<changeSet id="createEntityLogEntryCollection" author="maverick">
|
<changeSet id="createEntityLogEntryCollection" author="maverick">
|
||||||
<ext:createCollection collectionName="entity-log-entries">
|
|
||||||
<ext:options>
|
|
||||||
{
|
|
||||||
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"
|
|
||||||
}
|
|
||||||
</ext:options>
|
|
||||||
</ext:createCollection>
|
|
||||||
|
|
||||||
<ext:createCollection collectionName="entity-logs">
|
<ext:createCollection collectionName="entity-log-entries"/>
|
||||||
<ext:options>
|
|
||||||
{
|
<ext:createCollection collectionName="entity-logs"/>
|
||||||
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"
|
|
||||||
}
|
|
||||||
</ext:options>
|
|
||||||
</ext:createCollection>
|
|
||||||
</changeSet>
|
</changeSet>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -0,0 +1,37 @@
|
|||||||
|
<databaseChangeLog
|
||||||
|
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
|
||||||
|
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.20.xsd
|
||||||
|
http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd">
|
||||||
|
|
||||||
|
<changeSet id="createEntityLogEntryCollection" author="maverick">
|
||||||
|
|
||||||
|
<ext:createIndex collectionName="entity-log-entries">
|
||||||
|
<ext:keys>
|
||||||
|
{
|
||||||
|
"_id": 1,
|
||||||
|
"positions.pageNumber": 1
|
||||||
|
}
|
||||||
|
</ext:keys>
|
||||||
|
<ext:options>
|
||||||
|
{name: "positions_pageNumber_index"}
|
||||||
|
</ext:options>
|
||||||
|
</ext:createIndex>
|
||||||
|
|
||||||
|
<ext:createIndex collectionName="entity-log-entries">
|
||||||
|
<ext:keys>
|
||||||
|
{
|
||||||
|
"_id": 1,
|
||||||
|
"changes.analysisNumber": -1
|
||||||
|
}
|
||||||
|
</ext:keys>
|
||||||
|
<ext:options>
|
||||||
|
{name: "changes_analysisNumber_index"}
|
||||||
|
</ext:options>
|
||||||
|
</ext:createIndex>
|
||||||
|
|
||||||
|
</changeSet>
|
||||||
|
|
||||||
|
|
||||||
|
</databaseChangeLog>
|
||||||
Loading…
x
Reference in New Issue
Block a user