Skip to content

Commit ce1c8fa

Browse files
authored
Merge pull request #35 from dfeyer/postgres-migrations
chore: add postgres migrations
2 parents e0ac5ac + 37f2614 commit ce1c8fa

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Neos\Flow\Persistence\Doctrine\Migrations;
6+
7+
use Doctrine\DBAL\Schema\Schema;
8+
use Doctrine\Migrations\AbstractMigration;
9+
10+
/**
11+
* Add Authorization table
12+
*/
13+
final class Version20240111140935 extends AbstractMigration
14+
{
15+
public function getDescription(): string
16+
{
17+
return 'Add Authorization table';
18+
}
19+
20+
public function up(Schema $schema): void
21+
{
22+
$this->abortIf(
23+
!$this->connection->getDatabasePlatform() instanceof \Doctrine\DBAL\Platforms\PostgreSQL100Platform,
24+
"Migration can only be executed safely on '\Doctrine\DBAL\Platforms\PostgreSQL100Platform'."
25+
);
26+
27+
$this->addSql('CREATE TABLE flownative_oauth2_client_authorization (authorizationid VARCHAR(255) NOT NULL, servicename VARCHAR(255) NOT NULL, clientid VARCHAR(255) NOT NULL, granttype VARCHAR(255) NOT NULL, scope VARCHAR(255) NOT NULL, expires TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, serializedaccesstoken TEXT DEFAULT NULL, encryptedserializedaccesstoken TEXT DEFAULT NULL, metadata TEXT DEFAULT NULL, PRIMARY KEY(authorizationid))');
28+
$this->addSql('COMMENT ON COLUMN flownative_oauth2_client_authorization.expires IS \'(DC2Type:datetime_immutable)\'');
29+
}
30+
31+
public function down(Schema $schema): void
32+
{
33+
$this->abortIf(
34+
!$this->connection->getDatabasePlatform() instanceof \Doctrine\DBAL\Platforms\PostgreSQL100Platform,
35+
"Migration can only be executed safely on '\Doctrine\DBAL\Platforms\PostgreSQL100Platform'."
36+
);
37+
38+
$this->addSql('DROP TABLE flownative_oauth2_client_authorization');
39+
}
40+
}

0 commit comments

Comments
 (0)