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

Support generated columns in postgres 12 #25

Open
tacman opened this issue Feb 10, 2022 · 0 comments
Open

Support generated columns in postgres 12 #25

tacman opened this issue Feb 10, 2022 · 0 comments

Comments

@tacman
Copy link
Contributor

tacman commented Feb 10, 2022

https://www.postgresql.org/docs/current/ddl-generated-columns.html

full text search seems like a perfect use of generated columns, e.g.

ALTER TABLE se_details ADD COLUMN ts tsvector
GENERATED ALWAYS AS (to_tsvector('english', event_narrative)) STORED;

Since the column with automatically sync with the source data.

I got this idea from

https://blog.crunchydata.com/blog/postgres-full-text-search-a-search-engine-in-a-database

If we bump the minimum up to PHP8 for version 2, we could add attributes in the Entity definition

#[FullText(index: 'main')]

We could then hook into the doctrine migrations and generate a migration that created the proper index.

Then instead of having

@TsVector(name="fts", fields={"name", "city"})

We could tag the name and city properties with the index name, and generate a migration and changed the index accordingly. The seems like it'd a much better DX.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant