Skip to content

Schema::rename('oldtable','newtable') support #480

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 19, 2012
Merged

Schema::rename('oldtable','newtable') support #480

merged 3 commits into from
Jul 19, 2012

Conversation

cviebrock
Copy link
Contributor

Tested against mysql and sqlite. I don't have access to postgres or sqlserver. Also, the comments in laravel/database/schema.php should probably be rewritten -- I just copied them from the drop() command.

Signed-off-by: Colin Viebrock <colin@viebrock.ca>
Signed-off-by: Colin Viebrock <colin@viebrock.ca>
@daylerees
Copy link
Contributor

If it works on all DBs this will be sweeeeeets.

@maikeldaloo
Copy link

that's a good feature to have :)

@daylerees
Copy link
Contributor

As a note, we have had many people asking for this in IRC.

@cviebrock
Copy link
Contributor Author

@daylerees Well, get it pulled then! ;)

@daylerees
Copy link
Contributor

@cviebrock I have no control over this one mate :) I'm sure T will get round to it soon enough.

@vespakoen
Copy link
Contributor

Tested this on PostgreSQL, was not working correctly.

schema.php, line 57 "$table->rename($name);" should be changed to "$table->rename($rename);"

After this fix it does work on PostgreSQL (9.1.3)

I would also suggest using $new_name in stead of $rename

Good luck on this pull!

@sparksp
Copy link
Contributor

sparksp commented May 27, 2012

Has anyone confirmed this works on SQLServer yet?

@daylerees
Copy link
Contributor

I will setup a VM to test this soon so we can get it in the core asap.

@causingeffect
Copy link

I really look forward to seeing this included in an upcoming version! Thanks for the work cviebrock, Vespakoen, and daylerees.

@eazuka
Copy link

eazuka commented Jun 25, 2012

this will be a cool feature to have. i'm also looking forward to this feature in an upcoming version.

taylorotwell added a commit that referenced this pull request Jul 19, 2012
Schema::rename('oldtable','newtable') support
@taylorotwell taylorotwell merged commit 38234c6 into laravel:develop Jul 19, 2012
@DJMcK
Copy link

DJMcK commented Feb 13, 2013

This is exactly what I was looking for! Noticed it doesn't carry over the prefix on the rename though.

Talking about the prefix(s) set in .../application/config/database.php

@DJMcK
Copy link

DJMcK commented Feb 13, 2013

Possible solution, working on mySQL:

return 'RENAME TABLE '.$this->wrap($table).' TO '.Grammar::wrap_table($command->name);

laravel/database/schema/grammars/mysql.php line:224

zoe-edwards pushed a commit to zoe-edwards/laravel that referenced this pull request Oct 14, 2013
@cviebrock cviebrock deleted the schema-rename branch December 11, 2013 15:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants