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
9459b440
Commit
9459b440
authored
Nov 14, 2013
by
Klimov Paul
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Composite primary key support removed from Sphinx schema.
parent
47a2e211
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
30 deletions
+6
-30
IndexSchema.php
extensions/sphinx/IndexSchema.php
+2
-26
Schema.php
extensions/sphinx/Schema.php
+4
-4
No files found.
extensions/sphinx/IndexSchema.php
View file @
9459b440
...
@@ -29,9 +29,9 @@ class IndexSchema extends Object
...
@@ -29,9 +29,9 @@ class IndexSchema extends Object
*/
*/
public
$name
;
public
$name
;
/**
/**
* @var string
[] primary keys
of this index.
* @var string
primary key
of this index.
*/
*/
public
$primaryKey
=
[]
;
public
$primaryKey
;
/**
/**
* @var ColumnSchema[] column metadata of this index. Each array element is a [[ColumnSchema]] object, indexed by column names.
* @var ColumnSchema[] column metadata of this index. Each array element is a [[ColumnSchema]] object, indexed by column names.
*/
*/
...
@@ -56,27 +56,4 @@ class IndexSchema extends Object
...
@@ -56,27 +56,4 @@ class IndexSchema extends Object
{
{
return
array_keys
(
$this
->
columns
);
return
array_keys
(
$this
->
columns
);
}
}
/**
* Manually specifies the primary key for this table.
* @param string|array $keys the primary key (can be composite)
* @throws InvalidParamException if the specified key cannot be found in the table.
*/
public
function
fixPrimaryKey
(
$keys
)
{
if
(
!
is_array
(
$keys
))
{
$keys
=
[
$keys
];
}
$this
->
primaryKey
=
$keys
;
foreach
(
$this
->
columns
as
$column
)
{
$column
->
isPrimaryKey
=
false
;
}
foreach
(
$keys
as
$key
)
{
if
(
isset
(
$this
->
columns
[
$key
]))
{
$this
->
columns
[
$key
]
->
isPrimaryKey
=
true
;
}
else
{
throw
new
InvalidParamException
(
"Primary key '
$key
' cannot be found in index '
{
$this
->
name
}
'."
);
}
}
}
}
}
\ No newline at end of file
extensions/sphinx/Schema.php
View file @
9459b440
...
@@ -70,7 +70,7 @@ class Schema extends Object
...
@@ -70,7 +70,7 @@ class Schema extends Object
* @param string $name index name
* @param string $name index name
* @return IndexSchema driver dependent index metadata. Null if the index does not exist.
* @return IndexSchema driver dependent index metadata. Null if the index does not exist.
*/
*/
protected
function
load
Table
Schema
(
$name
)
protected
function
load
Index
Schema
(
$name
)
{
{
$index
=
new
IndexSchema
;
$index
=
new
IndexSchema
;
$this
->
resolveIndexNames
(
$index
,
$name
);
$this
->
resolveIndexNames
(
$index
,
$name
);
...
@@ -119,7 +119,7 @@ class Schema extends Object
...
@@ -119,7 +119,7 @@ class Schema extends Object
if
(
$cache
instanceof
Cache
)
{
if
(
$cache
instanceof
Cache
)
{
$key
=
$this
->
getCacheKey
(
$name
);
$key
=
$this
->
getCacheKey
(
$name
);
if
(
$refresh
||
(
$index
=
$cache
->
get
(
$key
))
===
false
)
{
if
(
$refresh
||
(
$index
=
$cache
->
get
(
$key
))
===
false
)
{
$index
=
$this
->
load
Table
Schema
(
$realName
);
$index
=
$this
->
load
Index
Schema
(
$realName
);
if
(
$index
!==
null
)
{
if
(
$index
!==
null
)
{
$cache
->
set
(
$key
,
$index
,
$db
->
schemaCacheDuration
,
new
GroupDependency
(
$this
->
getCacheGroup
()));
$cache
->
set
(
$key
,
$index
,
$db
->
schemaCacheDuration
,
new
GroupDependency
(
$this
->
getCacheGroup
()));
}
}
...
@@ -127,7 +127,7 @@ class Schema extends Object
...
@@ -127,7 +127,7 @@ class Schema extends Object
return
$this
->
_indexes
[
$name
]
=
$index
;
return
$this
->
_indexes
[
$name
]
=
$index
;
}
}
}
}
return
$this
->
_indexes
[
$name
]
=
$index
=
$this
->
load
Table
Schema
(
$realName
);
return
$this
->
_indexes
[
$name
]
=
$index
=
$this
->
load
Index
Schema
(
$realName
);
}
}
/**
/**
...
@@ -424,7 +424,7 @@ class Schema extends Object
...
@@ -424,7 +424,7 @@ class Schema extends Object
$column
=
$this
->
loadColumnSchema
(
$info
);
$column
=
$this
->
loadColumnSchema
(
$info
);
$index
->
columns
[
$column
->
name
]
=
$column
;
$index
->
columns
[
$column
->
name
]
=
$column
;
if
(
$column
->
isPrimaryKey
)
{
if
(
$column
->
isPrimaryKey
)
{
$index
->
primaryKey
[]
=
$column
->
name
;
$index
->
primaryKey
=
$column
->
name
;
}
}
}
}
return
true
;
return
true
;
...
...
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