Skip to content

Conversation

@ewrayjohnson
Copy link

@ewrayjohnson ewrayjohnson commented May 13, 2020

Fixes: Fix - fail to honor non-unique property constraint #389

Connector does not honor non-unique constraint definition for a property declaration in model json file on automigrate.
Example model json file snipet:

"properties": [ 
  "email": {
    "type": "String",
    "index": {
      "unique": false
    }
  }
]

OR

"indexes": [
  "email_ndx" {
    "keys": [ "email" ],
    "options": {
      "unique": false
    }
  }
]

error generated: "could not create unique index "[modelname] _email_idx"

Connector does not honor non-unique constraint definition for a property declaration in model json file on automigrate.  
Example model json file snipet:
"properties": [ 
  "email": {
    "type": "String",
    "index": {
      "unique": false
    }
  }
]

error generated: "could not create unique index "[modelname] _email_idx"
@slnode
Copy link

slnode commented May 13, 2020

Can one of the admins verify this patch? To accept patch and trigger a build add comment ".ok\W+to\W+test."

@dhmlau
Copy link
Member

dhmlau commented May 15, 2020

@ewrayjohnson, thanks for the PR. Could you please take care of a few things first?

  • your PR is out of date, please rebase.
  • Fix the commit linter error:
**************************************************
**
**  Linting commit logs
**
**  2 problems found:
**    8acaa10 - Improved fixed for ignoring creation of non-unique : First line should be 50 characters or less (saw 58)
**    8b0cafc - Fix - fail to honor non-unique property constraint: line 3 longer than 72 characters.
**
**************************************************
  • add some tests to verify your changes.

FYI - Here is the instruction on how to change the commit message: https://help.github.com/en/github/committing-changes-to-your-project/changing-a-commit-message.

Thanks.

@dhmlau dhmlau added the community-contribution Patches contributed by community label May 15, 2020
Copy link
Member

@bajtos bajtos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @ewrayjohnson for the pull request.

Please add tests to verify your fixes and prevent regressions in the future. See test/postgresql.autoupdate.test.js for inspiration. I am not sure if the approach used by the existing tests can verify what indexes are created, feel free to run a direct SQL query to obtain information about the indexes in the database, for example:

ds.execute(
  'SELECT * from information_schema.key_column_usage', 
  function(err, result) => {
    // ...
  }
);

@bajtos bajtos changed the title Patch 1 fix: honor non-unique property constraint May 22, 2020
@bajtos bajtos added the bug label May 22, 2020
@stale
Copy link

stale bot commented Jul 25, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Jul 25, 2020
@stale
Copy link

stale bot commented Aug 8, 2020

This issue has been closed due to continued inactivity. Thank you for your understanding. If you believe this to be in error, please contact one of the code owners, listed in the CODEOWNERS file at the top-level of this repository.

@stale stale bot closed this Aug 8, 2020
@agnes512 agnes512 reopened this Aug 10, 2020
@stale stale bot removed the stale label Aug 10, 2020
@dhmlau
Copy link
Member

dhmlau commented Aug 21, 2020

We just switch the contribution method from CLA to DCO, making your contribution easier in the future. Please sign the commits with DCO by amending your commit messages with -s flag and push the changes again. If you're using the command line, you can:

git commit --amend -s
git push --force-with-lease

Please refer to this docs page for details. Thanks!

For more questions, please join our Slack workspace - #loopback-contributors.

@stale
Copy link

stale bot commented Dec 19, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Dec 19, 2020
@stale
Copy link

stale bot commented Jun 26, 2021

This issue has been closed due to continued inactivity. Thank you for your understanding. If you believe this to be in error, please contact one of the code owners, listed in the CODEOWNERS file at the top-level of this repository.

@stale stale bot closed this Jun 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug community-contribution Patches contributed by community stale

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants