Repository: ariga/atlas
Pull request #2698 (2024-04-19 10:16:21)

sql/postgres/postgrescheck: move conidx check to new -ent based one


Patch:
diff --git a/sql/postgres/migrate.go b/sql/postgres/migrate.go
index 57723e0e..66120b31 100644
--- a/sql/postgres/migrate.go
+++ b/sql/postgres/migrate.go
@@ -513,25 +513,29 @@ func (s *state) alterTable(t *schema.Table, changes []schema.Change) error {
 				b.P("DROP COLUMN").Ident(change.C.Name)
 				reverse = append(reverse, &schema.AddColumn{C: change.C})
 			case *AddUniqueConstraint:
-				b.P("ADD CONSTRAINT").Ident(change.Name).P("UNIQUE USING INDEX").Ident(change.Using.Name)
+				b.P("ADD")
 				drop := change.Using
-				if drop.Name != change.Name {
+				if change.Name != "" {
+					b.P("CONSTRAINT").Ident(change.Name)
 					drop = sqlx.P(*change.Using)
 					drop.Name = change.Name
 				}
+				b.P("UNIQUE USING INDEX").Ident(change.Using.Name)
 				// Translated to the DROP CONSTRAINT below,
 				// which drops the index as well.
 				reverse = append(reverse, &schema.DropIndex{I: drop})
 			case *AddPKConstraint:
-				b.P("ADD CONSTRAINT").Ident(change.Name).P("PRIMARY KEY USING INDEX").Ident(change.Using.Name)
+				b.P("ADD")
 				drop := change.Using
-				if drop.Name != change.Name {
+				if change.Name != "" {
+					b.P("CONSTRAINT").Ident(change.Name)
 					drop = sqlx.P(*change.Using)
 					drop.Name = change.Name
 				}
+				b.P("PRIMARY KEY USING INDEX").Ident(change.Using.Name)
 				// Translated to the DROP CONSTRAINT below,
 				// which drops the index as well.
-				reverse = append(reverse, &schema.DropIndex{I: drop})
+				reverse = append(reverse, &schema.DropPrimaryKey{P: drop})
 			case *schema.AddIndex:
 				b.P("ADD")
 				if err := s.unique(b, change.I); err != nil {
diff --git a/sql/postgres/postgrescheck/postgrescheck.go b/sql/postgres/postgrescheck/postgrescheck.go
index 53710af4..ae80876a 100644
--- a/sql/postgres/postgrescheck/postgrescheck.go
+++ b/sql/postgres/postgrescheck/postgrescheck.go
@@ -5,15 +5,10 @@
 package postgrescheck
 
 import (
-	"context"
-	"errors"
 	"fmt"
 
 	"ariga.io/atlas/schemahcl"
-	"ariga.io/atlas/sql/internal/sqlx"
-	"ariga.io/atlas/sql/migrate"
 	"ariga.io/atlas/sql/postgres"
-	"ariga.io/atlas/sql/schema"
 	"ariga.io/atlas/sql/sqlcheck"
 	"ariga.io/atlas/sql/sqlcheck/condrop"
 	"ariga.io/atlas/sql/sqlcheck/datadepend"
@@ -58,135 +53,5 @@ func analyzers(r *schemahcl.Resource) ([]sqlcheck.Analyzer, error) {
 	if err != nil {
 		return nil, err
 	}
-	ci, err := NewConcurrentIndex(r)
-	if err != nil {
-		return nil, err
-	}
-	return []sqlcheck.Analyzer{ds, dd, cd, bc, nm, ci}, nil
-}
-
-type (
-	// ConcurrentIndex checks for concurrent index creation,
-	// dropping, and its transactional safety.
-	ConcurrentIndex struct {
-		ConcurrentOptions
-	}
-	// ConcurrentOptions for concurrent index creation.
-	ConcurrentOptions struct {
-		sqlcheck.Options
-		CheckCreate *bool `spec:"check_create"`
-		CheckDrop   *bool `spec:"check_drop"`
-		CheckTxMode *bool `spec:"check_txmode"`
-	}
-)
-
-// NewConcurrentIndex creates a new concurrent-index Analyzer with the given options.
-func NewConcurrentIndex(r *schemahcl.Resource) (*ConcurrentIndex, error) {
-	az := &ConcurrentIndex{}
-	az.CheckCreate = sqlx.P(true)
-	az.CheckDrop = sqlx.P(true)
-	az.CheckTxMode = sqlx.P(true)
-	if r, ok := r.Resource(az.Name()); ok {
-		if err := r.As(&az.Options); err != nil {
-			return nil, fmt.Errorf("sql/sqlcheck: parsing concurrent_index error option: %w", err)
-		}
-		if err := r.As(&az.ConcurrentOptions); err != nil {
-			return nil, fmt.Errorf("sql/sqlcheck: parsing concurrent_index check options: %w", err)
-		}
-	}
-	return az, nil
-}
-
-// Name of the analyzer. Implements the sqlcheck.NamedAnalyzer interface.
-func (*ConcurrentIndex) Name() string {
-	return "concurrent_index"
-}
-
-var (
-	// codeCreateNoCon is a PostgreSQL specific code for reporting
-	// indexes creation without the CONCURRENTLY option.
-	codeCreateNoCon = sqlcheck.Code("PG101")
-	// codeDropNoCon is a PostgreSQL specific code for reporting
-	// indexes deletion without the CONCURRENTLY option.
-	codeDropNoCon = sqlcheck.Code("PG102")
-	// codeNoTxNone is a PostgreSQL specific code for reporting indexes
-	// creation or deletion concurrently without the txmode directive set
-	// to none.
-	codeNoTxNone = sqlcheck.Code("PG103")
-)
-
-// Analyze implements sqlcheck.Analyzer.
-func (a *ConcurrentIndex) Analyze(_ context.Context, p *sqlcheck.Pass) error {
-	var (
-		notx  bool
-		notxC int
-		diags []sqlcheck.Diagnostic
-	)
-	// The txmode directive, currently defined in cmd/atlas,
-	// might be moved to sql/migrate in the future.
-	if l, ok := p.File.File.(*migrate.LocalFile); ok {
-		mode := l.Directive("txmode")
-		notx = len(mode) == 1 && mode[0] == "none"
-	}
-	for _, sc := range p.File.Changes {
-		for _, c := range sc.Changes {
-			m, ok := c.(*schema.ModifyTable)
-			// Skip modifications for tables that have been created in this file.
-			if !ok || p.File.TableSpan(m.T)&sqlcheck.SpanAdded == 1 {
-				continue
-			}
-			for i := range m.Changes {
-				switch mc := m.Changes[i].(type) {
-				case *schema.AddIndex:
-					switch hasC := sqlx.Has(mc.Extra, &postgres.Concurrently{}); {
-					case !sqlx.V(a.CheckCreate):
-					case hasC && !notx && sqlx.V(a.CheckTxMode):
-						notxC++
-					case !hasC:
-						diags = append(diags, sqlcheck.Diagnostic{
-							Pos:  sc.Stmt.Pos,
-							Code: codeCreateNoCon,
-							Text: fmt.Sprintf(
-								"Creating index %q non-concurrently causes write locks on the %q table",
-								mc.I.Name, m.T.Name,
-							),
-						})
-					}
-				case *schema.DropIndex:
-					switch hasC := sqlx.Has(mc.Extra, &postgres.Concurrently{}); {
-					case !sqlx.V(a.CheckDrop):
-					case hasC && !notx && sqlx.V(a.CheckTxMode):
-						notxC++
-					case !hasC:
-						diags = append(diags, sqlcheck.Diagnostic{
-							Pos:  sc.Stmt.Pos,
-							Code: codeDropNoCon,
-							Text: fmt.Sprintf(
-								"Dropping index %q non-concurrently causes write locks on the %q table",
-								mc.I.Name, m.T.Name,
-							),
-						})
-					}
-				}
-			}
-		}
-	}
-	if notxC > 0 {
-		diags = append([]sqlcheck.Diagnostic{{
-			Pos:  0,
-			Code: codeNoTxNone,
-			Text: "Indexes cannot be created or deleted concurrently within a transaction. Add the `atlas:txmode none` " +
-				"directive to the header to prevent this file from running in a transaction",
-		}}, diags...)
-	}
-	if len(diags) > 0 {
-		const reportText = "concurrent index violations detected"
-		p.Reporter.WriteReport(sqlcheck.Report{Text: reportText, Diagnostics: diags})
-		// Report an error only if it is configured this way and the
-		// diagnostics include non-concurrent creation or deletion.
-		if sqlx.V(a.Error) && (notxC == 0 || len(diags) > 1) {
-			return errors.New(reportText)
-		}
-	}
-	return nil
+	return []sqlcheck.Analyzer{ds, dd, cd, bc, nm}, nil
 }


Test patch:
diff --git a/internal/integration/testdata/postgres/cli-migrate-lint-concurrent-idx.txt b/internal/integration/testdata/postgres/cli-migrate-lint-concurrent-idx.txt
deleted file mode 100644
index 3199fb04..00000000
--- a/internal/integration/testdata/postgres/cli-migrate-lint-concurrent-idx.txt
+++ /dev/null
@@ -1,152 +0,0 @@
-only postgres15
-
-# Ignore tables that were created in the same file.
-atlas migrate lint --dir file://migrations1 --dev-url URL --latest=1
-stdout 'Analyzing changes until version 1 \(1 migration in total\):'
-stdout ''
-stdout '  -- analyzing version 1'
-stdout '    -- no diagnostics found'
-stdout '  -- ok \(.+\)'
-stdout ''
-stdout '  -------------------------'
-stdout '  -- .+'
-stdout '  -- 1 version ok'
-stdout '  -- 2 schema changes'
-
-atlas migrate lint --dir file://migrations2 --dev-url URL --latest=1
-stdout 'Analyzing changes from version 1 to 2 \(1 migration in total\):'
-stdout ''
-stdout '  -- analyzing version 2'
-stdout '    -- concurrent index violations detected:'
-stdout '      -- L1: Dropping index "i1" non-concurrently causes write locks on the "t" table'
-stdout '         https://atlasgo.io/lint/analyzers#PG102'
-stdout '      -- L2: Creating index "i2" non-concurrently causes write locks on the "t" table'
-stdout '         https://atlasgo.io/lint/analyzers#PG101'
-stdout '  -- ok \(.+\)'
-stdout ''
-stdout '  -------------------------'
-stdout '  -- .+'
-stdout '  -- 1 version with warnings'
-stdout '  -- 2 schema changes'
-stdout '  -- 2 diagnostics'
-
-atlas migrate lint --dir file://migrations3 --dev-url URL --latest=1
-stdout 'Analyzing changes from version 1 to 2 \(1 migration in total\):'
-stdout ''
-stdout '  -- analyzing version 2'
-stdout '    -- concurrent index violations detected:'
-stdout '      -- L1: Indexes cannot be created or deleted concurrently within a transaction. Add the'
-stdout '         `atlas:txmode none` directive to the header to prevent this file from running in a'
-stdout '         transaction https://atlasgo.io/lint/analyzers#PG103'
-stdout '  -- ok \(.+\)'
-stdout ''
-stdout '  -------------------------'
-stdout '  -- .+'
-stdout '  -- 1 version with warnings'
-stdout '  -- 1 schema change'
-stdout '  -- 1 diagnostic'
-
-atlas migrate lint --dir file://migrations4 --dev-url URL --latest=1
-stdout 'Analyzing changes from version 1 to 2 \(1 migration in total\):'
-stdout ''
-stdout '  -- analyzing version 2'
-stdout '    -- concurrent index violations detected:'
-stdout '      -- L1: Indexes cannot be created or deleted concurrently within a transaction. Add the'
-stdout '         `atlas:txmode none` directive to the header to prevent this file from running in a'
-stdout '         transaction https://atlasgo.io/lint/analyzers#PG103'
-stdout '      -- L2: Creating index "i1" non-concurrently causes write locks on the "t" table'
-stdout '         https://atlasgo.io/lint/analyzers#PG101'
-stdout '  -- ok \(.+\)'
-stdout ''
-stdout '  -------------------------'
-stdout '  -- .+'
-stdout '  -- 1 version with warnings'
-stdout '  -- 2 schema changes'
-stdout '  -- 2 diagnostics'
-
-atlas migrate lint --dir file://migrations5 --dev-url URL --latest=1
-stdout 'Analyzing changes from version 1 to 2 \(1 migration in total\):'
-stdout ''
-stdout '  -- analyzing version 2'
-stdout '    -- concurrent index violations detected:'
-stdout '      -- L1: Dropping index "i1" non-concurrently causes write locks on the "t" table'
-stdout '         https://atlasgo.io/lint/analyzers#PG102'
-stdout '  -- ok \(.+\)'
-stdout ''
-stdout '  -------------------------'
-stdout '  -- .+'
-stdout '  -- 1 version with warnings'
-stdout '  -- 1 schema change'
-stdout '  -- 1 diagnostic'
-
-atlas migrate lint --dir file://migrations6 --dev-url URL --latest=1
-stdout 'Analyzing changes from version 1 to 2 \(1 migration in total\):'
-stdout ''
-stdout '  -- analyzing version 2'
-stdout '    -- concurrent index violations detected:'
-stdout '      -- L1: Indexes cannot be created or deleted concurrently within a transaction. Add the'
-stdout '         `atlas:txmode none` directive to the header to prevent this file from running in a'
-stdout '         transaction https://atlasgo.io/lint/analyzers#PG103'
-stdout '  -- ok \(.+\)'
-stdout ''
-stdout '  -------------------------'
-stdout '  -- .+'
-stdout '  -- 1 version with warnings'
-stdout '  -- 1 schema change'
-stdout '  -- 1 diagnostic'
-
-atlas migrate lint --dir file://migrations7 --dev-url URL --latest=1
-stdout 'Analyzing changes from version 1 to 2 \(1 migration in total\):'
-stdout ''
-stdout '  -- analyzing version 2'
-stdout '    -- no diagnostics found'
-stdout '  -- ok \(.+\)'
-stdout ''
-stdout '  -------------------------'
-stdout '  -- .+'
-stdout '  -- 1 version ok'
-stdout '  -- 2 schema changes'
-
--- migrations1/1.sql --
-CREATE TABLE t(c int);
-CREATE INDEX i ON t(c);
-
--- migrations2/1.sql --
-CREATE TABLE t(c int);
-CREATE INDEX i1 ON t(c);
--- migrations2/2.sql --
-DROP INDEX i1;
-CREATE INDEX i2 ON t(c);
-
--- migrations3/1.sql --
-CREATE TABLE t(c int);
--- migrations3/2.sql --
-CREATE INDEX CONCURRENTLY i ON t(c);
-
--- migrations4/1.sql --
-CREATE TABLE t(c int);
--- migrations4/2.sql --
-CREATE INDEX CONCURRENTLY i2 ON t(c);
-CREATE INDEX i1 ON t(c);
-
--- migrations5/1.sql --
-CREATE TABLE t(c int);
-CREATE INDEX i1 ON t(c);
--- migrations5/2.sql --
-DROP INDEX i1;
-
--- migrations6/1.sql --
-CREATE TABLE t(c int);
-CREATE INDEX i1 ON t(c);
--- migrations6/2.sql --
-DROP INDEX CONCURRENTLY i1;
-
--- migrations7/1.sql --
-CREATE TABLE t(c int);
-CREATE INDEX i1 ON t(c);
-CREATE INDEX i2 ON t(c);
--- migrations7/2.sql --
--- atlas:txmode none
-
-DROP INDEX CONCURRENTLY i1;
-DROP INDEX CONCURRENTLY script_cli_migrate_lint_concurrent_idx.i2;
diff --git a/sql/postgres/migrate_test.go b/sql/postgres/migrate_test.go
index 732bb825..470d6bcb 100644
--- a/sql/postgres/migrate_test.go
+++ b/sql/postgres/migrate_test.go
@@ -486,7 +486,70 @@ func TestPlanChanges(t *testing.T) {
 				},
 			},
 		},
-		// Add a primary key using index.
+		// Add a named unique constraint using index.
+		{
+			changes: []schema.Change{
+				func() schema.Change {
+					users := schema.NewTable("users").
+						SetSchema(schema.New("test")).
+						AddColumns(
+							schema.NewIntColumn("id", "bigint"),
+						)
+					users.SetPrimaryKey(schema.NewPrimaryKey(users.Columns...))
+					return &schema.ModifyTable{
+						T: users,
+						Changes: []schema.Change{
+							&AddUniqueConstraint{
+								Name:  "users_unique",
+								Using: schema.NewUniqueIndex("boring"),
+							},
+						},
+					}
+				}(),
+			},
+			wantPlan: &migrate.Plan{
+				Reversible:    true,
+				Transactional: true,
+				Changes: []*migrate.Change{
+					{
+						Cmd:     `ALTER TABLE "test"."users" ADD CONSTRAINT "users_unique" UNIQUE USING INDEX "boring"`,
+						Reverse: `ALTER TABLE "test"."users" DROP CONSTRAINT "users_unique"`,
+					},
+				},
+			},
+		},
+		// Add an unnamed unique constraint using index.
+		{
+			changes: []schema.Change{
+				func() schema.Change {
+					users := schema.NewTable("users").
+						SetSchema(schema.New("test")).
+						AddColumns(
+							schema.NewIntColumn("id", "bigint"),
+						)
+					users.SetPrimaryKey(schema.NewPrimaryKey(users.Columns...))
+					return &schema.ModifyTable{
+						T: users,
+						Changes: []schema.Change{
+							&AddUniqueConstraint{
+								Using: schema.NewUniqueIndex("boring"),
+							},
+						},
+					}
+				}(),
+			},
+			wantPlan: &migrate.Plan{
+				Reversible:    true,
+				Transactional: true,
+				Changes: []*migrate.Change{
+					{
+						Cmd:     `ALTER TABLE "test"."users" ADD UNIQUE USING INDEX "boring"`,
+						Reverse: `ALTER TABLE "test"."users" DROP CONSTRAINT "boring"`,
+					},
+				},
+			},
+		},
+		// Add a named primary key constraint using index.
 		{
 			changes: []schema.Change{
 				func() schema.Change {
@@ -518,6 +581,37 @@ func TestPlanChanges(t *testing.T) {
 				},
 			},
 		},
+		// Add an unnamed primary key constraint using index.
+		{
+			changes: []schema.Change{
+				func() schema.Change {
+					users := schema.NewTable("users").
+						SetSchema(schema.New("test")).
+						AddColumns(
+							schema.NewIntColumn("id", "bigint"),
+						)
+					users.SetPrimaryKey(schema.NewPrimaryKey(users.Columns...))
+					return &schema.ModifyTable{
+						T: users,
+						Changes: []schema.Change{
+							&AddPKConstraint{
+								Using: schema.NewUniqueIndex("users_pkey"),
+							},
+						},
+					}
+				}(),
+			},
+			wantPlan: &migrate.Plan{
+				Reversible:    true,
+				Transactional: true,
+				Changes: []*migrate.Change{
+					{
+						Cmd:     `ALTER TABLE "test"."users" ADD PRIMARY KEY USING INDEX "users_pkey"`,
+						Reverse: `ALTER TABLE "test"."users" DROP CONSTRAINT "users_pkey"`,
+					},
+				},
+			},
+		},
 		// Modify a primary key.
 		{
 			changes: []schema.Change{
diff --git a/sql/postgres/postgrescheck/postgrescheck_test.go b/sql/postgres/postgrescheck/postgrescheck_test.go
index f71b33c0..f8beb66d 100644
--- a/sql/postgres/postgrescheck/postgrescheck_test.go
+++ b/sql/postgres/postgrescheck/postgrescheck_test.go
@@ -8,10 +8,8 @@ import (
 	"context"
 	"testing"
 
-	"ariga.io/atlas/schemahcl"
 	"ariga.io/atlas/sql/migrate"
 	"ariga.io/atlas/sql/postgres"
-	"ariga.io/atlas/sql/postgres/postgrescheck"
 	_ "ariga.io/atlas/sql/postgres/postgrescheck"
 	"ariga.io/atlas/sql/schema"
 	"ariga.io/atlas/sql/sqlcheck"
@@ -19,144 +17,6 @@ import (
 	"github.com/stretchr/testify/require"
 )
 
-func TestConcurrentIndex(t *testing.T) {
-	var cfg struct {
-		schemahcl.DefaultExtension
-	}
-	// language=hcl
-	err := schemahcl.New().EvalBytes([]byte(`
-concurrent_index {
-  error = true
-}
-`), &cfg, nil)
-	require.NoError(t, err)
-	require.NoError(t, err)
-	az, err := postgrescheck.NewConcurrentIndex(cfg.Remain())
-	require.NoError(t, err)
-
-	t.Run("MissingConcurrent", func(t *testing.T) {
-		var report *sqlcheck.Report
-		err := az.Analyze(context.Background(), &sqlcheck.Pass{
-			File: &sqlcheck.File{
-				File: migrate.NewLocalFile("1.sql", []byte("CREATE INDEX i1 ON t(c);")),
-				Changes: []*sqlcheck.Change{
-					{
-						Changes: schema.Changes{
-							&schema.ModifyTable{
-								T: schema.NewTable("Users").SetSchema(schema.New("public")),
-								Changes: schema.Changes{
-									&schema.AddIndex{
-										I: schema.NewIndex("i1"),
-									},
-								},
-							},
-						},
-						Stmt: &migrate.Stmt{
-							Pos:  0,
-							Text: "CREATE INDEX i1 ON t(c)",
-						},
-					},
-				},
-			},
-			Reporter: sqlcheck.ReportWriterFunc(func(r sqlcheck.Report) {
-				report = &r
-			}),
-		})
-		require.EqualError(t, err, "concurrent index violations detected")
-		require.Len(t, report.Diagnostics, 1)
-		require.Equal(t, report.Diagnostics[0].Text, `Creating index "i1" non-concurrently causes write locks on the "Users" table`)
-	})
-
-	t.Run("MissingTxMode", func(t *testing.T) {
-		var report *sqlcheck.Report
-		err := az.Analyze(context.Background(), &sqlcheck.Pass{
-			File: &sqlcheck.File{
-				File: migrate.NewLocalFile("1.sql", []byte("CREATE INDEX CONCURRENTLY i1 ON t(c);")),
-				Changes: []*sqlcheck.Change{
-					{
-						Changes: schema.Changes{
-							&schema.ModifyTable{
-								T: schema.NewTable("Users").SetSchema(schema.New("public")),
-								Changes: schema.Changes{
-									&schema.AddIndex{
-										I: schema.NewIndex("i1"),
-										Extra: []schema.Clause{
-											&postgres.Concurrently{},
-										},
-									},
-								},
-							},
-						},
-						Stmt: &migrate.Stmt{
-							Pos:  0,
-							Text: "CREATE INDEX CONCURRENTLY i1 ON t(c)",
-						},
-					},
-				},
-			},
-			Reporter: sqlcheck.ReportWriterFunc(func(r sqlcheck.Report) {
-				report = &r
-			}),
-		})
-		require.NoError(t, err)
-		require.Len(t, report.Diagnostics, 1)
-		require.Equal(t, report.Diagnostics[0].Text, "Indexes cannot be created or deleted concurrently within a transaction. Add the `atlas:txmode none` directive to the header to prevent this file from running in a transaction")
-	})
-
-	t.Run("MixedReport", func(t *testing.T) {
-		var report *sqlcheck.Report
-		err := az.Analyze(context.Background(), &sqlcheck.Pass{
-			File: &sqlcheck.File{
-				File: migrate.NewLocalFile("1.sql", []byte("CREATE INDEX CONCURRENTLY i1 ON t(c);DROP INDEX i2;")),
-				Changes: []*sqlcheck.Change{
-					{
-						Changes: schema.Changes{
-							&schema.ModifyTable{
-								T: schema.NewTable("Users").SetSchema(schema.New("public")),
-								Changes: schema.Changes{
-									&schema.AddIndex{
-										I: schema.NewIndex("i1"),
-										Extra: []schema.Clause{
-											&postgres.Concurrently{},
-										},
-									},
-								},
-							},
-						},
-						Stmt: &migrate.Stmt{
-							Pos:  0,
-							Text: "CREATE INDEX CONCURRENTLY i1 ON t(c)",
-						},
-					},
-					{
-						Changes: schema.Changes{
-							&schema.ModifyTable{
-								T: schema.NewTable("Users").SetSchema(schema.New("public")),
-								Changes: schema.Changes{
-									&schema.DropIndex{
-										I: schema.NewIndex("i2"),
-									},
-								},
-							},
-						},
-						Stmt: &migrate.Stmt{
-							Pos:  0,
-							Text: "DROP INDEX i2",
-						},
-					},
-				},
-			},
-			Reporter: sqlcheck.ReportWriterFunc(func(r sqlcheck.Report) {
-				report = &r
-			}),
-		})
-		require.EqualError(t, err, "concurrent index violations detected")
-		require.Len(t, report.Diagnostics, 2)
-		require.Equal(t, report.Diagnostics[0].Text, "Indexes cannot be created or deleted concurrently within a transaction. Add the `atlas:txmode none` directive to the header to prevent this file from running in a transaction")
-		require.Equal(t, report.Diagnostics[1].Text, `Dropping index "i2" non-concurrently causes write locks on the "Users" table`)
-	})
-}
-
 func TestDataDepend_MightFail(t *testing.T) {
 	var (
 		report *sqlcheck.Report