only postgres15

atlas migrate lint --dir file://migrations1 --dev-url URL --latest=1
stdout 'Analyzing changes from version 1 to 2 \(1 migration in total\):'
stdout ''
stdout '  -- analyzing version 2'
stdout '    -- backward incompatible changes detected:'
stdout '      -- L1: Renaming table "users" to "atlas_users"'
stdout '         https://atlasgo.io/lint/analyzers#BC101'
stdout '  -- ok \(.+\)'
stdout ''
stdout '  -------------------------'
stdout '  -- .+'
stdout '  -- 1 version with warnings'
stdout '  -- 1 schema change'
stdout '  -- 1 diagnostic'

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 '    -- backward incompatible changes detected:'
stdout '      -- L1: Renaming column "id" to "uid" https://atlasgo.io/lint/analyzers#BC102'
stdout '  -- ok \(.+\)'
stdout ''
stdout '  -------------------------'
stdout '  -- .+'
stdout '  -- 1 version with warnings'
stdout '  -- 1 schema change'
stdout '  -- 1 diagnostic'


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 '    -- backward incompatible changes detected:'
stdout '      -- L9: Renaming column "id" to "cid" https://atlasgo.io/lint/analyzers#BC102'
stdout '  -- ok \(.+\)'
stdout ''
stdout '  -------------------------'
stdout '  -- .+'
stdout '  -- 1 version with warnings'
stdout '  -- 6 schema changes'
stdout '  -- 1 diagnostic'

-- migrations1/1.sql --
CREATE TABLE users (id int);

-- migrations1/2.sql --
ALTER TABLE users RENAME TO atlas_users;

-- migrations2/1.sql --
CREATE TABLE users (id int);

-- migrations2/2.sql --
ALTER TABLE users RENAME COLUMN id TO uid;

-- migrations3/1.sql --
CREATE TABLE "users" (id int);
CREATE TABLE posts (id int);
CREATE TABLE cards (id int);

-- migrations3/2.sql --
ALTER TABLE "users" RENAME TO "atlas_users";
CREATE VIEW "users" AS SELECT * FROM "atlas_users";
ALTER TABLE posts RENAME COLUMN id TO uid;
/*
Although it is recommended to add the renamed column as generated,
adding it as a regular column is considered backwards compatible.
*/
ALTER TABLE posts ADD COLUMN id int DEFAULT 0;
ALTER TABLE cards RENAME COLUMN id TO cid;
ALTER TABLE cards ADD COLUMN name text;

