Skip to content

Conversation

@AliGebily
Copy link
Contributor

Update database sequencers, after importing, to be set to max(autoincrement column) from table, so that when next insertions don't provide value of autoincrement column, as in case of using APIs, it should be set automatically based on last value of sequencers.

…rement column) from table, so that when next insertions don't provide value of autoincrement column, as in case of using APIs, it should be set automatically based on lastvalue of sequencers.
Copy link
Contributor

@maxceem maxceem left a comment

Choose a reason for hiding this comment

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

Thanks, @AliGebily.

It works great, though I have one concern. While we currently follow the format of naming sequences as ${tableName}_${field}_seq someone eventually can make a mistake and name it differently (or maybe even now some model has it with a typo).

Could we get the name of the sequence from Posgresql like this:

SELECT pg_get_serial_sequence('projects', 'id');

image

This should make this script robust and guaranty that we always use the correct name of the sequence. What do you think, does it make sense?

  1. Could you please, add a small comment to the code which updates the sequence value with description of why we do this.

  2. Small formatting issue:

    image

@AliGebily AliGebily requested a review from maxceem April 16, 2020 16:06
@AliGebily
Copy link
Contributor Author

AliGebily commented Apr 16, 2020 via email

Copy link
Contributor

@maxceem maxceem left a comment

Choose a reason for hiding this comment

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

Perfect!

@maxceem maxceem merged commit 740427d into topcoder-platform:feature/export-import Apr 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants