Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
B
beego
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
beego
Commits
e81f1e53
Unverified
Commit
e81f1e53
authored
Jan 04, 2018
by
astaxie
Committed by
GitHub
Jan 04, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3017 from Medicean/develop
Update: Fix migration generate SQL
parents
0507076c
cf92d2c6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
+4
-4
ddl.go
migration/ddl.go
+4
-4
No files found.
migration/ddl.go
View file @
e81f1e53
...
...
@@ -322,7 +322,7 @@ func (m *Migration) GetSQL() (sql string) {
sql
+=
fmt
.
Sprintf
(
"
\n
DROP COLUMN `%s`"
,
column
.
Name
)
}
if
len
(
m
.
Columns
)
>
index
{
if
len
(
m
.
Columns
)
>
index
+
1
{
sql
+=
","
}
}
...
...
@@ -355,7 +355,7 @@ func (m *Migration) GetSQL() (sql string) {
}
else
{
sql
+=
fmt
.
Sprintf
(
"
\n
DROP COLUMN `%s`"
,
column
.
Name
)
}
if
len
(
m
.
Columns
)
>
index
{
if
len
(
m
.
Columns
)
>
index
+
1
{
sql
+=
","
}
}
...
...
@@ -366,14 +366,14 @@ func (m *Migration) GetSQL() (sql string) {
for
index
,
unique
:=
range
m
.
Uniques
{
sql
+=
fmt
.
Sprintf
(
"
\n
DROP KEY `%s`"
,
unique
.
Definition
)
if
len
(
m
.
Uniques
)
>
index
{
if
len
(
m
.
Uniques
)
>
index
+
1
{
sql
+=
","
}
}
for
index
,
column
:=
range
m
.
Renames
{
sql
+=
fmt
.
Sprintf
(
"
\n
CHANGE COLUMN `%s` `%s` %s %s %s %s"
,
column
.
NewName
,
column
.
OldName
,
column
.
OldDataType
,
column
.
OldUnsign
,
column
.
OldNull
,
column
.
OldDefault
)
if
len
(
m
.
Renames
)
>
index
{
if
len
(
m
.
Renames
)
>
index
+
1
{
sql
+=
","
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment