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
6fd74f5c
Commit
6fd74f5c
authored
Jun 08, 2013
by
gevik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updated code style. braces on the same line for control statements.
parent
19793f7a
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
24 deletions
+12
-24
Schema.php
framework/yii/db/pgsql/Schema.php
+12
-24
No files found.
framework/yii/db/pgsql/Schema.php
View file @
6fd74f5c
...
...
@@ -89,16 +89,13 @@ class Schema extends \yii\db\Schema
protected
function
resolveTableNames
(
$table
,
$name
)
{
$parts
=
explode
(
'.'
,
str_replace
(
'"'
,
''
,
$name
));
if
(
isset
(
$parts
[
1
]))
{
if
(
isset
(
$parts
[
1
]))
{
$table
->
schemaName
=
$parts
[
0
];
$table
->
name
=
$parts
[
1
];
}
else
{
}
else
{
$table
->
name
=
$parts
[
0
];
}
if
(
$table
->
schemaName
===
null
)
{
if
(
$table
->
schemaName
===
null
)
{
$table
->
schemaName
=
$this
->
defaultSchema
;
}
}
...
...
@@ -123,8 +120,7 @@ class Schema extends \yii\db\Schema
{
$table
=
new
TableSchema
();
$this
->
resolveTableNames
(
$table
,
$name
);
if
(
$this
->
findColumns
(
$table
))
{
if
(
$this
->
findColumns
(
$table
))
{
$this
->
findConstraints
(
$table
);
return
$table
;
}
...
...
@@ -166,11 +162,9 @@ SQL;
foreach
(
$constraints
as
$constraint
)
{
$columns
=
explode
(
','
,
$constraint
[
'columns'
]);
$fcolumns
=
explode
(
','
,
$constraint
[
'foreign_columns'
]);
if
(
$constraint
[
'foreign_table_schema'
]
!==
$this
->
defaultSchema
)
{
if
(
$constraint
[
'foreign_table_schema'
]
!==
$this
->
defaultSchema
)
{
$foreign_table
=
$constraint
[
'foreign_table_schema'
]
.
'.'
.
$constraint
[
'foreign_table_name'
];
}
else
{
}
else
{
$foreign_table
=
$constraint
[
'foreign_table_name'
];
}
$citem
=
array
(
$foreign_table
);
...
...
@@ -246,21 +240,17 @@ ORDER BY
a.attnum;
SQL;
try
{
try
{
$columns
=
$this
->
db
->
createCommand
(
$sql
)
->
queryAll
();
}
catch
(
\Exception
$e
)
{
}
catch
(
\Exception
$e
)
{
return
false
;
}
foreach
(
$columns
as
$column
)
{
$column
=
$this
->
loadColumnSchema
(
$column
);
$table
->
columns
[
$column
->
name
]
=
$column
;
if
(
$column
->
isPrimaryKey
===
true
)
{
if
(
$column
->
isPrimaryKey
===
true
)
{
$table
->
primaryKey
[]
=
$column
->
name
;
if
(
$table
->
sequenceName
===
null
&&
preg_match
(
"/nextval\('\w+'(::regclass)?\)/"
,
$column
->
defaultValue
)
===
1
)
{
if
(
$table
->
sequenceName
===
null
&&
preg_match
(
"/nextval\('\w+'(::regclass)?\)/"
,
$column
->
defaultValue
)
===
1
)
{
$table
->
sequenceName
=
preg_replace
(
array
(
'/nextval/'
,
'/::/'
,
'/regclass/'
,
'/\'\)/'
,
'/\(\'/'
),
''
,
$column
->
defaultValue
);
}
}
...
...
@@ -289,11 +279,9 @@ SQL;
$column
->
scale
=
$info
[
'numeric_scale'
];
$column
->
size
=
$info
[
'size'
];
if
(
isset
(
$this
->
typeMap
[
$column
->
dbType
]))
{
if
(
isset
(
$this
->
typeMap
[
$column
->
dbType
]))
{
$column
->
type
=
$this
->
typeMap
[
$column
->
dbType
];
}
else
{
}
else
{
$column
->
type
=
self
::
TYPE_STRING
;
}
$column
->
phpType
=
$this
->
getColumnPhpType
(
$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