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 99acca94
authored
Jul 13, 2014
by
Jan Aagaard Meier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove any existing DB file in transaction setup for sqlite
1 parent
26aef71d
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
5 deletions
test/associations/has-many.test.js
test/sequelize.test.js
test/support.js
test/associations/has-many.test.js
View file @
99acca9
...
@@ -1129,7 +1129,6 @@ describe(Support.getTestDialectTeaser("HasMany"), function() {
...
@@ -1129,7 +1129,6 @@ describe(Support.getTestDialectTeaser("HasMany"), function() {
this
.
User
.
hasMany
(
this
.
Task
,
{
through
:
this
.
UserTask
});
this
.
User
.
hasMany
(
this
.
Task
,
{
through
:
this
.
UserTask
});
this
.
Task
.
hasMany
(
this
.
User
,
{
through
:
this
.
UserTask
});
this
.
Task
.
hasMany
(
this
.
User
,
{
through
:
this
.
UserTask
});
this
.
sequelize
=
sequelize
;
this
.
sequelize
=
sequelize
;
return
sequelize
.
sync
({
force
:
true
});
return
sequelize
.
sync
({
force
:
true
});
}).
then
(
function
()
{
}).
then
(
function
()
{
...
...
test/sequelize.test.js
View file @
99acca9
...
@@ -906,7 +906,7 @@ describe(Support.getTestDialectTeaser("Sequelize"), function () {
...
@@ -906,7 +906,7 @@ describe(Support.getTestDialectTeaser("Sequelize"), function () {
it
(
'supports nested transactions using savepoints'
,
function
(
done
)
{
it
(
'supports nested transactions using savepoints'
,
function
(
done
)
{
var
self
=
this
var
self
=
this
var
User
=
this
.
sequelize
.
define
(
'Users'
,
{
username
:
DataTypes
.
STRING
})
var
User
=
this
.
sequelize
WithTransaction
.
define
(
'Users'
,
{
username
:
DataTypes
.
STRING
})
User
.
sync
({
force
:
true
}).
success
(
function
()
{
User
.
sync
({
force
:
true
}).
success
(
function
()
{
self
.
sequelizeWithTransaction
.
transaction
().
then
(
function
(
t1
)
{
self
.
sequelizeWithTransaction
.
transaction
().
then
(
function
(
t1
)
{
...
@@ -994,7 +994,7 @@ describe(Support.getTestDialectTeaser("Sequelize"), function () {
...
@@ -994,7 +994,7 @@ describe(Support.getTestDialectTeaser("Sequelize"), function () {
it
(
'supports rolling back a nested transaction'
,
function
(
done
)
{
it
(
'supports rolling back a nested transaction'
,
function
(
done
)
{
var
self
=
this
var
self
=
this
var
User
=
this
.
sequelize
.
define
(
'Users'
,
{
username
:
DataTypes
.
STRING
})
var
User
=
this
.
sequelize
WithTransaction
.
define
(
'Users'
,
{
username
:
DataTypes
.
STRING
})
User
.
sync
({
force
:
true
}).
success
(
function
()
{
User
.
sync
({
force
:
true
}).
success
(
function
()
{
self
.
sequelizeWithTransaction
.
transaction
().
then
(
function
(
t1
)
{
self
.
sequelizeWithTransaction
.
transaction
().
then
(
function
(
t1
)
{
...
@@ -1019,7 +1019,7 @@ describe(Support.getTestDialectTeaser("Sequelize"), function () {
...
@@ -1019,7 +1019,7 @@ describe(Support.getTestDialectTeaser("Sequelize"), function () {
it
(
'supports rolling back outermost transaction'
,
function
(
done
)
{
it
(
'supports rolling back outermost transaction'
,
function
(
done
)
{
var
self
=
this
var
self
=
this
var
User
=
this
.
sequelize
.
define
(
'Users'
,
{
username
:
DataTypes
.
STRING
})
var
User
=
this
.
sequelize
WithTransaction
.
define
(
'Users'
,
{
username
:
DataTypes
.
STRING
})
User
.
sync
({
force
:
true
}).
success
(
function
()
{
User
.
sync
({
force
:
true
}).
success
(
function
()
{
self
.
sequelizeWithTransaction
.
transaction
().
then
(
function
(
t1
)
{
self
.
sequelizeWithTransaction
.
transaction
().
then
(
function
(
t1
)
{
...
...
test/support.js
View file @
99acca9
...
@@ -38,7 +38,17 @@ var Support = {
...
@@ -38,7 +38,17 @@ var Support = {
var
dialect
=
Support
.
getTestDialect
();
var
dialect
=
Support
.
getTestDialect
();
if
(
dialect
===
'sqlite'
)
{
if
(
dialect
===
'sqlite'
)
{
var
options
=
Sequelize
.
Utils
.
_
.
extend
({},
sequelize
.
options
,
{
storage
:
path
.
join
(
__dirname
,
'tmp'
,
'db.sqlite'
)
})
var
p
=
path
.
join
(
__dirname
,
'tmp'
,
'db.sqlite'
);
return
new
Sequelize
.
Promise
(
function
(
resolve
,
reject
)
{
// We cannot promisify exists, since exists does not follow node callback convention - first argument is a boolean, not an error / null
if
(
fs
.
existsSync
(
p
))
{
resolve
(
Sequelize
.
Promise
.
promisify
(
fs
.
unlink
)(
p
));
}
else
{
resolve
();
}
}).
then
(
function
()
{
var
options
=
Sequelize
.
Utils
.
_
.
extend
({},
sequelize
.
options
,
{
storage
:
p
})
,
_sequelize
=
new
Sequelize
(
sequelize
.
config
.
database
,
null
,
null
,
options
);
,
_sequelize
=
new
Sequelize
(
sequelize
.
config
.
database
,
null
,
null
,
options
);
if
(
callback
)
{
if
(
callback
)
{
...
@@ -46,6 +56,7 @@ var Support = {
...
@@ -46,6 +56,7 @@ var Support = {
}
else
{
}
else
{
return
_sequelize
.
sync
({
force
:
true
}).
return
(
_sequelize
);
return
_sequelize
.
sync
({
force
:
true
}).
return
(
_sequelize
);
}
}
});
}
else
{
}
else
{
if
(
callback
)
{
if
(
callback
)
{
callback
(
sequelize
);
callback
(
sequelize
);
...
...
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