Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
public
/
sequelize
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
不要怂,就是干,撸起袖子干!
Commit 42ed19cc
authored
Dec 11, 2011
by
sdepold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tests for remove index
1 parent
1b593a74
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
9 deletions
spec/query-generator.mysql.spec.js
spec/query-generator.mysql.spec.js
View file @
42ed19c
...
@@ -10,7 +10,7 @@ describe('QueryGenerator', function() {
...
@@ -10,7 +10,7 @@ describe('QueryGenerator', function() {
afterEach
(
function
()
{
Helpers
.
drop
()
})
afterEach
(
function
()
{
Helpers
.
drop
()
})
var
suites
=
{
var
suites
=
{
'createTableQuery'
:
[
createTableQuery
:
[
{
{
arguments
:
[
'myTable'
,
{
title
:
'VARCHAR(255)'
,
name
:
'VARCHAR(255)'
}],
arguments
:
[
'myTable'
,
{
title
:
'VARCHAR(255)'
,
name
:
'VARCHAR(255)'
}],
expectation
:
"CREATE TABLE IF NOT EXISTS `myTable` (`title` VARCHAR(255), `name` VARCHAR(255)) ENGINE=InnoDB;"
expectation
:
"CREATE TABLE IF NOT EXISTS `myTable` (`title` VARCHAR(255), `name` VARCHAR(255)) ENGINE=InnoDB;"
...
@@ -25,14 +25,14 @@ describe('QueryGenerator', function() {
...
@@ -25,14 +25,14 @@ describe('QueryGenerator', function() {
}
}
],
],
'dropTableQuery'
:
[
dropTableQuery
:
[
{
{
arguments
:
[
'myTable'
],
arguments
:
[
'myTable'
],
expectation
:
"DROP TABLE IF EXISTS `myTable`;"
expectation
:
"DROP TABLE IF EXISTS `myTable`;"
}
}
],
],
'selectQuery'
:
[
selectQuery
:
[
{
{
arguments
:
[
'myTable'
],
arguments
:
[
'myTable'
],
expectation
:
"SELECT * FROM `myTable`;"
expectation
:
"SELECT * FROM `myTable`;"
...
@@ -76,7 +76,7 @@ describe('QueryGenerator', function() {
...
@@ -76,7 +76,7 @@ describe('QueryGenerator', function() {
}
}
],
],
'insertQuery'
:
[
insertQuery
:
[
{
{
arguments
:
[
'myTable'
,
{
name
:
'foo'
}],
arguments
:
[
'myTable'
,
{
name
:
'foo'
}],
expectation
:
"INSERT INTO `myTable` (`name`) VALUES ('foo');"
expectation
:
"INSERT INTO `myTable` (`name`) VALUES ('foo');"
...
@@ -92,7 +92,7 @@ describe('QueryGenerator', function() {
...
@@ -92,7 +92,7 @@ describe('QueryGenerator', function() {
}
}
],
],
'updateQuery'
:
[
updateQuery
:
[
{
{
arguments
:
[
'myTable'
,
{
name
:
'foo'
,
birthday
:
new
Date
(
2011
,
2
,
27
,
10
,
1
,
55
)},
{
id
:
2
}],
arguments
:
[
'myTable'
,
{
name
:
'foo'
,
birthday
:
new
Date
(
2011
,
2
,
27
,
10
,
1
,
55
)},
{
id
:
2
}],
expectation
:
"UPDATE `myTable` SET `name`='foo',`birthday`='2011-03-27 10:01:55' WHERE `id`=2"
expectation
:
"UPDATE `myTable` SET `name`='foo',`birthday`='2011-03-27 10:01:55' WHERE `id`=2"
...
@@ -108,7 +108,7 @@ describe('QueryGenerator', function() {
...
@@ -108,7 +108,7 @@ describe('QueryGenerator', function() {
}
}
],
],
'deleteQuery'
:
[
deleteQuery
:
[
{
{
arguments
:
[
'myTable'
,
{
name
:
'foo'
}],
arguments
:
[
'myTable'
,
{
name
:
'foo'
}],
expectation
:
"DELETE FROM `myTable` WHERE `name`='foo' LIMIT 1"
expectation
:
"DELETE FROM `myTable` WHERE `name`='foo' LIMIT 1"
...
@@ -124,7 +124,7 @@ describe('QueryGenerator', function() {
...
@@ -124,7 +124,7 @@ describe('QueryGenerator', function() {
}
}
],
],
'addIndexQuery'
:
[
addIndexQuery
:
[
{
{
arguments
:
[
'User'
,
[
'username'
,
'isAdmin'
]],
arguments
:
[
'User'
,
[
'username'
,
'isAdmin'
]],
expectation
:
'CREATE INDEX user_username_is_admin ON User (username, isAdmin)'
expectation
:
'CREATE INDEX user_username_is_admin ON User (username, isAdmin)'
...
@@ -144,7 +144,7 @@ describe('QueryGenerator', function() {
...
@@ -144,7 +144,7 @@ describe('QueryGenerator', function() {
}
}
],
],
'showIndexQuery'
:
[
showIndexQuery
:
[
{
{
arguments
:
[
'User'
],
arguments
:
[
'User'
],
expectation
:
'SHOW INDEX FROM User'
expectation
:
'SHOW INDEX FROM User'
...
@@ -154,7 +154,17 @@ describe('QueryGenerator', function() {
...
@@ -154,7 +154,17 @@ describe('QueryGenerator', function() {
}
}
],
],
'hashToWhereConditions'
:
[
removeIndexQuery
:
[
{
arguments
:
[
'User'
,
'user_foo_bar'
],
expectation
:
"DROP INDEX user_foo_bar ON User"
},
{
arguments
:
[
'User'
,
[
'foo'
,
'bar'
]],
expectation
:
"DROP INDEX user_foo_bar ON User"
}
],
hashToWhereConditions
:
[
{
{
arguments
:
[{
id
:
[
1
,
2
,
3
]
}],
arguments
:
[{
id
:
[
1
,
2
,
3
]
}],
expectation
:
"`id` IN (1,2,3)"
expectation
:
"`id` IN (1,2,3)"
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment