以编程方式创建和更新数据库结构 [英] Create and update programmatically database structure

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

问题描述

我想通过向客户更新我的软件来创建和更新数据库结构.

i would like to create and update database structure through the update of my software to customer.

最好的方法是什么?也许使用 Sql(创建表、更改表等)?谢谢

What is the best way ? Maybe Using Sql (create table, alter table etc.) ? Thanks

推荐答案

我看不到除了使用 SQL 语句(例如 CREATE TABLEALTER TABLE)之外的任何其他方法和 DROP TABLE.您可能希望在某处放置一个架构版本号,以检查您的帮助脚本必须运行哪些更新才能更新数据库架构.这可能比使 SQL 语句具有幂等性更容易,因为您通常还需要进行一些数据转换.

I don't see any other way than using SQL statements such as CREATE TABLE, ALTER TABLE and DROP TABLE. You might want to put somewhere a schema version number in order to check what updates your helper script must run in order to update the database schema. This is probably easier than making SQL statements idempotent, as often you also need to do some data conversion too.

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

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