数据库架构更新 [英] Database schema updates

查看:203
本文介绍了数据库架构更新的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用本地SQLite数据库的AIR应用程序,并想知道我怎么能管理数据库架构更新,当我分发应用程序的新版本。同时考虑到跳过某些版本的更新。例如。而不是去从1.0到1.1,从1.0去1.5

I'm working on an AIR application that uses a local SQLite database and was wondering how I could manage database schema updates when I distribute new versions of the application. Also considering updates that skip some versions. E.g. instead of going from 1.0 to 1.1, going from 1.0 to 1.5.

你会推荐什么样的技术?

What technique would you recommend?

推荐答案

我们的脚本每一个DDL更改到数据库,当我们做一个释放,我们将它们连接成一个单一的升级版的剧本,以及任何存储过程而自从上次已更改

We script every DDL change to the DB and when we make a "release" we concatenate them into a single "upgrade" script, together with any Stored Procedures which have changed "since last time"

我们有一个存储应用了最新补丁的版本号的表 - 所以升级工具可以应用任何更新补丁

We have a table that stores the version number of the latest patch applied - so upgrade tools can apply any newer patches.

每一个存储过程是在一个单独的文件。每开始一个插入语句来存储存储过程,版本名称和现在一个记录表。 (实际上是一个存储过程执行存储这一点,它不是一个原始的插入语句)。

Every Stored Procedure is in a separate file. Each starts with an "insert" statement to a logging table that stores Name of SProc, Version and "now". (Actually an SProc is executed to store this, its not a raw insert statement).

有时候在部署过程中,我们手动更改存储过程,或推出赔率和放大器;从DEV结束,该日志对客户的测试和产品数据库比较,使我们能够检查一切是同一版本。

Sometimes during deployment we manually change an SProc, or rollout odds & ends from DEV, and comparing the log on client's TEST and PRODUCTION databases enables us to check that everything is at the same version.

我们也有一个放主数据库,这是我们应用更新,而我们使用的,对于新安装的还原备份(保存运行脚本,这明显随时间增加的时间)。我们更新为&放大器;时,因为很明显,如果它是一个有点陈旧后来的补丁脚本可以应用。

We also have a "release" master-database, to which we apply the updates, and we use a restored backup of that for new installations (saves the time of running the scripts, which obviously increase over time). We update that as & when, because obviously if it is a bit stale the later patch scripts can be applied.

我们的推出数据库还包含消毒起动数据(其被删除,或有时通过&安培;改性,前一个新的安装上线 - 因此不包括在任何更新脚本)

Our Release database also contains sanitised starter data (which is deleted, or sometimes adopted & modified, before a new installation goes live - so this is not included in any update scripts)

SQL Server有一个工具栏按钮脚本的变化 - 这样你就可以使用GUI工具,使所有的变化,但不是他们节省生成一个脚本。 (实际上,有一个复选框的总是生成一个脚本,所以如果你忘记了,只是preSS保存它仍然给你后 - 事实上,它使用的脚本,它可以保存为补丁文件)

SQL Server has a toolbar button to script a change - so you can use the GUI tools to make all the changes, but rather than saving them generate a script instead. (actually, there is a checkbox to always generate a script, so if you forget and just press SAVE it still gives you the script it used after-the-fact, which can be saved as the patch file)

这篇关于数据库架构更新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆