Add migration for postgres
This commit is contained in:
parent
72dbe95168
commit
990358750b
1 changed files with 5 additions and 1 deletions
|
@ -78,6 +78,10 @@ class DenormalizedEolAndAddColumnForExplicitDateToAssets extends Migration
|
|||
return DB::raw("DATE(purchase_date, '+' || (SELECT eol FROM " . DB::getTablePrefix() . "models WHERE models.id = assets.model_id) || ' months')");
|
||||
}
|
||||
|
||||
if (DB::getDriverName() === 'pgsql') {
|
||||
return DB::raw("date(purchase_date + interval '1 month' * (SELECT eol FROM " . DB::getTablePrefix() . "models WHERE models.id = assets.model_id))");
|
||||
}
|
||||
|
||||
// Default to MySQL's method
|
||||
return DB::raw('DATE_ADD(purchase_date, INTERVAL ' . DB::getTablePrefix() . 'models.eol MONTH)');
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue