aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPTableRelations.m
diff options
context:
space:
mode:
authorstuconnolly <stuart02@gmail.com>2013-10-21 14:43:10 +0000
committerstuconnolly <stuart02@gmail.com>2013-10-21 14:43:10 +0000
commit546f436290721d208381769bef646a8ab9d42212 (patch)
tree6c49bf30c7c0328c6f8ff8a42ef6d06f132a4e52 /Source/SPTableRelations.m
parent43271f8e86b54c7d953c0e1c4059a2530693eb39 (diff)
downloadsequelpro-546f436290721d208381769bef646a8ab9d42212.tar.gz
sequelpro-546f436290721d208381769bef646a8ab9d42212.tar.bz2
sequelpro-546f436290721d208381769bef646a8ab9d42212.zip
Issue #1369: Fix the display of cross database relations.
Diffstat (limited to 'Source/SPTableRelations.m')
-rw-r--r--Source/SPTableRelations.m17
1 files changed, 10 insertions, 7 deletions
diff --git a/Source/SPTableRelations.m b/Source/SPTableRelations.m
index 26ab8195..a28462b7 100644
--- a/Source/SPTableRelations.m
+++ b/Source/SPTableRelations.m
@@ -42,12 +42,13 @@
static NSString *SPRemoveRelation = @"SPRemoveRelation";
-static NSString *SPRelationNameKey = @"name";
-static NSString *SPRelationColumnsKey = @"columns";
-static NSString *SPRelationFKTableKey = @"fk_table";
-static NSString *SPRelationFKColumnsKey = @"fk_columns";
-static NSString *SPRelationOnUpdateKey = @"on_update";
-static NSString *SPRelationOnDeleteKey = @"on_delete";
+static NSString *SPRelationNameKey = @"name";
+static NSString *SPRelationColumnsKey = @"columns";
+static NSString *SPRelationFKDatabaseKey = @"fk_database";
+static NSString *SPRelationFKTableKey = @"fk_table";
+static NSString *SPRelationFKColumnsKey = @"fk_columns";
+static NSString *SPRelationOnUpdateKey = @"on_update";
+static NSString *SPRelationOnDeleteKey = @"on_delete";
@interface SPTableRelations ()
@@ -586,15 +587,17 @@ static NSString *SPRelationOnDeleteKey = @"on_delete";
NSArray *constraints = [tableDataInstance getConstraints];
for (NSDictionary *constraint in constraints)
- {
+ {
[relationData addObject:[NSDictionary dictionaryWithObjectsAndKeys:
[constraint objectForKey:SPRelationNameKey], SPRelationNameKey,
[[constraint objectForKey:SPRelationColumnsKey] componentsJoinedByCommas], SPRelationColumnsKey,
+ [constraint objectForKey:@"ref_database"] ? [constraint objectForKey:@"ref_database"] : [tableDocumentInstance database], SPRelationFKDatabaseKey,
[constraint objectForKey:@"ref_table"], SPRelationFKTableKey,
[[constraint objectForKey:@"ref_columns"] componentsJoinedByCommas], SPRelationFKColumnsKey,
([constraint objectForKey:@"update"] ? [constraint objectForKey:@"update"] : @""), SPRelationOnUpdateKey,
([constraint objectForKey:@"delete"] ? [constraint objectForKey:@"delete"] : @""), SPRelationOnDeleteKey,
nil]];
+
[takenConstraintNames addObject:[[constraint objectForKey:SPRelationNameKey] lowercaseString]];
}
}