fluent-migrator

Fluent Migration: How to specify profile when running Migrations in Process .net core

▼魔方 西西 提交于 2020-08-08 06:00:31
问题 On fluent migrator and according to the documentation this is an example on how run migrations in process on .net core: using System; using System.Linq; using FluentMigrator.Runner; using FluentMigrator.Runner.Initialization; using Microsoft.Extensions.DependencyInjection; namespace test { class Program { static void Main(string[] args) { var serviceProvider = CreateServices(); // Put the database update into a scope to ensure // that all resources will be disposed. using (var scope =

Explanation of Migrators (FluentMigrator)?

99封情书 提交于 2020-01-12 07:06:30
问题 Could someone explain the concept of Migrators (specifically fluentmigrator)? Here are the (possibly confused) facts Ive gleaned on the subject: Is it a way to initially create then maintain updates for a database by way of versioning. The first migration (or initial version of the database) would contain all the tables, relationships and properties required (done either fluently or using a chunk of sql in a script). When you want to push a change to a database, you would create a new

Explanation of Migrators (FluentMigrator)?

时间秒杀一切 提交于 2020-01-12 07:06:10
问题 Could someone explain the concept of Migrators (specifically fluentmigrator)? Here are the (possibly confused) facts Ive gleaned on the subject: Is it a way to initially create then maintain updates for a database by way of versioning. The first migration (or initial version of the database) would contain all the tables, relationships and properties required (done either fluently or using a chunk of sql in a script). When you want to push a change to a database, you would create a new

add new column to database table dynamically

☆樱花仙子☆ 提交于 2020-01-06 02:30:09
问题 As EF Migration do provide a way to create new columns as part of migration like below public class AddRatingMig : DbMigration { public override void Up() { AddColumn("dbo.Movies", "Rating", c => c.String()); } public override void Down() { DropColumn("dbo.Movies", "Rating"); } } But I want to create a column as part of code and not thru migration. We are providing admins an option to capture more information about the users of the application. The facility to do that will be thru some

Why to use fluentmigrator?

青春壹個敷衍的年華 提交于 2020-01-05 04:11:11
问题 When and why to use FluentMigrator as Entity Framework does the same job. If I have code- database then structures are already there and EF already provides classes to manipulate database. I am not clear why and when(in which cases) to use fluentmigrator? Thanks 回答1: Not everybody uses Entity Framework. I don't use it in my current project for example. In this scenario FluentMigrator is very useful for managing the database changes for each release. 回答2: EntityFramework kind of gives you both

FluentMigrator migration succeeds, but no changes to DB

北城以北 提交于 2019-12-23 07:29:19
问题 I must be missing something pretty basic. 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. 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

Using MSBuild with external xml parameter file

牧云@^-^@ 提交于 2019-12-23 03:21:34
问题 How do I have an MSBuild task use a parameter from an external xml parameter file? Example: Use the 'MyConnectionStringParameter' from an external xml file for my MSBuild task. MSBuild File: <?xml version="1.0"?> <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Migrate"> <UsingTask TaskName="FluentMigrator.MSBuild.Migrate" AssemblyFile="../bin/FluentMigrator.MSBuild.dll"/> <PropertyGroup> <TargetPath>../bin/Target.dll</TargetPath> </PropertyGroup> <Target

Update row data with a new value per row using fluentmigrator

别说谁变了你拦得住时间么 提交于 2019-12-22 05:37:07
问题 I am using fluentmigrator to add a new column to a table. I then want to update each row in the table with a unique value for that column. Currently when I use: Update.Table("Foo").InSchema("dbo").Set(new { Bar = Bar.Generate() }).AllRows(); It gives the same value for all the rows. How do I ensure it calls that method for each row? 回答1: I'm not sure what Bar.Generate does but I am guessing it creates a GUID or unique id. If so then you could use: Execute.Sql("update dbo.Foo set Bar = NEWID()

Is it possible to use fluent migrator in application_start?

我的未来我决定 提交于 2019-12-20 08:35:54
问题 I'm using fluent migrator to manage my database migrations, but what I'd like to do is have the migrations run at app start. The closest I have managed is this: public static void MigrateToLatest(string connectionString) { using (var announcer = new TextWriterAnnouncer(Console.Out) { ShowElapsedTime = true, ShowSql = true }) { var assembly = typeof(Runner).Assembly.GetName().Name; var migrationContext = new RunnerContext(announcer) { Connection = connectionString, Database = "SqlServer2008",