SQL Azure架构升级策略

发布于 2024-10-02 05:17:32 字数 624 浏览 0 评论 0原文

我目前正在开发一个以实体框架作为数据库后端的 asp.mvc 应用程序,该应用程序将在 ms azure 平台上运行。

在我的开发机器上,我正在运行一个 sqlexpress 实例,它托管我的开发数据库(就像我说的,应用程序可能通过实体框架连接到它)。

通过实体框架数据库生成向导将数据库架构从本地 sqlexpress 部署到 sql azure 非常容易(无论出于何种原因,向导总是希望创建一些聚集索引,我在生成的 sql 文件中手动更正这些索引)。

但我想不出一种方法来保存我的数据!自动生成的 sql 脚本总是转储我的所有表并创建新表...这对于初始设置来说是可以的,但不能升级现有数据库。

一定有一种好方法可以在不丢失数据的情况下执行架构更新...请帮忙!我已经尝试过 sql management studio (r2) 和 SQLAzureMW(在 codeplex 上可用)...但它们不能完成这项工作:(

请不要告诉我我必须编写自己的工具才能做到这一点!

寻找您的help

thx

编辑:这是我现在的做法,

我使用 EF 迁移向导为我的本地 SQL Express 创建的 SQL 脚本,并自行修改它们以与 SQL Azure 兼容,这比人们想象的要少,并且工作完美:)

i'm currently working on a asp.mvc application with entity framework as db backend which will be running on ms azure platform.

on my development machine i'm running a sqlexpress instance which hosts my development database (like i said may app connects via entity framework to it).

deploying the database schema from my local sqlexpress to sql azure is pretty easy via the entity framework database generation wizard (for whatever reasons the wizard always wants to create some clustered indexes which i correct manually in the generated sql file).

but i can't figure out a way to keep my data! the auto generated sql script always dumps all my tables and creates new ones...thats ok for initial setup, but not to upgrade a existing database.

there must be a nice way to perform a schema update without dataloss...please help! i have already tried sql management studio (r2) and SQLAzureMW (available on codeplex)...but they don't do the job :(

please don't tell me i have to code my own tool to do that!

looking for your help

thx

Edit: here's how i do it now

I use the SQL scripts created by the EF migration wizard for my local SQL Express and modify them myself to be compatible with SQL Azure. Is less work that one might think and works perfect :)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

不气馁 2024-10-09 05:17:32

您是否尝试过使用 BCP 导出然后导入数据?我相信您应该能够使用 BCP 将数据从 SQL Express 实例导出到文件中,然后将数据从文件导入到 SQL Azure 中。 SQL Azure 团队有一篇博客文章,介绍了如何将 BCP 与 SQL Azure 结合使用 - 链接

此外,将来,即将发布的 SQL Azure Data Sync CTP2 可能能够为您提供帮助。

出于好奇,您在使用 SQLAzureMW 时遇到了什么问题?

Have you tried to use BCP to export and then import your data? I believe you should be able to use BCP to export data from your SQL Express instance into a file, and then import data from the file into SQL Azure. The SQL Azure team has a blog posting that describes using BCP with SQL Azure - Link.

Additionally, in the future, the upcoming release of SQL Azure Data Sync CTP2 might be able to help you out.

Out of curiosity, what problems where you having with SQLAzureMW?

我三岁 2024-10-09 05:17:32

RedGate 以 SQL 服务器同步和用于部署目的的数据同步而闻名。

他们的 DataCompare 和 SchemaCompare 产品有 v9 测试版,与 SQL Azure 兼容。我一直在成功地使用它们并且非常喜欢它们。

如果您是小型企业,那么购买时它们会很昂贵。

http://www.red-gate.com/Azure

RedGate is famous for SQL server synchronization and data synchronization for deployment purposes.

They have a v9 beta out of their DataCompare and SchemaCompare products that are compatible with SQL Azure. I've been using both successfully and like them alot.

They are pricey when purchased, if you are a small business.

http://www.red-gate.com/Azure

不知在何时 2024-10-09 05:17:32

这听起来与这个问题类似,唯一的答案是“等等实体框架的下一版本”。我承认我不使用 EF,但我使用 SQL Server Management Studio 和脚本以老式方式对表进行更改。修改表 FTW。

编辑:如果您无权访问 SQL Server Management studio,新版本的 SQL Azure 门户包含一个基于 Silverlight 的应用程序,可让您运行查询和脚本

This sounds vary similar to this question, the only answer to which is "wait for the next version of entity framework". I'll admit that I don't use EF, but I make my changes to tables the old school way with SQL Server Management Studio and scripts. ALTER TABLE FTW.

EDIT: If you don't have access to SQL Server Management studio, the new version of the SQL Azure portal includes a Silverlight based application that allows you to run queries and scripts

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文