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;
