@@ -17,14 +17,65 @@ test('should be able to diff some mysql', async ({ assert }) => {
17
17
) Engine=InnoDB DEFAULT CHARSET=utf8mb4;
18
18
`
19
19
const r = await sqldef ( 'mysql' , sql1 , sql2 )
20
- assert . equal ( r , 'ALTER TABLE `user` DROP COLUMN `created_at`' )
20
+ assert . snapshot ( r )
21
+ } )
22
+
23
+ test ( 'should be able to diff some mssql' , async ( { assert } ) => {
24
+ const sql1 = `
25
+ CREATE TABLE dbo.Employee (
26
+ EmployeeID INT PRIMARY KEY
27
+ );
28
+ `
29
+
30
+ const sql2 = `
31
+ CREATE TABLE dbo.Employee (
32
+ Employee INT PRIMARY KEY
33
+ );
34
+ `
35
+ const r = await sqldef ( 'mssql' , sql1 , sql2 )
36
+ assert . snapshot ( r )
37
+ } )
38
+
39
+ test ( 'should be able to diff some sqlite' , async ( { assert } ) => {
40
+ const sql1 = `
41
+ CREATE TABLE IF NOT EXISTS user (
42
+ id INT PRIMARY KEY
43
+ );
44
+ `
45
+
46
+ const sql2 = `
47
+ CREATE TABLE IF NOT EXISTS user (
48
+ id INT PRIMARY KEY,
49
+ name VARCHAR NOT NULL
50
+ );
51
+ `
52
+ const r = await sqldef ( 'sqlite' , sql1 , sql2 )
53
+ assert . snapshot ( r )
54
+ } )
55
+
56
+ test ( 'should be able to diff some postgres' , async ( { assert } ) => {
57
+ const sql1 = `
58
+ CREATE TABLE IF NOT EXISTS user (
59
+ id INT PRIMARY KEY
60
+ );
61
+ `
62
+
63
+ const sql2 = `
64
+ CREATE TABLE IF NOT EXISTS user (
65
+ id INT PRIMARY KEY,
66
+ name VARCHAR NOT NULL,
67
+ location point
68
+ );
69
+ `
70
+ const r = await sqldef ( 'postgres' , sql1 , sql2 )
71
+ assert . snapshot ( r )
21
72
} )
22
73
23
74
test ( 'should throw on bad SQL' , async ( { assert} ) => {
24
75
try {
25
76
await sqldef ( 'mysql' , 'BAD STUFF' , 'NOT SQL, SORRRY' )
26
77
assert . equal ( true , 'Should have thrown' )
27
78
} catch ( e ) {
28
- assert . equal ( true , e . message . includes ( 'found syntax error when parsing DDL' ) , `Error is not correct: ${ e . message } ` )
79
+ assert . snapshot ( e . message )
29
80
}
30
81
} )
0 commit comments