Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
Project
Overview
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PSDI Army
yii2
Commits
f5dbd9a0
Commit
f5dbd9a0
authored
May 23, 2014
by
Qiang Xue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes #3564: Fixed the bug that primary key columns should not take default values from schema
parent
6e7713ec
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
13 additions
and
6 deletions
+13
-6
CHANGELOG.md
framework/CHANGELOG.md
+1
-0
Schema.php
framework/db/cubrid/Schema.php
+4
-0
Schema.php
framework/db/mssql/Schema.php
+1
-1
Schema.php
framework/db/mysql/Schema.php
+1
-1
Schema.php
framework/db/oci/Schema.php
+2
-0
Schema.php
framework/db/pgsql/Schema.php
+2
-4
Schema.php
framework/db/sqlite/Schema.php
+2
-0
No files found.
framework/CHANGELOG.md
View file @
f5dbd9a0
...
@@ -30,6 +30,7 @@ Yii Framework 2 Change Log
...
@@ -30,6 +30,7 @@ Yii Framework 2 Change Log
-
Bug #3458: Fixed the bug that the image rendered by
`CaptchaAction`
was using a wrong content type (MDMunir, qiangxue)
-
Bug #3458: Fixed the bug that the image rendered by
`CaptchaAction`
was using a wrong content type (MDMunir, qiangxue)
-
Bug #3522: Fixed BaseFileHelper::normalizePath to allow a (.) for the current path. (skotos)
-
Bug #3522: Fixed BaseFileHelper::normalizePath to allow a (.) for the current path. (skotos)
-
Bug #3548: Fixed the bug that X-Rate-Limit-Remaining header is always zero when using RateLimiter (qiangxue)
-
Bug #3548: Fixed the bug that X-Rate-Limit-Remaining header is always zero when using RateLimiter (qiangxue)
-
Bug #3564: Fixed the bug that primary key columns should not take default values from schema (qiangxue)
-
Bug #3567: Fixed the bug that smallint was treated as string for PostgreSQL (qiangxue)
-
Bug #3567: Fixed the bug that smallint was treated as string for PostgreSQL (qiangxue)
-
Bug: Fixed inconsistent return of
`\yii\console\Application::runAction()`
(samdark)
-
Bug: Fixed inconsistent return of
`\yii\console\Application::runAction()`
(samdark)
-
Enh #2264:
`CookieCollection::has()`
will return false for expired or removed cookies (qiangxue)
-
Enh #2264:
`CookieCollection::has()`
will return false for expired or removed cookies (qiangxue)
...
...
framework/db/cubrid/Schema.php
View file @
f5dbd9a0
...
@@ -227,6 +227,10 @@ class Schema extends \yii\db\Schema
...
@@ -227,6 +227,10 @@ class Schema extends \yii\db\Schema
$column
->
phpType
=
$this
->
getColumnPhpType
(
$column
);
$column
->
phpType
=
$this
->
getColumnPhpType
(
$column
);
if
(
$column
->
isPrimaryKey
)
{
return
$column
;
}
if
(
$column
->
type
===
'timestamp'
&&
$info
[
'Default'
]
===
'CURRENT_TIMESTAMP'
||
if
(
$column
->
type
===
'timestamp'
&&
$info
[
'Default'
]
===
'CURRENT_TIMESTAMP'
||
$column
->
type
===
'datetime'
&&
$info
[
'Default'
]
===
'SYS_DATETIME'
||
$column
->
type
===
'datetime'
&&
$info
[
'Default'
]
===
'SYS_DATETIME'
||
$column
->
type
===
'date'
&&
$info
[
'Default'
]
===
'SYS_DATE'
||
$column
->
type
===
'date'
&&
$info
[
'Default'
]
===
'SYS_DATE'
||
...
...
framework/db/mssql/Schema.php
View file @
f5dbd9a0
...
@@ -221,7 +221,7 @@ class Schema extends \yii\db\Schema
...
@@ -221,7 +221,7 @@ class Schema extends \yii\db\Schema
if
(
$info
[
'column_default'
]
==
'(NULL)'
)
{
if
(
$info
[
'column_default'
]
==
'(NULL)'
)
{
$info
[
'column_default'
]
=
null
;
$info
[
'column_default'
]
=
null
;
}
}
if
(
$column
->
type
!==
'timestamp'
||
$info
[
'column_default'
]
!==
'CURRENT_TIMESTAMP'
)
{
if
(
!
$column
->
isPrimaryKey
&&
(
$column
->
type
!==
'timestamp'
||
$info
[
'column_default'
]
!==
'CURRENT_TIMESTAMP'
)
)
{
$column
->
defaultValue
=
$column
->
typecast
(
$info
[
'column_default'
]);
$column
->
defaultValue
=
$column
->
typecast
(
$info
[
'column_default'
]);
}
}
...
...
framework/db/mysql/Schema.php
View file @
f5dbd9a0
...
@@ -168,7 +168,7 @@ class Schema extends \yii\db\Schema
...
@@ -168,7 +168,7 @@ class Schema extends \yii\db\Schema
$column
->
phpType
=
$this
->
getColumnPhpType
(
$column
);
$column
->
phpType
=
$this
->
getColumnPhpType
(
$column
);
if
(
$column
->
type
!==
'timestamp'
||
$info
[
'Default'
]
!==
'CURRENT_TIMESTAMP'
)
{
if
(
!
$column
->
isPrimaryKey
&&
(
$column
->
type
!==
'timestamp'
||
$info
[
'Default'
]
!==
'CURRENT_TIMESTAMP'
)
)
{
$column
->
defaultValue
=
$column
->
typecast
(
$info
[
'Default'
]);
$column
->
defaultValue
=
$column
->
typecast
(
$info
[
'Default'
]);
}
}
...
...
framework/db/oci/Schema.php
View file @
f5dbd9a0
...
@@ -170,11 +170,13 @@ EOD;
...
@@ -170,11 +170,13 @@ EOD;
$this
->
extractColumnType
(
$c
,
$column
[
'DATA_TYPE'
]);
$this
->
extractColumnType
(
$c
,
$column
[
'DATA_TYPE'
]);
$this
->
extractColumnSize
(
$c
,
$column
[
'DATA_TYPE'
]);
$this
->
extractColumnSize
(
$c
,
$column
[
'DATA_TYPE'
]);
if
(
!
$column
->
isPrimaryKey
)
{
if
(
stripos
(
$column
[
'DATA_DEFAULT'
],
'timestamp'
)
!==
false
)
{
if
(
stripos
(
$column
[
'DATA_DEFAULT'
],
'timestamp'
)
!==
false
)
{
$c
->
defaultValue
=
null
;
$c
->
defaultValue
=
null
;
}
else
{
}
else
{
$c
->
defaultValue
=
$c
->
typecast
(
$column
[
'DATA_DEFAULT'
]);
$c
->
defaultValue
=
$c
->
typecast
(
$column
[
'DATA_DEFAULT'
]);
}
}
}
return
$c
;
return
$c
;
}
}
...
...
framework/db/pgsql/Schema.php
View file @
f5dbd9a0
...
@@ -367,14 +367,12 @@ SQL;
...
@@ -367,14 +367,12 @@ SQL;
foreach
(
$columns
as
$column
)
{
foreach
(
$columns
as
$column
)
{
$column
=
$this
->
loadColumnSchema
(
$column
);
$column
=
$this
->
loadColumnSchema
(
$column
);
$table
->
columns
[
$column
->
name
]
=
$column
;
$table
->
columns
[
$column
->
name
]
=
$column
;
if
(
$column
->
isPrimaryKey
===
true
)
{
if
(
$column
->
isPrimaryKey
)
{
$table
->
primaryKey
[]
=
$column
->
name
;
$table
->
primaryKey
[]
=
$column
->
name
;
if
(
$table
->
sequenceName
===
null
&&
preg_match
(
"/nextval
\\
('
\"
?
\\
w+
\"
?\.?
\"
?
\\
w+
\"
?'(::regclass)?
\\
)/"
,
$column
->
defaultValue
)
===
1
)
{
if
(
$table
->
sequenceName
===
null
&&
preg_match
(
"/nextval
\\
('
\"
?
\\
w+
\"
?\.?
\"
?
\\
w+
\"
?'(::regclass)?
\\
)/"
,
$column
->
defaultValue
)
===
1
)
{
$table
->
sequenceName
=
preg_replace
([
'/nextval/'
,
'/::/'
,
'/regclass/'
,
'/\'\)/'
,
'/\(\'/'
],
''
,
$column
->
defaultValue
);
$table
->
sequenceName
=
preg_replace
([
'/nextval/'
,
'/::/'
,
'/regclass/'
,
'/\'\)/'
,
'/\(\'/'
],
''
,
$column
->
defaultValue
);
}
}
}
}
elseif
(
$column
->
defaultValue
)
{
if
(
$column
->
defaultValue
)
{
if
(
preg_match
(
"/^'(.*?)'::/"
,
$column
->
defaultValue
,
$matches
)
||
preg_match
(
"/^(.*?)::/"
,
$column
->
defaultValue
,
$matches
))
{
if
(
preg_match
(
"/^'(.*?)'::/"
,
$column
->
defaultValue
,
$matches
)
||
preg_match
(
"/^(.*?)::/"
,
$column
->
defaultValue
,
$matches
))
{
$column
->
defaultValue
=
$matches
[
1
];
$column
->
defaultValue
=
$matches
[
1
];
}
}
...
...
framework/db/sqlite/Schema.php
View file @
f5dbd9a0
...
@@ -238,12 +238,14 @@ class Schema extends \yii\db\Schema
...
@@ -238,12 +238,14 @@ class Schema extends \yii\db\Schema
}
}
$column
->
phpType
=
$this
->
getColumnPhpType
(
$column
);
$column
->
phpType
=
$this
->
getColumnPhpType
(
$column
);
if
(
!
$column
->
isPrimaryKey
)
{
$value
=
trim
(
$info
[
'dflt_value'
],
"'
\"
"
);
$value
=
trim
(
$info
[
'dflt_value'
],
"'
\"
"
);
if
(
$column
->
type
===
'string'
)
{
if
(
$column
->
type
===
'string'
)
{
$column
->
defaultValue
=
$value
;
$column
->
defaultValue
=
$value
;
}
else
{
}
else
{
$column
->
defaultValue
=
$column
->
typecast
(
strcasecmp
(
$value
,
'null'
)
?
$value
:
null
);
$column
->
defaultValue
=
$column
->
typecast
(
strcasecmp
(
$value
,
'null'
)
?
$value
:
null
);
}
}
}
return
$column
;
return
$column
;
}
}
...
...
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