-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16 from ger4003/add-postgresql-migration
Add migration for PostgreSQL
- Loading branch information
Showing
1 changed file
with
41 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Neos\Flow\Persistence\Doctrine\Migrations; | ||
|
||
use Doctrine\DBAL\Schema\Schema; | ||
use Doctrine\Migrations\AbstractMigration; | ||
|
||
final class Version20240531174227 extends AbstractMigration | ||
{ | ||
public function getDescription(): string | ||
{ | ||
return 'Generate the table for the token authentication.'; | ||
} | ||
|
||
public function up(Schema $schema): void | ||
{ | ||
// this up() migration is auto-generated, please modify it to your needs | ||
$this->abortIf( | ||
!$this->connection->getDatabasePlatform() instanceof \Doctrine\DBAL\Platforms\PostgreSQL100Platform, | ||
"Migration can only be executed safely on '\Doctrine\DBAL\Platforms\PostgreSQL100Platform'." | ||
); | ||
|
||
$this->addSql('CREATE TABLE flownative_tokenauthentication_security_model_hashandroles (hash VARCHAR(255) NOT NULL, roleshash VARCHAR(255) NOT NULL, roles JSON NOT NULL, settings JSON NOT NULL, PRIMARY KEY(hash))'); | ||
$this->addSql('COMMENT ON COLUMN flownative_tokenauthentication_security_model_hashandroles.roles IS \'(DC2Type:json_array)\''); | ||
$this->addSql('COMMENT ON COLUMN flownative_tokenauthentication_security_model_hashandroles.settings IS \'(DC2Type:json_array)\''); | ||
} | ||
|
||
public function down(Schema $schema): void | ||
{ | ||
// this down() migration is auto-generated, please modify it to your needs | ||
$this->abortIf( | ||
!$this->connection->getDatabasePlatform() instanceof \Doctrine\DBAL\Platforms\PostgreSQL100Platform, | ||
"Migration can only be executed safely on '\Doctrine\DBAL\Platforms\PostgreSQL100Platform'." | ||
); | ||
|
||
$this->addSql('CREATE SCHEMA public'); | ||
$this->addSql('DROP TABLE flownative_tokenauthentication_security_model_hashandroles'); | ||
} | ||
} |