Quantcast
Channel: Entity Framework
Viewing all articles
Browse latest Browse all 10318

Commented Issue: Migrations: Crash when earlier migration added (multi-user) [761]

$
0
0
When an earlier migration is added (typically by pulling another dev's changes) we crash on update.

PM> Update-Database -Verbose
Using StartUp project 'ClassLibrary2'.
Using NuGet project 'ClassLibrary2'.
Specify the '-Verbose' flag to view the SQL statements being applied to the target database.
Target database is: 'ClassLibrary2.MyContext2' (DataSource: .\SQLEXPRESS, Provider: System.Data.SqlClient, Origin: Convention).
Applying explicit migrations: [201301022205214_M1].
Applying explicit migration: 201301022205214_M1.
CREATE TABLE [dbo].[Foos] (
[Id] [int] NOT NULL IDENTITY,
[Name] [nvarchar](max),
[Description] [nvarchar](max),
CONSTRAINT [PK_dbo.Foos] PRIMARY KEY ([Id])
)
CREATE TABLE [dbo].[__MigrationHistory] (
[MigrationId] [nvarchar](255) NOT NULL,
[ContextKey] [nvarchar](512) NOT NULL,
[Model] [varbinary](max) NOT NULL,
[ProductVersion] [nvarchar](32) NOT NULL,
CONSTRAINT [PK_dbo.__MigrationHistory] PRIMARY KEY ([MigrationId], [ContextKey])
)
BEGIN TRY
EXEC sp_MS_marksystemobject 'dbo.__MigrationHistory'
END TRY
BEGIN CATCH
END CATCH
System.Data.SqlClient.SqlException (0x80131904): There is already an object named '__MigrationHistory' in the database.

Comments: Fixed in #fbdeeffd1740

Viewing all articles
Browse latest Browse all 10318

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>