resolve issue with migrations with table prefixes

This commit is contained in:
spencerrlongg 2023-10-12 14:50:12 -05:00
parent 138ec33555
commit 9b53b0fedc

View file

@ -42,13 +42,13 @@ class DenormalizedEolAndAddColumnForExplicitDateToAssets extends Migration
} }
}); });
DB::table('assets') DB::table( 'assets')
->whereNull('asset_eol_date') ->whereNull('asset_eol_date')
->whereNotNull('purchase_date') ->whereNotNull('purchase_date')
->whereNotNull('model_id') ->whereNotNull('model_id')
->join('models', 'assets.model_id', '=', 'models.id') ->join('models', 'assets.model_id', '=', 'models.id')
->update([ ->update([
'asset_eol_date' => DB::raw('DATE_ADD(purchase_date, INTERVAL models.eol MONTH)') 'asset_eol_date' => DB::raw('DATE_ADD(purchase_date, INTERVAL ' . DB::getTablePrefix() . 'models.eol MONTH)')
]); ]);
} }