Skip to content
Snippets Groups Projects
Unverified Commit d240a533 authored by Case Nelson's avatar Case Nelson Committed by GitHub
Browse files

Add database_required to field metadata (#23213)

* Add database_required to field metadata

The purpose of this new column is meant to track if the database believes
that the column is required during writeback. It may be that the user
knows better but that is out of scope and would need
another column so that sync never overwrites what a user would set.

Since writeback isn't planned to be added to non transactional-dbs yet
we do not need to calculate requiredness in other drivers.

This could become more sophisticated in the future (look at triggers
that modify the column) simply looking for not-null and non-default
columns gets us a big win in UI.

* Fixing tests

* Fixing more tests

* Default updates to false

* Add database-required to field sync metadata test

* Update driver tests

* Fix tests

* Changes from testing on different dbs

https://docs.oracle.com/javase/7/docs/api/java/sql/DatabaseMetaData.html#getColumns(java.lang.String,%20java.lang.String,%20java.lang.String,%20java.lang.String)
Based on these descriptions of `getColumns` and testing across dbs made
the following changes:

`COLUMN_DEF` may or may not show autoincrement defaults
`COLUMN_DEF` may be `nil` or `"NULL"` and the docs say it may be `"null"`
`NULLABLE` is an int value, `0` indicating not null

NULLABLE and AUTOINCREMENT may be unknown (`3`, `""`) in those cases the
field will not be marked as required.

* Updating tests from changes

* Fix driver tests

* Cypress tests had fk field ids hardcoded
parent 28c5a14d
Branches
Tags
No related merge requests found
Showing
with 172 additions and 66 deletions
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment