go-gorm / gorm.io

GORM official site
https://gorm.io
254 stars 358 forks source link

[Question] How i roll back the database??? #775

Open bhupesh7shakya opened 3 months ago

bhupesh7shakya commented 3 months ago

image this was my database table for some reason i have remove the colum and image then it is not refeclting in the database its still there..!!!

VLS-v commented 3 months ago

Hi @bhupesh7shakya. This is stated in the documentation:

NOTE: AutoMigrate will create tables, missing foreign keys, constraints, columns and indexes. It will change existing column’s type if its size, precision, nullable changed. It WON’T delete unused columns to protect your data.

I would recommend using 'golang-migrate' to track database changes. I hope this helps!

bhupesh7shakya commented 3 months ago

Hi @bhupesh7shakya. This is stated in the documentation:

NOTE: AutoMigrate will create tables, missing foreign keys, constraints, columns and indexes. It will change existing column’s type if its size, precision, nullable changed. It WON’T delete unused columns to protect your data.

I would recommend using 'golang-migrate' to track database changes. I hope this helps!

yep i found that i am looking for somehting like migrations like django..! is there any of it