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

migrate fail at ALTER TABLE keto_uuid_mappings DROP CONSTRAINT keto_uuid_mappings_chk_1 #1587

Open
3 of 5 tasks
ealyn opened this issue Sep 20, 2024 · 0 comments
Open
3 of 5 tasks
Labels
bug Something is not working.

Comments

@ealyn
Copy link

ealyn commented Sep 20, 2024

Preflight checklist

Ory Network Project

No response

Describe the bug

The job-migration execute keto migrate up -y --config /etc/config/keto.yaml and output:

error executing migrations/sql/20220513200400000001_uuid-mapping-remove-check.mysql.up.sql, sql: ALTER TABLE keto_uuid_mappings DROP CONSTRAINT keto_uuid_mappings_chk_1;

Reproducing the bug

First time install keto by using helm install, and set this values to running the job-migration:

keto:
  automigration:
    enabled: true

DSN is an empty mysql database

Relevant log output

time=2024-09-20T12:04:41Z level=info msg=No tracer configured - skipping tracing setup audience=application service_name=Ory Keto service_version=v0.12.0-alpha.0
Current status:
Version			Name					Status
20150100000001000000	networks				Applied
20201110175414000000	relationtuple				Applied
20201110175414000001	relationtuple				Applied
20210623162417000000	relationtuple				Applied
20210623162417000001	relationtuple				Applied
20210914134624000000	legacy-cleanup				Applied
20220217152313000000	nid_fk					Applied
20220512151000000000	indices					Applied
20220513200300000000	create-intermediary-uuid-table		Applied
20220513200400000000	create-uuid-mapping-table		Applied
20220513200400000001	uuid-mapping-remove-check		Pending
20220513200500000000	migrate-strings-to-uuids		Pending
20220513200600000000	drop-old-non-uuid-table			Pending
20220513200600000001	drop-old-non-uuid-table			Pending
20230228091200000000	add-on-delete-cascade-to-relationship	Pending
Applying migrations...
time=2024-09-20T12:04:41Z level=info msg=Migration has not yet been applied, running migration. audience=application migration_file=migrations/sql/20220513200400000001_uuid-mapping-remove-check.mysql.up.sql migration_name=uuid-mapping-remove-check service_name=Ory Keto service_version=v0.12.0-alpha.0 version=20220513200400000001
Could not apply migrations: Error 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'CONSTRAINT keto_uuid_mappings_chk_1' at line 1
error executing migrations/sql/20220513200400000001_uuid-mapping-remove-check.mysql.up.sql, sql: ALTER TABLE keto_uuid_mappings DROP CONSTRAINT keto_uuid_mappings_chk_1;

github.com/ory/x/popx.NewMigrationBox.func1.1
	/go/pkg/mod/github.com/ory/[email protected]/popx/migration_box.go:160
github.com/ory/x/popx.(*Migrator).UpTo.func1.2
	/go/pkg/mod/github.com/ory/[email protected]/popx/migrator.go:151
github.com/ory/x/popx.(*Migrator).isolatedTransaction
	/go/pkg/mod/github.com/ory/[email protected]/popx/migrator.go:353
github.com/ory/x/popx.(*Migrator).UpTo.func1
	/go/pkg/mod/github.com/ory/[email protected]/popx/migrator.go:150
github.com/ory/x/popx.(*Migrator).exec
	/go/pkg/mod/github.com/ory/[email protected]/popx/migrator.go:590
github.com/ory/x/popx.(*Migrator).UpTo
	/go/pkg/mod/github.com/ory/[email protected]/popx/migrator.go:97
github.com/ory/x/popx.(*Migrator).Up
	/go/pkg/mod/github.com/ory/[email protected]/popx/migrator.go:86
github.com/ory/keto/cmd/migrate.BoxUp
	/project/cmd/migrate/up.go:91
github.com/ory/keto/cmd/migrate.newUpCmd.func1
	/project/cmd/migrate/up.go:50
github.com/spf13/cobra.(*Command).execute
	/go/pkg/mod/github.com/spf13/[email protected]/command.go:940
github.com/spf13/cobra.(*Command).ExecuteC
	/go/pkg/mod/github.com/spf13/[email protected]/command.go:1068
github.com/spf13/cobra.(*Command).Execute
	/go/pkg/mod/github.com/spf13/[email protected]/command.go:992
github.com/spf13/cobra.(*Command).ExecuteContext
	/go/pkg/mod/github.com/spf13/[email protected]/command.go:985
github.com/ory/keto/cmd.Execute
	/project/cmd/root.go:63
main.main
	/project/main.go:14
runtime.main
	/usr/local/go/src/runtime/proc.go:267
runtime.goexit
	/usr/local/go/src/runtime/asm_amd64.s:1650

Relevant configuration

serve:
  read:
    port: 4466
  write:
    port: 4467
  metrics:
    port: 4468
namespaces:
  - id: 0
    name: sample
dsn: mysql://xx:xx@tcp(xx.rds.ivolces.com:3306)/ory-keto

Version

v0.12.0

On which operating system are you observing this issue?

Linux

In which environment are you deploying?

Kubernetes with Helm

Additional Context

No response

@ealyn ealyn added the bug Something is not working. label Sep 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is not working.
Projects
None yet
Development

No branches or pull requests

1 participant