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

Invalid definitions for COLUMNSTORE and SPATIAL Indexes for SQL Server #2846

Open
paul-komarnytskyy opened this issue Jun 7, 2024 · 0 comments
Assignees
Labels

Comments

@paul-komarnytskyy
Copy link

COLUMNSTORE and SPATIAL indexes are not properly defined neither when using atlas schema inspect, nor with atlas migrate diff

I create the following index:

CREATE SPATIAL INDEX [SpatialIndex-20240607-140858] ON [dbo].[Users]
(
	[Coordinates]
)USING  GEOGRAPHY_GRID
WITH (GRIDS =(LEVEL_1 = MEDIUM,LEVEL_2 = MEDIUM,LEVEL_3 = MEDIUM,LEVEL_4 = MEDIUM),
CELLS_PER_OBJECT = 16, PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO

After atlas schema inspect it's definition inside test.hcl is as follows:

 index "SpatialIndex-20240607-140858" {
    type = SPATIAL
  }

Migration generated by atlas migrate diff from the database creates the following code inside the migration:

-- Create index "SpatialIndex-20240607-140858" to table: "Users"
CREATE SPATIAL INDEX [SpatialIndex-20240607-140858] ON [dbo].[Users] ();

Obviously, when trying to apply such a migration, it fails:
image

The same happens with COLUMNSTORE index:

SQL to create the index inside the database:

CREATE NONCLUSTERED COLUMNSTORE INDEX [NonClusteredColumnStoreIndex-20240607-140323] ON [dbo].[Users]
(
	[Name],
	[Email]
)WITH (DROP_EXISTING = OFF, COMPRESSION_DELAY = 0, DATA_COMPRESSION = COLUMNSTORE) ON [PRIMARY]
GO

Index definition inside test.hcl after atlas schema inspect:

index "NonClusteredColumnStoreIndex-20240607-140323" {
    nonclustered = true
    type         = COLUMNSTORE
  }

Migration created with atlas migrate diff from the db:

-- Create index "NonClusteredColumnStoreIndex-20240607-140323" to table: "Users"
CREATE NONCLUSTERED COLUMNSTORE INDEX [NonClusteredColumnStoreIndex-20240607-134450] ON [dbo].[Users] ();

Additional info:
atlas version v0.23.1-ccbf575-canary
SQL Server 16.0.1115.1
docker image/url used for "dev-url" param "docker://sqlserver/2022-latest/dev?mode=database"

@paul-komarnytskyy paul-komarnytskyy changed the title Invalid definitions for COLUMNSTORE and SPATIAL Indexes Invalid definitions for COLUMNSTORE and SPATIAL Indexes for SQL Server Jun 7, 2024
@giautm giautm self-assigned this Aug 27, 2024
@giautm giautm added the MSSQL label Aug 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants