|
@@ -427,6 +427,12 @@ class DataCatalogEntry {
|
|
|
primaryKeys[primaryKey.name] = true;
|
|
primaryKeys[primaryKey.name] = true;
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
|
|
+ const foreignKeys = {};
|
|
|
|
|
+ if (sourceMeta.foreign_keys) {
|
|
|
|
|
+ sourceMeta.foreign_keys.forEach(foreignKey => {
|
|
|
|
|
+ foreignKeys[foreignKey.name] = true;
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
const entities =
|
|
const entities =
|
|
|
sourceMeta.databases ||
|
|
sourceMeta.databases ||
|
|
@@ -466,6 +472,9 @@ class DataCatalogEntry {
|
|
|
if (sourceMeta.primary_keys) {
|
|
if (sourceMeta.primary_keys) {
|
|
|
definition.primaryKey = !!primaryKeys[entity.name];
|
|
definition.primaryKey = !!primaryKeys[entity.name];
|
|
|
}
|
|
}
|
|
|
|
|
+ if (sourceMeta.foreign_keys) {
|
|
|
|
|
+ definition.foreignKey = !!foreignKeys[entity.name];
|
|
|
|
|
+ }
|
|
|
definition.index = index++;
|
|
definition.index = index++;
|
|
|
catalogEntry.definition = definition;
|
|
catalogEntry.definition = definition;
|
|
|
catalogEntry.saveLater();
|
|
catalogEntry.saveLater();
|
|
@@ -1260,6 +1269,17 @@ class DataCatalogEntry {
|
|
|
return self.definition && !!self.definition.partitionKey;
|
|
return self.definition && !!self.definition.partitionKey;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * Returns true if the entry is a foreign key. Note that the definition has to come from a parent entry, i.e.
|
|
|
|
|
+ * getChildren().
|
|
|
|
|
+ *
|
|
|
|
|
+ * @return {boolean}
|
|
|
|
|
+ */
|
|
|
|
|
+ isForeignKey() {
|
|
|
|
|
+ const self = this;
|
|
|
|
|
+ return self.definition && !!self.definition.foreignKey;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* Returns true if the entry is either a partition or primary key. Note that the definition has to come from a parent entry, i.e.
|
|
* Returns true if the entry is either a partition or primary key. Note that the definition has to come from a parent entry, i.e.
|
|
|
* getChildren().
|
|
* getChildren().
|
|
@@ -1267,7 +1287,7 @@ class DataCatalogEntry {
|
|
|
* @return {boolean}
|
|
* @return {boolean}
|
|
|
*/
|
|
*/
|
|
|
isKey() {
|
|
isKey() {
|
|
|
- return this.isPartitionKey() || this.isPrimaryKey();
|
|
|
|
|
|
|
+ return this.isPartitionKey() || this.isPrimaryKey() || this.isForeignKey();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|