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

Panic when inspecting pg #557

Closed
bodinsamuel opened this issue Feb 9, 2022 · 7 comments
Closed

Panic when inspecting pg #557

bodinsamuel opened this issue Feb 9, 2022 · 7 comments

Comments

@bodinsamuel
Copy link

Hi team,

Saw the post on HN and wanted to try the tool.
After reading the doc (could be cool to have a simple brew install), got to this step:

atlas schema inspect -d "postgres://postgres:<pwd>@localhost:26432/postgres?sslmode=disable" -w

But the process crashes with the error panic: inconsistent map element types

Click to see stacktrace
panic: inconsistent map element types (cty.Object(map[string]cty.Type{"__ref":cty.String, "column":cty.Map(cty.Object(map[string]cty.Type{"__ref":cty.String, "default":cty.CapsuleWithOps("lit", reflect.TypeOf(schemaspec.LiteralValue{V:""}), &cty.CapsuleOps{GoString:(func(interface {}) string)(nil), TypeGoString:(func(reflect.Type) string)(nil), Equals:(func(interface {}, interface {}) cty.Value)(nil), RawEquals:(func(interface {}, interface {}) bool)(nil), ConversionFrom:(func(cty.Type) func(interface {}, cty.Path) (cty.Value, error))(0x44b6620), ConversionTo:(func(cty.Type) func(cty.Value, cty.Path) (interface {}, error))(nil), ExtensionData:(func(interface {}) interface {})(nil)}), "null":cty.CapsuleWithOps("lit", reflect.TypeOf(schemaspec.LiteralValue{V:""}), &cty.CapsuleOps{GoString:(func(interface {}) string)(nil), TypeGoString:(func(reflect.Type) string)(nil), Equals:(func(interface {}, interface {}) cty.Value)(nil), RawEquals:(func(interface {}, interface {}) bool)(nil), ConversionFrom:(func(cty.Type) func(interface {}, cty.Path) (cty.Value, error))(0x44b6620), ConversionTo:(func(cty.Type) func(cty.Value, cty.Path) (interface {}, error))(nil), ExtensionData:(func(interface {}) interface {})(nil)}), "type":cty.CapsuleWithOps("lit", reflect.TypeOf(schemaspec.LiteralValue{V:""}), &cty.CapsuleOps{GoString:(func(interface {}) string)(nil), TypeGoString:(func(reflect.Type) string)(nil), Equals:(func(interface {}, interface {}) cty.Value)(nil), RawEquals:(func(interface {}, interface {}) bool)(nil), ConversionFrom:(func(cty.Type) func(interface {}, cty.Path) (cty.Value, error))(0x44b6620), ConversionTo:(func(cty.Type) func(cty.Value, cty.Path) (interface {}, error))(nil), ExtensionData:(func(interface {}) interface {})(nil)})})), "foreign_key":cty.Map(cty.Object(map[string]cty.Type{"__ref":cty.String, "columns":cty.CapsuleWithOps("lit", reflect.TypeOf(schemaspec.LiteralValue{V:""}), &cty.CapsuleOps{GoString:(func(interface {}) string)(nil), TypeGoString:(func(reflect.Type) string)(nil), Equals:(func(interface {}, interface {}) cty.Value)(nil), RawEquals:(func(interface {}, interface {}) bool)(nil), ConversionFrom:(func(cty.Type) func(interface {}, cty.Path) (cty.Value, error))(0x44b6620), ConversionTo:(func(cty.Type) func(cty.Value, cty.Path) (interface {}, error))(nil), ExtensionData:(func(interface {}) interface {})(nil)}), "on_delete":cty.CapsuleWithOps("lit", reflect.TypeOf(schemaspec.LiteralValue{V:""}), &cty.CapsuleOps{GoString:(func(interface {}) string)(nil), TypeGoString:(func(reflect.Type) string)(nil), Equals:(func(interface {}, interface {}) cty.Value)(nil), RawEquals:(func(interface {}, interface {}) bool)(nil), ConversionFrom:(func(cty.Type) func(interface {}, cty.Path) (cty.Value, error))(0x44b6620), ConversionTo:(func(cty.Type) func(cty.Value, cty.Path) (interface {}, error))(nil), ExtensionData:(func(interface {}) interface {})(nil)}), "on_update":cty.CapsuleWithOps("lit", reflect.TypeOf(schemaspec.LiteralValue{V:""}), &cty.CapsuleOps{GoString:(func(interface {}) string)(nil), TypeGoString:(func(reflect.Type) string)(nil), Equals:(func(interface {}, interface {}) cty.Value)(nil), RawEquals:(func(interface {}, interface {}) bool)(nil), ConversionFrom:(func(cty.Type) func(interface {}, cty.Path) (cty.Value, error))(0x44b6620), ConversionTo:(func(cty.Type) func(cty.Value, cty.Path) (interface {}, error))(nil), ExtensionData:(func(interface {}) interface {})(nil)}), "ref_columns":cty.CapsuleWithOps("lit", reflect.TypeOf(schemaspec.LiteralValue{V:""}), &cty.CapsuleOps{GoString:(func(interface {}) string)(nil), TypeGoString:(func(reflect.Type) string)(nil), Equals:(func(interface {}, interface {}) cty.Value)(nil), RawEquals:(func(interface {}, interface {}) bool)(nil), ConversionFrom:(func(cty.Type) func(interface {}, cty.Path) (cty.Value, error))(0x44b6620), ConversionTo:(func(cty.Type) func(cty.Value, cty.Path) (interface {}, error))(nil), ExtensionData:(func(interface {}) interface {})(nil)})})), "index":cty.Map(cty.Object(map[string]cty.Type{"__ref":cty.String, "columns":cty.CapsuleWithOps("lit", reflect.TypeOf(schemaspec.LiteralValue{V:""}), &cty.CapsuleOps{GoString:(func(interface {}) string)(nil), TypeGoString:(func(reflect.Type) string)(nil), Equals:(func(interface {}, interface {}) cty.Value)(nil), RawEquals:(func(interface {}, interface {}) bool)(nil), ConversionFrom:(func(cty.Type) func(interface {}, cty.Path) (cty.Value, error))(0x44b6620), ConversionTo:(func(cty.Type) func(cty.Value, cty.Path) (interface {}, error))(nil), ExtensionData:(func(interface {}) interface {})(nil)}), "on":cty.Map(cty.Object(map[string]cty.Type{"__ref":cty.String, "column":cty.CapsuleWithOps("lit", reflect.TypeOf(schemaspec.LiteralValue{V:""}), &cty.CapsuleOps{GoString:(func(interface {}) string)(nil), TypeGoString:(func(reflect.Type) string)(nil), Equals:(func(interface {}, interface {}) cty.Value)(nil), RawEquals:(func(interface {}, interface {}) bool)(nil), ConversionFrom:(func(cty.Type) func(interface {}, cty.Path) (cty.Value, error))(0x44b6620), ConversionTo:(func(cty.Type) func(cty.Value, cty.Path) (interface {}, error))(nil), ExtensionData:(func(interface {}) interface {})(nil)}), "desc":cty.CapsuleWithOps("lit", reflect.TypeOf(schemaspec.LiteralValue{V:""}), &cty.CapsuleOps{GoString:(func(interface {}) string)(nil), TypeGoString:(func(reflect.Type) string)(nil), Equals:(func(interface {}, interface {}) cty.Value)(nil), RawEquals:(func(interface {}, interface {}) bool)(nil), ConversionFrom:(func(cty.Type) func(interface {}, cty.Path) (cty.Value, error))(0x44b6620), ConversionTo:(func(cty.Type) func(cty.Value, cty.Path) (interface {}, error))(nil), ExtensionData:(func(interface {}) interface {})(nil)}), "expr":cty.CapsuleWithOps("lit", reflect.TypeOf(schemaspec.LiteralValue{V:""}), &cty.CapsuleOps{GoString:(func(interface {}) string)(nil), TypeGoString:(func(reflect.Type) string)(nil), Equals:(func(interface {}, interface {}) cty.Value)(nil), RawEquals:(func(interface {}, interface {}) bool)(nil), ConversionFrom:(func(cty.Type) func(interface {}, cty.Path) (cty.Value, error))(0x44b6620), ConversionTo:(func(cty.Type) func(cty.Value, cty.Path) (interface {}, error))(nil), ExtensionData:(func(interface {}) interface {})(nil)})})), "unique":cty.CapsuleWithOps("lit", reflect.TypeOf(schemaspec.LiteralValue{V:""}), &cty.CapsuleOps{GoString:(func(interface {}) string)(nil), TypeGoString:(func(reflect.Type) string)(nil), Equals:(func(interface {}, interface {}) cty.Value)(nil), RawEquals:(func(interface {}, interface {}) bool)(nil), ConversionFrom:(func(cty.Type) func(interface {}, cty.Path) (cty.Value, error))(0x44b6620), ConversionTo:(func(cty.Type) func(cty.Value, cty.Path) (interface {}, error))(nil), ExtensionData:(func(interface {}) interface {})(nil)})})), "primary_key":cty.Map(cty.Object(map[string]cty.Type{"__ref":cty.String, "columns":cty.CapsuleWithOps("lit", reflect.TypeOf(schemaspec.LiteralValue{V:""}), &cty.CapsuleOps{GoString:(func(interface {}) string)(nil), TypeGoString:(func(reflect.Type) string)(nil), Equals:(func(interface {}, interface {}) cty.Value)(nil), RawEquals:(func(interface {}, interface {}) bool)(nil), ConversionFrom:(func(cty.Type) func(interface {}, cty.Path) (cty.Value, error))(0x44b6620), ConversionTo:(func(cty.Type) func(cty.Value, cty.Path) (interface {}, error))(nil), ExtensionData:(func(interface {}) interface {})(nil)})})), "schema":cty.CapsuleWithOps("lit", reflect.TypeOf(schemaspec.LiteralValue{V:""}), &cty.CapsuleOps{GoString:(func(interface {}) string)(nil), TypeGoString:(func(reflect.Type) string)(nil), Equals:(func(interface {}, interface {}) cty.Value)(nil), RawEquals:(func(interface {}, interface {}) bool)(nil), ConversionFrom:(func(cty.Type) func(interface {}, cty.Path) (cty.Value, error))(0x44b6620), ConversionTo:(func(cty.Type) func(cty.Value, cty.Path) (interface {}, error))(nil), ExtensionData:(func(interface {}) interface {})(nil)})}) then cty.Object(map[string]cty.Type{"__ref":cty.String, "column":cty.Map(cty.Object(map[string]cty.Type{"__ref":cty.String, "default":cty.CapsuleWithOps("lit", reflect.TypeOf(schemaspec.LiteralValue{V:""}), &cty.CapsuleOps{GoString:(func(interface {}) string)(nil), TypeGoString:(func(reflect.Type) string)(nil), Equals:(func(interface {}, interface {}) cty.Value)(nil), RawEquals:(func(interface {}, interface {}) bool)(nil), ConversionFrom:(func(cty.Type) func(interface {}, cty.Path) (cty.Value, error))(0x44b6620), ConversionTo:(func(cty.Type) func(cty.Value, cty.Path) (interface {}, error))(nil), ExtensionData:(func(interface {}) interface {})(nil)}), "null":cty.CapsuleWithOps("lit", reflect.TypeOf(schemaspec.LiteralValue{V:""}), &cty.CapsuleOps{GoString:(func(interface {}) string)(nil), TypeGoString:(func(reflect.Type) string)(nil), Equals:(func(interface {}, interface {}) cty.Value)(nil), RawEquals:(func(interface {}, interface {}) bool)(nil), ConversionFrom:(func(cty.Type) func(interface {}, cty.Path) (cty.Value, error))(0x44b6620), ConversionTo:(func(cty.Type) func(cty.Value, cty.Path) (interface {}, error))(nil), ExtensionData:(func(interface {}) interface {})(nil)}), "type":cty.CapsuleWithOps("lit", reflect.TypeOf(schemaspec.LiteralValue{V:""}), &cty.CapsuleOps{GoString:(func(interface {}) string)(nil), TypeGoString:(func(reflect.Type) string)(nil), Equals:(func(interface {}, interface {}) cty.Value)(nil), RawEquals:(func(interface {}, interface {}) bool)(nil), ConversionFrom:(func(cty.Type) func(interface {}, cty.Path) (cty.Value, error))(0x44b6620), ConversionTo:(func(cty.Type) func(cty.Value, cty.Path) (interface {}, error))(nil), ExtensionData:(func(interface {}) interface {})(nil)})})), "foreign_key":cty.Map(cty.Object(map[string]cty.Type{"__ref":cty.String, "columns":cty.CapsuleWithOps("lit", reflect.TypeOf(schemaspec.LiteralValue{V:""}), &cty.CapsuleOps{GoString:(func(interface {}) string)(nil), TypeGoString:(func(reflect.Type) string)(nil), Equals:(func(interface {}, interface {}) cty.Value)(nil), RawEquals:(func(interface {}, interface {}) bool)(nil), ConversionFrom:(func(cty.Type) func(interface {}, cty.Path) (cty.Value, error))(0x44b6620), ConversionTo:(func(cty.Type) func(cty.Value, cty.Path) (interface {}, error))(nil), ExtensionData:(func(interface {}) interface {})(nil)}), "on_delete":cty.CapsuleWithOps("lit", reflect.TypeOf(schemaspec.LiteralValue{V:""}), &cty.CapsuleOps{GoString:(func(interface {}) string)(nil), TypeGoString:(func(reflect.Type) string)(nil), Equals:(func(interface {}, interface {}) cty.Value)(nil), RawEquals:(func(interface {}, interface {}) bool)(nil), ConversionFrom:(func(cty.Type) func(interface {}, cty.Path) (cty.Value, error))(0x44b6620), ConversionTo:(func(cty.Type) func(cty.Value, cty.Path) (interface {}, error))(nil), ExtensionData:(func(interface {}) interface {})(nil)}), "on_update":cty.CapsuleWithOps("lit", reflect.TypeOf(schemaspec.LiteralValue{V:""}), &cty.CapsuleOps{GoString:(func(interface {}) string)(nil), TypeGoString:(func(reflect.Type) string)(nil), Equals:(func(interface {}, interface {}) cty.Value)(nil), RawEquals:(func(interface {}, interface {}) bool)(nil), ConversionFrom:(func(cty.Type) func(interface {}, cty.Path) (cty.Value, error))(0x44b6620), ConversionTo:(func(cty.Type) func(cty.Value, cty.Path) (interface {}, error))(nil), ExtensionData:(func(interface {}) interface {})(nil)}), "ref_columns":cty.CapsuleWithOps("lit", reflect.TypeOf(schemaspec.LiteralValue{V:""}), &cty.CapsuleOps{GoString:(func(interface {}) string)(nil), TypeGoString:(func(reflect.Type) string)(nil), Equals:(func(interface {}, interface {}) cty.Value)(nil), RawEquals:(func(interface {}, interface {}) bool)(nil), ConversionFrom:(func(cty.Type) func(interface {}, cty.Path) (cty.Value, error))(0x44b6620), ConversionTo:(func(cty.Type) func(cty.Value, cty.Path) (interface {}, error))(nil), ExtensionData:(func(interface {}) interface {})(nil)})})), "index":cty.Map(cty.Object(map[string]cty.Type{"__ref":cty.String, "columns":cty.CapsuleWithOps("lit", reflect.TypeOf(schemaspec.LiteralValue{V:""}), &cty.CapsuleOps{GoString:(func(interface {}) string)(nil), TypeGoString:(func(reflect.Type) string)(nil), Equals:(func(interface {}, interface {}) cty.Value)(nil), RawEquals:(func(interface {}, interface {}) bool)(nil), ConversionFrom:(func(cty.Type) func(interface {}, cty.Path) (cty.Value, error))(0x44b6620), ConversionTo:(func(cty.Type) func(cty.Value, cty.Path) (interface {}, error))(nil), ExtensionData:(func(interface {}) interface {})(nil)}), "on":cty.Object(map[string]cty.Type{"__ref":cty.String, "column":cty.CapsuleWithOps("lit", reflect.TypeOf(schemaspec.LiteralValue{V:""}), &cty.CapsuleOps{GoString:(func(interface {}) string)(nil), TypeGoString:(func(reflect.Type) string)(nil), Equals:(func(interface {}, interface {}) cty.Value)(nil), RawEquals:(func(interface {}, interface {}) bool)(nil), ConversionFrom:(func(cty.Type) func(interface {}, cty.Path) (cty.Value, error))(0x44b6620), ConversionTo:(func(cty.Type) func(cty.Value, cty.Path) (interface {}, error))(nil), ExtensionData:(func(interface {}) interface {})(nil)}), "desc":cty.CapsuleWithOps("lit", reflect.TypeOf(schemaspec.LiteralValue{V:""}), &cty.CapsuleOps{GoString:(func(interface {}) string)(nil), TypeGoString:(func(reflect.Type) string)(nil), Equals:(func(interface {}, interface {}) cty.Value)(nil), RawEquals:(func(interface {}, interface {}) bool)(nil), ConversionFrom:(func(cty.Type) func(interface {}, cty.Path) (cty.Value, error))(0x44b6620), ConversionTo:(func(cty.Type) func(cty.Value, cty.Path) (interface {}, error))(nil), ExtensionData:(func(interface {}) interface {})(nil)}), "expr":cty.CapsuleWithOps("lit", reflect.TypeOf(schemaspec.LiteralValue{V:""}), &cty.CapsuleOps{GoString:(func(interface {}) string)(nil), TypeGoString:(func(reflect.Type) string)(nil), Equals:(func(interface {}, interface {}) cty.Value)(nil), RawEquals:(func(interface {}, interface {}) bool)(nil), ConversionFrom:(func(cty.Type) func(interface {}, cty.Path) (cty.Value, error))(0x44b6620), ConversionTo:(func(cty.Type) func(cty.Value, cty.Path) (interface {}, error))(nil), ExtensionData:(func(interface {}) interface {})(nil)})}), "unique":cty.CapsuleWithOps("lit", reflect.TypeOf(schemaspec.LiteralValue{V:""}), &cty.CapsuleOps{GoString:(func(interface {}) string)(nil), TypeGoString:(func(reflect.Type) string)(nil), Equals:(func(interface {}, interface {}) cty.Value)(nil), RawEquals:(func(interface {}, interface {}) bool)(nil), ConversionFrom:(func(cty.Type) func(interface {}, cty.Path) (cty.Value, error))(0x44b6620), ConversionTo:(func(cty.Type) func(cty.Value, cty.Path) (interface {}, error))(nil), ExtensionData:(func(interface {}) interface {})(nil)})})), "primary_key":cty.Map(cty.Object(map[string]cty.Type{"__ref":cty.String, "columns":cty.CapsuleWithOps("lit", reflect.TypeOf(schemaspec.LiteralValue{V:""}), &cty.CapsuleOps{GoString:(func(interface {}) string)(nil), TypeGoString:(func(reflect.Type) string)(nil), Equals:(func(interface {}, interface {}) cty.Value)(nil), RawEquals:(func(interface {}, interface {}) bool)(nil), ConversionFrom:(func(cty.Type) func(interface {}, cty.Path) (cty.Value, error))(0x44b6620), ConversionTo:(func(cty.Type) func(cty.Value, cty.Path) (interface {}, error))(nil), ExtensionData:(func(interface {}) interface {})(nil)})})), "schema":cty.CapsuleWithOps("lit", reflect.TypeOf(schemaspec.LiteralValue{V:""}), &cty.CapsuleOps{GoString:(func(interface {}) string)(nil), TypeGoString:(func(reflect.Type) string)(nil), Equals:(func(interface {}, interface {}) cty.Value)(nil), RawEquals:(func(interface {}, interface {}) bool)(nil), ConversionFrom:(func(cty.Type) func(interface {}, cty.Path) (cty.Value, error))(0x44b6620), ConversionTo:(func(cty.Type) func(cty.Value, cty.Path) (interface {}, error))(nil), ExtensionData:(func(interface {}) interface {})(nil)})}))

goroutine 1 [running]:
github.com/zclconf/go-cty/cty.MapVal(0xc000398ec8)
	/Users/runner/go/pkg/mod/github.com/zclconf/go-cty@v1.8.0/cty/value_init.go:207 +0x47d
ariga.io/atlas/schema/schemaspec/schemahcl.blockVars(0xc0004b9b80, {0x0, 0x0}, 0xc000336c00)
	/Users/runner/go/pkg/mod/ariga.io/atlas@v0.3.3-0.20220203122529-48cb560255ca/schema/schemaspec/schemahcl/context.go:87 +0x253
ariga.io/atlas/schema/schemaspec/schemahcl.evalCtx(0xc00000e180, 0xc000239bc0)
	/Users/runner/go/pkg/mod/ariga.io/atlas@v0.3.3-0.20220203122529-48cb560255ca/schema/schemaspec/schemahcl/context.go:41 +0xc5
ariga.io/atlas/schema/schemaspec/schemahcl.decode(0x7440108, {0xc0003e2a80, 0x63b4, 0x6a80})
	/Users/runner/go/pkg/mod/ariga.io/atlas@v0.3.3-0.20220203122529-48cb560255ca/schema/schemaspec/schemahcl/hcl.go:76 +0x145
ariga.io/atlas/schema/schemaspec/schemahcl.(*state).UnmarshalSpec(0xc000062900, {0xc0003e2a80, 0x63b4, 0x6a80}, {0x4ca9de0, 0xc000296140})
	/Users/runner/go/pkg/mod/ariga.io/atlas@v0.3.3-0.20220203122529-48cb560255ca/schema/schemaspec/schemahcl/hcl.go:55 +0x5d
ariga.io/atlas/sql/postgres.UnmarshalSpec({0xc0003e2a80, 0x63b4, 0x6a80}, {0x656d3a0, 0xc0001b0de0}, {0x4e08660, 0xc0002960f0})
	/Users/runner/go/pkg/mod/ariga.io/atlas@v0.3.3-0.20220203122529-48cb560255ca/sql/postgres/sqlspec.go:39 +0x9b
ariga.io/atlas/sql/postgres.glob..func1({0xc0003e2a80, 0xc0003dc000, 0x63b4}, {0x4e08660, 0xc0002960f0})
	/Users/runner/go/pkg/mod/ariga.io/atlas@v0.3.3-0.20220203122529-48cb560255ca/sql/postgres/sqlspec.go:97 +0x3f
ariga.io/atlantis/ent/schema.validateSchema.func1({0x658e9d0, 0xc000336390}, 0xc000148630)
	/Users/runner/work/ariga/ariga/atlantis/ent/schema/atlasschema.go:98 +0x3d3
ariga.io/atlantis/ent/hook.AtlasSchemaFunc.Mutate(0x6570dc0, {0x658e9d0, 0xc000336390}, {0x65b52f0, 0xc000148630})
	/Users/runner/work/ariga/ariga/atlantis/ent/hook/hook.go:22 +0x49
ariga.io/atlantis/ent/hook.If.func1.1({0x658e9d0, 0xc000336390}, {0x65b52f0, 0xc000148630})
	/Users/runner/work/ariga/ariga/atlantis/ent/hook/hook.go:229 +0x89
entgo.io/ent.MutateFunc.Mutate(0xc000698240, {0x658e9d0, 0xc000336390}, {0x65b52f0, 0xc000148630})
	/Users/runner/go/pkg/mod/entgo.io/ent@v0.10.0/ent.go:347 +0x3d
ariga.io/atlantis/ent/runtime.init.0.func1.1({0x658e9d0, 0xc000336390}, {0x65b52f0, 0xc000148630})
	/Users/runner/work/ariga/ariga/atlantis/ent/runtime/runtime.go:33 +0xa2
entgo.io/ent.MutateFunc.Mutate(0x6596c58, {0x658e9d0, 0xc000336390}, {0x65b52f0, 0xc000148630})
	/Users/runner/go/pkg/mod/entgo.io/ent@v0.10.0/ent.go:347 +0x3d
ariga.io/atlantis/ent.historyMutator.AtlasSchemaHistoryMutateHook.func1({0x658e9d0, 0xc000336390}, {0x65b52f0, 0xc000148630})
	/Users/runner/work/ariga/ariga/atlantis/ent/enthistory.go:54 +0x16c
entgo.io/ent.MutateFunc.Mutate(0x6570dc0, {0x658e9d0, 0xc000336390}, {0x65b52f0, 0xc000148630})
	/Users/runner/go/pkg/mod/entgo.io/ent@v0.10.0/ent.go:347 +0x3d
ariga.io/atlantis/ent.(*AtlasSchemaCreate).Save(0xc0002960a0, {0x658e9d0, 0xc000336390})
	/Users/runner/work/ariga/ariga/atlantis/ent/atlasschema_create.go:97 +0x22c
ariga.io/atlantis/ent.(*AtlasSchemaCreate).SaveX(...)
	/Users/runner/work/ariga/ariga/atlantis/ent/atlasschema_create.go:106
ariga.io/atlantis/cmd/atlas/web.Inspect({0x658e928, 0xc0000c61c0}, 0xc000148580, {0x20b330808, 0x45}, {0x0, 0xc0000c61c0, 0xc0005f4d40})
	/Users/runner/work/ariga/ariga/atlantis/cmd/atlas/web/web.go:55 +0x405
main.initConfig.func1({0x658e928, 0xc0000c61c0}, 0xc0000c61c0)
	/Users/runner/work/ariga/ariga/atlantis/cmd/atlas/main.go:48 +0x46
main.run({0x4ea6bdf, 0xe}, 0x643ff10)
	/Users/runner/work/ariga/ariga/atlantis/cmd/atlas/main.go:77 +0x10c
main.registerWeb.func1(0x6d87460, {0x4e8eb10, 0x3, 0x3})
	/Users/runner/work/ariga/ariga/atlantis/cmd/atlas/main.go:58 +0x25
github.com/spf13/cobra.(*Command).execute(0x6d87460, {0xc0000be5a0, 0x3, 0x3})
	/Users/runner/go/pkg/mod/github.com/spf13/cobra@v1.3.0/command.go:860 +0x5f8
github.com/spf13/cobra.(*Command).ExecuteC(0x6d86a60)
	/Users/runner/go/pkg/mod/github.com/spf13/cobra@v1.3.0/command.go:974 +0x3bc
github.com/spf13/cobra.(*Command).Execute(...)
	/Users/runner/go/pkg/mod/github.com/spf13/cobra@v1.3.0/command.go:902
main.main()
	/Users/runner/work/ariga/ariga/atlantis/cmd/atlas/main.go:35 +0x115

Version

  • atlas CLI version v0.3.3
  • MacOS 12.2

Best Regards,

@yonidavidson
Copy link
Contributor

Hi @bodinsamuel 👋
Thanks for reporting this issue,
Is there a simple way for us to reproduce?
Thanks.

@a8m
Copy link
Member

a8m commented Feb 9, 2022

Hey @bodinsamuel, can you please check if you get this without the -w?

@bodinsamuel
Copy link
Author

bodinsamuel commented Feb 9, 2022

seems to work without the -w it output my schema correctly.
I guess my db has some unexpected keyword, but I can not share the schema since it's company property.

I tried to find a minimum schema to reproduce but seems "random" even though it's probably not ^^
I'll try to dig more

@bodinsamuel
Copy link
Author

bodinsamuel commented Feb 9, 2022

I think I have reduced it down, but not sure why.

atlas schema apply -d "postgres://postgres:<pwd>@localhost:26432/postgres?sslmode=disable" -f main.hcl

# main.hcl
table "states" {
  schema = schema.public
  column "config_id" {
    null = false
    type = uuid
  }
  column "end_at" {
    null = true
    type = timestamp_without_time_zone(6)
  }
  foreign_key "states_id_fkey" {
    columns     = [table.states.column.config_id]
    ref_columns = [table.configs.column.id]
    on_update   = "NO ACTION"
    on_delete   = "CASCADE"
  }
  index "states_config_id_end_at" {
    on {
      column = table.states.column.config_id
    }
    on {
      desc   = true
      column = table.states.column.end_at
    }
    unique = true
  }
}

table "configs" {
  schema = schema.public
  column "id" {
    null = false
    type = uuid
  }
  column "name" {
    null = true
    type = character_varying(255)
  }
  primary_key {
    columns = [table.configs.column.id]
  }
}

schema "public" {
}

@rotemtam
Copy link
Member

rotemtam commented Feb 9, 2022

Thanks for reporting this @bodinsamuel ! Your example
was spot on in helping us triage the issue. Working on a fix now. Will update soon!

@yonidavidson
Copy link
Contributor

Hi @bodinsamuel ,
Thanks again for the hcl schema, it really helped us solve this issue and a fix can be found in our latest URL:

curl -LO https://release.ariga.io/atlas/atlas-darwin-amd64-latest

atlas CLI version

v0.3.3-92362a3e1558-canary

@bodinsamuel
Copy link
Author

it works 🙏🏻
thanks !

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

No branches or pull requests

4 participants