Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
U
UserAdminV2
Overview
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
庄欣
UserAdminV2
Commits
7d4a346f
Commit
7d4a346f
authored
Apr 02, 2012
by
Colin Viebrock
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding Schema::rename('oldtable','newtable') support
Signed-off-by: Colin Viebrock <colin@viebrock.ca>
parent
2a49787e
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
59 additions
and
0 deletions
+59
-0
laravel/database/schema/grammars/mysql.php
+12
-0
laravel/database/schema/grammars/postgres.php
+12
-0
laravel/database/schema/grammars/sqlite.php
+12
-0
laravel/database/schema/grammars/sqlserver.php
+12
-0
laravel/database/schema/table.php
+11
-0
No files found.
laravel/database/schema/grammars/mysql.php
View file @
7d4a346f
...
...
@@ -213,6 +213,18 @@ class MySQL extends Grammar {
}
/**
* Generate the SQL statement for a rename table command.
*
* @param Table $table
* @param Fluent $command
* @return string
*/
public
function
rename
(
Table
$table
,
Fluent
$command
)
{
return
'RENAME TABLE '
.
$this
->
wrap
(
$table
)
.
' TO '
.
$this
->
wrap
(
$command
->
name
);
}
/**
* Generate the SQL statement for a drop table command.
*
* @param Table $table
...
...
laravel/database/schema/grammars/postgres.php
View file @
7d4a346f
...
...
@@ -199,6 +199,18 @@ class Postgres extends Grammar {
}
/**
* Generate the SQL statement for a rename table command.
*
* @param Table $table
* @param Fluent $command
* @return string
*/
public
function
rename
(
Table
$table
,
Fluent
$command
)
{
return
'ALTER TABLE '
.
$this
->
wrap
(
$table
)
.
' RENAME TO '
.
$this
->
wrap
(
$command
->
name
);
}
/**
* Generate the SQL statement for a drop table command.
*
* @param Table $table
...
...
laravel/database/schema/grammars/sqlite.php
View file @
7d4a346f
...
...
@@ -202,6 +202,18 @@ class SQLite extends Grammar {
}
/**
* Generate the SQL statement for a rename table command.
*
* @param Table $table
* @param Fluent $command
* @return string
*/
public
function
rename
(
Table
$table
,
Fluent
$command
)
{
return
'ALTER TABLE '
.
$this
->
wrap
(
$table
)
.
' RENAME TO '
.
$this
->
wrap
(
$command
->
name
);
}
/**
* Generate the SQL statement for a drop table command.
*
* @param Table $table
...
...
laravel/database/schema/grammars/sqlserver.php
View file @
7d4a346f
...
...
@@ -213,6 +213,18 @@ class SQLServer extends Grammar {
}
/**
* Generate the SQL statement for a rename table command.
*
* @param Table $table
* @param Fluent $command
* @return string
*/
public
function
rename
(
Table
$table
,
Fluent
$command
)
{
return
'ALTER TABLE '
.
$this
->
wrap
(
$table
)
.
' RENAME TO '
.
$this
->
wrap
(
$command
->
name
);
}
/**
* Generate the SQL statement for a drop table command.
*
* @param Table $table
...
...
laravel/database/schema/table.php
View file @
7d4a346f
...
...
@@ -143,6 +143,17 @@ class Table {
}
/**
* Rename the database table.
*
* @param string $name
* @return Fluent
*/
public
function
rename
(
$name
)
{
return
$this
->
command
(
__FUNCTION__
,
compact
(
'name'
));
}
/**
* Drop the database table.
*
* @return Fluent
...
...
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