Note that there are some explanatory texts on larger screens.

plurals
  1. POFluentMigrator migration succeeds, but no changes to DB
    primarykey
    data
    text
    <p>I must be missing something pretty basic.</p> <p>I'm working on a legacy project, and I'm trying to bring FluentMigrator into the mix cause I've got some interesting database changes and data migrations coming up that I think will be made much easier by using this tool.</p> <p>For the initial migration, I just want to bring the database up to the current production version, as-is. To simplify the initial migration, I scripted out my SQL Server 2008 database, and the migration executes the scripted commands as a series of SQL commands.</p> <p>To test it out, I create an entirely empty database, and try to run it from command line using this:</p> <pre><code>&gt; migrate -a "C:\My\Project\Path\bin\debug\Rds.MyProjName.DBMigrations.dll" -db SqlServer2008 -conn "Data Source=.\SQLEXPRESS2008;Initial Catalog=myNewDbName; Integrated Security=SSPI" -version=20100901000000 </code></pre> <p>The version specified is the timestamp on the first migration class's Migration attribute.</p> <p>At the command line, everything appears to run fine - the the entire script zooms by, and it ends with:</p> <pre><code>-- CreateProductionDbCircaSep2010: migrated </code></pre> <p>However, when I take a look at the database, it is still empty. Absolutely nothing is in there. My Up method looks like this:</p> <pre><code>public override void Up() { var cmds = LoadEmbeddedResources .GetEmbeddedResource("scripted_db_2010-09-01.sql") .AsString() .ParseCommands(); foreach (var c in cmds) { Execute.Sql(c); } CreateReferenceData(); } </code></pre> <p>(FYI, I'm parsing the script instead of running it as-is because I started by using Migrator.Net before discovering it was dead, and this was already set up.)</p> <p>Can anyone give me a hand? It almost appears like a transaction isn't committing, or some command-line option to have the migration do a dry- run is turned on, but I don't see it...</p> <p><strong>EDIT:Additional things I've tried</strong></p> <p>To confirm that the connection string was using the database I expect it to, I renamed the database and afterwards got a login error, as expected.</p> <p>For further tests, I cut down the length of the script, and tried executing it using </p> <pre><code>public override void Up() { Execute.Script(@"..\Resources\test.sql"); } </code></pre> <p>instead of command-by-command, but I get the same results. Here is the output on that test (note, I edited the pathes and such):</p> <pre><code>C:\My\Project\Path\FluentMigrator.Net\ &gt;migrate -a "C:\My\Project\Path\bin\debug \My.Project.DBMigrations.dll" -db SqlServer2008 -conn "Data Source=.\SQLEXPRESS2 008;Initial Catalog=myNewDbName;Integrated Security=SSPI" -version=2010090100000 0 Using Database SqlServer2008 and Connection String Data Source=.\SQLEXPRESS2008; Initial Catalog=myNewDbName;Integrated Security=SSPI -- VersionMigration: migrating =============================================== -- CreateTable VersionInfo -- VersionMigration: migrated -- CreateProductionDbCircaSep2010: migrating ================================= -- ExecuteSqlScript C:\My\Project\Path\FluentMigrator.Net\..\Resources\test.sql -- CreateProductionDbCircaSep2010: migrated </code></pre> <p>Yet no tables in the database - there isn't even the expected VersionInfo table.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload