简体   繁体   中英

How can I include database changes (DDL patches, one-time data inserts, etc) in my build process?

I run my build script and then I have to remember which of the database SQL and PL/SQL scripts to run each time I deploy my application. How can I include these patches in my build script? Or does everybody just run them manually? Currently I number my patches so I know the order to run them, but sometimes I have to check SVN history to know what number to start at.

I'm using PHP but can use Java in my solution to this problem.

liquibase可能会为您解决此问题,它可以集成到ant或maven中,但也可以从cmd行启动

You should be saving your changes as scripts and putting them in source control like the rest of your code. Then you know what changes belong to what build and need to be promoted to prod.

Since you're using PHP phing/DbDeployTask would be a smart choice. For every DB table you will have a start file and a number of patches, eg:

001 user.sql
002 project.sql
501 user-AddColumnAvatar.sql

etc.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM