reload data into production database without losing information

I don’t have much experience in programming with PHP, it happens that I have a billing system already in production which I am modifying the database by adding a QR name column to save a QR code when issuing a payment receipt, the original system generates this code but it doesn’t save it.

The modification runs well on the new tenants that are created; but in those created before the modification it gives me this error

indicating that the QR column is not found. I understand that when running the migrations they do not modify the modules or columns of the DB already created.
I would be grateful if you could tell me if there is any way to regenerate the already created modules, but without losing information

I tried to run php artisan tenancy:migrate, but it didn’t work

  • 1

    You need to update the existing database schema to include the new column. Generally you would use a technique called “database migrations” to apply changes to the database in a versioned manner along with matching code changes.

    – 

  • 1

    Also, IMO saving a QR code image is kind of unnecessary since it’s a pretty trivial encoding of a much more compact piece of data. You could even offload it to client-side javascript pretty easily.

    – 

  • 2

    Your question is not clear, but migrations are iterative. You do not edit an already existing migration class with a new column. You create a new migration to alter the existing table. This is pretty basic stuff you should know before having anything in production.

    – 




  • Please do not post images of code/data/errors. If you’re new to Laravel and need to do something related to migrations, why not start by reading the docs on migrations?

    – 

Leave a Comment