-
Notifications
You must be signed in to change notification settings - Fork 278
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
globalid is not supported by this command. Use 'migrate diff' instead #3307
Comments
Hey @advdv, The reason you are facing this issue is that the |
Wow, great timing. Thank you, eagerly looking for forward! |
@advdv I have not created the docs for this yet, but here is a small example of how to use the new ent schema loader: data "external_schema" "trigger" {
program = [
"go", "run","-mod=mod", "entgo.io/ent/cmd/ent@master",
"schema", "./ent/schema",
"--dialect", "mysql",
"--version", "8",
"--feature", "sql/globalid"
]
}
data "composite_schema" "ent" {
schema "dev" {
url = data.external_schema.trigger.url
}
schema "dev" {
url = "file://trigger.sql"
}
}
env "local" {
url = data.composite_schema.ent.url
dev = "docker://mysql/8/dev"
} Note, that in order for the unique global id to work, you need to enable the feature in ent (it is called I will have the docs done end of today or tomorrow. |
@masseelch Very cool. I actually started experimenting with it already since i saw the commit ;). We dump the ent schema in sql as part of go generate but nice to know this can also be triggered from Atlas. The only thing that didn't work is the multi-schema setup with annoations as described here: https://entgo.io/docs/multischema-migrations. I adde the schema annotations but the dump didn't use them. All of our Ent sql is in the same schema so this didn't matter but maybe it is something you are not aware of. |
I have a pretty elaborate setup with a composite schema. The relevant parts of my atlas.hcl look like this:
But when i then run the diff command, like so:
atlas migrate diff initial --env=local
It gives me the following error:This seems to be a design decision but i don't really understand why, and I can't find documentation about it. Also the instructions to solve it are weird because i'm running the
migrate diff
command.It works without the
?globalid=1
part, but i'm trying to generate globally unique id columns.The text was updated successfully, but these errors were encountered: