EF6 migration up命令是否可以使用这些命令删除数据库?

时间:2014-10-27 19:53:48

标签: entity-framework ef-code-first ef-migrations

无论如何,当我运行

时,我的C#代码或实体框架6正在删除并创建数据库
PM> update-database -verbose

来自使用up()方法的显式迁移,看起来像这样......

public override void Up()
{
    AddColumn("dbo.Term", "Term_Id", c => c.Int());
    CreateIndex("dbo.Term", "Term_Id");
    AddForeignKey("dbo.Term", "Term_Id", "dbo.Term", "Id");
}

-verbose生成这个......

Origin: Configuration).
Applying explicit migrations: [201410271927053_addTermsTable2].
Applying explicit migration: 201410271927053_addTermsTable2.
ALTER TABLE [dbo].[Term] ADD [Term_Id] [int]
CREATE INDEX [IX_Term_Id] ON [dbo].[Term]([Term_Id])
ALTER TABLE [dbo].[Term] ADD CONSTRAINT [FK_dbo.Term_dbo.Term_Term_Id] FOREIGN KEY ([Term_Id]) REFERENCES [dbo].[Term] ([Id])
INSERT [dbo].[__MigrationHistory]([MigrationId], [ContextKey], [Model], [ProductVersion])

(加上迁移插入语句)

其中没有一个表明(对我来说)数据库即将被删除。

有人可以确认这不会掉线吗?

是否重要

this is an Azure SQL database?
that the columns were added in response to adding this.. to the class?
public virtual ICollection<Term> urls { get; set; }

有关如何确定何时会发生drop创建的任何指示?

感谢。

0 个答案:

没有答案