1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
|
# Ignore all diagnostics.
atlas migrate lint --dir file://migrations1 --dev-url URL --latest=1 > got.txt
cmp got.txt empty.txt
# Ignore specific diagnostics.
atlas migrate lint --dir file://migrations2 --dev-url URL --latest=1 > got.txt
cmp got.txt empty.txt
# Ignore by code.
atlas migrate lint --dir file://migrations3 --dev-url URL --latest=1 > got.txt
cmp got.txt expected3.txt
-- migrations1/1.sql --
CREATE TABLE users (id int);
CREATE TABLE pets (id int);
-- migrations1/2.sql --
-- atlas:nolint
ALTER TABLE users ADD COLUMN name text NOT NULL;
-- atlas:nolint
DROP TABLE pets;
-- migrations2/1.sql --
CREATE TABLE users (id int);
CREATE TABLE pets (id int);
-- migrations2/2.sql --
-- atlas:nolint data_depend
ALTER TABLE users ADD COLUMN name text NOT NULL;
-- atlas:nolint destructive
DROP TABLE pets;
-- empty.txt --
-- migrations3/1.sql --
CREATE TABLE users (id int);
CREATE TABLE pets (id int);
-- migrations3/2.sql --
ALTER TABLE users ADD COLUMN name text NOT NULL;
-- atlas:nolint DS102
DROP TABLE pets;
-- expected3.txt --
2.sql: data dependent changes detected:
L1: Adding a non-nullable "text" column "name" will fail in case table "users" is not empty
|