[Solved] Database not properly merge with version control (git)



  • Hi all,

    I'm not sure this is proper place to ask this question. If not please forgive me.
    But I hope some one can help me.

    I'm using Qt Creator 4.7, SQLITE 3.3.55.2206 and git 1.7.11.msysgit.1.

    Normally I follow below steps.

    1. Coding
    2. Update DBs
    3. Commit changes
    4. pull from git repository
    5. push my changes

    4th step is problematic. After pull all the local changes (mine) to the database vanish.

    In other words, can not properly manage the database updates with git. I search for solution, and some site says git regard DB file as binary file and pull causes to overwrite the existing one.

    Are there any solution?

    Thanking you.


  • Moderators

    Hi,

    [quote]I’m not sure this is proper place to ask this question. If not please forgive me.[/quote]It's not the right place because this is not related to Qt or Qt Creator, but we're happy to help with small, once-off issues :) (just don't do it too often)

    [quote]some site says git regard DB file as binary file and pull causes to overwrite the existing one.[/quote]That's correct. Git is for managing changes to your source code; it is not for managing databases.

    You should separate your database from your source code, and let git manage your source code only.

    What's in your database?



  • Thanks JKSH..

    I don't do it again :) sorry.

    My application handling some sort of item collection of a company. Database consist the items with their details.

    Thanks again..


  • Moderators

    That's ok :)

    Why did you want to put that database in git?



  • I'm one member of development team. Each one need to read/write from/to database. So we put the database in to git.

    We can not use the centralized location inside LAN because some members are working outside of the country. And according to our App database should exist locally.

    Thank you.


  • Moderators

    [quote]I’m one member of development team. Each one need to read/write from/to database. So we put the database in to git.

    We can not use the centralized location inside LAN because some members are working outside of the country.[/quote]http://en.wikipedia.org/wiki/Virtual_private_network

    [quote]And according to our App database should exist locally.[/quote]Why?



  • We asked for VPN from administration still haven't replied. :( Then we gave up the idea.

    This application going to deliver to the customers of the company. So we are not going give them access to the server. Local DB preferred.



  • I think you are asking for handle the code using git and make the Db as centralized? isn't it?

    Then I have a question how can we versioning the Db?

    Thanks for replying me.


  • Moderators

    [quote]This application going to deliver to the customers of the company. So we are not going give them access to the server. Local DB preferred.[/quote]That's a good point.

    [quote]I think you are asking for handle the code using git and make the Db as centralized? isn’t it?[/quote]Yes, that was my original idea because git cannot merge/fork a SQLITE file. I was thinking you could use a centralized database during development and then export the data into an SQLITE file when you ship it to your customer.

    However, I did some Googling, and found out that my original idea isn't very good. Sorry about that.

    [quote]Then I have a question how can we versioning the Db?[/quote]http://stackoverflow.com/questions/115369/do-you-use-source-control-for-your-database-items Other developers recommend putting your database scripts in version control. Scripts are like source code, so git can handle them.

    Your team should edit the scripts, not the database itself. Then, when you are ready to test/deploy, generate the database from the scripts.



  • Dear JKSH,

    Thank you very much for the support.

    I'll discuss this idea with my team.

    Thank you again.


  • Moderators

    You're welcome. All the best.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.