From: Brian O'Connor Date: Wed, 31 Dec 2003 11:17:58 +0000 (+0000) Subject: The Turnkey producer now uses the latest head on SQLFairy. There may still be some... X-Git-Tag: v0.06~247 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=63c988edd90d9a126b5452d41f3a19cc47bb9748;p=dbsrgits%2FSQL-Translator.git The Turnkey producer now uses the latest head on SQLFairy. There may still be some bugs but the autogeneration seems to work OK. --- diff --git a/lib/SQL/Translator/Producer/Turnkey.pm b/lib/SQL/Translator/Producer/Turnkey.pm index 07974a8..07d8f86 100644 --- a/lib/SQL/Translator/Producer/Turnkey.pm +++ b/lib/SQL/Translator/Producer/Turnkey.pm @@ -1,7 +1,7 @@ package SQL::Translator::Producer::Turnkey; # ------------------------------------------------------------------- -# $Id: Turnkey.pm,v 1.10 2003-12-28 12:14:59 boconnor Exp $ +# $Id: Turnkey.pm,v 1.11 2003-12-31 11:17:58 boconnor Exp $ # ------------------------------------------------------------------- # Copyright (C) 2003 Allen Day , # Brian O'Connor . @@ -23,7 +23,7 @@ package SQL::Translator::Producer::Turnkey; use strict; use vars qw[ $VERSION $DEBUG ]; -$VERSION = sprintf "%d.%02d", q$Revision: 1.10 $ =~ /(\d+)\.(\d+)/; +$VERSION = sprintf "%d.%02d", q$Revision: 1.11 $ =~ /(\d+)\.(\d+)/; $DEBUG = 1 unless defined $DEBUG; use SQL::Translator::Schema::Constants; @@ -354,14 +354,14 @@ elsif($type eq 'atom'){ [% ###### DOCUMENT START ###### %] [% FOREACH node = nodes %] -[% IF node.value.compoundedges %] +[% IF !node.value.is_trivial_link %] ############################################## package Turnkey::Atom::[% node.value.name FILTER replace "Turnkey::Model::", "" %]; [% pname = node.value.name FILTER replace "Turnkey::Model::", "" %] -[% pkey = "Turnkey::Model::${pname}" %] + use base qw(Turnkey::Atom); use Data::Dumper; @@ -429,8 +429,8 @@ EOF } elsif($type eq 'xml'){ return < - - + + @@ -441,42 +441,63 @@ EOF -[% FOREACH node = linkable %] - +[% FOREACH node = nodes %] +[% IF !node.value.is_trivial_link %] + [%- END -%] +[% END %] -[% FOREACH focus_atom = linkable %] - [% FOREACH link_atom = focus_atom.value %] - +[% FOREACH focus_atom = nodes %] +[% IF !focus_atom.value.is_trivial_link %] + [% FOREACH link_atom = focus_atom.value.hyperedges %] + [%- END -%] + [% previous = "" %] + [% FOREACH link_atom = focus_atom.value.edges %] + [% IF link_atom.type == 'export' && previous != link_atom.thatnode.table.name && link_atom.thatnode.table.name != "" %] + + [% previous = link_atom.thatnode.table.name %] + [% END %] + [%- END %] [%- END -%] +[% END %] -[% FOREACH focus_atom = linkable %] - - [% FOREACH link_atom = focus_atom.value %] - - [%- END -%] - +[% FOREACH focus_atom = nodes %] +[% IF !focus_atom.value.is_trivial_link %] + + [% FOREACH link_atom = focus_atom.value.hyperedges %] + + [%- END%] + [% previous = "" %] + [% FOREACH link_atom = focus_atom.value.edges %] + [% IF link_atom.type == 'export' && previous != link_atom.thatnode.table.name %] + + [% previous = link_atom.thatnode.table.name %] + [% END %] + [%- END %] + - [%- END -%] + [%- END %] +[% END %] - + -[% FOREACH focus_atom = linkable %] - +[% FOREACH focus_atom = nodes %] +[% IF !focus_atom.value.is_trivial_link %] + [%- END -%] - +[% END %] - + EOF } elsif($type eq 'template'){ @@ -524,20 +545,24 @@ EOF [% CASE DEFAULT %] [% renderlist(atom.render(dbobject)) %] [% END %] -[- FOREACH node = linkable -] +[- FOREACH node = nodes -] +[- IF !node.value.is_trivial_link -] [% MACRO render[- node.key FILTER ucfirst -]Atom(lstArr) BLOCK %] [% FOREACH record = lstArr %] [% fields = record.data %] [- pname = node.key FILTER ucfirst -] - [- pkey = "Durian::Model::${pname}" -] - [- FOREACH field = nodes.$pkey.columns_essential -] + [- pkey = "Turnkey::Model::${pname}" -] + [- FOREACH field = node.value.data_fields -] + [- IF field != "1" -] [- field -][% fields.[- field -] %] [- END -] + [- END -] [% id = record.id %] Link [% END %] [% END %] [- END -] +[- END -] [% MACRO renderlist(lstArr) BLOCK %] [% FOREACH item = lstArr %] [% item %]