MichaelJohn
MichaelJohn

Reputation: 215

Git Repository And Database Schemas

My company use Git for “version control”,etc. Currently it is used for C, C# and Python. I have been asked to add the database schemas together with the more “complex” SQL (no idea when it becomes “complex”) to the repository. Currently the database is backed up after changes have been made to the schemas or after data has been added (at the moment it is purely a development environment). Having looked at Git, database schemas and the like do not really seem (to me) to map onto it. Should I be considering another package for “source control” to compliment the existing MySQL backups?

Thank you...

Upvotes: 3

Views: 2157

Answers (2)

CodeWizard
CodeWizard

Reputation: 141946

The fingerprint rule is not to store large files which are often modified in git for several reasons. (out of this answer scope - heuristically, snapshots etc) so i would suggest not to add them to git directly and instead store them in a submodule as a standalone repository.

This way you can still use git to track changes but your git repository will not growth to a huge size (pack files) and you can manage it inside your project.

If you only want to store the sql script git is a good choice sine it will handle it as any other file.

Upvotes: 0

Adam H
Adam H

Reputation: 1573

Assuming you are just wanting to store the SQL scripts that can recreate your DB schema without any data in it (CREATE TABLE, VIEW, INDEX, etc.) then Git seems like a perfectly good option. Git is generally good for version control of textual data, such as SQL scripts.

Upvotes: 3

Related Questions