Closed GoogleCodeExporter closed 9 years ago
I tried changing the status to an enhancement request, but was unsuccessful :(
Original comment by carel.l...@gmail.com
on 17 Jun 2008 at 9:09
I think this can be nice...anyway, if you need this now and cannot wait you can
look
at the console example and use the migrateup from there...i'm doing this when
needing to upgrade as part of the execution and it works great...
You can also obviously record the migrations using the query trace tool of the
RDBMS
also and use this SQL for what you're looking for.
Until something like this is developed you have some workarounds.
Original comment by gustavo.ringel@gmail.com
on 17 Jun 2008 at 9:54
Hi
In case you interested, I took the opportunity this evening to add the feature
in a
more transparent way. I attach a patch file containing the feature in case you
are
interested in harvesting the approach.
I extended the ILogger interface and added a ApplyingDBChanges(string sql)
method
that the TransformationProvider invokes when executing the SQL statements that
change
the structure/content of the database (i.e.
TransformationProvider.ExecuteNonQuery).
I then used the Decorator pattern to add a SqlScriptFileLogger that decorates the
TaskLogger for both NAnt and MSBuild. The decorater intercepts and basically
decorates the normal ApplyingDBChanges call by writing it to a file.
I completed the feature by adding two additional properties to the NAnt/MSBuild
task
called ScriptChanges and ScriptFile. You can set ScriptChanges to indicate
that the
sql statements should be scripted to the ScriptFile.
Regards
Carel
Btw, I only have VS 2008 installed on my PC and I had to upgrade the solution.
I
therefore do not submit my .csproj file changes to make it easier to apply the
patch
if you should wish to do so. You will then however have to manually include the
SqlScriptFileLogger.cs file that I added to the Migration.MSBuild and
Migrator.NAnt
projects.
Original comment by carel.l...@gmail.com
on 18 Jun 2008 at 8:06
Attachments:
Carel,
I'll take a look at the patch. Thanks.
Original comment by geoffl...@gmail.com
on 19 Jun 2008 at 2:20
Carel,
There's something funny with that patch. It's trying to patch
SqlScriptFileLogger.cs
- but that file doesn't exist. The patch needs to create that file. Can you try
and
recreate it?
Also it looks like there are 2 SqlScriptFileLoggers. One for NAnt and one for
MSBuild. Is it possible for that to be a shared class that just used the ILogger
interface?
Original comment by geoffl...@gmail.com
on 19 Jun 2008 at 3:12
Find attached another attempt at creating a patch. This time I include
everything so
beware that the .csproj have been upgraded to support VS 2008.
You are correct, there are 2 SqlScriptFileLoggers. The one decorates the
MSBuild
TaskLogger and the other one decorates the NAnt TaskLogger. It should be
possible to
make this a shared class, by letting it decorate an ILogger instance instead of
the
individual NAnt/MSBuild task loggers.
Original comment by carel.l...@gmail.com
on 19 Jun 2008 at 6:23
Attachments:
Hi
I changed the implementation and created a single SqlScriptFileLogger that is
now
located in the Migrator.Framework.Loggers namespace. It now decorates a ILogger
instance so it can be used in conjunction with any existing ILogger
implementation.
I also changed the NAnt/MSBuild TaskLogger and the
Migrator.Framework.Loggers.Logger
implementation to issue a Trace statement for the ILogger.ApplyingDBChange
method
call. In this way the user will only see the output if he/she has selected to
view
detailed output via setting the Trace flag or by requesting detailed output via
NAnt/MSbuild cmd line settings.
Find attached a patch for the changes. Again, remember that the changes were
made
with VS 2008 so be aware of changes to the .csproj and .sln files.
Original comment by carel.l...@gmail.com
on 20 Jun 2008 at 6:12
Attachments:
I could *really* use this. Has it been included in the source yet? Are there
any
gotchas you're aware of?
Original comment by subdigi...@gmail.com
on 5 Aug 2008 at 12:46
SVN 110
Applied patch (with some minor changes)
Original comment by geoffl...@gmail.com
on 5 Aug 2008 at 2:29
Original issue reported on code.google.com by
carel.l...@gmail.com
on 17 Jun 2008 at 8:46