deleteGlobalSecondaryIndex
deleteGlobalSecondaryIndex
is a Change Type in the Liquibase DynamoDB Pro extension that deletes a global secondary index from a table. For more information, see Using Global Secondary Indexes in DynamoDB.
Uses
A secondary index lets you query the data in the table using an alternate key, in addition to queries against the primary key. A global secondary index is an index with a partition key and sort key that can be different from those on the table. It is different from a local secondary index, which is an index with the same partition key as the table, but a different sort key. For more information, see Core components of Amazon DynamoDB.
Run deleteGlobalSecondaryIndex
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
Now, Liquibase deploys your change on your DynamoDB database. By default, read operations on DynamoDB are eventually consistent. When you look at your database immediately after running liquibase update
, DynamoDB may display the status of an object as CREATING
, UPDATING
, or DELETING
. When it finishes, it displays the status as ACTIVE
.
Note: If your deployment fails because the DynamoDB waiter times out or reaches a retry limit, you can modify the waiter settings using Liquibase Parameters for Amazon DynamoDB Pro.
Available attributes
For more information, see DynamoDB API: DeleteTable and DynamoDB API: DeleteGlobalSecondaryIndexAction.
Name | Type | Description | Requirement |
---|---|---|---|
tableName
|
String |
Name of the table that is indexed |
Required |
indexName
|
String |
Name of the index |
Required |
Examples
databaseChangeLog:
- changeSet:
id: 2
author: your.name
changes:
- deleteGlobalSecondaryIndex:
tableName: deleteGlobalSecondaryIndexYaml
indexName: globalIndex
rollback:
empty
{
"databaseChangeLog": [
{
"changeSet": {
"id": "2",
"author": "your.name",
"changes": [
{
"deleteGlobalSecondaryIndex": {
"tableName": "deleteGlobalSecondaryIndexJson",
"indexName": "globalIndex"
}
}
],
"rollback": [
{
"empty": {
}
}
]
}
}
]
}
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:dynamodb="http://www.liquibase.org/xml/ns/pro-dynamodb"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-latest.xsd
http://www.liquibase.org/xml/ns/pro-dynamodb
http://www.liquibase.org/xml/ns/pro-dynamodb/liquibase-pro-dynamodb-latest.xsd">
<changeSet id="2" author="your.name" labels="test">
<dynamodb-pro:deleteGlobalSecondaryIndex tableName="deleteGlobalSecondaryIndexXml" indexName="globalIndex"/>
<rollback/>
</changeSet>
</databaseChangeLog>
Database support
This Change Type is only supported for Amazon DynamoDB. It does not support auto rollback.