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

added index flags to schema table #308

Merged
merged 1 commit into from
May 1, 2013
Merged

Conversation

bamarni
Copy link
Contributor

@bamarni bamarni commented Apr 20, 2013

This would allow, for example, to create some fulltext indexes with the MysqlPlatform, by passing the "fulltext" flag.

@doctrinebot
Copy link

Hello,

thank you for creating this pull request. I have automatically opened an issue
on our Jira Bug Tracker for you. See the issue link:

http://www.doctrine-project.org/jira/browse/DBAL-500

We use Jira to track the state of pull requests and the versions they got
included in.

@mvrhov
Copy link

mvrhov commented Apr 20, 2013

@bamarni: does this make sense. for example PostgreSQL allows us to define a function call or constrains when creating an index, if we want to support this we will have to add yet another parameter to those functions.. Wouldn't it be better to add support for raw index definition right now? (Just like it's with the columns definition, where you have to specify the rest of the declaration)

@bamarni
Copy link
Contributor Author

bamarni commented Apr 20, 2013

@mvrhov : I understand your concern, personally my goal is to define a fulltext index on an entity mapping, I was planning to then submit a PR to the ORM in order to leverage those "flags" in the different drivers (see https://gist.github.com/bamarni/5362442 for an example).

Then wether it should be abstracted or through database-specific raw definition is not for me to judge, as a side note, this is currently already implemented in the MysqlPlatform (https://github.com/doctrine/dbal/blob/master/lib/Doctrine/DBAL/Platforms/MySqlPlatform.php#L598), but not leveraged at the Schema Table level.

@beberlei what do you think?

@mvrhov
Copy link

mvrhov commented Apr 20, 2013

PostgreSQL allows me to do something like that:

  • expression index:
    CREATE INDEX test1_lower_col1_idx ON test1 (lower(col1));
    CREATE INDEX people_names ON people ((first_name || ' ' || last_name));
  • partial index:
    CREATE INDEX orders_unbilled_index ON orders (order_nr) WHERE billed is not true;

IMO, the "raw" index definition where you specify everything right of CREATE INDEX test1_lower_col1_idx ON would be better.

@bamarni
Copy link
Contributor Author

bamarni commented Apr 23, 2013

I don't really know the internals but I guess then doctrine wouldn't be able to do schema diff for those raw indexes? It'd be something you'll have to keep in mind and handle manually on involved machines in multiple situations (structure changes during development, production database upgrades) while currently I'm only relying on doctrine self-upgrading tools (doctrine:schema:update and doctrine migrations).

So imo it is much more robust to have flags, usually it'd pretty simple to handle, in my use case here it's only 1 keyword to add.

@stof
Copy link
Member

stof commented Apr 23, 2013

@mvrhov as the Index class already has a concept of flags, it makes sense to expose them in the Schema too IMO

beberlei added a commit that referenced this pull request May 1, 2013
added index flags to schema table
@beberlei beberlei merged commit 4b1ad76 into doctrine:master May 1, 2013
@beberlei
Copy link
Member

beberlei commented May 1, 2013

We can always refactor towards "indexDefintion" later

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 29, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants