diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2016-12-16 15:32:45 +0100 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2016-12-16 15:32:45 +0100 |
commit | 41da68b50229976333d62f06033101d6ad8c2277 (patch) | |
tree | 999b0f17a4c5538403293bfc14528e5308853faf /dia2pg.rb | |
parent | a9b984021af0544e2bb2ef082ba0c119f38b4460 (diff) | |
download | bin-41da68b50229976333d62f06033101d6ad8c2277.zip bin-41da68b50229976333d62f06033101d6ad8c2277.tar.gz |
dia2pg: fix unique usage
Diffstat (limited to 'dia2pg.rb')
-rwxr-xr-x | dia2pg.rb | 17 |
1 files changed, 12 insertions, 5 deletions
@@ -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/ |