Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
张磊
/
FileStorageBeego
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
d2119f71
authored
2014-08-14 11:39:59 +0800
by
astaxie
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
update the migrations
1 parent
f98b1810
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
1 deletions
migration/migration.go
migration/migration.go
View file @
d2119f7
...
...
@@ -148,6 +148,7 @@ func Upgrade(lasttime int64) error {
}
}
beego
.
Info
(
"total success upgrade:"
,
i
,
" migration"
)
time
.
Sleep
(
2
*
time
.
Second
)
return
nil
}
...
...
@@ -163,6 +164,7 @@ func Rollback(name string) error {
return
err
}
beego
.
Info
(
"end rollback"
)
time
.
Sleep
(
2
*
time
.
Second
)
return
nil
}
else
{
return
errors
.
New
(
"not exist the migrationMap name:"
+
name
)
...
...
@@ -176,6 +178,7 @@ func Reset() error {
for
k
,
v
:=
range
migrationMap
{
if
isRollBack
(
k
)
{
beego
.
Info
(
"skip the"
,
k
)
time
.
Sleep
(
1
*
time
.
Second
)
continue
}
beego
.
Info
(
"start reset:"
,
k
)
...
...
@@ -189,6 +192,7 @@ func Reset() error {
beego
.
Info
(
"end reset:"
,
k
)
}
beego
.
Info
(
"total success reset:"
,
i
,
" migration"
)
time
.
Sleep
(
2
*
time
.
Second
)
return
nil
}
...
...
@@ -242,7 +246,7 @@ func sortMap(m map[string]Migrationer) dataSlice {
func
isRollBack
(
name
string
)
bool
{
o
:=
orm
.
NewOrm
()
var
maps
[]
orm
.
Params
num
,
err
:=
o
.
Raw
(
"select * from migrations where `name` = ? order by id desc"
,
name
)
.
Values
(
&
maps
)
num
,
err
:=
o
.
Raw
(
"select * from migrations where `name` = ? order by id
_migration
desc"
,
name
)
.
Values
(
&
maps
)
if
err
!=
nil
{
beego
.
Info
(
"get name has error"
,
err
)
return
false
...
...
Write
Preview
Styling with
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