-
Notifications
You must be signed in to change notification settings - Fork 7
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
[DAT-18790] added defaultValue snapshotting #192
base: main
Are you sure you want to change the base?
Conversation
Should work for most cases except: |
Column column = (Column) super.snapshotObject(example, snapshot); | ||
//These two are used too often, avoiding them? otherwise there would be too much DB calls | ||
if (!column.getRelation().getName().equalsIgnoreCase("databasechangelog") | ||
&& !column.getRelation().getName().equalsIgnoreCase("databasechangeloglock")) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even with skipping DBCL and DBCLL we are making additional call for every column. We have info for all columns in show create table
.
column.getRelation() has all the columns, so we can iterate over them and add defaultValue information for all columns at once
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@SvampX as discussed, maybe DatabaseSnapshot.snapshotScratchPad could be useful to cache this information between executions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved show create table call to the Table snapshot generator. Storing create table statement in the snapshotScratchPad
suggested by @filipelautert with a show create table query as key. I believe such keys should be unique within a database as the query has full table name with catalog and schema.
if (example instanceof Column) { | ||
Column column = (Column) super.snapshotObject(example, snapshot); | ||
//These two are used too often, avoiding them? otherwise there would be too much DB calls | ||
if (!column.getRelation().getName().equalsIgnoreCase("databasechangelog") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tracking tables can have custom names.
better to use database.getDatabaseChangeLogTableName()
and database.getDatabaseChangeLogLockTableName()
Column column = (Column) super.snapshotObject(example, snapshot); | ||
//These two are used too often, avoiding them? otherwise there would be too much DB calls | ||
if (!column.getRelation().getName().equalsIgnoreCase("databasechangelog") | ||
&& !column.getRelation().getName().equalsIgnoreCase("databasechangeloglock")) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@SvampX as discussed, maybe DatabaseSnapshot.snapshotScratchPad could be useful to cache this information between executions.
… one per table for column default values. updated test
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good.
(I can't approve as i opened PR originally)
Quality Gate failedFailed conditions See analysis details on SonarCloud Catch issues before they fail your Quality Gate with our IDE extension SonarLint |
No description provided.