Skip to content

Commit

Permalink
Merge pull request #16 from ger4003/add-postgresql-migration
Browse files Browse the repository at this point in the history
Add migration for PostgreSQL
  • Loading branch information
kitsunet authored Oct 24, 2024
2 parents fb250f4 + 04716b3 commit 66ff828
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions Migrations/Postgresql/Version20240531174227.php
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');
}
}

0 comments on commit 66ff828

Please sign in to comment.