summaryrefslogtreecommitdiffstats
path: root/dia2pg.rb
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2014-06-17 16:19:38 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2014-06-17 16:19:38 +0200
commitc6e74ef695f8b1c567275f175e31be39a456e536 (patch)
tree7fa35556db8a6e4b0f8d8e66f0a12b8263155828 /dia2pg.rb
parent7d03636e06c8c10f7bd313a28bb09836299d9d1c (diff)
downloadbin-c6e74ef695f8b1c567275f175e31be39a456e536.zip
bin-c6e74ef695f8b1c567275f175e31be39a456e536.tar.gz
dia2pg : support field comment tag default=_expr_
Diffstat (limited to 'dia2pg.rb')
-rwxr-xr-xdia2pg.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/dia2pg.rb b/dia2pg.rb
index e52ad0c..a26fc6d 100755
--- a/dia2pg.rb
+++ b/dia2pg.rb
@@ -189,6 +189,13 @@ class Attribute
@comment=~/no_export=1/
end
#
+ def default
+ return '' if @comment.nil?
+ @comment=~/default=(.*)$/
+ return '' if $1.nil?
+ return " DEFAULT "+$1.to_s
+ end
+ #
def real_name
if not no_rename? and foreign?
rl = RELATIONS.find { |r| r.tbl_to==@tbl and r.attr_to.name==@name }
@@ -227,6 +234,7 @@ class Attribute
else
r << "#{type} NOT NULL"
end
+ r << default
r << ",\n"
end
#