_id is free
This commit is contained in:
@@ -200,6 +200,17 @@ message TableDefinitionResponse {
|
||||
|
||||
// Describes the tree of all profiles and their tables.
|
||||
message ProfileTreeResponse {
|
||||
// One link: the table it points at, and the column carrying it.
|
||||
message Dependency {
|
||||
// Table being referenced.
|
||||
string table_name = 1;
|
||||
|
||||
// Column holding the reference, named by whoever declared the link. This
|
||||
// is what identifies the link, since a table may point at one target
|
||||
// several times.
|
||||
string column_name = 2;
|
||||
}
|
||||
|
||||
// Table entry in a profile.
|
||||
message Table {
|
||||
// Internal ID from table_definitions.id (metadata record).
|
||||
@@ -208,8 +219,9 @@ message ProfileTreeResponse {
|
||||
// Table name within the profile (schema).
|
||||
string name = 2;
|
||||
|
||||
// Other tables this one references (based on link definitions only).
|
||||
repeated string depends_on = 3;
|
||||
// Links this table declares. One entry per link, so a table that names the
|
||||
// same target twice appears twice.
|
||||
repeated Dependency depends_on = 3;
|
||||
|
||||
// Columns whose values make up the human-readable row label, in order.
|
||||
repeated string row_display_columns = 4;
|
||||
|
||||
Binary file not shown.
@@ -173,8 +173,20 @@ pub struct ProfileTreeResponse {
|
||||
}
|
||||
/// Nested message and enum types in `ProfileTreeResponse`.
|
||||
pub mod profile_tree_response {
|
||||
/// Table entry in a profile.
|
||||
/// One link: the table it points at, and the column carrying it.
|
||||
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
|
||||
pub struct Dependency {
|
||||
/// Table being referenced.
|
||||
#[prost(string, tag = "1")]
|
||||
pub table_name: ::prost::alloc::string::String,
|
||||
/// Column holding the reference, named by whoever declared the link. This
|
||||
/// is what identifies the link, since a table may point at one target
|
||||
/// several times.
|
||||
#[prost(string, tag = "2")]
|
||||
pub column_name: ::prost::alloc::string::String,
|
||||
}
|
||||
/// Table entry in a profile.
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct Table {
|
||||
/// Internal ID from table_definitions.id (metadata record).
|
||||
#[prost(int64, tag = "1")]
|
||||
@@ -182,9 +194,10 @@ pub mod profile_tree_response {
|
||||
/// Table name within the profile (schema).
|
||||
#[prost(string, tag = "2")]
|
||||
pub name: ::prost::alloc::string::String,
|
||||
/// Other tables this one references (based on link definitions only).
|
||||
#[prost(string, repeated, tag = "3")]
|
||||
pub depends_on: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
|
||||
/// Links this table declares. One entry per link, so a table that names the
|
||||
/// same target twice appears twice.
|
||||
#[prost(message, repeated, tag = "3")]
|
||||
pub depends_on: ::prost::alloc::vec::Vec<Dependency>,
|
||||
/// Columns whose values make up the human-readable row label, in order.
|
||||
#[prost(string, repeated, tag = "4")]
|
||||
pub row_display_columns: ::prost::alloc::vec::Vec<
|
||||
|
||||
@@ -13,6 +13,10 @@ pub struct RelationshipHop {
|
||||
pub struct RelationshipLink {
|
||||
pub source_table: String,
|
||||
pub target_table: String,
|
||||
/// The column carrying the link, which is the name it was given. A table
|
||||
/// may link to one target several times, so the target's name does not
|
||||
/// identify the column.
|
||||
pub fk_column: String,
|
||||
}
|
||||
|
||||
pub fn resolve_relationship_path(
|
||||
@@ -53,7 +57,7 @@ pub fn resolve_relationship_path(
|
||||
from_table: table.clone(),
|
||||
to_table: next.to_string(),
|
||||
fk_source_table: link.source_table.clone(),
|
||||
fk_column: format!("{}_id", link.target_table),
|
||||
fk_column: link.fk_column.clone(),
|
||||
});
|
||||
if next == end {
|
||||
match_depth = Some(next_path.len());
|
||||
|
||||
Reference in New Issue
Block a user