From b82abcda4114b9da6b2ae5dbec3c5ad90665e3ee Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Wed, 9 Jun 2021 09:54:32 +0800 Subject: [PATCH] Add test for #1182 --- integrations/engine_test.go | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/integrations/engine_test.go b/integrations/engine_test.go index a06d91aa..017fa604 100644 --- a/integrations/engine_test.go +++ b/integrations/engine_test.go @@ -262,3 +262,25 @@ func TestGetColumns(t *testing.T) { assert.Equal(t, comment, hasComment) assert.Zero(t, noComment) } + +func TestIndex(t *testing.T) { + assert.NoError(t, PrepareEngine()) + + if testEngine.Dialect().URI().DBType != schemas.POSTGRES { + t.Skip() + return + } + + type Machine struct { + Id int64 + Lat float64 + Lng float64 + } + + assertSync(t, new(Machine)) + + _, err := testEngine.Exec("CREATE INDEX ll_idx on machine USING gist(ll_to_earth(lat, lng));") + assert.NoError(t, err) + + assertSync(t, new(Machine)) +}