Skip to content

Commit e98217f

Browse files
committed
Issue #391: Implemented Doctrine table prefixes
Signed-off-by: alexmerlin <[email protected]>
1 parent 5852bb2 commit e98217f

File tree

8 files changed

+223
-25
lines changed

8 files changed

+223
-25
lines changed

bin/doctrine

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,25 @@
33

44
declare(strict_types=1);
55

6+
use Core\App\Event\TablePrefixEventListener;
67
use Doctrine\ORM\EntityManager;
8+
use Doctrine\ORM\Events;
79
use Doctrine\ORM\Tools\Console\ConsoleRunner;
810
use Doctrine\ORM\Tools\Console\EntityManagerProvider\SingleManagerProvider;
11+
use Dot\DataFixtures\Command\ExecuteFixturesCommand;
12+
use Dot\DataFixtures\Command\ListFixturesCommand;
913

1014
require_once 'vendor/autoload.php';
1115

12-
$container = require getcwd() . '/config/container.php' ;
16+
$container = require 'config/container.php';
1317

1418
$entityManager = $container->get(EntityManager::class);
19+
$entityManager->getEventManager()
20+
->addEventListener(Events::loadClassMetadata, $container->get(TablePrefixEventListener::class));
1521

1622
$commands = [
17-
$container->get(Dot\DataFixtures\Command\ExecuteFixturesCommand::class),
18-
$container->get(Dot\DataFixtures\Command\ListFixturesCommand::class),
23+
$container->get(ExecuteFixturesCommand::class),
24+
$container->get(ListFixturesCommand::class),
1925
];
2026

21-
ConsoleRunner::run(
22-
new SingleManagerProvider($entityManager),
23-
$commands
24-
);
27+
ConsoleRunner::run(new SingleManagerProvider($entityManager), $commands);

config/autoload/local.php.dist

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,17 @@ $baseUrl = 'http://localhost:8080';
1313

1414
$databases = [
1515
'default' => [
16-
'host' => 'localhost',
17-
'dbname' => 'dotkernel',
18-
'user' => '',
19-
'password' => '',
20-
'port' => 3306,
21-
'driver' => 'pdo_mysql',
22-
'charset' => 'utf8mb4',
23-
'collate' => 'utf8mb4_general_ci',
16+
'host' => 'localhost',
17+
'dbname' => 'dotkernel',
18+
'user' => '',
19+
'password' => '',
20+
'port' => 3306,
21+
'driver' => 'pdo_mysql',
22+
'charset' => 'utf8mb4',
23+
'collate' => 'utf8mb4_general_ci',
24+
'table_prefix' => '',
2425
],
25-
// you can add more database connections into this array
26+
// you can add more database connections to this array
2627
];
2728

2829
return [

config/cli-config.php

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,20 @@
22

33
declare(strict_types=1);
44

5+
use Core\App\Event\TablePrefixEventListener;
56
use Doctrine\Migrations\Configuration\EntityManager\ExistingEntityManager;
67
use Doctrine\Migrations\Configuration\Migration\ConfigurationArray;
78
use Doctrine\Migrations\DependencyFactory;
89
use Doctrine\ORM\EntityManager;
10+
use Doctrine\ORM\Events;
911

10-
$container = require __DIR__ . '/container.php';
12+
$container = require 'config/container.php';
13+
14+
$entityManager = $container->get(EntityManager::class);
15+
$entityManager->getEventManager()
16+
->addEventListener(Events::loadClassMetadata, $container->get(TablePrefixEventListener::class));
1117

1218
return DependencyFactory::fromEntityManager(
13-
new ConfigurationArray(
14-
$container->get('config')['doctrine']['migrations']
15-
),
16-
new ExistingEntityManager(
17-
$container->get(EntityManager::class)
18-
)
19+
new ConfigurationArray($container->get('config')['doctrine']['migrations']),
20+
new ExistingEntityManager($entityManager)
1921
);

log/.gitignore

100644100755
File mode changed.

src/Core/src/App/src/ConfigProvider.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77
use Core\App\Command\RouteListCommand;
88
use Core\App\DBAL\Types\SuccessFailureEnumType;
99
use Core\App\DBAL\Types\YesNoEnumType;
10+
use Core\App\Event\TablePrefixEventListener;
1011
use Core\App\Factory\EntityListenerResolverFactory;
12+
use Core\App\Factory\TablePrefixDelegatorFactory;
1113
use Core\App\Resolver\EntityListenerResolver;
1214
use Core\App\Service\MailService;
1315
use Doctrine\ORM\EntityManager;
@@ -23,6 +25,7 @@
2325
use Dot\Mail\Factory\MailOptionsAbstractFactory;
2426
use Dot\Mail\Factory\MailServiceAbstractFactory;
2527
use Dot\Mail\Service\MailService as DotMailService;
28+
use Mezzio\Application;
2629
use Ramsey\Uuid\Doctrine\UuidBinaryOrderedTimeType;
2730
use Ramsey\Uuid\Doctrine\UuidBinaryType;
2831
use Ramsey\Uuid\Doctrine\UuidType;
@@ -117,15 +120,19 @@ public function __invoke(): array
117120
private function getDependencies(): array
118121
{
119122
return [
120-
'factories' => [
123+
'delegators' => [
124+
Application::class => [TablePrefixDelegatorFactory::class],
125+
],
126+
'factories' => [
121127
'doctrine.entity_manager.orm_default' => EntityManagerFactory::class,
122128
'dot-mail.options.default' => MailOptionsAbstractFactory::class,
123129
'dot-mail.service.default' => MailServiceAbstractFactory::class,
124130
EntityListenerResolver::class => EntityListenerResolverFactory::class,
125131
MailService::class => AttributedServiceFactory::class,
126132
RouteListCommand::class => AttributedServiceFactory::class,
133+
TablePrefixEventListener::class => AttributedServiceFactory::class,
127134
],
128-
'aliases' => [
135+
'aliases' => [
129136
DotMailService::class => 'dot-mail.service.default',
130137
EntityManager::class => 'doctrine.entity_manager.orm_default',
131138
EntityManagerInterface::class => 'doctrine.entity_manager.orm_default',
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Core\App\Event;
6+
7+
use Doctrine\ORM\Event\LoadClassMetadataEventArgs;
8+
use Doctrine\ORM\Mapping\ClassMetadata;
9+
use Dot\DependencyInjection\Attribute\Inject;
10+
11+
use function array_key_exists;
12+
use function is_string;
13+
14+
class TablePrefixEventListener
15+
{
16+
private string $prefix = '';
17+
18+
/**
19+
* @phpstan-param array<non-empty-string, mixed> $config
20+
*/
21+
#[Inject(
22+
'config.doctrine.connection.orm_default.params',
23+
)]
24+
public function __construct(array $config)
25+
{
26+
if (array_key_exists('table_prefix', $config) && is_string($config['table_prefix'])) {
27+
$this->prefix = $config['table_prefix'];
28+
}
29+
}
30+
31+
public function loadClassMetadata(LoadClassMetadataEventArgs $eventArgs): void
32+
{
33+
if ($this->prefix === '') {
34+
return;
35+
}
36+
37+
$classMetadata = $eventArgs->getClassMetadata();
38+
if (
39+
! $classMetadata->isInheritanceTypeSingleTable()
40+
|| $classMetadata->getName() === $classMetadata->rootEntityName
41+
) {
42+
$classMetadata->setPrimaryTable([
43+
'name' => $this->prefix . $classMetadata->getTableName(),
44+
]);
45+
}
46+
47+
foreach ($classMetadata->getAssociationMappings() as $fieldName => $mapping) {
48+
if ($mapping['type'] === ClassMetadata::MANY_TO_MANY && $mapping['isOwningSide']) {
49+
$classMetadata->associationMappings[$fieldName]['joinTable']['name'] =
50+
$this->prefix . $mapping['joinTable']['name'];
51+
}
52+
}
53+
}
54+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Core\App\Factory;
6+
7+
use Core\App\Event\TablePrefixEventListener;
8+
use Doctrine\ORM\EntityManagerInterface;
9+
use Doctrine\ORM\Events;
10+
use Mezzio\Application;
11+
use Psr\Container\ContainerExceptionInterface;
12+
use Psr\Container\ContainerInterface;
13+
use Psr\Container\NotFoundExceptionInterface;
14+
15+
class TablePrefixDelegatorFactory
16+
{
17+
/**
18+
* @throws ContainerExceptionInterface
19+
* @throws NotFoundExceptionInterface
20+
*/
21+
public function __invoke(ContainerInterface $container, string $name, callable $callback): Application
22+
{
23+
if ($container->has('doctrine.entity_manager.orm_default')) {
24+
/** @var EntityManagerInterface $entityManager */
25+
$entityManager = $container->get('doctrine.entity_manager.orm_default');
26+
$entityManager->getEventManager()->addEventListener(
27+
Events::loadClassMetadata,
28+
$container->get(TablePrefixEventListener::class)
29+
);
30+
}
31+
32+
return $callback();
33+
}
34+
}
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Core\App\Migration;
6+
7+
use Doctrine\DBAL\Schema\Schema;
8+
use Doctrine\Migrations\AbstractMigration;
9+
10+
/**
11+
* Auto-generated Migration: Please modify to your needs!
12+
*/
13+
final class Version20251104121246 extends AbstractMigration
14+
{
15+
public function getDescription(): string
16+
{
17+
return '';
18+
}
19+
20+
public function up(Schema $schema): void
21+
{
22+
// this up() migration is auto-generated, please modify it to your needs
23+
$this->addSql('CREATE TABLE dk_admin (identity VARCHAR(191) NOT NULL, firstName VARCHAR(191) DEFAULT NULL, lastName VARCHAR(191) DEFAULT NULL, password VARCHAR(191) NOT NULL, status ENUM(\'active\', \'inactive\') DEFAULT \'active\' NOT NULL, uuid BINARY(16) NOT NULL, created DATETIME NOT NULL, updated DATETIME DEFAULT NULL, UNIQUE INDEX UNIQ_BC6297E6A95E9C4 (identity), PRIMARY KEY (uuid)) DEFAULT CHARACTER SET utf8mb4');
24+
$this->addSql('CREATE TABLE dk_admin_roles (userUuid BINARY(16) NOT NULL, roleUuid BINARY(16) NOT NULL, INDEX IDX_9E8CBDA4D73087E9 (userUuid), INDEX IDX_9E8CBDA488446210 (roleUuid), PRIMARY KEY (userUuid, roleUuid)) DEFAULT CHARACTER SET utf8mb4');
25+
$this->addSql('CREATE TABLE dk_admin_login (identity VARCHAR(191) DEFAULT NULL, adminIp VARCHAR(191) DEFAULT NULL, country VARCHAR(191) DEFAULT NULL, continent VARCHAR(191) DEFAULT NULL, organization VARCHAR(191) DEFAULT NULL, deviceType VARCHAR(191) DEFAULT NULL, deviceBrand VARCHAR(191) DEFAULT NULL, deviceModel VARCHAR(40) DEFAULT NULL, isMobile ENUM(\'yes\', \'no\') DEFAULT NULL, osName VARCHAR(191) DEFAULT NULL, osVersion VARCHAR(191) DEFAULT NULL, osPlatform VARCHAR(191) DEFAULT NULL, clientType VARCHAR(191) DEFAULT NULL, clientName VARCHAR(191) DEFAULT NULL, clientEngine VARCHAR(191) DEFAULT NULL, clientVersion VARCHAR(191) DEFAULT NULL, loginStatus ENUM(\'success\', \'fail\') DEFAULT NULL, uuid BINARY(16) NOT NULL, created DATETIME NOT NULL, updated DATETIME DEFAULT NULL, PRIMARY KEY (uuid)) DEFAULT CHARACTER SET utf8mb4');
26+
$this->addSql('CREATE TABLE dk_admin_role (name ENUM(\'admin\', \'superuser\') DEFAULT \'admin\' NOT NULL, uuid BINARY(16) NOT NULL, created DATETIME NOT NULL, updated DATETIME DEFAULT NULL, UNIQUE INDEX UNIQ_E74277525E237E06 (name), PRIMARY KEY (uuid)) DEFAULT CHARACTER SET utf8mb4');
27+
$this->addSql('CREATE TABLE dk_oauth_access_tokens (id INT UNSIGNED AUTO_INCREMENT NOT NULL, user_id VARCHAR(25) DEFAULT NULL, token VARCHAR(100) NOT NULL, revoked TINYINT(1) DEFAULT 0 NOT NULL, expires_at DATETIME NOT NULL, client_id INT UNSIGNED DEFAULT NULL, INDEX IDX_3277905919EB6921 (client_id), PRIMARY KEY (id)) DEFAULT CHARACTER SET utf8mb4');
28+
$this->addSql('CREATE TABLE dk_oauth_access_token_scopes (access_token_id INT UNSIGNED NOT NULL, scope_id INT UNSIGNED NOT NULL, INDEX IDX_2749672C2CCB2688 (access_token_id), INDEX IDX_2749672C682B5931 (scope_id), PRIMARY KEY (access_token_id, scope_id)) DEFAULT CHARACTER SET utf8mb4');
29+
$this->addSql('CREATE TABLE dk_oauth_auth_codes (id INT UNSIGNED AUTO_INCREMENT NOT NULL, revoked TINYINT(1) DEFAULT 0 NOT NULL, expiresDatetime DATETIME DEFAULT NULL, client_id INT UNSIGNED DEFAULT NULL, INDEX IDX_99975E0519EB6921 (client_id), PRIMARY KEY (id)) DEFAULT CHARACTER SET utf8mb4');
30+
$this->addSql('CREATE TABLE dk_oauth_auth_code_scopes (auth_code_id INT UNSIGNED NOT NULL, scope_id INT UNSIGNED NOT NULL, INDEX IDX_9720AA369FEDEE4 (auth_code_id), INDEX IDX_9720AA3682B5931 (scope_id), PRIMARY KEY (auth_code_id, scope_id)) DEFAULT CHARACTER SET utf8mb4');
31+
$this->addSql('CREATE TABLE dk_oauth_clients (id INT UNSIGNED AUTO_INCREMENT NOT NULL, name VARCHAR(40) NOT NULL, secret VARCHAR(100) DEFAULT NULL, redirect VARCHAR(191) NOT NULL, revoked TINYINT(1) DEFAULT 0 NOT NULL, isConfidential TINYINT(1) DEFAULT 0 NOT NULL, user_id BINARY(16) DEFAULT NULL, INDEX IDX_F024D1A0A76ED395 (user_id), PRIMARY KEY (id)) DEFAULT CHARACTER SET utf8mb4');
32+
$this->addSql('CREATE TABLE dk_oauth_refresh_tokens (id INT UNSIGNED AUTO_INCREMENT NOT NULL, revoked TINYINT(1) DEFAULT 0 NOT NULL, expires_at DATETIME NOT NULL, access_token_id INT UNSIGNED DEFAULT NULL, INDEX IDX_4BA657022CCB2688 (access_token_id), PRIMARY KEY (id)) DEFAULT CHARACTER SET utf8mb4');
33+
$this->addSql('CREATE TABLE dk_oauth_scopes (id INT UNSIGNED AUTO_INCREMENT NOT NULL, scope VARCHAR(191) NOT NULL, PRIMARY KEY (id)) DEFAULT CHARACTER SET utf8mb4');
34+
$this->addSql('CREATE TABLE dk_settings (identifier ENUM(\'table_admin_list_selected_columns\', \'table_admin_list_logins_selected_columns\', \'table_user_list_selected_columns\') NOT NULL, value LONGTEXT NOT NULL, uuid BINARY(16) NOT NULL, created DATETIME NOT NULL, updated DATETIME DEFAULT NULL, admin_uuid BINARY(16) DEFAULT NULL, INDEX IDX_8F015ADAF166D246 (admin_uuid), PRIMARY KEY (uuid)) DEFAULT CHARACTER SET utf8mb4');
35+
$this->addSql('CREATE TABLE dk_user (identity VARCHAR(191) NOT NULL, password VARCHAR(191) NOT NULL, status ENUM(\'active\', \'pending\', \'deleted\') DEFAULT \'pending\' NOT NULL, hash VARCHAR(191) NOT NULL, uuid BINARY(16) NOT NULL, created DATETIME NOT NULL, updated DATETIME DEFAULT NULL, UNIQUE INDEX UNIQ_9632195E6A95E9C4 (identity), UNIQUE INDEX UNIQ_9632195ED1B862B8 (hash), PRIMARY KEY (uuid)) DEFAULT CHARACTER SET utf8mb4');
36+
$this->addSql('CREATE TABLE dk_user_roles (userUuid BINARY(16) NOT NULL, roleUuid BINARY(16) NOT NULL, INDEX IDX_C4CEAA47D73087E9 (userUuid), INDEX IDX_C4CEAA4788446210 (roleUuid), PRIMARY KEY (userUuid, roleUuid)) DEFAULT CHARACTER SET utf8mb4');
37+
$this->addSql('CREATE TABLE dk_user_avatar (name VARCHAR(191) NOT NULL, uuid BINARY(16) NOT NULL, created DATETIME NOT NULL, updated DATETIME DEFAULT NULL, userUuid BINARY(16) DEFAULT NULL, UNIQUE INDEX UNIQ_FBBD018BD73087E9 (userUuid), PRIMARY KEY (uuid)) DEFAULT CHARACTER SET utf8mb4');
38+
$this->addSql('CREATE TABLE dk_user_detail (firstName VARCHAR(191) DEFAULT NULL, lastName VARCHAR(191) DEFAULT NULL, email VARCHAR(191) NOT NULL, uuid BINARY(16) NOT NULL, created DATETIME NOT NULL, updated DATETIME DEFAULT NULL, userUuid BINARY(16) DEFAULT NULL, UNIQUE INDEX UNIQ_C3CC0C37D73087E9 (userUuid), PRIMARY KEY (uuid)) DEFAULT CHARACTER SET utf8mb4');
39+
$this->addSql('CREATE TABLE dk_user_reset_password (expires DATETIME NOT NULL, hash VARCHAR(191) NOT NULL, status ENUM(\'completed\', \'requested\') DEFAULT \'requested\' NOT NULL, uuid BINARY(16) NOT NULL, created DATETIME NOT NULL, updated DATETIME DEFAULT NULL, userUuid BINARY(16) DEFAULT NULL, UNIQUE INDEX UNIQ_2A282199D1B862B8 (hash), INDEX IDX_2A282199D73087E9 (userUuid), PRIMARY KEY (uuid)) DEFAULT CHARACTER SET utf8mb4');
40+
$this->addSql('CREATE TABLE dk_user_role (name ENUM(\'guest\', \'user\') DEFAULT \'user\' NOT NULL, uuid BINARY(16) NOT NULL, created DATETIME NOT NULL, updated DATETIME DEFAULT NULL, UNIQUE INDEX UNIQ_A08A8FAC5E237E06 (name), PRIMARY KEY (uuid)) DEFAULT CHARACTER SET utf8mb4');
41+
$this->addSql('ALTER TABLE dk_admin_roles ADD CONSTRAINT FK_9E8CBDA4D73087E9 FOREIGN KEY (userUuid) REFERENCES dk_admin (uuid)');
42+
$this->addSql('ALTER TABLE dk_admin_roles ADD CONSTRAINT FK_9E8CBDA488446210 FOREIGN KEY (roleUuid) REFERENCES dk_admin_role (uuid)');
43+
$this->addSql('ALTER TABLE dk_oauth_access_tokens ADD CONSTRAINT FK_3277905919EB6921 FOREIGN KEY (client_id) REFERENCES dk_oauth_clients (id)');
44+
$this->addSql('ALTER TABLE dk_oauth_access_token_scopes ADD CONSTRAINT FK_2749672C2CCB2688 FOREIGN KEY (access_token_id) REFERENCES dk_oauth_access_tokens (id)');
45+
$this->addSql('ALTER TABLE dk_oauth_access_token_scopes ADD CONSTRAINT FK_2749672C682B5931 FOREIGN KEY (scope_id) REFERENCES dk_oauth_scopes (id)');
46+
$this->addSql('ALTER TABLE dk_oauth_auth_codes ADD CONSTRAINT FK_99975E0519EB6921 FOREIGN KEY (client_id) REFERENCES dk_oauth_clients (id)');
47+
$this->addSql('ALTER TABLE dk_oauth_auth_code_scopes ADD CONSTRAINT FK_9720AA369FEDEE4 FOREIGN KEY (auth_code_id) REFERENCES dk_oauth_auth_codes (id)');
48+
$this->addSql('ALTER TABLE dk_oauth_auth_code_scopes ADD CONSTRAINT FK_9720AA3682B5931 FOREIGN KEY (scope_id) REFERENCES dk_oauth_scopes (id)');
49+
$this->addSql('ALTER TABLE dk_oauth_clients ADD CONSTRAINT FK_F024D1A0A76ED395 FOREIGN KEY (user_id) REFERENCES dk_user (uuid)');
50+
$this->addSql('ALTER TABLE dk_oauth_refresh_tokens ADD CONSTRAINT FK_4BA657022CCB2688 FOREIGN KEY (access_token_id) REFERENCES dk_oauth_access_tokens (id)');
51+
$this->addSql('ALTER TABLE dk_settings ADD CONSTRAINT FK_8F015ADAF166D246 FOREIGN KEY (admin_uuid) REFERENCES dk_admin (uuid)');
52+
$this->addSql('ALTER TABLE dk_user_roles ADD CONSTRAINT FK_C4CEAA47D73087E9 FOREIGN KEY (userUuid) REFERENCES dk_user (uuid)');
53+
$this->addSql('ALTER TABLE dk_user_roles ADD CONSTRAINT FK_C4CEAA4788446210 FOREIGN KEY (roleUuid) REFERENCES dk_user_role (uuid)');
54+
$this->addSql('ALTER TABLE dk_user_avatar ADD CONSTRAINT FK_FBBD018BD73087E9 FOREIGN KEY (userUuid) REFERENCES dk_user (uuid)');
55+
$this->addSql('ALTER TABLE dk_user_detail ADD CONSTRAINT FK_C3CC0C37D73087E9 FOREIGN KEY (userUuid) REFERENCES dk_user (uuid)');
56+
$this->addSql('ALTER TABLE dk_user_reset_password ADD CONSTRAINT FK_2A282199D73087E9 FOREIGN KEY (userUuid) REFERENCES dk_user (uuid)');
57+
}
58+
59+
public function down(Schema $schema): void
60+
{
61+
// this down() migration is auto-generated, please modify it to your needs
62+
$this->addSql('ALTER TABLE dk_admin_roles DROP FOREIGN KEY FK_9E8CBDA4D73087E9');
63+
$this->addSql('ALTER TABLE dk_admin_roles DROP FOREIGN KEY FK_9E8CBDA488446210');
64+
$this->addSql('ALTER TABLE dk_oauth_access_tokens DROP FOREIGN KEY FK_3277905919EB6921');
65+
$this->addSql('ALTER TABLE dk_oauth_access_token_scopes DROP FOREIGN KEY FK_2749672C2CCB2688');
66+
$this->addSql('ALTER TABLE dk_oauth_access_token_scopes DROP FOREIGN KEY FK_2749672C682B5931');
67+
$this->addSql('ALTER TABLE dk_oauth_auth_codes DROP FOREIGN KEY FK_99975E0519EB6921');
68+
$this->addSql('ALTER TABLE dk_oauth_auth_code_scopes DROP FOREIGN KEY FK_9720AA369FEDEE4');
69+
$this->addSql('ALTER TABLE dk_oauth_auth_code_scopes DROP FOREIGN KEY FK_9720AA3682B5931');
70+
$this->addSql('ALTER TABLE dk_oauth_clients DROP FOREIGN KEY FK_F024D1A0A76ED395');
71+
$this->addSql('ALTER TABLE dk_oauth_refresh_tokens DROP FOREIGN KEY FK_4BA657022CCB2688');
72+
$this->addSql('ALTER TABLE dk_settings DROP FOREIGN KEY FK_8F015ADAF166D246');
73+
$this->addSql('ALTER TABLE dk_user_roles DROP FOREIGN KEY FK_C4CEAA47D73087E9');
74+
$this->addSql('ALTER TABLE dk_user_roles DROP FOREIGN KEY FK_C4CEAA4788446210');
75+
$this->addSql('ALTER TABLE dk_user_avatar DROP FOREIGN KEY FK_FBBD018BD73087E9');
76+
$this->addSql('ALTER TABLE dk_user_detail DROP FOREIGN KEY FK_C3CC0C37D73087E9');
77+
$this->addSql('ALTER TABLE dk_user_reset_password DROP FOREIGN KEY FK_2A282199D73087E9');
78+
$this->addSql('DROP TABLE dk_admin');
79+
$this->addSql('DROP TABLE dk_admin_roles');
80+
$this->addSql('DROP TABLE dk_admin_login');
81+
$this->addSql('DROP TABLE dk_admin_role');
82+
$this->addSql('DROP TABLE dk_oauth_access_tokens');
83+
$this->addSql('DROP TABLE dk_oauth_access_token_scopes');
84+
$this->addSql('DROP TABLE dk_oauth_auth_codes');
85+
$this->addSql('DROP TABLE dk_oauth_auth_code_scopes');
86+
$this->addSql('DROP TABLE dk_oauth_clients');
87+
$this->addSql('DROP TABLE dk_oauth_refresh_tokens');
88+
$this->addSql('DROP TABLE dk_oauth_scopes');
89+
$this->addSql('DROP TABLE dk_settings');
90+
$this->addSql('DROP TABLE dk_user');
91+
$this->addSql('DROP TABLE dk_user_roles');
92+
$this->addSql('DROP TABLE dk_user_avatar');
93+
$this->addSql('DROP TABLE dk_user_detail');
94+
$this->addSql('DROP TABLE dk_user_reset_password');
95+
$this->addSql('DROP TABLE dk_user_role');
96+
}
97+
}

0 commit comments

Comments
 (0)