Git Notifications on Pull/Submodule Update
I’m currently on a dev team building a website using MySql, Go, and a customized templating engine for the front-end. We use Git for version control.
As I edit the model structs, I occasionally have to make breaking changes to the db structure (we’re still early in the process here). We construct our schema in the Go code, so all I need to do is drop my database and the app will recreate a new one on startup, with the correct structure.
- A smart way to sync development and remote repos with FTP-access only?
- How do you maintain revision control of your database structure?
- Is there a convenient way to include a mysqldump in my git commits?
- How do you manage databases in development, test, and production?
- Data Base Connection Issue in Spring Petclinic (Spring Boot)
- How do I install and use MySQLdb for Python 3 on Windows 10?
However, my teammates aren’t necessarily aware of these breaking changes to the db. They do a pull or a submodule update, and most things may work fine, but when they move to a particular section of the site or use a particular feature they get strange databases errors (go figure, right?).
I’d like to have some way to notify my teammates that the db structure has changed, and that they need to rebuild it. I can obviously put that information into a commit message, but then they need to inspect the log after every pull.
Is there any way to make a message show up in the console when a user pulls/submodule updates/checks out a particular commit?
One Solution collect form web for “Git Notifications on Pull/Submodule Update”
You could, as suggested, use a
post-merge hook but:
- it needs to be deployed on all client
- it won’t execute if the pull resulted in any conflict
A centralized approach might be best, where you have:
- a versioned script able to rebuild the db, and to create a new commit with message “
DB Vxxx rebuilt“
- a versioned file with “
Vxxx” in it to memorize or detect that the version of the db has changed
- a unique
pre-receivehook on the Git repositories hosting server used by all the developers rejecting their commits if none of the commit pushed include “
DB Vxxx rebuilt” message, with a matching the content (
git show) of the file storing the official db version.
That way, a developer would have to be sure his/her history includes a trace of the DB having been rebuilt, with a version matching the one stored by the last person having modified said db structure.