mardi 3 novembre 2015

Running fluentMigrator with default Value on SQLite

I try to run migrations with withDefaultValue() columns on a SQLite Database, but I get an error.

Migration:

[Migration(201207041759)]
public class M009_Init_Database_Change_SequentialNumber : ForwardOnlyMigration
{
    public override void Up()
    {
        Alter.Column("LastSequenceNumber").OnTable("SequentialNumber").AsInt64().NotNullable().WithDefaultValue(0);
        Create.Column("Format").OnTable("SequentialNumber").AsString().NotNullable().WithDefaultValue("0000000");

        // Insert data
        Insert.IntoTable("SequentialNumber").Row(new { Type = "Inquiry", Format = "AF0000000" });
        //More Insertions


    }
}

Error:

/* !!! constraint failed
NOT NULL constraint failed: SequentialNumber.LastSequenceNumber
While Processing:
"INSERT INTO "SequentialNumber" ("Type", "Format") VALUES ('Inquiry', 'AF0000000')" */

I found this post on github and if I understood it correctly, this should definitely work with SQLite and normal integer-values.

Aucun commentaire:

Enregistrer un commentaire