dropCompositeType
The dropCompositeType
change type removes a defined composite type in your PostgreSQL tables, columns, and function signatures.
Note: Inspection features or commands, such as snapshot
, diff
, generate-changelog
, and diff-changelog
, are not currently supported with composite types.
Run renameCompositeType
To run this Change Type, follow these steps:
- Add the Change Type to your changeset, as shown in the examples on this page.
- Specify any required attributes. Use the table on this page to see which ones your database requires.
- Deploy your changeset by running the
update
command:
liquibase update
Available attributes
Name | Type | Description | Requirement |
---|---|---|---|
catalogName
|
String | Name of the catalog | Optional |
schemaName
|
String | Name of the schema that contains the composite type you want to drop | Optional |
typeName
|
String | Name of the type you want to you want to drop | Required |
ifExists
|
Boolean | Drop objects only if they exist in the database. | Optional |
onDelete
|
String |
Set to |
Optional |
Examples
databaseChangeLog:
- changeSet:
id: 1
author: itTest
changes:
- createCompositeType:
typeName: "myDelType"
typeAttributes:
- typeAttribute:
name: "attr1"
type: "int"
- typeAttribute:
name: "attr2"
type: "text"
collation: "en_US"
- dropCompositeType:
typeName: "myDelType"
ifExists: true
onDelete: "CASCADE"
rollback:
empty
{
"databaseChangeLog": [
{
"changeSet": {
"id": "1",
"author": "itTest",
"changes": [
{
"createCompositeType": {
"typeName":"myDelType",
"typeAttributes": [
{
"typeAttribute": {
"name": "attr1",
"type": "int"
}
},
{
"typeAttribute": {
"name": "attr2",
"type": "text",
"collation":"en_US"
}
}
]
}
},
{
"dropCompositeType": {
"typeName":"myDelType",
"ifExists": true,
"onDelete": "CASCADE"
}
}
],
"rollback":[]
}
}
]
}
<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:pro="http://www.liquibase.org/xml/ns/pro"
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-latest.xsd">
<changeSet author="itTest" id="1">
<pro:createCompositeType typeName="myDelType">
<pro:typeAttribute name="attr1" type="int"/>
<pro:typeAttribute name="attr2" type="text" collation="en_US"/>
</pro:createCompositeType>
<pro:dropCompositeType typeName="myDelType" ifExists="true" onDelete="CASCADE"/>
<rollback/>
</changeSet>
</databaseChangeLog>
Database Support
This change type is only supported for PostgreSQL.