kugra-al / al-laravel

Status: live
0 stars 0 forks source link

need to use migration when adding item columns #21

Open kugra-al opened 1 year ago

kugra-al commented 1 year ago

Currently it just uses schema directly:

https://github.com/kugra-al/al-laravel/blob/9466a444137da5e553f2b1cc8eb1e4810316d088/app/Jobs/WriteItmCacheToDatabase.php#L49-L53

This means we can't easily roll back to a fresh version of items - have to migrate:fresh and reset the whole database.

Need to write a migration file so we can just truncate table and rollback that migration when we need to refresh items.

kugra-al commented 1 year ago

Updating items doesn't work either. This should be fixed with migrations

kugra-al commented 1 year ago

Workaround - put everything that should never be dynamic generated into 1 migration file:

https://github.com/kugra-al/al-laravel/blob/master/database/migrations/2023_02_05_122929_create_items_table.php

When we need to reset items, run:

php artisan migrate --path=/database/migrations/2023_02_05_122929_create_items_table.php

Ed: probably need a 'dropIfExists' thing in the migration file

kugra-al commented 1 year ago

Workaround added in https://github.com/kugra-al/al-laravel/commit/9059cb4c132278f31affb9aef74bef958ba7984f

Still should be done using migrations (that the 'correct' way).