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
55a77110
authored
2014-08-14 10:19:55 +0800
by
astaxie
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
migration: skip reset
1 parent
436edda9
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
1 deletions
migration/migration.go
migration/migration.go
View file @
55a7711
...
...
@@ -43,7 +43,10 @@ type Migrationer interface {
GetCreated
()
int64
}
var
migrationMap
map
[
string
]
Migrationer
var
(
migrationMap
map
[
string
]
Migrationer
SkipReset
[]
string
)
func
init
()
{
migrationMap
=
make
(
map
[
string
]
Migrationer
)
...
...
@@ -172,6 +175,10 @@ func Rollback(name string) error {
func
Reset
()
error
{
i
:=
0
for
k
,
v
:=
range
migrationMap
{
if
inSlice
(
k
,
SkipReset
)
{
beego
.
Info
(
"skip the"
,
k
)
continue
}
beego
.
Info
(
"start reset:"
,
k
)
v
.
Down
()
err
:=
v
.
Exec
(
k
,
"down"
)
...
...
@@ -232,3 +239,12 @@ func sortMap(m map[string]Migrationer) dataSlice {
sort
.
Sort
(
s
)
return
s
}
func
inSlice
(
key
string
,
sli
[]
string
)
bool
{
for
_
,
v
:=
range
sli
{
if
v
==
key
{
return
true
}
}
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