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

fix: Fix old migrations for Keto 0.8, column nit is not exists in table network #1573

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

DarkDrim
Copy link

Updated old migrations (for update between keto 0.7 and 0.8)
Table networks don't have column nit:
telegram-cloud-photo-size-2-5366126015455288294-y

So correct query should be

DELETE FROM keto_relation_tuples WHERE nid NOT IN (SELECT id FROM networks);

I've faced this issue when migrate Keto from 0.7 to 0.8:

20220217152313000000  nid_fk    Pending  
Applying migrations...
Could not apply migrations: ERROR: insert or update on table "keto_relation_tuples" violates foreign key constraint "keto_relation_tuples_nid_fk" (SQLSTATE 23503)
error executing migrations/sql/20220217152313000000_nid_fk.up.sql, sql: -- These tuples can't be retrieved over any API (and also not inserted by any API) because we always add a WHERE nid = ? clause to the queries.
-- This DELETE statement is here to ensure that we don't run into problems where the nid column is not properly set. Should not happen if only the official API is used.
DELETE FROM keto_relation_tuples WHERE nid NOT IN (SELECT nid FROM networks);
  • I have read the contributing guidelines.
  • I have referenced an issue containing the design document if my change
    introduces a new feature.
  • I am following the
    contributing code guidelines.
  • I have read the security policy.
  • I confirm that this pull request does not address a security
    vulnerability. If this pull request addresses a security vulnerability, I
    confirm that I got the approval (please contact
    [email protected]) from the maintainers to push
    the changes.
  • I have added tests that prove my fix is effective or that my feature
    works.
  • I have added or changed the documentation.

@CLAassistant
Copy link

CLAassistant commented Aug 27, 2024

CLA assistant check
All committers have signed the CLA.

@DarkDrim DarkDrim changed the title Fix old migrations for Keto 0.8, column nit is not exists in table network fix: Fix old migrations for Keto 0.8, column nit is not exists in table network Aug 27, 2024
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