Recently, Laravel LLC introduced Envoyer, which allows you to update the production server without turning it off. And the scheme there seems to be as clear - roughly speaking, we first collect the new version in a new folder and, as everything is ready, switch the site to use files from this new folder.

But I did not understand how to deal with migrations. For example, I have a service in which users register at several hundred people per second. In essence, the user has a name field (on the registration form, respectively, also one field), in which the user's first and last names fall.

I decided to update it and make it so that instead of one name field there are 2 fields: first_name and last_name (i.e. new users must fill in two corresponding fields when registering, and the existing ones must share the name field into two fields). And if everything is clear with the update of the source code, how about the update of the database? In order not to turn off the server and no user fell off during the registration process.

    1 answer 1

    If you want without downtime, then do the structure change in several stages - first migrations that do not break anything in the code, the following calculation code adapted for this migration. And so several times, until you achieve the desired result, and the sequence of calculations can change (first the code, then the migration).

    For example:

    1. The calculation of the migration to add two new fields.
    2. The layout of the code that supports these fields and fills in both the old and the new.
    3. Display code that does not use the old field.
    4. The migration tab that migrates from the old field to the new data and deletes the old field.
    • Thanks for the answer. Indeed, according to the scenario described by you, it will be possible to update without downtime. I make a conclusion for myself that it is necessary to think through a competent server update strategy. - Ivan Torg