Create a new database view
Name | Description |
---|---|
catalogName | Name of the catalog@ v3.0E.g. 'cat' |
encoding | Name of the encoding (as specified in java.nio.Charset javadoc) used in the file defined in the `path` attributeDefault: 'utf-8' |
fullDefinition | booleanSet to true if selectQuery is the entire view definition. False if the CREATE VIEW header should be added@ v3.3 |
path | Path to file containing view definition@ v3.6E.g. 'A String' |
relativeToChangelogFile | booleanWhether the file path is relative to the root changelog file rather than to the classpath. |
remarks | Comments stored for the viewE.g. 'A String' |
replaceIfExists | booleanUse 'create or replace' syntaxSupported by: db2, firebird, h2, hsqldb, ingres, mariadb, mssql, mysql, oracle, postgresql, sqlite, sybase@ v1.5 |
schemaName | Name of the schemaE.g. 'public' |
[XML: text content] / selectQuery | SQL for generating the viewE.g. 'select id, name from person where id > 10'Required for: informixNote: the content of the tag in XML |
viewName | Name of the view to createE.g. 'v_person' |
<changeSet author="liquibase-docs" id="createView-example">
<createView catalogName="cat"
encoding="A String"
fullDefinition="true"
path="A String"
relativeToChangelogFile="true"
remarks="A String"
replaceIfExists="false"
schemaName="public"
viewName="v_person">select id, name from person where id > 10</createView>
</changeSet>
changeSet:
id: createView-example
author: liquibase-docs
changes:
- createView:
catalogName: cat
encoding: A String
fullDefinition: true
path: A String
relativeToChangelogFile: true
remarks: A String
replaceIfExists: false
schemaName: public
selectQuery: select id, name from person where id > 10
viewName: v_person
{
"changeSet": {
"id": "createView-example",
"author": "liquibase-docs",
"changes": [
{
"createView": {
"catalogName": "cat",
"encoding": "A String",
"fullDefinition": true,
"path": "A String",
"relativeToChangelogFile": true,
"remarks": "A String",
"replaceIfExists": false,
"schemaName": "public",
"selectQuery": "select id, name from person where id > 10",
"viewName": "v_person"
}
}]
}
}
CREATE VIEW cat.v_person AS select id,
name from person where id > 10;
Database | Notes | Auto Rollback |
---|---|---|
DB2/LUW | Supported | Yes |
DB2/z | Supported | Yes |
Derby | Supported | Yes |
Firebird | Supported | Yes |
H2 | Supported | Yes |
HyperSQL | Supported | Yes |
INGRES | Supported | Yes |
Informix | Supported | Yes |
MariaDB | Supported | Yes |
MySQL | Supported | Yes |
Oracle | Supported | Yes |
PostgreSQL | Supported | Yes |
SQL Server | Supported | Yes |
SQLite | Supported | Yes |
Sybase | Supported | Yes |
Sybase Anywhere | Supported | Yes |