Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue #212: Implemented enums in database #300

Open
wants to merge 6 commits into
base: 5.0
Choose a base branch
from
Open

Conversation

alexmerlin
Copy link
Member

@MarioRadu @pinclau If you have time to take a look at this PR, it would be helpful.
I followed the same steps as with dotkernel/api#339 but can't figure out what is missing.

The issue is the the same we had before when we tried implementing enums.
Running the command:

vendor/bin/doctrine-migrations diff

will create a new migration even if there were no changes in the entities, with this up():

    public function up(Schema $schema): void
    {
        // this up() migration is auto-generated, please modify it to your needs
        $this->addSql('ALTER TABLE admin CHANGE status status ENUM(\'active\', \'inactive\') DEFAULT \'active\' NOT NULL');
        $this->addSql('ALTER TABLE admin_login CHANGE isMobile isMobile ENUM(\'yes\', \'no\') NOT NULL, CHANGE loginStatus loginStatus ENUM(\'success\', \'failure\') NOT NULL');
    }

and down():

public function down(Schema $schema): void
    {
        // this down() migration is auto-generated, please modify it to your needs
        $this->addSql('ALTER TABLE admin CHANGE status status VARCHAR(0) DEFAULT \'active\' NOT NULL');
        $this->addSql('ALTER TABLE admin_login CHANGE isMobile isMobile VARCHAR(0) NOT NULL, CHANGE loginStatus loginStatus VARCHAR(0) NOT NULL');
    }

Emptying Doctrine cache did not solve the problem.
Any feedback is welcomed!

Signed-off-by: alexmerlin <alex.merlin.1985@gmail.com>
@alexmerlin alexmerlin self-assigned this Nov 15, 2024
@alexmerlin alexmerlin marked this pull request as draft November 15, 2024 19:29
Copy link

github-actions bot commented Nov 15, 2024

Qodana for PHP

It seems all right 👌

No new problems were found according to the checks applied

💡 Qodana analysis was run in the pull request mode: only the changed files were checked
☁️ View the detailed Qodana report

Detected 116 dependencies

Third-party software list

This page lists the third-party software dependencies used in project

Dependency Version Licenses
brick/math 0.12.1 MIT
brick/varexporter 0.5.0 MIT
composer/ca-bundle 1.5.3 MIT
doctrine/collections 2.2.2 MIT
doctrine/common 3.4.5 MIT
doctrine/data-fixtures 1.8.0 MIT
doctrine/dbal 4.2.1 MIT
doctrine/deprecations 1.1.3 MIT
doctrine/event-manager 2.0.1 MIT
doctrine/inflector 2.0.10 MIT
doctrine/instantiator 2.0.0 MIT
doctrine/lexer 3.0.1 MIT
doctrine/migrations 3.8.2 MIT
doctrine/orm 3.3.0 MIT
doctrine/persistence 3.4.0 MIT
dotkernel/dot-authentication 2.4.0 MIT
dotkernel/dot-authorization 3.5.2 MIT
dotkernel/dot-cache 4.1.0 MIT
dotkernel/dot-cli 3.6.1 MIT
dotkernel/dot-controller 3.5.1 MIT
dotkernel/dot-data-fixtures 1.2.3 MIT
dotkernel/dot-dependency-injection 1.1.0 MIT
dotkernel/dot-errorhandler 4.0.0 MIT
dotkernel/dot-event 3.4.2 MIT
dotkernel/dot-flashmessenger 3.5.0 MIT
dotkernel/dot-geoip 3.7.2 MIT
dotkernel/dot-helpers 3.6.0 MIT
dotkernel/dot-log 4.0.4 MIT
dotkernel/dot-mail 4.3.0 MIT
dotkernel/dot-navigation 3.5.1 MIT
dotkernel/dot-rbac-guard 3.5.0 MIT
dotkernel/dot-rbac 3.6.0 MIT
dotkernel/dot-session 5.6.0 MIT
dotkernel/dot-twigrenderer 3.4.3 MIT
fig/http-message-util 1.1.5 MIT
friendsofphp/proxy-manager-lts v1.0.18 MIT
geoip2/geoip2 v3.1.0 Apache-2.0
guzzlehttp/guzzle 7.9.2 MIT
guzzlehttp/promises 2.0.4 MIT
guzzlehttp/psr7 2.7.0 MIT
laminas/laminas-authentication 2.16.0 BSD-3-Clause
laminas/laminas-cli 1.10.0 BSD-3-Clause
laminas/laminas-code 4.16.0 BSD-3-Clause
laminas/laminas-component-installer 3.4.0 BSD-3-Clause
laminas/laminas-config-aggregator 1.17.0 BSD-3-Clause
laminas/laminas-diactoros 3.5.0 BSD-3-Clause
laminas/laminas-escaper 2.14.0 BSD-3-Clause
laminas/laminas-eventmanager 3.13.1 BSD-3-Clause
laminas/laminas-filter 2.39.0 BSD-3-Clause
laminas/laminas-form 3.21.0 BSD-3-Clause
laminas/laminas-httphandlerrunner 2.11.0 BSD-3-Clause
laminas/laminas-hydrator 4.16.0 BSD-3-Clause
laminas/laminas-i18n 2.29.0 BSD-3-Clause
laminas/laminas-inputfilter 2.31.0 BSD-3-Clause
laminas/laminas-json 3.7.0 BSD-3-Clause
laminas/laminas-loader 2.11.0 BSD-3-Clause
laminas/laminas-mail 2.25.1 BSD-3-Clause
laminas/laminas-math 3.7.0 BSD-3-Clause
laminas/laminas-mime 2.12.0 BSD-3-Clause
laminas/laminas-permissions-rbac 3.6.0 BSD-3-Clause
laminas/laminas-servicemanager 3.23.0 BSD-3-Clause
laminas/laminas-session 2.22.0 BSD-3-Clause
laminas/laminas-stdlib 3.20.0 BSD-3-Clause
laminas/laminas-stratigility 3.13.0 BSD-3-Clause
laminas/laminas-translator 1.1.0 BSD-3-Clause
laminas/laminas-validator 2.64.1 BSD-3-Clause
laminas/laminas-view 2.35.0 BSD-3-Clause
maxmind-db/reader v1.12.0 Apache-2.0
maxmind/web-service-common v0.10.0 Apache-2.0
mezzio/mezzio-authentication 1.10.0 BSD-3-Clause
mezzio/mezzio-authorization-rbac 1.8.0 BSD-3-Clause
mezzio/mezzio-authorization 1.10.0 BSD-3-Clause
mezzio/mezzio-cors 1.13.0 BSD-3-Clause
mezzio/mezzio-fastroute 3.12.0 BSD-3-Clause
mezzio/mezzio-helpers 5.17.0 BSD-3-Clause
mezzio/mezzio-router 3.18.0 BSD-3-Clause
mezzio/mezzio-template 2.11.0 BSD-3-Clause
mezzio/mezzio-twigrenderer 2.17.0 BSD-3-Clause
mezzio/mezzio 3.20.1 BSD-3-Clause
nikic/fast-route v1.3.0 BSD-3-Clause
nikic/php-parser v5.3.1 BSD-3-Clause
psr/cache 3.0.0 MIT
psr/container 1.1.2 MIT
psr/event-dispatcher 1.0.0 MIT
psr/http-client 1.0.3 MIT
psr/http-factory 1.1.0 MIT
psr/http-message 2.0 MIT
psr/http-server-handler 1.0.2 MIT
psr/http-server-middleware 1.0.2 MIT
psr/log 3.0.2 MIT
ralouphie/getallheaders 3.0.3 MIT
ramsey/collection 2.0.0 MIT
ramsey/uuid-doctrine 2.1.0 MIT
ramsey/uuid 4.7.6 MIT
roave/psr-container-doctrine 5.5.0 BSD-2-Clause
symfony/cache-contracts v3.5.0 MIT
symfony/cache v7.1.7 MIT
symfony/console v7.1.8 MIT
symfony/deprecation-contracts v3.5.0 MIT
symfony/event-dispatcher-contracts v3.5.0 MIT
symfony/event-dispatcher v7.1.6 MIT
symfony/filesystem v7.1.6 MIT
symfony/polyfill-ctype v1.31.0 MIT
symfony/polyfill-intl-grapheme v1.31.0 MIT
symfony/polyfill-intl-idn v1.31.0 MIT
symfony/polyfill-intl-normalizer v1.31.0 MIT
symfony/polyfill-mbstring v1.31.0 MIT
symfony/polyfill-php80 v1.31.0 MIT
symfony/polyfill-php81 v1.31.0 MIT
symfony/service-contracts v3.5.0 MIT
symfony/stopwatch v7.1.6 MIT
symfony/string v7.1.8 MIT
symfony/var-exporter v7.1.6 MIT
twig/twig v3.15.0 BSD-3-Clause
webimpress/safe-writer 2.2.0 BSD-2-Clause
webmozart/assert 1.11.0 MIT
Contact Qodana team

Contact us at qodana-support@jetbrains.com

Signed-off-by: alexmerlin <alex.merlin.1985@gmail.com>
Signed-off-by: alexmerlin <alex.merlin.1985@gmail.com>
@alexmerlin alexmerlin marked this pull request as ready for review November 20, 2024 14:56
Signed-off-by: alexmerlin <alex.merlin.1985@gmail.com>
@alexmerlin
Copy link
Member Author

@arhimede @MarioRadu @pinclau Found the issue...

@arhimede
Copy link
Member

@arhimede @MarioRadu @pinclau Found the issue...

But why that is an issue ?

Signed-off-by: alexmerlin <alex.merlin.1985@gmail.com>
@alexmerlin
Copy link
Member Author

@arhimede @MarioRadu @pinclau Found the issue...

But why that is an issue ?

Correction: It was this old hack we added ages ago.
The config I mentioned earlier check_database_platform had nothing to do with the issue - I got confused by caching.

@alexmerlin alexmerlin linked an issue Nov 20, 2024 that may be closed by this pull request
@alexmerlin
Copy link
Member Author

One small issue to note: in the migration, the uuid column is not the first one, as it should be.

Signed-off-by: alexmerlin <alex.merlin.1985@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

redefine ENUMs with enumType
2 participants