What are the Slack Archives?
It’s a history of our time together in the Slack Community! There’s a ton of knowledge in here, so feel free to search through the archives for a possible answer to your question.
Because this space is not active, you won’t be able to create a new post or comment here. If you have a question or want to start a discussion about something, head over to our categories and pick one to post in! You can always refer back to a post from Slack Archives if needed; just copy the link to use it as a reference..
Hello! Which is the best approach if I want to replace a unique constraint as group. For example in
Comments
-
Did I got you right, you want to replace an existing unique constraint or better extend it with an additional field?
If that’s the question, just add a file Pyz/Zed/Quote/Persistence/Propel/Schema/spy_quote.schema.xml with the follwing content:
<?xml version=“1.0”?>
” name=“zed” xsi:noNamespaceSchemaLocation=“http://static.spryker.com/schema-01.xsd” namespace=“Orm\Zed\Quote\Persistence” package=“src.Orm.Zed.Quote.Persistence”>” /> 0 -
I did that, but the old constraint is still there and works. My constraint is not applied....
0 -
And you did a console propel:schema:copy && propel:diff && propel:migrate && propel:model:build (or propel:install as alternative)?
What’s in you generated migration file?0 -
My contrait is created in DB, but not working. Is used the Spryker contraint
0 -
What DB do you use?
Do you have null values in one of the columns (depending on the DB null values are ignored for constraints)?Did you already tested on a database level that the constraint isn’t working (e.g.: Inserting tho datasets with the same name, customer_reference and )?
0 -
Yes,
duplicate key value violates unique constraint "spy_quote-unique-name-customer_reference"
0 -
Than I do not understand the problem, maybe you can give a better explanation what did you expect and what do you get instead.
Maybe you expected that the name of the unique constraint will include your field, that would be a wrong assumption as defines the naming of the constraint. And as you try to overwrite an existing constraint, you shouldn’t change the name.
0 -
I never tested this so this is just a wild guess:
Did you use the exact same name for the constraint as Spryker uses?0 -
I added a new unique constraint and I want to use that. That's it!
0 -
In my schema: ```
<unique name="spy_quote-unique-name-customer_reference-company_reference"> <unique-column name="name"/> <unique-column name="customer_reference"/> <unique-column name="company_reference"/> </unique> </table> ```
0 -
As far as I know you will not be able to remove a constraint that was added by Spryker in the core implementations. Schema files will get merged and unless you actually replace a constaint (hence the name suggestion) it will be there.
0 -
What's wrong with using the same name?
0
Categories
- All Categories
- 42 Getting Started & Guidelines
- 7 Getting Started in the Community
- 8 Additional Resources
- 7 Community Ideas and Feedback
- 76 Spryker News
- 929 Developer Corner
- 787 Spryker Development
- 89 Spryker Dev Environment
- 362 Spryker Releases
- 3 Oryx frontend framework
- 35 Propel ORM
- 68 Community Projects
- 3 Community Ideation Board
- 30 Hackathon
- 3 PHP Bridge
- 6 Gacela Project
- 26 Job Opportunities
- 3.2K 📜 Slack Archives
- 116 Academy
- 5 Business Users
- 370 Docker
- 551 Slack General
- 2K Help
- 75 Knowledge Sharing
- 6 Random Stuff
- 4 Code Testing
- 32 Product & Business Questions
- 70 Spryker Safari Questions
- 50 Random