forked from brianc/node-sql
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdrop-table-tests.js
More file actions
96 lines (91 loc) · 2.32 KB
/
drop-table-tests.js
File metadata and controls
96 lines (91 loc) · 2.32 KB
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
'use strict';
var Harness = require('./support');
var post = Harness.definePostTable();
Harness.test({
query: post.drop(),
pg: {
text : 'DROP TABLE "post"',
string: 'DROP TABLE "post"'
},
sqlite: {
text : 'DROP TABLE "post"',
string: 'DROP TABLE "post"'
},
mysql: {
text : 'DROP TABLE `post`',
string: 'DROP TABLE `post`'
},
mssql: {
text : 'DROP TABLE [post]',
string: 'DROP TABLE [post]'
},
oracle: {
text : 'DROP TABLE "post"',
string: 'DROP TABLE "post"'
},
params: []
});
Harness.test({
query: post.drop().ifExists(),
pg: {
text : 'DROP TABLE IF EXISTS "post"',
string: 'DROP TABLE IF EXISTS "post"'
},
sqlite: {
text : 'DROP TABLE IF EXISTS "post"',
string: 'DROP TABLE IF EXISTS "post"'
},
mysql: {
text : 'DROP TABLE IF EXISTS `post`',
string: 'DROP TABLE IF EXISTS `post`'
},
mssql: {
text : 'IF EXISTS(SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = [post]) BEGIN DROP TABLE [post] END',
string: 'IF EXISTS(SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = [post]) BEGIN DROP TABLE [post] END'
},
oracle: {
text : 'BEGIN EXECUTE IMMEDIATE \'DROP TABLE "post"\'; EXCEPTION WHEN OTHERS THEN IF SQLCODE != -942 THEN RAISE; END IF; END;',
string: 'BEGIN EXECUTE IMMEDIATE \'DROP TABLE "post"\'; EXCEPTION WHEN OTHERS THEN IF SQLCODE != -942 THEN RAISE; END IF; END;'
},
params: []
});
Harness.test({
query: post.drop().cascade(),
pg: {
text : 'DROP TABLE "post" CASCADE',
string: 'DROP TABLE "post" CASCADE'
},
sqlite: {
text : 'Sqlite do not support CASCADE in DROP TABLE',
throws: true
},
mysql: {
text : 'DROP TABLE `post` CASCADE',
string: 'DROP TABLE `post` CASCADE'
},
oracle: {
text : 'DROP TABLE "post" CASCADE CONSTRAINTS',
string: 'DROP TABLE "post" CASCADE CONSTRAINTS'
},
params: []
});
Harness.test({
query: post.drop().restrict(),
pg: {
text : 'DROP TABLE "post" RESTRICT',
string: 'DROP TABLE "post" RESTRICT'
},
sqlite: {
text : 'Sqlite do not support RESTRICT in DROP TABLE',
throws: true
},
mysql: {
text : 'DROP TABLE `post` RESTRICT',
string: 'DROP TABLE `post` RESTRICT'
},
oracle: {
text : 'Oracle do not support RESTRICT in DROP TABLE',
throws: true
},
params: []
});