changeCompositeTypeOwner

The changeCompositeTypeOwner change type allows you to change the user who owns the composite type. The new owner can alter, drop, grant, revoke, or transfer ownership to another user.

Note: Inspection features or commands, such as snapshot, diff, generate-changelog, and diff-changelog, are not currently supported with composite types.

Run changeCompositeTypeOwner

To run this Change Type, follow these steps:

  1. Add the Change Type to your changeset, as shown in the examples on this page.
  2. Specify any required attributes. Use the table on this page to see which ones your database requires.
  3. Deploy your changeset by running the update command:
  4. 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 Optional
typeName String Name of the type you want to you want to change the owner of Required
newOwner String Name of the new user who is designated as the owner of the composite type. Accepted values are: CURRENT_ROLE, CURRENT_USER, SESSION_USER. Required

Examples


databaseChangeLog:
 - changeSet:
	id: 1
	author: itTest
	changes:
	 - createCompositeType:
		typeName: "myType"
		typeAttributes:
		 - typeAttribute:
			name: "attr1"
			type: "int"
		 - typeAttribute:
			name: "attr2"
			type: "text"
			collation: "en_US"
	 - changeCompositeTypeOwner:
		 typeName: "myType"
		 newOwner: "SESSION_USER"

	rollback:
	 - dropCompositeType:
		 typeName: "myType"
		 ifExists: true
		 onDelete: "CASCADE"

{
  "databaseChangeLog": [
    {
      "changeSet": {
        "id": "1",
        "author": "itTest",
        "changes": [
          {
            "createCompositeType": {
              "typeName":"myType",
              "typeAttributes": [
                {
                  "typeAttribute": {
                    "name": "attr1",
                    "type": "int"
                  }
                },
                {
                  "typeAttribute": {
                    "name": "attr2",
                    "type": "text",
                    "collation":"en_US"
                  }
                }
              ]
            }
          },
          {
            "changeCompositeTypeOwner": {
              "typeName":"myType",
              "newOwner":"SESSION_USER"
            }
          }
        ],
        "rollback": [
          {
            "dropCompositeType": {
              "typeName":"myType",
              "ifExists": true,
              "onDelete": "CASCADE"
            }
          }
        ]
      }
    }
  ]
}

<?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="myType">
            <pro:typeAttribute name="attr1" type="int"/>
            <pro:typeAttribute name="attr2" type="text" collation="en_US"/>
        </pro:createCompositeType>
        <pro:changeCompositeTypeOwner typeName="myType" newOwner="SESSION_USER"/>
        <rollback>
            <pro:dropCompositeType typeName="myType" ifExists="true" onDelete="CASCADE"/>
        </rollback>
    </changeSet>
</databaseChangeLog>

Database Support

This change type is only supported for PostgreSQL.