liquibase.V202206022344-create-table-messages.xml Maven / Gradle / Ivy
<?xml version="1.0" encoding="UTF-8"?> <databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.9.xsd"> <changeSet id="V202206022344" author="Maksim Kostromin"> <comment>Create `messages` table and `messages_sent_at_idx` index with rollback</comment> <createTable tableName="messages"> <column name="body" type="CLOB"/> <column name="address_to" type="VARCHAR(255)"/> <column name="address_from" type="VARCHAR(255)"/> <column name="sent_at" type="${timestamp.type}" defaultValueComputed="${current.timestamp.function}"/> <column autoIncrement="true" name="id" type="BIGINT"> <constraints primaryKey="true" primaryKeyName="messages_pk"/> </column> </createTable> <createIndex tableName="messages" indexName="messages_sent_at_idx"> <column name="sent_at"/> </createIndex> <rollback> <dropIndex tableName="messages" indexName="messages_sent_at_idx"/> <dropTable tableName="messages"/> </rollback> </changeSet> </databaseChangeLog>