In an application that I am supporting, lately I have made several changes to the DB structure.
在我支持的应用程序中,最近我对DB结构进行了一些更改。
I send the update to the users, but its very hard to keep them all up-to-date.
我将更新发送给用户,但很难让他们保持最新状态。
Is there any simple way to do this ?
有没有简单的方法来做到这一点?
Something that enables users to skip versions, but still do the update in the next version they install.
允许用户跳过版本但仍然在他们安装的下一个版本中进行更新的东西。
I use BlackFish database.
我使用BlackFish数据库。
Thanks
谢谢
3 个解决方案
#1
5
Just store database version number in the database and write migration scripts like this:
只需将数据库版本号存储在数据库中,然后编写如下的迁移脚本:
- database_10.sql - initial db structure
- database_10.sql - 初始数据库结构
- database_10_15.sql - migration script to move from 1.0 to 1.5
- database_10_15.sql - 迁移脚本从1.0移动到1.5
- database_10_17.sql - migration script to move from 1.5 to 1.7
- database_10_17.sql - 迁移脚本从1.5移动到1.7
Check database version number on every application startup and apply needed migration scripts.
检查每个应用程序启动时的数据库版本号并应用所需的迁移脚本
#2
0
Side note:
边注:
Another appealing alternative to it also for small project is Component ACE Absolute Database.
对于小型项目而言,另一个吸引人的替代方案是Component ACE Absolute Database。
Now direct to the point:
现在直截了当:
The personnal edition (Free) comes with a custom utility named DBManager (along with its source code).
个人版(免费)附带一个名为DBManager的自定义实用程序(及其源代码)。
It can serve as starting point to how to manage database structure change programmatically (the Delphi way!).
它可以作为如何以编程方式管理数据库结构变更的起点(Delphi方式!)。
Why not port it to BlackFish?
为什么不把它移植到BlackFish?
#3
0
I very rarely change Databases but just add a table or sometimes a colunm. When I startup my program it checks for the existance of said column or table and if it's not there it just tries to make it.
我很少更改数据库,只是添加一个表或有时一个colunm。当我启动我的程序时,它检查所述列或表的存在,如果它不存在,它只是尝试制作它。
#1
5
Just store database version number in the database and write migration scripts like this:
只需将数据库版本号存储在数据库中,然后编写如下的迁移脚本:
- database_10.sql - initial db structure
- database_10.sql - 初始数据库结构
- database_10_15.sql - migration script to move from 1.0 to 1.5
- database_10_15.sql - 迁移脚本从1.0移动到1.5
- database_10_17.sql - migration script to move from 1.5 to 1.7
- database_10_17.sql - 迁移脚本从1.5移动到1.7
Check database version number on every application startup and apply needed migration scripts.
检查每个应用程序启动时的数据库版本号并应用所需的迁移脚本
#2
0
Side note:
边注:
Another appealing alternative to it also for small project is Component ACE Absolute Database.
对于小型项目而言,另一个吸引人的替代方案是Component ACE Absolute Database。
Now direct to the point:
现在直截了当:
The personnal edition (Free) comes with a custom utility named DBManager (along with its source code).
个人版(免费)附带一个名为DBManager的自定义实用程序(及其源代码)。
It can serve as starting point to how to manage database structure change programmatically (the Delphi way!).
它可以作为如何以编程方式管理数据库结构变更的起点(Delphi方式!)。
Why not port it to BlackFish?
为什么不把它移植到BlackFish?
#3
0
I very rarely change Databases but just add a table or sometimes a colunm. When I startup my program it checks for the existance of said column or table and if it's not there it just tries to make it.
我很少更改数据库,只是添加一个表或有时一个colunm。当我启动我的程序时,它检查所述列或表的存在,如果它不存在,它只是尝试制作它。