How to update schema without lose my data?

#1

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!

0 Likes

#2
  • 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

#3

Thank you so much man.

0 Likes

#4

I thought that this way I also lost the data.

0 Likes

#5

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