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 Everyone , In my persistence schema file i am having one unique column name , but i am adding
Hello Everyone ,
In my persistence schema file i am having one unique column name , but i am adding one more unique column in existing and run console propel:install .but i am not getting validation on second one which i have added.
This is my existing code
<unique name="pyz_dss_blog-name"> <unique-column name="name"/> </unique>
and currently added unique column name
<unique name="pyz_dss_blog-name"> <unique-column name="name"/> <unique-column name="url"/> </unique>
Comments
-
fsmeier Senior Software Engineer & Developer Enablement Advocate Sprykee Posts: 1,088 ⚖️ - Guardians (admin)
Heyhey, do you want to have uniqueness on name+url in combination or everything in column name and everything in column url should be unique?
0 -
I hope, everything in name and everything in URL should be unique
0 -
is this the correct way to add more than one unique constraints
<unique name="pyz_dss_blog-name"> <unique-column name="name"/> <unique-column name="url"/> </unique>
0 -
no, you need to have separate entries, propel does not support combined keys
0 -
fsmeier Senior Software Engineer & Developer Enablement Advocate Sprykee Posts: 1,088 ⚖️ - Guardians (admin)
@U028VTHNMF1 isnt it exactly what was posted in the question?
0 -
Actually that was he tend to ask, we need to add more than one unique constraints.
0 -
fsmeier Senior Software Engineer & Developer Enablement Advocate Sprykee Posts: 1,088 ⚖️ - Guardians (admin)
So depend on what you want you can have either:
A:<unique name="pyz_dss_blog-name-and-url"> <unique-column name="name"/> <unique-column name="url"/> </unique>
or B:
<unique name="pyz_dss_blog-name"> <unique-column name="name"/> </unique> <unique name="pyz_dss_blog-url"> <unique-column name="url"/> </unique>
A will check for uniqueness in both columns, so col1+col2 have to be unique in combination. for B the values inside each column have to be unique
0 -
@florian.scholz thanks, I got it from @UKHD8KTMF and created it as like B. The thing is am getting error now on alter table.
0 -
@florian.scholz I dropped the constraints created previously and ran propel install with the option B and am getting error
0 -
fsmeier Senior Software Engineer & Developer Enablement Advocate Sprykee Posts: 1,088 ⚖️ - Guardians (admin)
Can you paste the content of
src/Orm/Propel/Schema/pyz_dss_blog.schema.xml
please?0 -
<?xml version="1.0"?> <database xmlns:xsi="<http://www.w3.org/2001/XMLSchema-instance>" name="zed" xsi:noNamespaceSchemaLocation="<http://static.spryker.com/schema-01.xsd>" namespace="Orm\Zed\DssBlog\Persistence" package="src.Orm.Zed.DssBlog.Persistence"> <table name="dss_post" phpName="DssPost"> <column name="id_post" required="true" type="INTEGER" autoIncrement="true" primaryKey="true"/> <column name="title" required="true" size="255" type="VARCHAR"/> <column name="url" required="true" size="255" type="VARCHAR"/> <column name="summary" required="true" type="LONGVARCHAR"/> <column name="content" required="true" type="LONGVARCHAR"/> <column name="author_id" type="INTEGER" required="true"/> <column name="is_published" type="BOOLEAN" required="true" defaultValue="false"/> <column name="created_at" type="TIMESTAMP"/> <column name="updated_at" type="TIMESTAMP"/> <column name="published_at" type="TIMESTAMP"/> <unique name="dss_post-title"> <unique-column name="title" /> </unique> <unique name="dss_post-url"> <unique-column name="url" /> </unique> <id-method-parameter value="dss_post_pk_seq"/> </table> <table name="dss_post_comment" phpName="DssPostComment"> <column name="id_post_comment" required="true" type="INTEGER" autoIncrement="true" primaryKey="true"/> <column name="fk_post" required="true" type="INTEGER" /> <column name="content" required="true" type="LONGVARCHAR"/> <column name="author_id" type="INTEGER" required="true"/> <column name="is_published" type="BOOLEAN" required="true" defaultValue="false"/> <column name="created_at" type="TIMESTAMP"/> <column name="published_at" type="TIMESTAMP"/> <foreign-key name="dss_post_comment-fk_post" foreignTable="dss_post"> <reference local="fk_post" foreign="id_post"/> </foreign-key> <id-method-parameter value="dss_post_comment_pk_seq"/> </table> </database>
0 -
fsmeier Senior Software Engineer & Developer Enablement Advocate Sprykee Posts: 1,088 ⚖️ - Guardians (admin)
Could it be that you have already values inside the table which would break the uniqueness?
0 -
👍
0 -
fsmeier Senior Software Engineer & Developer Enablement Advocate Sprykee Posts: 1,088 ⚖️ - Guardians (admin)
Is the problem solved now? 👀
0 -
@florian.scholz yes, thanks a lot.
0 -
fsmeier Senior Software Engineer & Developer Enablement Advocate Sprykee Posts: 1,088 ⚖️ - Guardians (admin)
perfect! Glad to help
0
Categories
- All Categories
- 42 Getting Started & Guidelines
- 7 Getting Started in the Community
- 8 Additional Resources
- 7 Community Ideas and Feedback
- 77 Spryker News
- 938 Developer Corner
- 795 Spryker Development
- 90 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
- 27 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
- 33 Product & Business Questions
- 69 Spryker Safari Questions
- 50 Random