Primary Key column has always NOT NULL after using update command
marcindyjas opened this issue · 1 comments
marcindyjas commented
Descripton:
Primary Key column is always not nullable after using update command but according to documentation on Cloud Spanner:
https://cloud.google.com/spanner/docs/schema-and-data-model#notes_about_key_columns
Primary Key columns can be defined to store NULLs.
Steps to reproduce:
Use changeLog as below:
databaseChangeLog:
- changeSet:
id: 1617793276323-1
author: author
changes:
- createTable:
columns:
- column:
constraints:
primaryKey: true
primaryKeyName: PRIMARY_KEY
name: FIRST_1
type: STRING(1024)
- column:
constraints:
nullable: false
primaryKey: true
primaryKeyName: PRIMARY_KEY
name: FIRST_2
type: STRING(MAX)
- column:
constraints:
primaryKey: true
primaryKeyName: PRIMARY_KEY
name: FIRST_3
type: INT64
- column:
name: FIRST_4
type: INT64
tableName: FIRST_TABLE
In command:
liquibase --url="jdbc:cloudspanner:/projects/<project_name>/instances/<instance_name>/databases/<db_name>" --changeLogFile=changeLog.yml update
After that in schema you can see all Primary Keys as a not nullable but should be only FIRST_2 column.
Even adding "nullable: true" does not help.
olavloite commented
Hmm... The default behavior in Liquibase seems to be to assume that any primary key column should also be NOT NULL
: