Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Additional (optional) tableType attribute on the CreateTableChange #3108

Merged
merged 16 commits into from
Dec 20, 2022

Conversation

MartinRied
Copy link
Contributor

Impact

  • Bug fix (non-breaking change which fixes expected existing functionality)
  • Enhancement/New feature (adds functionality without impacting existing logic)
  • Breaking change (fix or feature that would cause existing functionality to change)

Description

Fixes #3067

A new (optional) tableType attribute/field is added CreateTableChange and CreateTableStatement.
This tableType, if present, is added to the CREATE TABLE statement by the CreateTableGenerator as follows:
CREATE <tableType> TABLE ...

Things to be aware of

  • I've chosen not to implement this as part of the Snowflake extension since it also affects SAP HANA (and possibly other DBMS).

Things to worry about

Additional Context

@MartinRied
Copy link
Contributor Author

Hi, is there any update on this Pull Request?

@kataggart
Copy link
Contributor

@MartinRied sorry, we do not have an update at this time. It is on our list of proposed enhancements to review, but we have not been able to get to it yet.

@nvoxland
Copy link
Contributor

nvoxland commented Nov 4, 2022

Pre-Review Notes:

The new "tableType" attribute is nice and non-database specific. It's not universally used, but we have other attributes that aren't universally used.

Questions I have:

  • None

Potential risks:

  • None

What could make the review difficult:

  • We'd want to make sure it's being used as applicable for the databases we currently support. Will need to do some research into at least the most popular databases to see if they have a table type-like clause in their create table syntax

@MalloD12 MalloD12 self-assigned this Nov 25, 2022
@MalloD12 MalloD12 self-requested a review November 25, 2022 18:37
@MalloD12
Copy link
Contributor

Hi @MartinRied,

I have started reviewing this PR and as part of my testing, I'm trying to figure out which other DBs supports "Table type" property other than Snowflake and SAP HANA. Are you aware of any other you can point me out?

Thanks,
Daniel.

Copy link
Contributor

@XDelphiGrl XDelphiGrl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you could please answer the questions I've left, then I'll go ahead and do the official code review. Thank you!

@MalloD12 MalloD12 added SafeToBuild Indicates that a particular PR contains changes which are safe to build using GitHub actions and removed SafeToBuild Indicates that a particular PR contains changes which are safe to build using GitHub actions labels Dec 14, 2022
@XDelphiGrl XDelphiGrl added the ReleaseMajor Fix needs to be part of an x.y release, not an x.y.z patch release label Dec 16, 2022
Copy link
Contributor

@XDelphiGrl XDelphiGrl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR is an enhancement to the createTable changetype. The optional tableType attribute allows users to define tables with modifiers of the format: CREATE [options] TABLE , where tableType indicates the [options]. For example, if tableType=TEMPORARY then the generated SQL becomes CREATE TEMPORARY TABLE.

  • Functional and test harness executions passing.
  • New integration tests added for oracle, mysql, h2, mariadb, postgresql and snowflake to validate using tableType=TEMPORARY.
  • No additional testing required.

APPROVED

NOTE!!! This PR introduces XSD changes and cannot be released as a patch version!

@filipelautert filipelautert added SafeToBuild Indicates that a particular PR contains changes which are safe to build using GitHub actions and removed SafeToBuild Indicates that a particular PR contains changes which are safe to build using GitHub actions labels Dec 20, 2022
@filipelautert filipelautert added SafeToBuild Indicates that a particular PR contains changes which are safe to build using GitHub actions and removed SafeToBuild Indicates that a particular PR contains changes which are safe to build using GitHub actions labels Dec 20, 2022
@filipelautert filipelautert merged commit 15b16af into liquibase:master Dec 20, 2022
@filipelautert filipelautert added this to the 1NEXT milestone Dec 20, 2022
benkard added a commit to benkard/mulkcms2 that referenced this pull request Jan 21, 2023
This MR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [org.liquibase.ext:liquibase-hibernate5](https://github.com/liquibase/liquibase-hibernate/wiki) ([source](https://github.com/liquibase/liquibase-hibernate)) | build | minor | `4.18.0` -> `4.19.0` |
| [org.liquibase:liquibase-maven-plugin](http://www.liquibase.org/liquibase-maven-plugin) ([source](https://github.com/liquibase/liquibase)) | build | minor | `4.18.0` -> `4.19.0` |
| [io.quarkus:quarkus-maven-plugin](https://github.com/quarkusio/quarkus) | build | minor | `2.15.3.Final` -> `2.16.0.Final` |

---

### Release Notes

<details>
<summary>liquibase/liquibase-hibernate</summary>

### [`v4.19.0`](https://github.com/liquibase/liquibase-hibernate/releases/tag/v4.19.0)

[Compare Source](liquibase/liquibase-hibernate@v4.18.0...v4.19.0)

Support for Liquibase 4.19.0.

#### What's Changed

-   Support Hibernate ORM 6.1 with Jakarta EE 10 by [@&#8203;papegaaij](https://github.com/papegaaij) in liquibase/liquibase-hibernate#434
-   Bump hibernate.version from 6.1.5.Final to 6.1.6.Final by [@&#8203;dependabot](https://github.com/dependabot) in liquibase/liquibase-hibernate#447
-   Bump spring.version from 6.0.2 to 6.0.3 by [@&#8203;dependabot](https://github.com/dependabot) in liquibase/liquibase-hibernate#448

#### New Contributors

-   [@&#8203;papegaaij](https://github.com/papegaaij) made their first contribution in liquibase/liquibase-hibernate#434

**Full Changelog**: liquibase/liquibase-hibernate@v4.18.0...v4.19.0

</details>

<details>
<summary>liquibase/liquibase</summary>

### [`v4.19.0`](https://github.com/liquibase/liquibase/releases/tag/v4.19.0)

[Compare Source](liquibase/liquibase@v4.18.0...v4.19.0)

##### Liquibase v4.19.0 is a patch release with an XSD upgrade.

#### Enhancements

-   Simplify assert calls and replaced with simpler and equivalent calls. by [@&#8203;arturobernalg](https://github.com/arturobernalg) in liquibase/liquibase#3497
-   Delete unused import statement.  by [@&#8203;arturobernalg](https://github.com/arturobernalg) in liquibase/liquibase#3522
-   Added call to modifyChangeSet during execute method to allow the changeSet to be correctly set on the executor DAT-12388 by [@&#8203;wwillard7800](https://github.com/wwillard7800) in liquibase/liquibase#3511
-   Remove unnecessary local variables that add nothing to the comprehensibility of a method. by [@&#8203;arturobernalg](https://github.com/arturobernalg) in liquibase/liquibase#3373
-   Allow loading gzipped data files by [@&#8203;mike-seger](https://github.com/mike-seger) in liquibase/liquibase#3379
-   Use try-with-resources Statement when is possible. by [@&#8203;arturobernalg](https://github.com/arturobernalg) in liquibase/liquibase#3374
-   Define and reuse constants. Use an empty array styles to convert a collection to an array. by [@&#8203;arturobernalg](https://github.com/arturobernalg) in liquibase/liquibase#3500
-   Add support for block comment rollback commands on SQL changesets by [@&#8203;krishnaenugandula](https://github.com/krishnaenugandula) in liquibase/liquibase#1399
-   Allow primary key on addColumn for H2 by [@&#8203;nick318](https://github.com/nick318) in liquibase/liquibase#3372
-   Additional (optional) tableType attribute on the CreateTableChange by [@&#8203;MartinRied](https://github.com/MartinRied) in liquibase/liquibase#3108
-   Include "path" in databasechangelog's description column for all change types with "path" attributes by [@&#8203;MichaelKern-IVV](https://github.com/MichaelKern-IVV) in liquibase/liquibase#3244
-   [#&#8203;1466](liquibase/liquibase#1466): Add ignore:true changeset attribute to Formatted SQL changeLogs by [@&#8203;skrivenko](https://github.com/skrivenko) in liquibase/liquibase#3377
-   [#&#8203;1290](liquibase/liquibase#1290): Forbid empty changeSet id and author by [@&#8203;skrivenko](https://github.com/skrivenko) in liquibase/liquibase#3397
-   Allow to drop and create a view for a Postgres database if replacing the view would fail by [@&#8203;rozenshteyn](https://github.com/rozenshteyn) in liquibase/liquibase#3399
-   Rename DatabaseObjectComparator class to be DatabaseObjectCollectionComparator for clarity DAT-10112 by [@&#8203;wwillard7800](https://github.com/wwillard7800) in liquibase/liquibase#3544
-   Do not lower case the ProvidedValue description if the string is capitalized, i.e. it starts with 2 upper-case characters DAT-12614 by [@&#8203;wwillard7800](https://github.com/wwillard7800) in liquibase/liquibase#3589
-   Use 'Integer.compare' instead by [@&#8203;arturobernalg](https://github.com/arturobernalg) in liquibase/liquibase#3528
-   Simplify 'Map' operations. by [@&#8203;arturobernalg](https://github.com/arturobernalg) in liquibase/liquibase#3527
-   Remove unnecessary semicolon. by [@&#8203;arturobernalg](https://github.com/arturobernalg) in liquibase/liquibase#3571
-   Missing Override annotations. by [@&#8203;arturobernalg](https://github.com/arturobernalg) in liquibase/liquibase#3558
-   Prevents redundant loop iterations. Early loop exit in 'if' condition. by [@&#8203;arturobernalg](https://github.com/arturobernalg) in liquibase/liquibase#3547
-   DAT 6635 - Implement TagCommand by [@&#8203;filipelautert](https://github.com/filipelautert) in liquibase/liquibase#3570
-   DAT-12576 update release workflow to attach artifact by run_id by [@&#8203;ap-liquibase](https://github.com/ap-liquibase) in liquibase/liquibase#3629
-   DAT-12365 update install4j script to version 10.x by [@&#8203;jnewton03](https://github.com/jnewton03) in liquibase/liquibase#3641
-   Upgrades installer JDK version for next release. by [@&#8203;filipelautert](https://github.com/filipelautert) in liquibase/liquibase#3440
-   remove licenses that were moved to individual extensions (DAT-12784) by [@&#8203;StevenMassaro](https://github.com/StevenMassaro) in liquibase/liquibase#3646
-   DAT-12597 include commercial sources and javadoc in reversion by [@&#8203;ap-liquibase](https://github.com/ap-liquibase) in liquibase/liquibase#3671

#### Security, Driver, and other updates

-   Bump mariadb-java-client from 3.0.8 to 3.1.0 by [@&#8203;dependabot](https://github.com/dependabot) in liquibase/liquibase#3471
-   Bump testcontainers-bom from 1.17.5 to 1.17.6 by [@&#8203;dependabot](https://github.com/dependabot) in liquibase/liquibase#3477
-   Bump snowflake-jdbc from 3.13.22 to 3.13.25 by [@&#8203;dependabot](https://github.com/dependabot) in liquibase/liquibase#3475
-   Bump slf4j-jdk14 from 2.0.3 to 2.0.4 by [@&#8203;dependabot](https://github.com/dependabot) in liquibase/liquibase#3485
-   Bump maven-install-plugin from 3.0.1 to 3.1.0 by [@&#8203;dependabot](https://github.com/dependabot) in liquibase/liquibase#3484
-   Bump castlabs/get-package-version-id-action from 2.0 to 2.1 by [@&#8203;dependabot](https://github.com/dependabot) in liquibase/liquibase#3490
-   Bump sqlite-jdbc from 3.39.4.0 to 3.40.0.0 by [@&#8203;dependabot](https://github.com/dependabot) in liquibase/liquibase#3510
-   Bump jaybird from 4.0.6.java8 to 4.0.8.java8 by [@&#8203;dependabot](https://github.com/dependabot) in liquibase/liquibase#3509
-   Bump mockito-inline from 4.8.1 to 4.10.0 by [@&#8203;dependabot](https://github.com/dependabot) in liquibase/liquibase#3580
-   Bump targetMavenVersion from 3.8.5 to 3.8.6 by [@&#8203;dependabot](https://github.com/dependabot) in liquibase/liquibase#3593
-   Bump junit-jupiter-params from 5.8.1 to 5.9.1 by [@&#8203;dependabot](https://github.com/dependabot) in liquibase/liquibase#3592
-   Bump jaybird from 4.0.6.java8 to 4.0.8.java8 by [@&#8203;dependabot](https://github.com/dependabot) in liquibase/liquibase#3602
-   Bump slf4j-jdk14 from 2.0.4 to 2.0.6 by [@&#8203;dependabot](https://github.com/dependabot) in liquibase/liquibase#3566
-   Bump snowflake-jdbc from 3.13.25 to 3.13.26 by [@&#8203;dependabot](https://github.com/dependabot) in liquibase/liquibase#3579
-   Bump robinraju/release-downloader from 1.6 to 1.7 by [@&#8203;dependabot](https://github.com/dependabot) in liquibase/liquibase#3603
-   Bump ojdbc8 from 21.7.0.0 to 21.8.0.0 by [@&#8203;dependabot](https://github.com/dependabot) in liquibase/liquibase#3551
-   Bump up the max number of code points for JSON/YAML parser DAT-12657 by [@&#8203;wwillard7800](https://github.com/wwillard7800) in liquibase/liquibase#3552
-   Bump actions/cache from 3.0.11 to 3.2.3 by [@&#8203;dependabot](https://github.com/dependabot) in liquibase/liquibase#3654
-   update changelog version - 4.19 by [@&#8203;suryaaki2](https://github.com/suryaaki2) in liquibase/liquibase#3676
-   Update changelog xsd 4.19 by [@&#8203;suryaaki2](https://github.com/suryaaki2) in liquibase/liquibase#3678
-   Bump targetMavenVersion from 3.8.5 to 3.8.7 by [@&#8203;dependabot](https://github.com/dependabot) in liquibase/liquibase#3634
-   Update release-published.yml by [@&#8203;jnewton03](https://github.com/jnewton03) in liquibase/liquibase#3540
-   DAT-12783 Adding extension license information by [@&#8203;wwillard7800](https://github.com/wwillard7800) in liquibase/liquibase#3614

#### Fixes

-   fix overwriteOutputFile parameter for GenerateChangelog (DAT-12036) by [@&#8203;StevenMassaro](https://github.com/StevenMassaro) in liquibase/liquibase#3543
-   Avoid ClassCastException when loading LogService from Scope by [@&#8203;mattbertolini](https://github.com/mattbertolini) in liquibase/liquibase#3518
-   Adds exclusions for mariadb newly added waffle dependency. by [@&#8203;filipelautert](https://github.com/filipelautert) in liquibase/liquibase#3559
-   Correctly handle indexes with descending columns in snapshot DAT-11447 by [@&#8203;wwillard7800](https://github.com/wwillard7800) in liquibase/liquibase#3535
-   Fix getting default schema issue for firebird by [@&#8203;MalloD12](https://github.com/MalloD12) in liquibase/liquibase#3390
-   Fix generatedSQL logic to allow setting up a function as a default value for MySQL version 8 by [@&#8203;MalloD12](https://github.com/MalloD12) in liquibase/liquibase#3362
-   DAT-11579: when generating changelogs for MySQL, ignore table column order for PKs by [@&#8203;StevenMassaro](https://github.com/StevenMassaro) in liquibase/liquibase#3486
-   Included SQL to return unique constraints for Sybase by [@&#8203;crenan](https://github.com/crenan) in liquibase/liquibase#3517
-   Add varbinary and binary support for DB2 - fixes [#&#8203;3408](liquibase/liquibase#3408)  by [@&#8203;mihaelaDev](https://github.com/mihaelaDev) in liquibase/liquibase#3428
-   Added support for COMPUTED values inside CSV files for loadData change by [@&#8203;zbynekvavros](https://github.com/zbynekvavros) in liquibase/liquibase#944
-   Prevent Executors collision due to hash used as a Map's key part by [@&#8203;Dasiu](https://github.com/Dasiu) in liquibase/liquibase#3533
-   Breaks out of LockService.init loop after validations are completed by [@&#8203;filipelautert](https://github.com/filipelautert) in liquibase/liquibase#3576
-   implement SingletonObject to solve [#&#8203;2349](liquibase/liquibase#2349) by [@&#8203;yairogen](https://github.com/yairogen) in liquibase/liquibase#3624
-   Postgresql - Fallback to default schema name in SequenceSnapshotGenerator when this is null by [@&#8203;djochim](https://github.com/djochim) in liquibase/liquibase#3637

##### OWASP Dependency Check: Reported Vulnerabilities

-   snakeyaml.jar - This is a ["critical" vulnerability reported against the snakeyaml library](https://ossindex.sonatype.org/vulnerability/CVE-2022-1471). We are currently on the newest version of snakeyaml and there is no fix for the issue as of yet.

#### New Contributors

-   [@&#8203;mike-seger](https://github.com/mike-seger) made their first contribution in liquibase/liquibase#3379
-   [@&#8203;crenan](https://github.com/crenan) made their first contribution in liquibase/liquibase#3517
-   [@&#8203;mihaelaDev](https://github.com/mihaelaDev) made their first contribution in liquibase/liquibase#3428
-   [@&#8203;krishnaenugandula](https://github.com/krishnaenugandula) made their first contribution in liquibase/liquibase#1399
-   [@&#8203;skrivenko](https://github.com/skrivenko) made their first contribution in liquibase/liquibase#3397
-   [@&#8203;zbynekvavros](https://github.com/zbynekvavros) made their first contribution in liquibase/liquibase#944
-   [@&#8203;Dasiu](https://github.com/Dasiu) made their first contribution in liquibase/liquibase#3533
-   [@&#8203;yairogen](https://github.com/yairogen) made their first contribution in liquibase/liquibase#3624
-   [@&#8203;djochim](https://github.com/djochim) made their first contribution in liquibase/liquibase#3637

**Full Changelog**: liquibase/liquibase@v4.18.0...v4.19.0

##### Get Certified

Learn all the Liquibase fundamentals from free online courses by Liquibase experts and see how to apply them in the real world at https://learn.liquibase.com/.

##### Read the Documentation

Please check out and contribute to the continually improving docs, now at https://docs.liquibase.com/.

##### Meet the Community

Our community has built a lot. From extensions to integrations, you’ve helped make Liquibase the amazing open source project that it is today. Keep contributing to making it stronger:

[Contribute code](https://www.liquibase.org/development/contribute.html)
[Make doc updates](https://github.com/Datical/liquibase-docs)
[Help by asking and answering questions](https://forum.liquibase.org/)
[Set up a chat with the Product team](https://calendly.com/liquibase-outreach/product-feedback)

Thanks to everyone who helps make the Liquibase community strong!

#### File Descriptions

-   **Liquibase CLI** -- Includes open source + commercial functionality
-   **liquibase-x.y.z.tar.gz** -- Archive in tar.gz format
-   **liquibase-x.y.z.zip** -- Archive in zip format
-   **liquibase-windows-x64-installer-x.y.z.exe** -- Installer for Windows
-   **liquibase-macos-installer-x.y.z.dmg** -- Installer for MacOS
-   **Primary Libraries** - For embedding in other software
    -   **liquibase-core-x.y.z.jar** – Base Liquibase library (open source)
    -   **liquibase-commerical-x.y.z.jar** – Additional commercial functionality
-   **liquibase-additional-x.y.z.zip** – Contains additional, less commonly used files
    -   Additional libraries such as liquibase-maven-plugin.jar and liquibase-cdi.jar
    -   Javadocs for all the libraries
    -   Source archives for all the open source libraries
    -   ASC/MD5/SHA1 verification hashes for all files
    **NOTE: liquibase-core-<version>.jar** contains only the open-source license. If you use Liquibase Pro or other commercial add-ons, you must also **install liquibase-commercial-<version>.jar**

</details>

<details>
<summary>quarkusio/quarkus</summary>

### [`v2.16.0.Final`](quarkusio/quarkus@2.15.3.Final...2.16.0.Final)

[Compare Source](quarkusio/quarkus@2.15.3.Final...2.16.0.Final)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever MR is behind base branch, or you tick the rebase/retry checkbox.

👻 **Immortal**: This MR will be recreated if closed unmerged. Get [config help](https://github.com/renovatebot/renovate/discussions) if that's undesired.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box

---

This MR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNC4yNC4wIiwidXBkYXRlZEluVmVyIjoiMzQuMjQuMCJ9-->
@awhitford-cip
Copy link

The new tableType attribute is missing from the createTable documentation.

@MalloD12
Copy link
Contributor

createTable documentation

Hi Anthony (@awhitford-cip), thanks for letting us know. I'll let the team know so we can update our documentation to reflect this change.

Thanks,
Daniel.

jccampanero added a commit to jccampanero/liquibase that referenced this pull request Jun 5, 2023
filipelautert pushed a commit that referenced this pull request Jun 28, 2023
#4322 Add four arguments constructor to CreateTableStatement for backward compatibility.

Amend #3108.

Co-authored-by: Daniel Mallorga <75833793+MalloD12@users.noreply.github.com>
@adrian-velonis1
Copy link
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
autocandidate DBSnowflake DocNeeded ReleaseMajor Fix needs to be part of an x.y release, not an x.y.z patch release SafeToBuild Indicates that a particular PR contains changes which are safe to build using GitHub actions sprint2022-39 TypeEnhancement
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Add Support for Snowflake HYBRID tables / SAP HANA Row & Column tables
9 participants