|
| 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