Skip to content

Commit bf2579a

Browse files
committed
Merge commit 'bbbe2226ac600315d66e77dc15e5dee2768c4aad' into alternation-engine
2 parents 53c2d13 + bbbe222 commit bf2579a

File tree

10 files changed

+66
-66
lines changed

10 files changed

+66
-66
lines changed

drizzle-kit/src/dialects/sqlite/introspect.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ export const fromDatabase = async (
8282
JOIN pragma_table_xinfo(m.name) AS p
8383
WHERE
8484
m.type = 'table'
85-
and m.tbl_name !== '__drizzle_migrations'
85+
and m.tbl_name != '__drizzle_migrations'
8686
and m.tbl_name NOT LIKE '\\_cf\\_%' ESCAPE '\\'
8787
and m.tbl_name NOT LIKE '\\_litestream\\_%' ESCAPE '\\'
8888
and m.tbl_name NOT LIKE 'libsql\\_%' ESCAPE '\\'
@@ -109,7 +109,7 @@ export const fromDatabase = async (
109109
FROM sqlite_master AS m
110110
WHERE
111111
m.type = 'view'
112-
and m.tbl_name !== '__drizzle_migrations'
112+
and m.tbl_name != '__drizzle_migrations'
113113
and m.tbl_name NOT LIKE '\\_cf\\_%' ESCAPE '\\'
114114
and m.tbl_name NOT LIKE '\\_litestream\\_%' ESCAPE '\\'
115115
and m.tbl_name NOT LIKE 'libsql\\_%' ESCAPE '\\'
@@ -174,7 +174,7 @@ export const fromDatabase = async (
174174
JOIN pragma_table_xinfo(m.name) AS p
175175
WHERE
176176
m.type = 'view'
177-
and m.tbl_name !== '__drizzle_migrations'
177+
and m.tbl_name != '__drizzle_migrations'
178178
and m.tbl_name NOT LIKE '\\_cf\\_%' ESCAPE '\\'
179179
and m.tbl_name NOT LIKE '\\_litestream\\_%' ESCAPE '\\'
180180
and m.tbl_name NOT LIKE 'libsql\\_%' ESCAPE '\\'

drizzle-kit/tests/cockroach/checks.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ test.concurrent('alter multiple check constraints', async ({ dbc: db }) => {
133133
table,
134134
) => [
135135
check('some_check_name_1', sql`${table.age} > 21`),
136-
check('some_check_name_2', sql`${table.name} !== 'Alex'`),
136+
check('some_check_name_2', sql`${table.name} != 'Alex'`),
137137
],
138138
),
139139
};
@@ -150,7 +150,7 @@ test.concurrent('alter multiple check constraints', async ({ dbc: db }) => {
150150
table,
151151
) => [
152152
check('some_check_name_3', sql`${table.age} > 21`),
153-
check('some_check_name_4', sql`${table.name} !== 'Alex'`),
153+
check('some_check_name_4', sql`${table.name} != 'Alex'`),
154154
],
155155
),
156156
};
@@ -164,7 +164,7 @@ test.concurrent('alter multiple check constraints', async ({ dbc: db }) => {
164164
`ALTER TABLE "users" DROP CONSTRAINT "some_check_name_1";`,
165165
`ALTER TABLE "users" DROP CONSTRAINT "some_check_name_2";`,
166166
`ALTER TABLE "users" ADD CONSTRAINT "some_check_name_3" CHECK ("users"."age" > 21);`,
167-
`ALTER TABLE "users" ADD CONSTRAINT "some_check_name_4" CHECK ("users"."name" !== \'Alex\');`,
167+
`ALTER TABLE "users" ADD CONSTRAINT "some_check_name_4" CHECK ("users"."name" != \'Alex\');`,
168168
];
169169
expect(st).toStrictEqual(st0);
170170
expect(pst).toStrictEqual(st0);
@@ -181,7 +181,7 @@ test.concurrent('create checks with same names', async ({ dbc: db }) => {
181181
},
182182
(
183183
table,
184-
) => [check('some_check_name', sql`${table.age} > 21`), check('some_check_name', sql`${table.name} !== 'Alex'`)],
184+
) => [check('some_check_name', sql`${table.age} > 21`), check('some_check_name', sql`${table.name} != 'Alex'`)],
185185
),
186186
};
187187

drizzle-kit/tests/cockroach/indexes.test.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ test.concurrent('adding basic indexes', async ({ dbc: db }) => {
2121
(t) => [
2222
index()
2323
.on(t.name, t.id.desc())
24-
.where(sql`name !== 'alef'`),
24+
.where(sql`name != 'alef'`),
2525
index('indx1').using('hash', t.name),
2626
],
2727
),
@@ -33,7 +33,7 @@ test.concurrent('adding basic indexes', async ({ dbc: db }) => {
3333
const { sqlStatements: pst } = await push({ db, to: schema2 });
3434

3535
const st0 = [
36-
`CREATE INDEX "users_name_id_index" ON "users" ("name","id" DESC) WHERE name !== 'alef';`,
36+
`CREATE INDEX "users_name_id_index" ON "users" ("name","id" DESC) WHERE name != 'alef';`,
3737
`CREATE INDEX "indx1" ON "users" ("name") USING hash;`,
3838
];
3939

@@ -360,7 +360,7 @@ test.concurrent('index #2', async ({ dbc: db }) => {
360360

361361
/**
362362
There are two similar tests shown here
363-
When creating an index with the sql`name !== 'alex'`, Cockroach automatically adds 'alex'::STRING
363+
When creating an index with the sql`name != 'alex'`, Cockroach automatically adds 'alex'::STRING
364364
Since this behavior comes directly from the sql`` we can't handle it
365365
366366
The second test passes because it explicitly add ::STRING
@@ -379,7 +379,7 @@ test.concurrent('index #3', async ({ dbc: db }) => {
379379
id: int4('id').primaryKey(),
380380
name: text('name'),
381381
}, (t) => [
382-
index().on(t.name.desc(), t.id.asc()).where(sql`name !== 'alex'`),
382+
index().on(t.name.desc(), t.id.asc()).where(sql`name != 'alex'`),
383383
index('indx1').using('hash', sql`${t.name}`),
384384
]),
385385
};
@@ -390,7 +390,7 @@ test.concurrent('index #3', async ({ dbc: db }) => {
390390
const { sqlStatements: pst } = await push({ db, to: schema2, ignoreSubsequent: true });
391391

392392
const st0 = [
393-
`CREATE INDEX "users_name_id_index" ON "users" ("name" DESC,"id") WHERE name !== 'alex';`,
393+
`CREATE INDEX "users_name_id_index" ON "users" ("name" DESC,"id") WHERE name != 'alex';`,
394394
`CREATE INDEX "indx1" ON "users" ("name") USING hash;`,
395395
];
396396
expect(st).toStrictEqual(st0);
@@ -409,7 +409,7 @@ test.concurrent('index #3_1', async ({ dbc: db }) => {
409409
id: int4('id').primaryKey(),
410410
name: text('name'),
411411
}, (t) => [
412-
index().on(t.name.desc(), t.id.asc()).where(sql`name !== 'alex'::STRING`),
412+
index().on(t.name.desc(), t.id.asc()).where(sql`name != 'alex'::STRING`),
413413
index('indx1').using('hash', sql`${t.name}`),
414414
]),
415415
};
@@ -420,7 +420,7 @@ test.concurrent('index #3_1', async ({ dbc: db }) => {
420420
const { sqlStatements: pst } = await push({ db, to: schema2 });
421421

422422
const st0 = [
423-
`CREATE INDEX "users_name_id_index" ON "users" ("name" DESC,"id") WHERE name !== 'alex'::STRING;`,
423+
`CREATE INDEX "users_name_id_index" ON "users" ("name" DESC,"id") WHERE name != 'alex'::STRING;`,
424424
`CREATE INDEX "indx1" ON "users" ("name") USING hash;`,
425425
];
426426
expect(st).toStrictEqual(st0);

drizzle-kit/tests/mssql/columns.test.ts

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -397,14 +397,14 @@ test('rename column #3. Part of check constraint', async (t) => {
397397
newSchema,
398398
users: newSchema.table('users', {
399399
id: int('id'),
400-
}, (t) => [check('hey', sql`${t.id} !== 2`)]),
400+
}, (t) => [check('hey', sql`${t.id} != 2`)]),
401401
};
402402

403403
const schema2 = {
404404
newSchema,
405405
users: newSchema.table('users', {
406406
id: int('id1'),
407-
}, (t) => [check('hey', sql`${t.id} !== 2`)]),
407+
}, (t) => [check('hey', sql`${t.id} != 2`)]),
408408
};
409409

410410
const { sqlStatements: st } = await diff(schema1, schema2, [
@@ -425,7 +425,7 @@ test('rename column #3. Part of check constraint', async (t) => {
425425
expect(st).toStrictEqual([
426426
`ALTER TABLE [new_schema].[users] DROP CONSTRAINT [hey];`,
427427
`EXEC sp_rename 'new_schema.users.id', [id1], 'COLUMN';`,
428-
`ALTER TABLE [new_schema].[users] ADD CONSTRAINT [hey] CHECK ([users].[id1] !== 2);`,
428+
`ALTER TABLE [new_schema].[users] ADD CONSTRAINT [hey] CHECK ([users].[id1] != 2);`,
429429
]);
430430
// error expected
431431
// since there will be changes in defintion
@@ -448,7 +448,7 @@ test('drop column #1. Part of check constraint', async (t) => {
448448
users: newSchema.table('users', {
449449
id: int('id'),
450450
name: varchar('name'),
451-
}, (t) => [check('hey', sql`${t.id} !== 2`)]),
451+
}, (t) => [check('hey', sql`${t.id} != 2`)]),
452452
};
453453

454454
const schema2 = {
@@ -1492,14 +1492,14 @@ test('drop identity from existing column #10. Table has checks', async (t) => {
14921492
{
14931493
id: int('id').identity(),
14941494
},
1495-
(t) => [check('hello_world', sql`${t.id} !== 1`)],
1495+
(t) => [check('hello_world', sql`${t.id} != 1`)],
14961496
),
14971497
};
14981498

14991499
const schema2 = {
15001500
users: mssqlTable('users', {
15011501
id: int('id'),
1502-
}, (t) => [check('hello_world', sql`${t.id} !== 1`)]),
1502+
}, (t) => [check('hello_world', sql`${t.id} != 1`)]),
15031503
};
15041504

15051505
const { sqlStatements: st } = await diff(schema1, schema2, []);
@@ -1516,7 +1516,7 @@ test('drop identity from existing column #10. Table has checks', async (t) => {
15161516
`ALTER TABLE [users] ADD [id] int;`,
15171517
`INSERT INTO [users] ([id]) SELECT [__old_id] FROM [users];`,
15181518
`ALTER TABLE [users] DROP COLUMN [__old_id];`,
1519-
'ALTER TABLE [users] ADD CONSTRAINT [hello_world] CHECK ([users].[id] !== 1);',
1519+
'ALTER TABLE [users] ADD CONSTRAINT [hello_world] CHECK ([users].[id] != 1);',
15201520
];
15211521
expect(st).toStrictEqual(st0);
15221522
expect(pst).toStrictEqual(st0);
@@ -1531,15 +1531,15 @@ test('drop identity from existing column #11. Table has checks. Column is not in
15311531
id: int('id').identity(),
15321532
name: varchar(),
15331533
},
1534-
(t) => [check('hello_world', sql`${t.name} !== 'Alex'`)],
1534+
(t) => [check('hello_world', sql`${t.name} != 'Alex'`)],
15351535
),
15361536
};
15371537

15381538
const schema2 = {
15391539
users: mssqlTable('users', {
15401540
id: int('id'),
15411541
name: varchar(),
1542-
}, (t) => [check('hello_world', sql`${t.name} !== 'Alex'`)]),
1542+
}, (t) => [check('hello_world', sql`${t.name} != 'Alex'`)]),
15431543
};
15441544

15451545
const { sqlStatements: st } = await diff(schema1, schema2, []);
@@ -1556,7 +1556,7 @@ test('drop identity from existing column #11. Table has checks. Column is not in
15561556
`ALTER TABLE [users] ADD [id] int;`,
15571557
`INSERT INTO [users] ([id]) SELECT [__old_id] FROM [users];`,
15581558
`ALTER TABLE [users] DROP COLUMN [__old_id];`,
1559-
"ALTER TABLE [users] ADD CONSTRAINT [hello_world] CHECK ([users].[name] !== 'Alex');",
1559+
"ALTER TABLE [users] ADD CONSTRAINT [hello_world] CHECK ([users].[name] != 'Alex');",
15601560
];
15611561

15621562
expect(st).toStrictEqual(st0);
@@ -1571,15 +1571,15 @@ test('drop identity from existing column #12. Rename table. Table has checks', a
15711571
id: int('id').identity(),
15721572
name: varchar(),
15731573
},
1574-
(t) => [check('hello_world', sql`${t.name} !== 'Alex'`)],
1574+
(t) => [check('hello_world', sql`${t.name} != 'Alex'`)],
15751575
),
15761576
};
15771577

15781578
const schema2 = {
15791579
users: mssqlTable('users2', {
15801580
id: int('id'),
15811581
name: varchar(),
1582-
}, (t) => [check('hello_world', sql`${t.name} !== 'Alex'`)]),
1582+
}, (t) => [check('hello_world', sql`${t.name} != 'Alex'`)]),
15831583
};
15841584

15851585
const { sqlStatements: st } = await diff(schema1, schema2, [`dbo.users->dbo.users2`]);
@@ -1598,7 +1598,7 @@ test('drop identity from existing column #12. Rename table. Table has checks', a
15981598
`ALTER TABLE [users2] ADD [id] int;`,
15991599
`INSERT INTO [users2] ([id]) SELECT [__old_id] FROM [users2];`,
16001600
`ALTER TABLE [users2] DROP COLUMN [__old_id];`,
1601-
"ALTER TABLE [users2] ADD CONSTRAINT [hello_world] CHECK ([users2].[name] !== 'Alex');",
1601+
"ALTER TABLE [users2] ADD CONSTRAINT [hello_world] CHECK ([users2].[name] != 'Alex');",
16021602
];
16031603

16041604
expect(st).toStrictEqual(st0);
@@ -1620,7 +1620,7 @@ test('drop identity from existing column #13. Rename table + Rename column. Add
16201620
users: mssqlTable('users2', {
16211621
id: int('id1'),
16221622
name: varchar(),
1623-
}, (t) => [check('hello_world', sql`${t.name} !== 'Alex'`)]),
1623+
}, (t) => [check('hello_world', sql`${t.name} != 'Alex'`)]),
16241624
};
16251625

16261626
const { sqlStatements: st } = await diff(schema1, schema2, [
@@ -1642,7 +1642,7 @@ test('drop identity from existing column #13. Rename table + Rename column. Add
16421642
`ALTER TABLE [users2] ADD [id1] int;`,
16431643
`INSERT INTO [users2] ([id1]) SELECT [__old_id1] FROM [users2];`,
16441644
`ALTER TABLE [users2] DROP COLUMN [__old_id1];`,
1645-
"ALTER TABLE [users2] ADD CONSTRAINT [hello_world] CHECK ([users2].[name] !== 'Alex');",
1645+
"ALTER TABLE [users2] ADD CONSTRAINT [hello_world] CHECK ([users2].[name] != 'Alex');",
16461646
];
16471647
expect(st).toStrictEqual(st0);
16481648
expect(pst).toStrictEqual(st0);
@@ -1656,7 +1656,7 @@ test('drop identity from existing column #14. Rename table + Rename column. Drop
16561656
id: int('id').identity(),
16571657
name: varchar(),
16581658
},
1659-
(t) => [check('hello_world', sql`${t.name} !== 'Alex'`)],
1659+
(t) => [check('hello_world', sql`${t.name} != 'Alex'`)],
16601660
),
16611661
};
16621662

@@ -1700,15 +1700,15 @@ test('drop identity from existing column #15. Rename table + Rename column. Tabl
17001700
id: int('id').identity(),
17011701
name: varchar(),
17021702
},
1703-
(t) => [check('hello_world', sql`${t.name} !== 'Alex'`)],
1703+
(t) => [check('hello_world', sql`${t.name} != 'Alex'`)],
17041704
),
17051705
};
17061706

17071707
const schema2 = {
17081708
users: mssqlTable('users2', {
17091709
id: int('id1'),
17101710
name: varchar(),
1711-
}, (t) => [check('hello_world', sql`${t.name} !== 'Alex'`)]),
1711+
}, (t) => [check('hello_world', sql`${t.name} != 'Alex'`)]),
17121712
};
17131713

17141714
const { sqlStatements: st } = await diff(schema1, schema2, [
@@ -1731,7 +1731,7 @@ test('drop identity from existing column #15. Rename table + Rename column. Tabl
17311731
`ALTER TABLE [users2] ADD [id1] int;`,
17321732
`INSERT INTO [users2] ([id1]) SELECT [__old_id1] FROM [users2];`,
17331733
`ALTER TABLE [users2] DROP COLUMN [__old_id1];`,
1734-
"ALTER TABLE [users2] ADD CONSTRAINT [hello_world] CHECK ([users2].[name] !== 'Alex');",
1734+
"ALTER TABLE [users2] ADD CONSTRAINT [hello_world] CHECK ([users2].[name] != 'Alex');",
17351735
];
17361736
expect(st).toStrictEqual(st0);
17371737
expect(pst).toStrictEqual(st0);

drizzle-kit/tests/mssql/constraints.test.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1720,16 +1720,16 @@ test('add check', async () => {
17201720
const schema2 = {
17211721
table: mssqlTable('table', {
17221722
id: int(),
1723-
}, (t) => [check('new_check', sql`${t.id} !== 10`), check('new_check2', sql`${t.id} !== 10`)]),
1723+
}, (t) => [check('new_check', sql`${t.id} != 10`), check('new_check2', sql`${t.id} != 10`)]),
17241724
};
17251725

17261726
const { sqlStatements: st } = await diff(schema1, schema2, []);
17271727
await push({ db, to: schema1, schemas: ['dbo'] });
17281728
const { sqlStatements: pst } = await push({ db, to: schema2, schemas: ['dbo'] });
17291729

17301730
const st0 = [
1731-
'ALTER TABLE [table] ADD CONSTRAINT [new_check] CHECK ([table].[id] !== 10);',
1732-
'ALTER TABLE [table] ADD CONSTRAINT [new_check2] CHECK ([table].[id] !== 10);',
1731+
'ALTER TABLE [table] ADD CONSTRAINT [new_check] CHECK ([table].[id] != 10);',
1732+
'ALTER TABLE [table] ADD CONSTRAINT [new_check2] CHECK ([table].[id] != 10);',
17331733
];
17341734
expect(st).toStrictEqual(st0);
17351735
expect(pst).toStrictEqual(st0);
@@ -1739,7 +1739,7 @@ test('drop check', async () => {
17391739
const schema1 = {
17401740
table: mssqlTable('table', {
17411741
id: int(),
1742-
}, (t) => [check('new_check', sql`${t.id} !== 10`)]),
1742+
}, (t) => [check('new_check', sql`${t.id} != 10`)]),
17431743
};
17441744

17451745
const schema2 = {
@@ -1928,7 +1928,7 @@ test('alter multiple check constraints (rename)', async (t) => {
19281928
table,
19291929
) => [
19301930
check('some_check_name_1', sql`${table.age} > 21`),
1931-
check('some_check_name_2', sql`${table.name} !== 'Alex'`),
1931+
check('some_check_name_2', sql`${table.name} != 'Alex'`),
19321932
],
19331933
),
19341934
};
@@ -1945,7 +1945,7 @@ test('alter multiple check constraints (rename)', async (t) => {
19451945
table,
19461946
) => [
19471947
check('some_check_name_3', sql`${table.age} > 21`),
1948-
check('some_check_name_4', sql`${table.name} !== 'Alex'`),
1948+
check('some_check_name_4', sql`${table.name} != 'Alex'`),
19491949
],
19501950
),
19511951
};
@@ -1958,7 +1958,7 @@ test('alter multiple check constraints (rename)', async (t) => {
19581958
`ALTER TABLE [users] DROP CONSTRAINT [some_check_name_1];`,
19591959
`ALTER TABLE [users] DROP CONSTRAINT [some_check_name_2];`,
19601960
`ALTER TABLE [users] ADD CONSTRAINT [some_check_name_3] CHECK ([users].[age] > 21);`,
1961-
`ALTER TABLE [users] ADD CONSTRAINT [some_check_name_4] CHECK ([users].[name] !== 'Alex');`,
1961+
`ALTER TABLE [users] ADD CONSTRAINT [some_check_name_4] CHECK ([users].[name] != 'Alex');`,
19621962
];
19631963
expect(st).toStrictEqual(st0);
19641964
expect(pst).toStrictEqual(st0);
@@ -1975,7 +1975,7 @@ test('create checks with same names', async (t) => {
19751975
},
19761976
(
19771977
table,
1978-
) => [check('some_check_name', sql`${table.age} > 21`), check('some_check_name', sql`${table.name} !== 'Alex'`)],
1978+
) => [check('some_check_name', sql`${table.age} > 21`), check('some_check_name', sql`${table.name} != 'Alex'`)],
19791979
),
19801980
};
19811981

@@ -1992,15 +1992,15 @@ test('rename table. Table has checks', async (t) => {
19921992
id: int('id'),
19931993
name: varchar(),
19941994
},
1995-
(t) => [check('hello_world', sql`${t.name} !== 'Alex'`)],
1995+
(t) => [check('hello_world', sql`${t.name} != 'Alex'`)],
19961996
),
19971997
};
19981998

19991999
const schema2 = {
20002000
users: mssqlTable('users2', {
20012001
id: int('id'),
20022002
name: varchar(),
2003-
}, (t) => [check('hello_world', sql`${t.name} !== 'Alex'`)]),
2003+
}, (t) => [check('hello_world', sql`${t.name} != 'Alex'`)]),
20042004
};
20052005

20062006
const { sqlStatements: st } = await diff(schema1, schema2, [`dbo.users->dbo.users2`]);
@@ -2010,7 +2010,7 @@ test('rename table. Table has checks', async (t) => {
20102010
expect(st).toStrictEqual([
20112011
`EXEC sp_rename 'users', [users2];`,
20122012
'ALTER TABLE [users2] DROP CONSTRAINT [hello_world];',
2013-
"ALTER TABLE [users2] ADD CONSTRAINT [hello_world] CHECK ([users2].[name] !== 'Alex');",
2013+
"ALTER TABLE [users2] ADD CONSTRAINT [hello_world] CHECK ([users2].[name] != 'Alex');",
20142014
]);
20152015
expect(pst).toStrictEqual([`EXEC sp_rename 'users', [users2];`]); // do not trigger on definition change when using push
20162016
});

0 commit comments

Comments
 (0)