hammond icon indicating copy to clipboard operation
hammond copied to clipboard

Conflict between AutoMigration and Migration

Open Goloso98 opened this issue 1 year ago • 0 comments

  • Installation Type: Docker
  • Have you tried using the latest docker image / code base: yes

Describe the bug Using a fresh database, main runs starting database init which first will run AutoMigrate on all models, including Vehicle with VIN field already in it. After that proceeds to "normal" migration which will try to add VIN again and will error because AutoMigrate already did and because it errors wont sign that migration as done.

hammond  | 2024/08/24 17:27:12 /api/db/migrations.go:39 record not found
hammond  | [0.081ms] [rows:0] SELECT * FROM `migrations` WHERE name="2022_03_08_13_16_AddVIN" ORDER BY `migrations`.`id` LIMIT 1
hammond  | ALTER TABLE vehicles ADD COLUMN vin text
hammond  | 
hammond  | 2024/08/24 17:27:12 /api/db/migrations.go:42 duplicate column name: vin
hammond  | [0.015ms] [rows:0] ALTER TABLE vehicles ADD COLUMN vin text

To Reproduce Steps to reproduce the behavior:

  1. New installation
  2. Fresh database
  3. Error on migrate

Expected behavior On a fresh install it add all migrations as done.

Goloso98 avatar Aug 24 '24 21:08 Goloso98