-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix problems reported by PHPStan #14
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -62,17 +62,17 @@ public function removeConnection(): void | |
return $model->getConnectionName(); | ||
})->each(function ($models, $connection) { | ||
$tables = []; | ||
$statements = []; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is it en error or |
||
foreach ($models as $model) { | ||
if (! $model instanceof Model) { | ||
throw new Exception("models in the models method should extend eloquents model class"); | ||
} | ||
$ghostConnectionTable = config('database.connections.' . $this->getGhostConnectionForModel($model) . '.prefix') . $model->getTable(); | ||
|
||
$defaultValues = DB::connection($model->getConnectionName())->select("SELECT column_name, column_default FROM information_schema.columns WHERE (table_schema, table_name) = ('public', '{$ghostConnectionTable}') AND column_default is not null;"); | ||
$statements = []; | ||
collect($defaultValues)->filter(function ($defaultValue) { | ||
return Str::contains($defaultValue->column_default, "_seq") && Str::contains($defaultValue->column_default, 'nextval('); | ||
})->each(function ($defaultValue) use ($model, $ghostConnectionTable, &$statements) { | ||
})->each(function ($defaultValue) use ($ghostConnectionTable, &$statements) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
$statements[] = "DROP SEQUENCE IF EXISTS {$ghostConnectionTable}_{$defaultValue->column_name}_seq"; | ||
}); | ||
$tables[] = $ghostConnectionTable; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,6 +35,6 @@ public function register() | |
return new RedisReplayRepository(); | ||
}); | ||
|
||
return parent::register(); // TODO: Change the autogenerated stub | ||
parent::register(); // TODO: Change the autogenerated stub | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There is an error in |
||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Protect
static
in line number 9.