-
Notifications
You must be signed in to change notification settings - Fork 486
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
Internationalization - Application Terms of Use #6042
Conversation
@JayanthyChengan overall this looks good. I think we should not have EN for lang for all settings, especially since not all settings are user text, so blank lang, which is default, but then you can add language specific ones if you need. So the logic should be if you don't provide a lang, it returns the default (and most settings would do that); if you do provide a language it looks for that language, but if not available returns the default. |
@scolapasta - Thanks for your review. I would like to add some notes of what I tried. INSERT INTO setting (name, content, lang) org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "setting_pkey" So, I added “lang” to the primary key (name,lang), and updated to default value “en” as primary key cannot be NULL setting_pkey PRIMARY KEY (name,lang) Please add your suggestion. |
Can one of the admins verify this patch? |
Hi @JayanthyChengan OK, I had to do some research, but I have a proposed solution. First, let's add a PK to this table that has no semantic meaning (i.e. just an id). Then we can add unique constraint for name,lang. The issue is that unique constraints don't generally work will null, i.e if you had two rows of ':ApplicationTermsOfUse',null, it would not be treated as unique and we'd have issues. However, I found a (series of) clever solution(s): using coalesce and/or multiple indices. In our case it should be doable with one:
(coalesce returns the first not-null value, so if null, will return ''. We can do this because that would never be a legitimate value for lang - if it wasn't we could use multiple indices). While we're at it it probably makes sense to add a constraints to make sure lang is never '':
Let me know if this makes sense or you'd like some more details. (here is the link to where I discoverd this idea: https://matjaz.it/tutorial-unique-constraint-on-null-values-in-postgresql/) |
Thanks @scolapasta , I will give it a try. |
@scolapasta - Thanks Gustavo and I implemented the suggested solution using coalesce, it worked. Committed the code, please review. Thanks |
@@ -2383,6 +2383,7 @@ staticSearchFields.dvObjectType=Type | |||
staticSearchFields.fileTag=File Tag | |||
staticSearchFields.fileAccess=Access | |||
staticSearchFields.publicationStatus=Publication Status | |||
staticSearchFields.subject_ss=Subject |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JayanthyChengan is this supposed to be part of this PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@scolapasta - Missing term related to facet Internationalization. hope it's okay to add with this PR.
@@ -0,0 +1,13 @@ | |||
ALTER TABLE ONLY setting DROP CONSTRAINT setting_pkey ; | |||
|
|||
ALTER TABLE setting ADD COLUMN ID SERIAL PRIMARY KEY; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does this add values for the id for existing settings? (it must, right?)
Also, can you update the file name to reference 4.16 (the latest release?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@scolapasta - Yes, it adds serial number to all existing rows. I will rename the file and commit it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
committed the changes.
@JayanthyChengan Would you refresh from develop? The app version is still 4.15.1. Thanks! |
@kcondon - merged the latest develop branch. |
@JayanthyChengan thanks. I am seeing a 500 error when I load the app in a browser with a sql error in logs: |
Hi @kcondon - there is a setting table update, I am not sure whether you executed the db update script? Let me know if the error still exists. Thanks |
@JayanthyChengan We now use an automatic db update management s/w called Flyway. We no longer use the updates dir method. If you would use the Flyway method, that would be great: http://guides.dataverse.org/en/4.16/developers/sql-upgrade-scripts.html# Thanks! |
@kcondon - Added the db upgrade file as per Flyway method. Please verify it now. Thanks |
@JayanthyChengan Almost there! The new script needs to be renamed: you need to use a capital V rather a v at the beginning of the script name, otherwise flyway ignores the script. Annoying, I know. |
@kcondon - got it, and renamed the file . |
Related Issues