mirror of
https://github.com/flarum/core.git
synced 2025-08-06 08:27:42 +02:00
Wrap column names; use whereColumn where possible
This commit is contained in:
@@ -19,7 +19,7 @@ return [
|
||||
$schema->getConnection()
|
||||
->table('access_tokens')
|
||||
->whereNotExists(function ($query) {
|
||||
$query->selectRaw(1)->from('users')->whereRaw('id = user_id');
|
||||
$query->selectRaw(1)->from('users')->whereColumn('id', 'user_id');
|
||||
})
|
||||
->delete();
|
||||
|
||||
|
@@ -21,7 +21,7 @@ return [
|
||||
|
||||
$selectId = function ($table, $column) use ($connection) {
|
||||
return new Expression(
|
||||
'('.$connection->table($table)->whereRaw("id = $column")->select('id')->toSql().')'
|
||||
'('.$connection->table($table)->whereColumn('id', $column)->select('id')->toSql().')'
|
||||
);
|
||||
};
|
||||
|
||||
|
@@ -19,10 +19,10 @@ return [
|
||||
$connection = $schema->getConnection();
|
||||
$connection->table('discussion_user')
|
||||
->whereNotExists(function ($query) {
|
||||
$query->selectRaw(1)->from('users')->whereRaw('id = user_id');
|
||||
$query->selectRaw(1)->from('users')->whereColumn('id', 'user_id');
|
||||
})
|
||||
->orWhereNotExists(function ($query) {
|
||||
$query->selectRaw(1)->from('discussions')->whereRaw('id = discussion_id');
|
||||
$query->selectRaw(1)->from('discussions')->whereColumn('id', 'discussion_id');
|
||||
})
|
||||
->delete();
|
||||
|
||||
|
@@ -19,7 +19,7 @@ return [
|
||||
$schema->getConnection()
|
||||
->table('email_tokens')
|
||||
->whereNotExists(function ($query) {
|
||||
$query->selectRaw(1)->from('users')->whereRaw('id = user_id');
|
||||
$query->selectRaw(1)->from('users')->whereColumn('id', 'user_id');
|
||||
})
|
||||
->delete();
|
||||
|
||||
|
@@ -19,7 +19,7 @@ return [
|
||||
$schema->getConnection()
|
||||
->table('group_permission')
|
||||
->whereNotExists(function ($query) {
|
||||
$query->selectRaw(1)->from('groups')->whereRaw('id = group_id');
|
||||
$query->selectRaw(1)->from('groups')->whereColumn('id', 'group_id');
|
||||
})
|
||||
->delete();
|
||||
|
||||
|
@@ -19,10 +19,10 @@ return [
|
||||
$schema->getConnection()
|
||||
->table('group_user')
|
||||
->whereNotExists(function ($query) {
|
||||
$query->selectRaw(1)->from('users')->whereRaw('id = user_id');
|
||||
$query->selectRaw(1)->from('users')->whereColumn('id', 'user_id');
|
||||
})
|
||||
->orWhereNotExists(function ($query) {
|
||||
$query->selectRaw(1)->from('groups')->whereRaw('id = group_id');
|
||||
$query->selectRaw(1)->from('groups')->whereColumn('id', 'group_id');
|
||||
})
|
||||
->delete();
|
||||
|
||||
|
@@ -19,14 +19,14 @@ return [
|
||||
$schema->getConnection()
|
||||
->table('notifications')
|
||||
->whereNotExists(function ($query) {
|
||||
$query->selectRaw(1)->from('users')->whereRaw('id = user_id');
|
||||
$query->selectRaw(1)->from('users')->whereColumn('id', 'user_id');
|
||||
})
|
||||
->delete();
|
||||
|
||||
$schema->getConnection()
|
||||
->table('notifications')
|
||||
->whereNotExists(function ($query) {
|
||||
$query->selectRaw(1)->from('users')->whereRaw('id = from_user_id');
|
||||
$query->selectRaw(1)->from('users')->whereColumn('id', 'from_user_id');
|
||||
})
|
||||
->update(['from_user_id' => null]);
|
||||
|
||||
|
@@ -19,7 +19,7 @@ return [
|
||||
$connection = $schema->getConnection();
|
||||
$connection->table('password_tokens')
|
||||
->whereNotExists(function ($query) {
|
||||
$query->selectRaw(1)->from('users')->whereRaw('id = user_id');
|
||||
$query->selectRaw(1)->from('users')->whereColumn('id', 'user_id');
|
||||
})
|
||||
->delete();
|
||||
|
||||
|
@@ -21,7 +21,7 @@ return [
|
||||
|
||||
$selectId = function ($table, $column) use ($connection) {
|
||||
return new Expression(
|
||||
'('.$connection->table($table)->whereRaw("id = $column")->select('id')->toSql().')'
|
||||
'('.$connection->table($table)->whereColumn('id', $column)->select('id')->toSql().')'
|
||||
);
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user