سؤال

I'm using fluentmigrator and I'm stuck with a problem I need to create DB script using fluentmigrator each time I run the build script and its done but the problem is I just want to rewrite the script only if the db is altered . How can I achieve that my current code is given below

<Target Name="Migrate" >
    <MakeDir Directories="$(OutputFolder)\DBScripts"></MakeDir>
    <Migrate Database="sqlserver2008"
           Connection="Data Source=ALen-PC;Initial Catalog=TestMigrator;User ID=user;Password=password"
           Target="$(OutputFolder)\Release\bin\MigratorTest.dll"
           Output="True"
           OutputFilename="$(OutputFolder)\DBScripts\DBScript.sql">
    </Migrate>
  </Target>
هل كانت مفيدة؟

المحلول

At the moment, there is no support for this process in FluentMigrator. You could add a timestamp to the filename and then check the size of the file. If it is very small, less than 200 bytes then throw it away. If it is larger than 200 bytes then the schema has changed so rename the file to DBScript.sql and replace the previous version.

I would recommend submitting this as a feature request for FluentMigrator here.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top