diff --git a/migrations/Version20240514134035.php b/migrations/Version20240514134035.php new file mode 100644 index 0000000..235654e --- /dev/null +++ b/migrations/Version20240514134035.php @@ -0,0 +1,39 @@ +addSql('CREATE SCHEMA IF NOT EXISTS whitedigital'); + $this->addSql('ALTER TABLE audit SET SCHEMA whitedigital'); + $this->addSql('ALTER INDEX whitedigital.idx_9218ff7964c19c1 RENAME TO IDX_1E4A63C64C19C1'); + $this->addSql('ALTER INDEX whitedigital.idx_9218ff79b6bd307f RENAME TO IDX_1E4A63CB6BD307F'); + $this->addSql('ALTER INDEX whitedigital.idx_9218ff7922ffd58c RENAME TO IDX_1E4A63C22FFD58C'); + $this->addSql('ALTER INDEX whitedigital.idx_9218ff79d0494586 RENAME TO IDX_1E4A63CD0494586'); + $this->addSql('ALTER INDEX whitedigital.idx_9218ff798b8e8428 RENAME TO IDX_1E4A63C8B8E8428'); + $this->addSql('ALTER INDEX whitedigital.idx_9218ff7943625d9f RENAME TO IDX_1E4A63C43625D9F'); + } + + public function down(Schema $schema): void + { + $this->addSql('ALTER TABLE audit SET SCHEMA public'); + $this->addSql('ALTER INDEX whitedigital.idx_1e4a63c43625d9f RENAME TO idx_9218ff7943625d9f'); + $this->addSql('ALTER INDEX whitedigital.idx_1e4a63c8b8e8428 RENAME TO idx_9218ff798b8e8428'); + $this->addSql('ALTER INDEX whitedigital.idx_1e4a63cd0494586 RENAME TO idx_9218ff79d0494586'); + $this->addSql('ALTER INDEX whitedigital.idx_1e4a63c22ffd58c RENAME TO idx_9218ff7922ffd58c'); + $this->addSql('ALTER INDEX whitedigital.idx_1e4a63cb6bd307f RENAME TO idx_9218ff79b6bd307f'); + $this->addSql('ALTER INDEX whitedigital.idx_1e4a63c64c19c1 RENAME TO idx_9218ff7964c19c1'); + } +} diff --git a/src/AuditBundle.php b/src/AuditBundle.php index 849a6ea..322fa05 100755 --- a/src/AuditBundle.php +++ b/src/AuditBundle.php @@ -81,6 +81,14 @@ public function prependExtension(ContainerConfigurator $container, ContainerBuil $this->addDoctrineConfig($container, $extensionConfig['default_entity_manager'] ?? 'default', 'Audit', self::MAPPINGS); } + if ($builder->hasExtension('doctrine_migrations')) { + $container->extension('doctrine_migrations', [ + 'migrations_paths' => [ + 'Whitedigital\Audit\Migrations' => '%kernel.project_dir%/vendor/whitedigital-eu/audit-service/migrations', + ], + ]); + } + $this->configureApiPlatformExtension($container, $extensionConfig); } diff --git a/src/Entity/Audit.php b/src/Entity/Audit.php index 05db009..4b01079 100755 --- a/src/Entity/Audit.php +++ b/src/Entity/Audit.php @@ -9,6 +9,7 @@ use WhiteDigital\EntityResourceMapper\Entity\BaseEntity; #[ORM\Entity] +#[ORM\Table(schema: 'whitedigital')] #[ORM\MappedSuperclass] #[ORM\Index(fields: ['category'])] #[ORM\Index(fields: ['message'])]