Answer the question
In order to leave comments, you need to log in
How to properly organize the web development process?
Dear community,
for a long time I have been developing my own website written in PHP, MySQL. I edit scripts directly on the server. I began to understand that I needed to switch to working with versions. I write scripts alone, on a Linux server. I am also interested in how to move to a new version of scripts correctly - after all, when working on it, users could add new data to the database, and in the new version the structure of the database may be different.
Tell us how to properly organize the development of PHP scripts by versions, how to move to a new version without interrupting the server. If there are useful books on this topic - also recommend.
Answer the question
In order to leave comments, you need to log in
To cope with problems when moving to a new version of the database, some ORMs have a so-called. "migrations".
Well, working through SVN / git is the most it for working with different versions. The most important plus, if you develop alone, is a quick rollback of changes
. There
are two ways to switch to a new version of scripts with a modified database:
allow)
2. Transferring the main database to a new format, launching a new version, transferring what managed to get into the old database during the conversion. However, in this case, thousands of nuances are possible, so it is better not to change the structure of the database on the working project radically.
Well, we have already written about SVN/Git. It would also be nice to connect a task / error tracking system (TRAC, Bugzilla, etc., there are enough free solutions that integrate with version control systems), it is very convenient to search / track the history of changes later.
And about the new version of the scripts and the database, a test server would help, on which the migration could be tested, plus an automatic backup-restore of the entire site (scripts + database). Then the test could be something like:
- backup of a "live" system
- deploying a backup on a test server
- running migration scripts on a test server
- checking the result
In a simple case: start a migrations folder, create a 0000.sql file, merge the database structure into it. When changing the structure, create a file 0001.sql, where you write alter and create table. Committee file along with the code that can work with the changed base.
As soon as you have a new xxxx.sql file during checkout, execute it. You can manually, you can write a hook for the version control system.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question