Database design for database-agnostic applications

后端 未结 17 1742
隐瞒了意图╮
隐瞒了意图╮ 2021-02-02 14:15

What do I have to consider in database design for a new application which should be able to support the most common relational database systems (SQL Server, MyS

17条回答
  •  谎友^
    谎友^ (楼主)
    2021-02-02 14:46

    I currently support Oracle, MySQL, and SQLite. And to be honest it's tough. Some recommendations would be:

    • avoid stored procedures, but you may need them to emulate missing features on some platform (see below)
    • learn how to use triggers, because you'll need them to emulate missing features (for example with Oracle you don't have auto-increment, so you need to emulate it, and a good choice is with triggers)
    • have a decent test environment because you'll need to test lots of SQL before knowing for sure that it's doing what you wan on all your platforms.

    Is it worth it... well depends. Commercially it is worth it for enterprise level applications, but for a blog or say a website you might as well stick with one platform if you can.

提交回复
热议问题