diff --git a/Migrations/Postgresql/Version20190108153502.php b/Migrations/Postgresql/Version20190108153502.php new file mode 100644 index 0000000..77bb8f4 --- /dev/null +++ b/Migrations/Postgresql/Version20190108153502.php @@ -0,0 +1,43 @@ +abortIf($this->connection->getDatabasePlatform()->getName() !== 'postgresql', 'Migration can only be executed safely on "postgresql".'); + + $this->addSql('CREATE TABLE dl_assetsync_domain_model_filestate (persistence_object_identifier VARCHAR(40) NOT NULL, resource VARCHAR(40) DEFAULT NULL, sourceidentifier VARCHAR(255) NOT NULL, sourcefileidentifier VARCHAR(255) NOT NULL, sourcefileidentifierhash VARCHAR(40) NOT NULL, sourcefiletime TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, lastsynced TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, PRIMARY KEY(persistence_object_identifier))'); + $this->addSql('CREATE UNIQUE INDEX UNIQ_227AD8ABC91F416 ON dl_assetsync_domain_model_filestate (resource)'); + $this->addSql('ALTER TABLE dl_assetsync_domain_model_filestate ADD CONSTRAINT FK_227AD8ABC91F416 FOREIGN KEY (resource) REFERENCES neos_flow_resourcemanagement_persistentresource (persistence_object_identifier) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE'); + } + + /** + * @param Schema $schema + * @return void + * @throws \Doctrine\DBAL\Migrations\AbortMigrationException + */ + public function down(Schema $schema): void + { + $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'postgresql', 'Migration can only be executed safely on "postgresql".'); + + $this->addSql('DROP TABLE dl_assetsync_domain_model_filestate'); + } +}