Skip to content

Commit

Permalink
fix: Snapshot generators should only apply when executing in a BigQue…
Browse files Browse the repository at this point in the history
…ry database (#254)

* fix: Snapshot generators for bigquery should only apply when we execute in a BigQuery database.
  • Loading branch information
filipelautert authored Feb 27, 2024
1 parent d946498 commit 02640e2
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ public class BigQueryDatasetSnapshotGenerator extends SchemaSnapshotGenerator {

@Override
public int getPriority(Class<? extends DatabaseObject> objectType, Database database) {
if (!(database instanceof BigqueryDatabase)) {
return PRIORITY_NONE;
}
int priority = super.getPriority(objectType, database);
if (priority > PRIORITY_NONE && database instanceof BigqueryDatabase) {
priority += PRIORITY_DATABASE;
Expand Down Expand Up @@ -123,4 +126,4 @@ protected DatabaseObject snapshotObject(DatabaseObject example, DatabaseSnapshot
return match;
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ public class BigQuerySequenceSnapshotGenerator extends SequenceSnapshotGenerator

@Override
public int getPriority(Class<? extends DatabaseObject> objectType, Database database) {
if (!(database instanceof BigqueryDatabase)) {
return PRIORITY_NONE;
}
int priority = super.getPriority(objectType, database);
if (priority > PRIORITY_NONE && database instanceof BigqueryDatabase) {
priority += PRIORITY_DATABASE;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ public class BigQueryUniqueConstraintSnapshotGenerator extends UniqueConstraintS

@Override
public int getPriority(Class<? extends DatabaseObject> objectType, Database database) {
if (!(database instanceof BigqueryDatabase)) {
return PRIORITY_NONE;
}
int priority = super.getPriority(objectType, database);
if (priority > PRIORITY_NONE && database instanceof BigqueryDatabase) {
priority += PRIORITY_DATABASE;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,18 @@ public class BigQueryViewSnapshotGenerator extends ViewSnapshotGenerator {

@Override
public int getPriority(Class<? extends DatabaseObject> objectType, Database database) {
if (!(database instanceof BigqueryDatabase)) {
return PRIORITY_NONE;
}
int priority = super.getPriority(objectType, database);
if (priority > PRIORITY_NONE && database instanceof BigqueryDatabase) {
priority += PRIORITY_DATABASE;
}
return priority;
}



@Override
protected DatabaseObject snapshotObject(DatabaseObject example, DatabaseSnapshot snapshot) throws DatabaseException {
if (((View) example).getDefinition() != null) {
Expand Down

0 comments on commit 02640e2

Please sign in to comment.