Skip to content

Commit 4cb006c

Browse files
authored
refactor(database): minor cleanup (#1768)
1 parent ee94b81 commit 4cb006c

File tree

3 files changed

+4
-12
lines changed

3 files changed

+4
-12
lines changed

packages/database/src/Builder/QueryBuilders/InsertQueryBuilder.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -145,18 +145,14 @@ private function convertObjectToArray(object $object, array $excludeProperties =
145145
$data = [];
146146

147147
foreach ($reflection->getPublicProperties() as $property) {
148-
if (! $property->isInitialized($object)) {
148+
if ($property->isUninitialized($object)) {
149149
continue;
150150
}
151151

152152
if ($property->isVirtual()) {
153153
continue;
154154
}
155155

156-
if ($property->isUninitialized($object)) {
157-
continue;
158-
}
159-
160156
$propertyName = $property->getName();
161157

162158
if (! in_array($propertyName, $excludeProperties, strict: true)) {

packages/database/src/Migrations/MigrationManager.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -247,10 +247,6 @@ public function executeDown(MigratesDown $migration): void
247247

248248
$statement = $migration->down();
249249

250-
if ($statement === null) {
251-
return;
252-
}
253-
254250
$query = new Query($statement->compile($this->dialect));
255251

256252
try {
@@ -261,10 +257,10 @@ public function executeDown(MigratesDown $migration): void
261257

262258
$this->database->execute($query);
263259

264-
// Disable foreign key checks
260+
// Enable foreign key checks
265261
new SetForeignKeyChecksStatement(enable: true)->execute($this->dialect, $this->onDatabase);
266262
} catch (QueryWasInvalid $queryWasInvalid) {
267-
// Disable foreign key checks
263+
// Enable foreign key checks
268264
new SetForeignKeyChecksStatement(enable: true)->execute($this->dialect, $this->onDatabase);
269265

270266
event(new MigrationFailed($migration->name, $queryWasInvalid));

packages/database/src/Transactions/GenericTransactionManager.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public function commit(): void
3535

3636
public function rollback(): void
3737
{
38-
$transactionRolledBack = $this->connection->rollBack();
38+
$transactionRolledBack = $this->connection->rollback();
3939

4040
if (! $transactionRolledBack) {
4141
throw new CouldNotRollbackTransaction();

0 commit comments

Comments
 (0)