Skip to content

Commit

Permalink
Fixed Postgres installation
Browse files Browse the repository at this point in the history
Fixes #15504
  • Loading branch information
brandonkelly committed Aug 10, 2024
1 parent b60be04 commit bf1ce12
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 5 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
# Release Notes for Craft CMS 5

## Unreleased

- Added `craft\db\afterDown()`.
- Added `craft\db\afterUp()`.
- Fixed a bug where Link fields weren’t allowing category groups to be selected, if they didn’t have a URI format for the primary site.
- Fixed an error that occurred when installing Craft in PostgreSQL. ([#15504](https://github.com/craftcms/cms/issues/15504))

## 5.3.1 - 2024-08-07

Expand Down
26 changes: 22 additions & 4 deletions src/db/Migration.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,21 @@ public function up(bool $throwExceptions = false): bool
return false;
}

$this->afterUp();
return true;
}

/**
* This method contains the logic to be executed after applying this migration.
*
* @since 5.3.2
*/
protected function afterUp(): void
{
// Fire an 'afterUp' event
if ($this->hasEventHandlers(self::EVENT_AFTER_UP)) {
$this->trigger(self::EVENT_AFTER_UP);
}

return true;
}

/**
Expand Down Expand Up @@ -96,12 +105,21 @@ public function down(bool $throwExceptions = false): bool
return false;
}

$this->afterDown();
return true;
}

/**
* This method contains the logic to be executed after removing this migration.
*
* @since 5.3.2
*/
protected function afterDown(): void
{
// Fire an 'afterDown' event
if ($this->hasEventHandlers(self::EVENT_AFTER_DOWN)) {
$this->trigger(self::EVENT_AFTER_DOWN);
}

return true;
}

// Schema Builder Methods
Expand Down
10 changes: 9 additions & 1 deletion src/migrations/Install.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,18 @@ public function safeUp(): bool
$this->createIndexes();
$this->addForeignKeys();
$this->db->getSchema()->refresh();
$this->insertDefaultData();
return true;
}

/**
* @inheritdoc
*/
protected function afterUp(): void
{
$this->insertDefaultData();
parent::afterUp();
}

/**
* @inheritdoc
*/
Expand Down

0 comments on commit bf1ce12

Please sign in to comment.