How to update schema without lose my data?


Hello guys, how are u?

I have a doubts on how I can change the structure of a table without losing its data?

Thank you!


  • You can alter the table in question from command line:
    adonis make:migration yourTableName --action alter
  • You can back up the data within that table
1 Like


Thank you so much man.



I thought that this way I also lost the data.



It does not make you loose the data since it will consist in altering the definition(s) of existing columns or adding new ones/columns (as long as the columns which are altered do not cause anomalies in rows that can be detected by the RDBMS and delete automatically those rows consequently). In all cases remember the golden rule is to always backup your data first.

1 Like