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

TASK: Core and neos schemas for pgsql and mysql #5398

Open
wants to merge 1 commit into
base: 9.0
Choose a base branch
from

Conversation

kitsunet
Copy link
Member

@kitsunet kitsunet commented Dec 7, 2024

Related: #3855

Extends the ideas of the DbalSchemaFactory and provides separate implementations for MySql/MariaDB and PostgreSQL, allowing all core tables to be created on both platforms.

@kitsunet kitsunet requested review from bwaidelich, mhsdesign and dlubitz and removed request for bwaidelich December 7, 2024 14:58
Copy link
Member

@mhsdesign mhsdesign left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice ❤️ so does that mean well have postgresql after all for 9.0? Then we should also consider enabling the test to run on postgresql again otherwise we cant be sure it really works.

regarding the warnings, id supress them in the baseline via:

see https://phpstan.org/user-guide/ignoring-errors#generate-an-ignoreerrors-entry

		-
			message: "#^The internal method \"Neos\\\\ContentRepository\\\\Core\\\\Infrastructure\\\\SchemaServiceInterface\\:\\:.*\" is called\\.$#"
			path: Neos.Neos/Classes/FrontendRouting/Projection/DocumentUriPathSchemaBuilder.php

@kitsunet
Copy link
Member Author

kitsunet commented Dec 7, 2024

Nope unfortunately that part is not uite as easy. The dbal adapter queries are still very much specific for my/maria. I might look into that too, but at least the schemas work now.

@mhsdesign
Copy link
Member

so that pr fixes the part that the uri path projection and change projection work with posgresql: #3855 (comment)

@mhsdesign
Copy link
Member

we could add a todo to the postgre adapter to use the SchemaService too once work is continued there so we dont duplicate this information if we have it already nicely now

@kitsunet
Copy link
Member Author

kitsunet commented Dec 7, 2024

ok WTF,

the tests say:

  • Locking phpstan/phpstan (1.12.12)

My phpstan will not update past 1.10.13 resulting in a different baseline that fails here.
Is phpstan maybe a bit brittle?

@kitsunet
Copy link
Member Author

kitsunet commented Dec 7, 2024

Right because neos/rector pins it to 1.10.13... WHY

@mhsdesign
Copy link
Member

jup because it needs phpstan php dependencies or sth. one of the reasons why you must not install rector in the same installation. I have it as a plain composer project because of that.

@kitsunet
Copy link
Member Author

kitsunet commented Dec 7, 2024

That is... bad?

@dlubitz
Copy link
Contributor

dlubitz commented Dec 8, 2024

But we know this since month an it's documented here: https://github.com/neos/rector#Installation

@bwaidelich
Copy link
Member

tbh, I'm a bit skeptical about this PR because it introduces interfaces and factories over what is called a DB abstraction and with that removes colocation of common concepts (i.e. I would prefer to keep common parts together and differences explicit) e.g. via:

    public function columnForNodeAnchorPoint(string $columnName): Column
    {
        // on PostgreSQL we use a string type for anchor points because....
        return (new Column($columnName, Type::getType($this->isPostgreSQL() ? Types::BIGINT : Types::STRING)))
            ->setNotnull(true);
    }

    public function columnForContentStreamId(string $columnName): Column
    {
        return (new Column($columnName, Type::getType(Types::STRING)))
            ->setLength(36);
    }

But then again, ofc it's great to have PG support fixed and we could always re-evaluate that part later

@kitsunet
Copy link
Member Author

kitsunet commented Dec 9, 2024

Yep we could totally just do that in a single class, I was thinking maybe sqlite support might follow at some point, surely not for production use, but could be useful for some testing purposes. I would be happy to not spend too much time on this right now as it's all internal but I can refactor it back into a single class ofc.

Comment on lines 50 to 59
/**
* The ContentStreamId is generally a UUID, therefore not a real "string" but at the moment a strified identifier,
* we can safely store it as binary string as the charset doesn't matter
* for the characters we use (they are all asscii).
*
* We should however reduce the allowed size to 36 like suggested
* here in the schema and as further improvement store the UUID in a more DB friendly format.
*
* @see ContentStreamId
*/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it seems they are the same comments like in the interface? i would just like to remove them all in this class then. Comments get outdated so easily and duplicating them is even worse (especially if its internal and no one reads them here ^^ )

Suggested change
/**
* The ContentStreamId is generally a UUID, therefore not a real "string" but at the moment a strified identifier,
* we can safely store it as binary string as the charset doesn't matter
* for the characters we use (they are all asscii).
*
* We should however reduce the allowed size to 36 like suggested
* here in the schema and as further improvement store the UUID in a more DB friendly format.
*
* @see ContentStreamId
*/
/**
* The ContentStreamId is generally a UUID, therefore not a real "string" but at the moment a strified identifier,
* we can safely store it as binary string as the charset doesn't matter
* for the characters we use (they are all asscii).
*
* We should however reduce the allowed size to 36 like suggested
* here in the schema and as further improvement store the UUID in a more DB friendly format.
*
* @see ContentStreamId
*/

@dlubitz
Copy link
Contributor

dlubitz commented Dec 9, 2024

tbh, I'm a bit skeptical about this PR because it introduces interfaces and factories over what is called a DB abstraction

I agree here. But I think we need some abstraction for a real Postgres adapter later to use Postgres specific (graph) features.

Related: #3855

Extends the ideas of the DbalSchemaFactory and provides separate implementations for MySql/MariaDB and PostgreSQL, allowing all core tables to be created on both platforms.
@kitsunet kitsunet force-pushed the task/schema-postgresql branch from 49f23e4 to 405d66a Compare December 13, 2024 13:53
@kitsunet
Copy link
Member Author

There we go, nice and simple, just a couple of ifs, checking platforms, but essentially doing the same thing as the change originally.

Copy link
Member

@bwaidelich bwaidelich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lovely, thanks a lot for the follow-up, IMO that is much easier to comprehend now <3

+1 by reading

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.

4 participants