only mysql8

atlas migrate lint --dir file://migrations1 --dev-url URL --latest=1 > got.txt
cmp got.txt expected1.txt

atlas migrate lint --dir file://migrations2 --dev-url URL --latest=1 > got.txt
cmp got.txt expected2.txt

atlas migrate lint --dir file://migrations3 --dev-url URL --latest=1 > got.txt
cmp got.txt empty.txt

atlas migrate lint --dir file://migrations4 --dev-url URL --latest=1 > got.txt
cmp got.txt expected4.txt

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

-- migrations1/2.sql --
ALTER TABLE users ADD COLUMN `rank` int NOT NULL DEFAULT 1;
ALTER TABLE users MODIFY COLUMN id int NOT NULL;

-- expected1.txt --
2.sql: data dependent changes detected:

	L2: Modifying nullable column "id" to non-nullable might fail in case it contains NULL values

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

-- migrations2/2.sql --
-- Add (a, b, c), backfill (a, b) and then modify all to not-null.
ALTER TABLE users ADD COLUMN `a` int, ADD COLUMN `b` int, ADD COLUMN `c` int;
UPDATE users SET `a` = 1;
UPDATE users SET `b` = 1 WHERE `b` IS NULL;
ALTER TABLE users MODIFY COLUMN `a` int NOT NULL, MODIFY COLUMN `b` int NOT NULL, MODIFY COLUMN `c` int NOT NULL;

-- expected2.txt --
2.sql: data dependent changes detected:

	L5: Modifying nullable column "c" to non-nullable might fail in case it contains NULL values

-- migrations3/1.sql --
CREATE TABLE users (id int);
ALTER TABLE users MODIFY COLUMN id int NOT NULL;

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

-- migrations4/2.sql --
ALTER TABLE users ADD COLUMN name varchar(255), ADD COLUMN age float;
UPDATE users SET name = 'Unknown', age = 0;
-- No diagnostics.
ALTER TABLE users MODIFY COLUMN name varchar(255) NOT NULL, MODIFY COLUMN age float NOT NULL;

ALTER TABLE pets ADD COLUMN name varchar(255), ADD COLUMN age float;
UPDATE pets SET name = 'Unknown', age = 0 WHERE RAND() > 0.5;
-- With diagnostics as statement above cannot be sure NULL values are back-filled.
ALTER TABLE pets MODIFY COLUMN name varchar(255) NOT NULL, MODIFY COLUMN age float NOT NULL;

-- expected4.txt --
2.sql: data dependent changes detected:

	L9: Modifying nullable column "name" to non-nullable might fail in case it contains NULL values
	L9: Modifying nullable column "age" to non-nullable might fail in case it contains NULL values

