mirror of
https://github.com/snipe/snipe-it.git
synced 2025-03-05 20:52:15 -08:00
Add migration for postgres
This commit is contained in:
parent
72dbe95168
commit
990358750b
|
@ -75,7 +75,11 @@ class DenormalizedEolAndAddColumnForExplicitDateToAssets extends Migration
|
||||||
private function eolUpdateExpression(): Expression
|
private function eolUpdateExpression(): Expression
|
||||||
{
|
{
|
||||||
if (DB::getDriverName() === 'sqlite') {
|
if (DB::getDriverName() === 'sqlite') {
|
||||||
return DB::raw("DATE(purchase_date, '+' || (SELECT eol FROM " . DB::getTablePrefix() ."models WHERE models.id = assets.model_id) || ' months')");
|
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
|
// Default to MySQL's method
|
||||||
|
|
Loading…
Reference in a new issue