ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dmitry Mamonov <dmitry.s.mamo...@gmail.com>
Subject ..\migrate and strored procedures
Date Tue, 13 Apr 2010 06:14:55 GMT
Hi everyone!

I'm trying to apply ibatis-migrations to manage our database schema and I
found a semantic problem with it.
(we are using postgres if it does matter.)

My plan is to maintain ALL changes of database with "..\migrate", including
changes in stored procedures.

Here is my use-case:
1. ..\migrate new create new stored procedure demo_stored_procedure_1
2. fill-up migration script with stored procedure body (and undo with drop
procedure)
3. ..\migrate up

looks fine so far, but "..\migrate" preprocessing my SQL code to make it
single line,
so body of my stored procedure (which is multiline in my script) is passed
to database
as single-line statement. So I can't get my stored procedure code back from
database
because it is required to reformat it back to multiline code.
It's also hard to find errors in code, and set-up a breakpoint (if it is
possible).

I see next solutions for this problem:

1. special options could be added to "..\migrate"  environment to force this
tool to keep SQL code formatting as is.
i.e. do_not_concatenate_lines=true
and do_not_strip_comments=true

2. I can put all my stored procedures code in separate SQL file and apply
them through "psql".

I prefer 1-st plan, but 2-nd is also fine.

May be I'm using "..\migrate" tool in wrong way, please suggest any better
solution
or explain why 1-st or 2-nd approach is good from your point of view.

-- 
Dmtiry

Mime
View raw message