Skip to content

Commit

Permalink
Merge pull request #4 from whitedigital-eu/0.3.x
Browse files Browse the repository at this point in the history
Alter entity table schema to whitedigital
  • Loading branch information
acirulis authored May 15, 2024
2 parents e223bba + 78323f3 commit 7a4948b
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 12 deletions.
24 changes: 12 additions & 12 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,24 +18,24 @@
"doctrine/doctrine-bundle": "*",
"doctrine/orm": "*",
"doctrine/persistence": "*",
"symfony/config": "^6.3",
"symfony/framework-bundle": "^6.3",
"symfony/http-foundation": "^6.3",
"symfony/http-kernel": "^6.3",
"symfony/property-info": "^6.3",
"symfony/security-core": "^6.3",
"symfony/serializer": "^6.3",
"symfony/translation": "^6.3",
"symfony/validator": "^6.3",
"symfony/config": "*",
"symfony/framework-bundle": "*",
"symfony/http-foundation": "*",
"symfony/http-kernel": "*",
"symfony/property-info": "*",
"symfony/security-core": "*",
"symfony/serializer": "*",
"symfony/translation": "*",
"symfony/validator": "*",
"vich/uploader-bundle": "*",
"whitedigital-eu/entity-resource-mapper-bundle": "^0.23|^0.24"
"whitedigital-eu/entity-resource-mapper-bundle": "*"
},
"require-dev": {
"doctrine/doctrine-fixtures-bundle": "*",
"friendsofphp/php-cs-fixer": "*",
"roave/security-advisories": "dev-latest",
"symfony/dependency-injection": "^6.2",
"symfony/http-client": "^6.2",
"symfony/dependency-injection": "*",
"symfony/http-client": "*",
"whitedigital-eu/config-pack": "^2.1"
},
"conflict": {
Expand Down
26 changes: 26 additions & 0 deletions migrations/Version20240515144134.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php

declare(strict_types=1);

namespace WhiteDigital\StorageItemResource\Migrations;

use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;

final class Version20240515144134 extends AbstractMigration
{
public function getDescription(): string
{
return 'Alter any existing storage_item table to use whitedigital schema';
}

public function up(Schema $schema): void
{
$this->addSql('CREATE SCHEMA IF NOT EXISTS whitedigital');
$this->addSql('ALTER TABLE IF EXISTS storage_item SET SCHEMA whitedigital');
}

public function down(Schema $schema): void
{
}
}
1 change: 1 addition & 0 deletions src/Entity/StorageItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use WhiteDigital\StorageItemResource\StorageItemResourceBundle;

#[ORM\Entity]
#[ORM\Table(schema: 'whitedigital')]
#[Vich\Uploadable]
#[Mapping(StorageItemResource::class)]
class StorageItem extends BaseEntity
Expand Down
8 changes: 8 additions & 0 deletions src/StorageItemResourceBundle.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,14 @@ public function prependExtension(ContainerConfigurator $container, ContainerBuil
],
]);

if ($builder->hasExtension('doctrine_migrations')) {
$container->extension('doctrine_migrations', [
'migrations_paths' => [
'WhiteDigital\StorageItemResource\Migrations' => '%kernel.project_dir%/vendor/whitedigital-eu/storage-item-resource/migrations',
],
]);
}

$this->configureApiPlatformExtension($container, $extensionConfig);
}

Expand Down

0 comments on commit 7a4948b

Please sign in to comment.