There is no problem adding all WordPress files to my repository, if I want to know I can .gitignore wp-config file, but since I am Currently the only developer, and these projects are closed source code, it really makes no sense.
WordPress relies heavily on the database, just like any CMS, it retains text content and many settings. It depends on the specific plugin/theme configuration I’m using. I want to know what is the best way to use version control on the database, if possible. I think I can do a SQL dump even though my MySQL server is on Windows (Read as: I don’t know what to do), and then add the SQL dump to my repository. But when I push something, it brings a huge security threat.
Is there an accepted practice for doing this?
mysqldump is a suitable The program to help you do this. Although it is not perfect. If anything disturbs the serialization order of the items (for example, due to the creation of new tables, etc.), then manual interruption will enter the difference. This will reduce storage efficiency. You can write a custom serializer to serialize only the changes-but you are doing the hard work that git is already good at. Just use sql dump.
That being said, what you want to do Not what developers usually mean when talking about putting a database into git. For example, if you read the link posted by @eggyal (link to codinghorror), you will see that what is actually placed in git is the script required to generate the initial database There may be other scripts, such as a script that fills the database data with a clean state, or fills it with test data. All these sql scripts are text files, almost the same as the sql dump format that mysqldump can get. So there is no reason not to use Do this for your daily data.
I am a WordPress designer/developer, and he is increasingly involved in the use of version control, especially Git, although I SVN is used in some projects. I am currently using Beanstalk as my remote repository.
There is no problem adding all WordPress files to my repository, if I want to know I can .gitignore wp-config file, but since I am the only developer at the moment, and these projects are closed source code, it really makes no sense.
WordPress relies heavily on the database, like Like any CMS, the text content and many settings are preserved, depending on the specific plugin/theme configuration I’m using. I want to know what is the best way to use version control on the database, if possible. I think I can make one SQL dump, although my MySQL server is running on Windows (read: I don’t know how to do it), then I add the SQL dump to my repository. But when I push something, this brings huge Security threats.
Is there an accepted practice for doing this?
You can back up the database in the git repository. Of course, if you put the data in git in binary form, you will lose git using diff (change ) All the ability to store data efficiently. Therefore, the best practice is to store the data in a text serialized format.
mysqldump is a suitable program to help you do this. Although it Not perfect. If anything disturbs the serialization order of items (for example, due to the creation of new tables, etc.), then manual interruption will enter the difference. This will reduce storage efficiency. You can write a custom serialization program to just sequence Changes – but you are doing the hard work that git already excels at. Just use sql dump.
That being said, what you want to do is not that developers usually talk about putting databases into git What it means. For example, if you read the link posted by @eggyal(link to codinghorror), you will see that what is actually placed in git is the script required to generate the initial database. There may be other scripts, such as filling with a clean state Scripts for database data, or fill it with test data. All these sql scripts are text files, almost the same as the sql dump format that mysqldump can get. So there is no reason not to do this with your daily data.
< /p>