Migration where local Migration class(es) not present in current project caused unexpected behavior

I am working on a project with another developer who created some migrations in his local copy and ran the migration from the command line using --AppTasks=migrate. Please note we are both using the same database (a bad practice which we will be changing very soon). I then ran the same command in my code base and it started the migration process FROM THE FIRST MIGRATION. This is unexpected behavior to say the least. I did this test because I execute the migrate command in our deployment process and was testing what would happen.

Migrations store their progress in the database, is it possible your code base was using a different database rather than a shared one? There will be a history of migrations and their output in the Migration table itself. If the Migration table is missing or there is no history of the migrations running, then yes, it will run from the first migration, this is to make it easier/more consistent when working locally etc. More info here on app tasks

Check the database itself and the history should give you more info.

Listed in the migration table was the new migration this user had just created, in this instance Migration1019. I did not have that class locally, so when I ran the migrate command, it only found all the migrations up and till Migration1018, and then starting from the beginning trying to migrate from the first migration, migration1000. When I went to look in the migration table in the same database, the previous migrations were listed, and then I saw new records for migration1000, etc. I ran the command multiple times and saw new records being recreated each time.

@bgiromini Are you able to share a minimal reproduction of the issue? If we can reproduce the problem, it will help us find the root cause and apply a fix if needed.

I’ll try to reproduce the problem with what you have shared.

Steps to reproduce:

  1. Downloaded Blazor Server sample project from https://blazor-gallery.servicestack.net/
  2. Run the post install migration npm task
  3. Create Migration1001.cs
namespace MigrationDemo.Migrations;

public class Migration1001 : MigrationBase
{
    class BookingStatus : AuditBase
    {
        [AutoIncrement]
        public int Id { get; set; }

        public string Name { get; set; }
    }

    

    public override void Up()
    {
        Db.CreateTable<BookingStatus>();
    }

    public override void Down()
    {
        Db.DropTable<BookingStatus>();
    }
}
  1. Run the migrate npm command
  2. Exclude the new Migration1001 class from the project ( I did this using Rider, right click on the file and select Exclude)
  3. Run the migrate npm command again

Here is the pertinent console output:

Running AppTask 'migrate'...
Migrations Found:
 - Migration1000

dbug: ServiceStack.OrmLite.OrmLiteReadCommandExtensions[0]
      SQL: SELECT "Id", "Name", "Description", "CreatedDate", "CompletedDate", "ConnectionString", "NamedConnection", "Log", "ErrorCode", "ErrorMessage", "ErrorStackTrace", "Meta" 
      FROM "Migration"
      ORDER BY "Name" DESC
      LIMIT 1
Running Migration1000...
dbug: ServiceStack.OrmLite.OrmLiteResultsFilterExtensions[0]
      SQL: INSERT INTO "Migration" ("Name","Description","CreatedDate","CompletedDate","ConnectionString","NamedConnection","Log","ErrorCode","ErrorMessage","ErrorStackTrace","Meta") VALUES (@Name,@Description,@CreatedDate,@CompletedDate,@ConnectionString,@NamedConnection,@Log,@ErrorCode,@ErrorMessage,@ErrorStackTrace,@Meta); SELECT last_insert_rowid()
      PARAMS: @Name=Migration1000, @Description=, @CreatedDate=8/21/2023 3:17:28 PM, @CompletedDate=, @ConnectionString=App_Data/db.sqlite, @NamedConnection=, @Log=, @ErrorCode=, @ErrorMessage=, @ErrorStackTrace=, @Meta=
dbug: ServiceStack.OrmLite.OrmLiteResultsFilterExtensions[0]
      SQL: INSERT INTO "Coupon" ("Id","Description","Discount","ExpiryDate") VALUES (@Id,@Description,@Discount,@ExpiryDate)
      PARAMS: @Id=BOOK5, @Description=5% off, @Discount=10, @ExpiryDate=9/20/2023 3:17:28 PM
SQL: INSERT INTO "Coupon" ("Id","Description","Discount","ExpiryDate") VALUES (@Id,@Description,@Discount,@ExpiryDate)
PARAMS: @Id=BOOK5, @Description=5% off, @Discount=10, @ExpiryDate=9/20/2023 3:17:28 PM

ERROR: SQLite Error 19: 'UNIQUE constraint failed: Coupon.Id'., Exception: SQLite Error 19: 'UNIQUE constraint failed: Coupon.Id'.
Microsoft.Data.Sqlite.SqliteException (0x80004005): SQLite Error 19: 'UNIQUE constraint failed: Coupon.Id'.
   at Microsoft.Data.Sqlite.SqliteException.ThrowExceptionForRC(Int32 rc, sqlite3 db)
   at Microsoft.Data.Sqlite.SqliteDataReader.NextResult()
   at Microsoft.Data.Sqlite.SqliteCommand.ExecuteReader(CommandBehavior behavior)
   at Microsoft.Data.Sqlite.SqliteCommand.ExecuteReader()
   at Microsoft.Data.Sqlite.SqliteCommand.ExecuteNonQuery()
   at ServiceStack.OrmLite.OrmLiteCommand.ExecuteNonQuery() in /home/runner/work/ServiceStack/ServiceStack/ServiceStack.OrmLite/src/ServiceStack.OrmLite/OrmLiteCommand.cs:line 46
   at ServiceStack.OrmLite.OrmLiteResultsFilterExtensions.ExecNonQuery(IDbCommand dbCmd) in /home/runner/work/ServiceStack/ServiceStack/ServiceStack.OrmLite/src/ServiceStack.OrmLite/OrmLiteResultsFilterExtensions.cs:line 64
   at ServiceStack.OrmLite.OrmLiteWriteCommandExtensions.InsertInternal[T](IOrmLiteDialectProvider dialectProvider, IDbCommand dbCmd, Object obj, Action`1 commandFilter, Boolean selectIdentity) in /home/runner/work/ServiceStack/ServiceStack/ServiceStack.OrmLite/src/ServiceStack.OrmLite/OrmLiteWriteCommandExtensions.cs:line 833
   at ServiceStack.OrmLite.OrmLiteWriteCommandExtensions.Insert[T](IDbCommand dbCmd, T obj, Action`1 commandFilter, Boolean selectIdentity, Boolean enableIdentityInsert)
   at ServiceStack.OrmLite.OrmLiteWriteApi.<>c__DisplayClass5_0`1.<Insert>b__0(IDbCommand dbCmd) in /home/runner/work/ServiceStack/ServiceStack/ServiceStack.OrmLite/src/ServiceStack.OrmLite/OrmLiteWriteApi.cs:line 72
   at ServiceStack.OrmLite.OrmLiteExecFilter.Exec[T](IDbConnection dbConn, Func`2 filter) in /home/runner/work/ServiceStack/ServiceStack/ServiceStack.OrmLite/src/ServiceStack.OrmLite/OrmLiteExecFilter.cs:line 66
   at ServiceStack.OrmLite.OrmLiteReadExpressionsApi.Exec[T](IDbConnection dbConn, Func`2 filter) in /home/runner/work/ServiceStack/ServiceStack/ServiceStack.OrmLite/src/ServiceStack.OrmLite/OrmLiteReadExpressionsApi.cs:line 18
   at ServiceStack.OrmLite.OrmLiteWriteApi.Insert[T](IDbConnection dbConn, T obj, Boolean selectIdentity, Boolean enableIdentityInsert) in /home/runner/work/ServiceStack/ServiceStack/ServiceStack.OrmLite/src/ServiceStack.OrmLite/OrmLiteWriteApi.cs:line 72
   at MigrationDemo.Migrations.Migration1000.<Up>b__3_0(Int32 percent) in /Users/bgiromini/RiderProjects/MigrationDemo/MigrationDemo/Migrations/Migration1000.cs:line 47
   at MigrationDemo.Migrations.Migration1000.Up() in /Users/bgiromini/RiderProjects/MigrationDemo/MigrationDemo/Migrations/Migration1000.cs:line 46
   at ServiceStack.OrmLite.Migrator.<>c.<Run>b__20_2(MigrationBase x) in /home/runner/work/ServiceStack/ServiceStack/ServiceStack.OrmLite/src/ServiceStack.OrmLite/Migrator.cs:line 194
   at ServiceStack.OrmLite.Migrator.Run(IDbConnectionFactory dbFactory, Type nextRun, Action`1 migrateAction, String namedConnection) in /home/runner/work/ServiceStack/ServiceStack/ServiceStack.OrmLite/src/ServiceStack.OrmLite/Migrator.cs:line 459
dbug: ServiceStack.OrmLite.OrmLiteResultsFilterExtensions[0]
      SQL: UPDATE "Migration" SET "Log"=@Log, "ErrorCode"=@ErrorCode, "ErrorMessage"=@ErrorMessage, "ErrorStackTrace"=@ErrorStackTrace WHERE ("Id" = @0)
      PARAMS: @0=3, @Log=SQL: INSERT INTO "Coupon" ("Id","Description","Discount","ExpiryDate") VALUES (@Id,@Description,@Discount,@ExpiryDate)
      PARAMS: @Id=BOOK5, @Description=5% off, @Discount=10, @ExpiryDate=9/20/2023 3:17:28 PM
      , @ErrorCode=SqliteException, @ErrorMessage=SQLite Error 19: 'UNIQUE constraint failed: Coupon.Id'., @ErrorStackTrace=   at Microsoft.Data.Sqlite.SqliteException.ThrowExceptionForRC(Int32 rc, sqlite3 db)
         at Microsoft.Data.Sqlite.SqliteDataReader.NextResult()
         at Microsoft.Data.Sqlite.SqliteCommand.ExecuteReader(CommandBehavior behavior)
         at Microsoft.Data.Sqlite.SqliteCommand.ExecuteReader()
         at Microsoft.Data.Sqlite.SqliteCommand.ExecuteNonQuery()
         at ServiceStack.OrmLite.OrmLiteCommand.ExecuteNonQuery() in /home/runner/work/ServiceStack/ServiceStack/ServiceStack.OrmLite/src/ServiceStack.OrmLite/OrmLiteCommand.cs:line 46
         at ServiceStack.OrmLite.OrmLiteResultsFilterExtensions.ExecNonQuery(IDbCommand dbCmd) in /home/runner/work/ServiceStack/ServiceStack/ServiceStack.OrmLite/src/ServiceStack.OrmLite/OrmLiteResultsFilterExtensions.cs:line 64
         at ServiceStack.OrmLite.OrmLiteWriteCommandExtensions.InsertInternal[T](IOrmLiteDialectProvider dialectProvider, IDbCommand dbCmd, Object obj, Action`1 commandFilter, Boolean selectIdentity) in /home/runner/work/ServiceStack/ServiceStack/ServiceStack.OrmLite/src/ServiceStack.OrmLite/OrmLiteWriteCommandExtensions.cs:line 833
         at ServiceStack.OrmLite.OrmLiteWriteCommandExtensions.Insert[T](IDbCommand dbCmd, T obj, Action`1 commandFilter, Boolean selectIdentity, Boolean enableIdentityInsert)
         at ServiceStack.OrmLite.OrmLiteWriteApi.<>c__DisplayClass5_0`1.<Insert>b__0(IDbCommand dbCmd) in /home/runner/work/ServiceStack/ServiceStack/ServiceStack.OrmLite/src/ServiceStack.OrmLite/OrmLiteWriteApi.cs:line 72
         at ServiceStack.OrmLite.OrmLiteExecFilter.Exec[T](IDbConnection dbConn, Func`2 filter) in /home/runner/work/ServiceStack/ServiceStack/ServiceStack.OrmLite/src/ServiceStack.OrmLite/OrmLiteExecFilter.cs:line 66
         at ServiceStack.OrmLite.OrmLiteReadExpressionsApi.Exec[T](IDbConnection dbConn, Func`2 filter) in /home/runner/work/ServiceStack/ServiceStack/ServiceStack.OrmLite/src/ServiceStack.OrmLite/OrmLiteReadExpressionsApi.cs:line 18
         at ServiceStack.OrmLite.OrmLiteWriteApi.Insert[T](IDbConnection dbConn, T obj, Boolean selectIdentity, Boolean enableIdentityInsert) in /home/runner/work/ServiceStack/ServiceStack/ServiceStack.OrmLite/src/ServiceStack.OrmLite/OrmLiteWriteApi.cs:line 72
         at MigrationDemo.Migrations.Migration1000.<Up>b__3_0(Int32 percent) in /Users/bgiromini/RiderProjects/MigrationDemo/MigrationDemo/Migrations/Migration1000.cs:line 47
         at MigrationDemo.Migrations.Migration1000.Up() in /Users/bgiromini/RiderProjects/MigrationDemo/MigrationDemo/Migrations/Migration1000.cs:line 46
         at ServiceStack.OrmLite.Migrator.<>c.<Run>b__20_2(MigrationBase x) in /home/runner/work/ServiceStack/ServiceStack/ServiceStack.OrmLite/src/ServiceStack.OrmLite/Migrator.cs:line 194
         at ServiceStack.OrmLite.Migrator.Run(IDbConnectionFactory dbFactory, Type nextRun, Action`1 migrateAction, String namedConnection) in /home/runner/work/ServiceStack/ServiceStack/ServiceStack.OrmLite/src/ServiceStack.OrmLite/Migrator.cs:line 459
ERROR: Failed to run AppTask 'migrate', Exception: SQLite Error 19: 'UNIQUE constraint failed: Coupon.Id'.
Microsoft.Data.Sqlite.SqliteException (0x80004005): SQLite Error 19: 'UNIQUE constraint failed: Coupon.Id'.
   at ServiceStack.OrmLite.Migrator.Run(Boolean throwIfError) in /home/runner/work/ServiceStack/ServiceStack/ServiceStack.OrmLite/src/ServiceStack.OrmLite/Migrator.cs:line 234
   at ServiceStack.OrmLite.Migrator.Run() in /home/runner/work/ServiceStack/ServiceStack/ServiceStack.OrmLite/src/ServiceStack.OrmLite/Migrator.cs:line 137
   at MigrationDemo.ConfigureDbMigrations.<>c__DisplayClass0_0.<Configure>b__1(String[] _) in /Users/bgiromini/RiderProjects/MigrationDemo/MigrationDemo/Configure.Db.Migrations.cs:line 15
   at ServiceStack.AppTasks.RanAsTask() in /home/runner/work/ServiceStack/ServiceStack/ServiceStack/src/ServiceStack.Common/AppTasks.cs:line 105

Process finished with exit code 1

Contents of the migrations table:

Id Name Description CreatedDate CompletedDate ConnectionString NamedConnection Log ErrorCode ErrorMessage ErrorStackTrace Meta
1 Migration1000 null 2023-08-21 15:13:48.77635 2023-08-21 15:13:48.812749 App_Data/db.sqlite null SQL: CREATE TABLE "Coupon"
(
"Id" VARCHAR(8000) PRIMARY KEY,
"Description" VARCHAR(8000) NULL,
"Discount" INTEGER NOT NULL,
"ExpiryDate" VARCHAR(8000) NOT NULL
);

SQL: CREATE TABLE "Booking"
(
"Id" INTEGER PRIMARY KEY AUTOINCREMENT,
"Name" VARCHAR(8000) NULL,
"RoomType" VARCHAR(255) NOT NULL,
"RoomNumber" INTEGER NOT NULL,
"BookingStartDate" VARCHAR(8000) NOT NULL,
"BookingEndDate" VARCHAR(8000) NULL,
"Cost" DECIMAL(18,12) NOT NULL,
"Notes" VARCHAR(8000) NULL,
"Cancelled" INTEGER NULL,
"CouponId" VARCHAR(8000) NULL,
"CreatedDate" VARCHAR(8000) NOT NULL,
"CreatedBy" VARCHAR(8000) NOT NULL,
"ModifiedDate" VARCHAR(8000) NOT NULL,
"ModifiedBy" VARCHAR(8000) NOT NULL,
"DeletedDate" VARCHAR(8000) NULL,
"DeletedBy" VARCHAR(8000) NULL,

CONSTRAINT "FK_Booking_Coupon_CouponId" FOREIGN KEY ("CouponId") REFERENCES "Coupon" ("Id")
);

SQL: CREATE INDEX idx_booking_deleteddate ON "Booking" ("DeletedDate");

SQL: INSERT INTO "Coupon" ("Id","Description","Discount","ExpiryDate") VALUES (@Id,@Description,@Discount,@ExpiryDate)
PARAMS: @Id=BOOK5, @Description=5% off, @Discount=10, @ExpiryDate=9/20/2023 3:13:48 PM
SQL: INSERT INTO "Coupon" ("Id","Description","Discount","ExpiryDate") VALUES (@Id,@Description,@Discount,@ExpiryDate)
PARAMS: @Id=BOOK10, @Description=10% off, @Discount=10, @ExpiryDate=9/20/2023 3:13:48 PM
SQL: INSERT INTO "Coupon" ("Id","Description","Discount","ExpiryDate") VALUES (@Id,@Description,@Discount,@ExpiryDate)
PARAMS: @Id=BOOK15, @Description=15% off, @Discount=10, @ExpiryDate=9/20/2023 3:13:48 PM
SQL: INSERT INTO "Coupon" ("Id","Description","Discount","ExpiryDate") VALUES (@Id,@Description,@Discount,@ExpiryDate)
PARAMS: @Id=BOOK20, @Description=20% off, @Discount=10, @ExpiryDate=9/20/2023 3:13:48 PM
SQL: INSERT INTO "Coupon" ("Id","Description","Discount","ExpiryDate") VALUES (@Id,@Description,@Discount,@ExpiryDate)
PARAMS: @Id=BOOK25, @Description=25% off, @Discount=10, @ExpiryDate=9/20/2023 3:13:48 PM
SQL: INSERT INTO "Coupon" ("Id","Description","Discount","ExpiryDate") VALUES (@Id,@Description,@Discount,@ExpiryDate)
PARAMS: @Id=BOOK30, @Description=30% off, @Discount=10, @ExpiryDate=9/20/2023 3:13:48 PM
SQL: INSERT INTO "Coupon" ("Id","Description","Discount","ExpiryDate") VALUES (@Id,@Description,@Discount,@ExpiryDate)
PARAMS: @Id=BOOK40, @Description=40% off, @Discount=10, @ExpiryDate=9/20/2023 3:13:48 PM
SQL: INSERT INTO "Coupon" ("Id","Description","Discount","ExpiryDate") VALUES (@Id,@Description,@Discount,@ExpiryDate)
PARAMS: @Id=BOOK50, @Description=50% off, @Discount=10, @ExpiryDate=9/20/2023 3:13:48 PM
SQL: INSERT INTO "Coupon" ("Id","Description","Discount","ExpiryDate") VALUES (@Id,@Description,@Discount,@ExpiryDate)
PARAMS: @Id=BOOK60, @Description=60% off, @Discount=10, @ExpiryDate=9/20/2023 3:13:48 PM
SQL: INSERT INTO "Coupon" ("Id","Description","Discount","ExpiryDate") VALUES (@Id,@Description,@Discount,@ExpiryDate)
PARAMS: @Id=BOOK70, @Description=70% off, @Discount=10, @ExpiryDate=9/20/2023 3:13:48 PM
SQL: INSERT INTO "Booking" ("Name","RoomType","RoomNumber","BookingStartDate","BookingEndDate","Cost","Notes","Cancelled","CouponId","CreatedDate","CreatedBy","ModifiedDate","ModifiedBy","DeletedDate","DeletedBy") VALUES (@Name,@RoomType,@RoomNumber,@BookingStartDate,@BookingEndDate,@Cost,@Notes,@Cancelled,@CouponId,@CreatedDate,@CreatedBy,@ModifiedDate,@ModifiedBy,@DeletedDate,@DeletedBy)
PARAMS: @Name=First Booking!, @RoomType=Queen, @RoomNumber=10, @BookingStartDate=8/31/2023 3:13:48 PM, @BookingEndDate=9/7/2023 3:13:48 PM, @Cost=100, @Notes=, @Cancelled=, @CouponId=BOOK10, @CreatedDate=8/21/2023 3:13:48 PM, @CreatedBy=employee@email.com, @ModifiedDate=8/21/2023 3:13:48 PM, @ModifiedBy=employee@email.com, @DeletedDate=, @DeletedBy=
SQL: INSERT INTO "Booking" ("Name","RoomType","RoomNumber","BookingStartDate","BookingEndDate","Cost","Notes","Cancelled","CouponId","CreatedDate","CreatedBy","ModifiedDate","ModifiedBy","DeletedDate","DeletedBy") VALUES (@Name,@RoomType,@RoomNumber,@BookingStartDate,@BookingEndDate,@Cost,@Notes,@Cancelled,@CouponId,@CreatedDate,@CreatedBy,@ModifiedDate,@ModifiedBy,@DeletedDate,@DeletedBy)
PARAMS: @Name=Booking 2, @RoomType=Double, @RoomNumber=12, @BookingStartDate=9/2/2023 3:13:48 PM, @BookingEndDate=9/9/2023 3:13:48 PM, @Cost=120, @Notes=, @Cancelled=, @CouponId=BOOK25, @CreatedDate=8/21/2023 3:13:48 PM, @CreatedBy=manager@email.com, @ModifiedDate=8/21/2023 3:13:48 PM, @ModifiedBy=manager@email.com, @DeletedDate=, @DeletedBy=
SQL: INSERT INTO "Booking" ("Name","RoomType","RoomNumber","BookingStartDate","BookingEndDate","Cost","Notes","Cancelled","CouponId","CreatedDate","CreatedBy","ModifiedDate","ModifiedBy","DeletedDate","DeletedBy") VALUES (@Name,@RoomType,@RoomNumber,@BookingStartDate,@BookingEndDate,@Cost,@Notes,@Cancelled,@CouponId,@CreatedDate,@CreatedBy,@ModifiedDate,@ModifiedBy,@DeletedDate,@DeletedBy)
PARAMS: @Name=Booking the 3rd, @RoomType=Suite, @RoomNumber=13, @BookingStartDate=9/3/2023 3:13:48 PM, @BookingEndDate=9/10/2023 3:13:48 PM, @Cost=130, @Notes=, @Cancelled=, @CouponId=, @CreatedDate=8/21/2023 3:13:48 PM, @CreatedBy=employee@email.com, @ModifiedDate=8/21/2023 3:13:48 PM, @ModifiedBy=employee@email.com, @DeletedDate=, @DeletedBy=
null null null null
2 Migration1001 null 2023-08-21 15:16:40.346636 2023-08-21 15:16:40.383743 App_Data/db.sqlite null SQL: CREATE TABLE "BookingStatus"
(
"Id" INTEGER PRIMARY KEY AUTOINCREMENT,
"Name" VARCHAR(8000) NULL,
"CreatedDate" VARCHAR(8000) NOT NULL,
"CreatedBy" VARCHAR(8000) NOT NULL,
"ModifiedDate" VARCHAR(8000) NOT NULL,
"ModifiedBy" VARCHAR(8000) NOT NULL,
"DeletedDate" VARCHAR(8000) NULL,
"DeletedBy" VARCHAR(8000) NULL
);

SQL: CREATE INDEX idx_bookingstatus_deleteddate ON "BookingStatus" ("DeletedDate");

null null null null
3 Migration1000 null 2023-08-21 15:17:28.815659 null App_Data/db.sqlite null SQL: INSERT INTO "Coupon" ("Id","Description","Discount","ExpiryDate") VALUES (@Id,@Description,@Discount,@ExpiryDate)
PARAMS: @Id=BOOK5, @Description=5% off, @Discount=10, @ExpiryDate=9/20/2023 3:17:28 PM
SqliteException SQLite Error 19: 'UNIQUE constraint failed: Coupon.Id'. at Microsoft.Data.Sqlite.SqliteException.ThrowExceptionForRC(Int32 rc, sqlite3 db)
at Microsoft.Data.Sqlite.SqliteDataReader.NextResult()
at Microsoft.Data.Sqlite.SqliteCommand.ExecuteReader(CommandBehavior behavior)
at Microsoft.Data.Sqlite.SqliteCommand.ExecuteReader()
at Microsoft.Data.Sqlite.SqliteCommand.ExecuteNonQuery()
at ServiceStack.OrmLite.OrmLiteCommand.ExecuteNonQuery() in /home/runner/work/ServiceStack/ServiceStack/ServiceStack.OrmLite/src/ServiceStack.OrmLite/OrmLiteCommand.cs:line 46
at ServiceStack.OrmLite.OrmLiteResultsFilterExtensions.ExecNonQuery(IDbCommand dbCmd) in /home/runner/work/ServiceStack/ServiceStack/ServiceStack.OrmLite/src/ServiceStack.OrmLite/OrmLiteResultsFilterExtensions.cs:line 64
at ServiceStack.OrmLite.OrmLiteWriteCommandExtensions.InsertInternal[T](IOrmLiteDialectProvider dialectProvider, IDbCommand dbCmd, Object obj, Action`1 commandFilter, Boolean selectIdentity) in /home/runner/work/ServiceStack/ServiceStack/ServiceStack.OrmLite/src/ServiceStack.OrmLite/OrmLiteWriteCommandExtensions.cs:line 833
at ServiceStack.OrmLite.OrmLiteWriteCommandExtensions.Insert[T](IDbCommand dbCmd, T obj, Action`1 commandFilter, Boolean selectIdentity, Boolean enableIdentityInsert)
at ServiceStack.OrmLite.OrmLiteWriteApi.<>c__DisplayClass5_0`1.<Insert>b__0(IDbCommand dbCmd) in /home/runner/work/ServiceStack/ServiceStack/ServiceStack.OrmLite/src/ServiceStack.OrmLite/OrmLiteWriteApi.cs:line 72
at ServiceStack.OrmLite.OrmLiteExecFilter.Exec[T](IDbConnection dbConn, Func`2 filter) in /home/runner/work/ServiceStack/ServiceStack/ServiceStack.OrmLite/src/ServiceStack.OrmLite/OrmLiteExecFilter.cs:line 66
at ServiceStack.OrmLite.OrmLiteReadExpressionsApi.Exec[T](IDbConnection dbConn, Func`2 filter) in /home/runner/work/ServiceStack/ServiceStack/ServiceStack.OrmLite/src/ServiceStack.OrmLite/OrmLiteReadExpressionsApi.cs:line 18
at ServiceStack.OrmLite.OrmLiteWriteApi.Insert[T](IDbConnection dbConn, T obj, Boolean selectIdentity, Boolean enableIdentityInsert) in /home/runner/work/ServiceStack/ServiceStack/ServiceStack.OrmLite/src/ServiceStack.OrmLite/OrmLiteWriteApi.cs:line 72
at MigrationDemo.Migrations.Migration1000.<Up>b__3_0(Int32 percent) in /Users/bgiromini/RiderProjects/MigrationDemo/MigrationDemo/Migrations/Migration1000.cs:line 47
at MigrationDemo.Migrations.Migration1000.Up() in /Users/bgiromini/RiderProjects/MigrationDemo/MigrationDemo/Migrations/Migration1000.cs:line 46
at ServiceStack.OrmLite.Migrator.<>c.<Run>b__20_2(MigrationBase x) in /home/runner/work/ServiceStack/ServiceStack/ServiceStack.OrmLite/src/ServiceStack.OrmLite/Migrator.cs:line 194
at ServiceStack.OrmLite.Migrator.Run(IDbConnectionFactory dbFactory, Type nextRun, Action`1 migrateAction, String namedConnection) in /home/runner/work/ServiceStack/ServiceStack/ServiceStack.OrmLite/src/ServiceStack.OrmLite/Migrator.cs:line 459
null

@bgiromini Thanks, I managed to reproduce the problem yesterday and created a fix. This fix is now available on our pre-release NuGet feeds. Let us know how you go, and if you have any other migration workflow issues. Thanks again.

1 Like

I followed your instructions and the changes worked as described. Thank you for the swift response!

1 Like