liquibase / liquibase

Main Liquibase Source
https://www.liquibase.org
Apache License 2.0
4.76k stars 1.87k forks source link

yaml files: table columns definition - subkeys column vs columns does not result in an error #1109

Open pvanek opened 4 years ago

pvanek commented 4 years ago

Database Vendor & Version: MySQL/H2

Version of Liquibase Used

3.8.3 (org.liquibase:liquibase-core)

Description

I made a typo in createTable definition. I used columns instead of column as a key for column definition. Liquibase run completed successfully but the column was ignored.

Snippet of the changelog file:

databaseChangeLog:
  - changeSet:
      id: a
      author: spongebob
      changes:
...
        - createTable:
            tableName: storyteller_task
            columns:
... many correct column definitions ...
              - columns:          <---- see the trailing s
                  constraints:
                    nullable: false
                  name: reported_to_oms
                  type: boolean
                  defaultValue: false
...

It results into correct run, the column is not created at all though

Steps to Reproduce

Try to align DB with this change set

databaseChangeLog:
  - changeSet:
      id: a
      author: spongebob
      changes:
        - createTable:
            tableName: foo_bar
            columns:
              - column:
                  name: id
                  type: int
              - columns:
                  name: typo_column
                  type: boolean

Actual Behavior

The SQL statement is created without the typo_column

CREATE TABLE PUBLIC.foo_bar (id INT)

Expected Behavior

I'd expect an error message. Eg. Cannot parse the changeset definition or similar. Ideally before the real DB work.

Additional Context

Maybe the yaml/json/xml changeset files can be validated against some schema...

Example files

<Any example files to share> 
molivasdat commented 4 years ago

Hi @pvanek Thanks for finding this issue. Would it be possible to share a few more details where I have highlighted in the comment section of this issue where I have put <need ... here>

pvanek commented 4 years ago

@molivasdat updated