| databaseChangeLog = { |
| |
| changeSet(author: "John Smith", id: "second-1") { |
| createTable(tableName: "author") { |
| column(autoIncrement: "true", name: "id", type: "BIGINT") { |
| constraints(primaryKey: "true", primaryKeyName: "authorPK") |
| } |
| |
| column(name: "version", type: "BIGINT") { |
| constraints(nullable: "false") |
| } |
| |
| column(name: "name", type: "VARCHAR(255)") { |
| constraints(nullable: "false") |
| } |
| } |
| } |
| |
| changeSet(author: "John Smith", id: "second-2") { |
| createTable(tableName: "book") { |
| column(autoIncrement: "true", name: "id", type: "BIGINT") { |
| constraints(primaryKey: "true", primaryKeyName: "bookPK") |
| } |
| |
| column(name: "version", type: "BIGINT") { |
| constraints(nullable: "false") |
| } |
| |
| column(name: "author_id", type: "BIGINT") { |
| constraints(nullable: "false") |
| } |
| |
| column(name: "title", type: "VARCHAR(255)") { |
| constraints(nullable: "false") |
| } |
| } |
| } |
| |
| changeSet(author: "John Smith", id: "second-3") { |
| addForeignKeyConstraint(baseColumnNames: "author_id", baseTableName: "book", constraintName: "FK_4sac2ubmnqva85r8bk8fxdvbf", deferrable: "false", initiallyDeferred: "false", referencedColumnNames: "id", referencedTableName: "author") |
| } |
| } |