Git Product home page Git Product logo

Comments (3)

pieterlukasse avatar pieterlukasse commented on September 13, 2024 2

@chrisknoll @m0nhawk the migration to fix this could be something like:

SELECT setval('sec_permission_sequence', (select max(id)+1 from sec_permission), false);
DROP SEQUENCE ohdsi.sec_permission_seq;

from webapi.

chrisknoll avatar chrisknoll commented on September 13, 2024

Found the same thing! When I was going through he performance optimization PR, I was looking where permissions were created (sec_permission) and noticed that there's 2 sequences (this is found in my pgAdmin for my local env):

sec_permission_id_seq
sec_permission_sequence

(These are the two that you pionted out above).

Where'd they come from? To find out, I looked at postgres migration scripts and searched for each:

sec_permission_sequence was introduced in migration V1.0.0.9__shrio_security.sql

sec_permission_id_seq was introduced in migration V1.0.11.0_data-cojhort-analysis-permission.

I'm not sure why the latter introduced a new sequence, but probably a developer error where they didn't see it.

But the sec_permission_id_seq is the one used in our JPA entity definition, so that's the only one that matters.

It's unfortunate about that because the naming convention that is used isn't the one we would want: the sequence name should be {table}_sequence (or _seq is also used).

I think the fix here is to introduce a migration that will drop the un-used sequence.

from webapi.

chrisknoll avatar chrisknoll commented on September 13, 2024

Right, but dropping sec_permission_id_seq , but also updating the Entity definition to use the sec_permission_sequence. I think those 2 steps would do it.

from webapi.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.