新闻建站cms系统、政府cms系统定制开发

广州网站建设公司-阅速公司

asp.net新闻发布系统、报纸数字报系统方案
/
http://www.ysneo.com/
广州网站建设公司
您当前位置:首页>网站技术

网站技术

Automatic migration was not applied because it would result in data loss

发布时间:2013/7/17 9:19:40  作者:Admin  阅读:626  

广告:阿里云采购优惠专区

PM> update-database -Verbose

Using StartUp project 'TopWin.Etone.Web'.

Using NuGet project 'TopWin.Etone.Domain'.

Specify the '-Verbose' flag to view the SQL statements being applied to the target database.

Target database is: 'Yunyou' (DataSource: .\sql2008, Provider: System.Data.SqlClient, Origin: Configuration).

No pending code-based migrations.

Applying automatic migration: 201307170115022_AutomaticMigration.

Automatic migration was not applied because it would result in data loss.

解决方法:提示“Automatic migration was not applied because it would result in data loss”(不能自动迁移,会导致数据丢失) ,则在Update-Database 后面加 -Force参数即可。注意,这样并不会引起数据丢失。

成功后提示:

PM> update-database -Force -Verbose

Using StartUp project 'TopWin.Etone.Web'.

Using NuGet project 'TopWin.Etone.Domain'.

Specify the '-Verbose' flag to view the SQL statements being applied to the target database.

Target database is: 'Yunyou' (DataSource: .\sql2008, Provider: System.Data.SqlClient, Origin: Configuration).

No pending code-based migrations.

Applying automatic migration: 201307170118213_AutomaticMigration.

ALTER TABLE [dbo].[Customer] ADD [CustomerName2] [nvarchar](max)

DECLARE @var0 nvarchar(128)

SELECT @var0 = name

FROM sys.default_constraints

WHERE parent_object_id = object_id(N'dbo.Customer')

AND col_name(parent_object_id, parent_column_id) = 'CustomerName1';

IF @var0 IS NOT NULL

EXECUTE('ALTER TABLE [dbo].[Customer] DROP CONSTRAINT ' + @var0)

ALTER TABLE [dbo].[Customer] DROP COLUMN [CustomerName1]

[Inserting migration history record]

Running Seed method.

PM>

广告:阿里云新人采购专场

相关文章
migration
code first
cms新闻系统购买咨询
扫描关注 广州阅速软件科技有限公司
扫描关注 广州阅速科技