Skip to content

Commit d67e007

Browse files
authored
Merge pull request #16 from evsikov/SB-1475
SB-1475: new migration. Change ArtifactEntry properties 'date' types into 'datetime'
2 parents 9b6ac73 + 9fab6e8 commit d67e007

File tree

3 files changed

+40
-1
lines changed

3 files changed

+40
-1
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,4 +53,4 @@
5353
<module>strongbox-db-server</module>
5454
</modules>
5555

56-
</project>
56+
</project>

strongbox-db-liquibase/src/main/resources/db/changelog/v1.0.0/db.changelog-1.0.0.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,6 @@
2424
<include file="v1.0.0.18__ArtifactGroup.xml" relativeToChangelogFile="true"/>
2525
<include file="v1.0.0.19__ArtifactEntry.xml" relativeToChangelogFile="true"/>
2626
<include file="v1.0.0.20__User.xml" relativeToChangelogFile="true"/>
27+
<include file="v1.0.0.21__ArtifactEntry.xml" relativeToChangelogFile="true"/>
2728

2829
</databaseChangeLog>
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
2+
xmlns:o="http://www.unbroken-dome.org/schema/liquibase-orientdb"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
5+
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.2.xsd">
6+
7+
<!--
8+
Problem:
9+
Need to change class ArtifactEntry property 'created' type from 'date' into 'datetime'.
10+
"ALTER PROPERTY ArtifactEntry.created TYPE datetime" fails to update property type.
11+
12+
Solution:
13+
Apply sequence of two statements.
14+
1. "DROP PROPERTY ArtifactEntry.created"
15+
"Removes a property from the schema. Does not remove the property values in the records,
16+
it just changes the schema information. Records continue to have the property values, if any."
17+
For details see: https://orientdb.org/docs/3.1.x/sql/SQL-Drop-Property.html
18+
19+
2. "CREATE PROPERTY ArtifactEntry.created datetime"
20+
"Creates a new property in the schema"
21+
For details see: https://orientdb.org/docs/3.1.x/sql/SQL-Create-Property.html
22+
23+
Property values will retain previously existing data, but will have a new type 'datetime'
24+
-->
25+
<changeSet id="v1.0.0.21" author="strongbox-dev@carlspring.com">
26+
27+
<o:dropProperty className="ArtifactEntry" propertyName="created"/>
28+
<o:createProperty className="ArtifactEntry" name="created" type="datetime"/>
29+
30+
<o:dropProperty className="ArtifactEntry" propertyName="lastUsed"/>
31+
<o:createProperty className="ArtifactEntry" name="lastUsed" type="datetime"/>
32+
33+
<o:dropProperty className="ArtifactEntry" propertyName="lastUpdated"/>
34+
<o:createProperty className="ArtifactEntry" name="lastUpdated" type="datetime"/>
35+
</changeSet>
36+
37+
</databaseChangeLog>
38+

0 commit comments

Comments
 (0)