Can't use new created columns in SQL - Statement in Up() Migration ------------------------------------------------------------------
Key: DNET-811 URL: http://tracker.firebirdsql.org/browse/DNET-811 Project: .NET Data provider Issue Type: Bug Components: Entity Framework Affects Versions: 5.9.1.0 Reporter: Andreas Patock Assignee: Jiri Cincura If I have the following migration: public partial class AddDeviceType : DbMigration { public override void Up() { CreateTable( "dbo.DeviceType", c => new { Id = c.Int(nullable: false, identity: true), Name = c.String(nullable: false, maxLength: 128), ManufacturerId = c.Int(nullable: false), }) .PrimaryKey(t => t.Id) .ForeignKey("dbo.Manufacturer", t => t.ManufacturerId, cascadeDelete: true) .Index(t => t.ManufacturerId); AddColumn("dbo.Device", "TempDeviceTypeId", c => c.Int()); AddColumn("dbo.Device", "DeviceTypeId", c => c.Int(nullable: false)); CreateIndex("dbo.Device", "DeviceTypeId"); AddForeignKey("dbo.Device", "DeviceTypeId", "dbo.DeviceType", "Id", cascadeDelete: true); Sql("UPDATE \"Device\" d SET d.\"DeviceTypeId\" = (SELECT t.\"Id\" from \"DeviceType\" t where t.\"ManufacturerId\" = d.\"ManufacturerId\" ORDER BY t.\"Id\" ROWS 1)"); } I can a Column unknown "DeviceTypeId" exception when running the migration. This can found on many examples in the internet and is working with mssql. I had the idea to do this in two migrations, but the "DeviceTypeId" is a not null field and so the first migration throws an exception also. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://tracker.firebirdsql.org/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ Firebird-net-provider mailing list Firebird-net-provider@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/firebird-net-provider