summaryrefslogtreecommitdiffstats
path: root/dia2pg.rb
diff options
context:
space:
mode:
Diffstat (limited to 'dia2pg.rb')
-rwxr-xr-xdia2pg.rb17
1 files changed, 12 insertions, 5 deletions
diff --git a/dia2pg.rb b/dia2pg.rb
index 2179305..e741272 100755
--- a/dia2pg.rb
+++ b/dia2pg.rb
@@ -140,11 +140,12 @@ class Table
idx[xi] << attr.real_name
end
pk << attr.real_name if attr.primary_key
- if attr.unique and not attr.primary_key
- if attr.comment=~/U./
- uq[attr.comment] ||= []
- uq[attr.comment]<< attr.real_name
- else
+ if attr.unique
+ ug = attr.unique_group
+ if not ug.nil?
+ uq[ug] ||= []
+ uq[ug]<< attr.real_name
+ elsif not attr.primary_key
uq[:all] << attr.real_name
end
end
@@ -187,6 +188,12 @@ class Attribute
$1
end
#
+ def unique_group
+ return nil if @comment.nil?
+ return nil if not @comment=~/unique=(\w+)/
+ $1
+ end
+ #
def no_rename?
return false if @comment.nil?
@comment=~/no_rename/