On Tue, 31 Oct 2000, Mike Haberman wrote:

> 
> For now let's worry about the case where each table has one serial column:
> 
> drop sequence User_id_seq;
> drop table User;
> CREATE TABLE User
> (
>     id serial,
>     ...
>     primary key(id)
> );
> 
> now the drop template for this table would be:
> drop sequence $table_$serial_seq;
> drop table $table;
> 
> (I had to add a token separator for Utils.stringSubstitution to work,
> e.g. drop sequence $table#_$serial#_seq;)
> 
> 
> however, if id was not serial, then the drop template
> would only be:
> drop table $table;
> 
> So that's why I proposed the drop_seq template.  It only works for
> table that have one serial/autoincrement column.
> 
> Perhaps the solution might be to use webmacro/velocity templates for
> the sql generation for each database.  Then you could put all the columns
> in the context and the template could test it:

That's where we are going, the OM uses WM, and it will soon
all use Velocity.
 
> #foreach $col in columns {
>   #if $col.isAutoIncrement() {
>      drop sequence $table;_$col.Name();_seq;;
>   }
> }
> drop $table;
> #include table-sql.wm

Right. We'll get there.

I'll take a look tonight and see what the easiest way to
get the postgres stuff working.

jvz.



------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Search: <http://www.mail-archive.com/turbine%40list.working-dogs.com/>
Problems?:           [EMAIL PROTECTED]

Reply via email to