Skip to content
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

Avoid double-initialisation of users #175

Open
kronosapiens opened this issue Jun 22, 2024 · 1 comment
Open

Avoid double-initialisation of users #175

kronosapiens opened this issue Jun 22, 2024 · 1 comment
Labels
maintenance Improving existing functionality
Milestone

Comments

@kronosapiens
Copy link
Member

The introduction of bf04fcf has added a race condition by which users are being initialised repeatedly. c566096 is a somewhat hacky fix. The issue should be fixed properly if possible, potentially through the introduction of a database constraint.

@kronosapiens kronosapiens added bug Something isn't working priority High priority issues labels Jun 22, 2024
@kronosapiens
Copy link
Member Author

kronosapiens commented Jun 22, 2024

A partial unique index may do the trick: https://knexjs.org/guide/schema-builder.html#unique

knex.schema.alterTable('job', function (t) {
  t.unique(['account_id', 'program_id'], {
    indexName: 'job_composite_index',
    predicate: knex.whereNotNull('account_id'),
  });

@kronosapiens kronosapiens added maintenance Improving existing functionality and removed priority High priority issues bug Something isn't working labels Jun 22, 2024
@kronosapiens kronosapiens added this to the v0.6.0 milestone Jul 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maintenance Improving existing functionality
Projects
None yet
Development

No branches or pull requests

1 participant