Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
syncEnrollments
Project
Project
Details
Activity
Releases
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
Yeray Santana Hualde
syncEnrollments
Commits
b29f8a88
Commit
b29f8a88
authored
Feb 15, 2012
by
Taylor Otwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add default value for index names.
parent
b73a60de
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
5 deletions
+13
-5
table.php
laravel/database/schema/table.php
+13
-5
No files found.
laravel/database/schema/table.php
View file @
b29f8a88
...
@@ -79,7 +79,7 @@ class Table {
...
@@ -79,7 +79,7 @@ class Table {
* @param string $name
* @param string $name
* @return Fluent
* @return Fluent
*/
*/
public
function
unique
(
$columns
,
$name
)
public
function
unique
(
$columns
,
$name
=
null
)
{
{
return
$this
->
key
(
__FUNCTION__
,
$columns
,
$name
);
return
$this
->
key
(
__FUNCTION__
,
$columns
,
$name
);
}
}
...
@@ -91,7 +91,7 @@ class Table {
...
@@ -91,7 +91,7 @@ class Table {
* @param string $name
* @param string $name
* @return Fluent
* @return Fluent
*/
*/
public
function
fulltext
(
$columns
,
$name
)
public
function
fulltext
(
$columns
,
$name
=
null
)
{
{
return
$this
->
key
(
__FUNCTION__
,
$columns
,
$name
);
return
$this
->
key
(
__FUNCTION__
,
$columns
,
$name
);
}
}
...
@@ -103,7 +103,7 @@ class Table {
...
@@ -103,7 +103,7 @@ class Table {
* @param string $name
* @param string $name
* @return Fluent
* @return Fluent
*/
*/
public
function
index
(
$columns
,
$name
)
public
function
index
(
$columns
,
$name
=
null
)
{
{
return
$this
->
key
(
__FUNCTION__
,
$columns
,
$name
);
return
$this
->
key
(
__FUNCTION__
,
$columns
,
$name
);
}
}
...
@@ -118,9 +118,17 @@ class Table {
...
@@ -118,9 +118,17 @@ class Table {
*/
*/
public
function
key
(
$type
,
$columns
,
$name
)
public
function
key
(
$type
,
$columns
,
$name
)
{
{
$
parameters
=
array
(
'name'
=>
$name
,
'columns'
=>
(
array
)
$columns
)
;
$
columns
=
(
array
)
$columns
;
return
$this
->
command
(
$type
,
$parameters
);
// If no index name was specified, we will concatenate the columns and
// append the index type to the name to generate a unique name for
// the index that can be used when dropping indexes.
if
(
is_null
(
$name
))
{
$name
=
implode
(
'_'
,
$columns
)
.
'_'
.
$type
;
}
return
$this
->
command
(
$type
,
compact
(
'name'
,
'columns'
));
}
}
/**
/**
...
...
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