Schema::create('posts', function($table) {
$table->increments('id');
$table->string('title');
$table->string('content');
$table->timestamps();
});
CREATE TABLE `posts` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`title` varchar(255) NOT NULL DEFAULT '',
`content` varchar(255) NOT NULL DEFAULT '',
`created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
`updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (`id`)
)
Schema::rename($from, $to);
Schema::rename('posts', 'articles');
ALTER TABLE `posts`
RENAME TO `articles`;
Schema::dropIfExists('posts');
Schema::table('posts', function($table)
{
$table->string('tag');
});
ALTER TABLE `posts`
ADD `tag` varchar(255);
Schema::table('posts', function($table)
{
$table->dropColumn('tag');
});
ALTER TABLE `posts`
DROP COLUMN `tag`;
Schema::table('posts', function($table)
{
$table->renameColumn('from', 'to');
});
ALTER TABLE `posts`
RENAME COLUMN `from` to `to`;