How to apply migration to Laravel (Yii) without disconnecting the site?



  • Laravel LLC recently presented the Envoyer, which allows the production of the server to be updated without disconnecting it. And the scheme is kind of understandable-- rudely speaking, we're starting to collect a new version of the new folder and, as it's ready, we're switching the website to use the files from this new folder.

    But I never understood how to understand migration. For example, I have a service where users register several hundred people per second. In fact, the user has a field name (in the form of registration, also one field) in which the user ' s name is available.

    I've decided to update this and make it two fields instead of one field: first_name and last_name (i.e. new users in registration should fill two relevant fields, and the field of the name of the existing ones should be shared by two fields). And if the original code is updated, how is it to be updated? In order not to turn off the server and no user has failed in the registration process.



  • If you want to do without downtime, do a change of structure in several stages - first migration, which does not break anything in the code, the next set of code adapted to this migration. A few times before you get the right result, and the sequence of the layout can change (code starts, then migration).

    For example:

    1. Exhibition of migration to two new fields.
    2. A code that supports these fields and fills in old and new.
    3. A code that doesn't use the old field.
    4. An example of migration that moves from the old field to new data and removes the old field.



Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2