laravel migrate增加、修改、删除字段

1,444次阅读
没有评论

生成migration文件

 php artisan make:migration alter_xxx_table 

修改migration文件

public function up()
{
Schema::table(‘xxx’, function (Blueprint $table) {
$table->string(‘a’, 1000); //增加
$table->string(‘b’, 100)->nullable()->change(); //修改
$table->renameColumn(‘c’, ‘d’); //重命名
$table->dropColumn([‘e’, ‘f’, ‘g’]);//删除
});
}

/**
 * Reverse the migrations.
 *
 * @return void
 */
public function down()
{
    Schema::table('xxx', function (Blueprint $table) {
        $table->drop_column('a'); //增加
        $table->string('b', 100)->change(); //修改
        $table->renameColumn('d', 'c'); //重命名
        $table->string('e', 1000); //删除
        $table->string('f', 1000); //删除
        $table->string('g', 1000); //删除
    });
}

}

执行命令

 php artisan migrate 

撤回命令

 php artisan migrate:rollback –step=n(n为撤回步数) 

正文完
可以使用微信扫码关注公众号(ID:xzluomor)
post-qrcode
 0
评论(没有评论)

文心AIGC

2023 年 11 月
 12345
6789101112
13141516171819
20212223242526
27282930  
文心AIGC
文心AIGC
人工智能ChatGPT,AIGC指利用人工智能技术来生成内容,其中包括文字、语音、代码、图像、视频、机器人动作等等。被认为是继PGC、UGC之后的新型内容创作方式。AIGC作为元宇宙的新方向,近几年迭代速度呈现指数级爆发,谷歌、Meta、百度等平台型巨头持续布局
文章搜索
热门文章
潞晨尤洋:日常办公没必要上私有模型,这三类企业才需要 | MEET2026

潞晨尤洋:日常办公没必要上私有模型,这三类企业才需要 | MEET2026

潞晨尤洋:日常办公没必要上私有模型,这三类企业才需要 | MEET2026 Jay 2025-12-22 09...
反超Nano Banana!OpenAI旗舰图像生成模型上线

反超Nano Banana!OpenAI旗舰图像生成模型上线

反超Nano Banana!OpenAI旗舰图像生成模型上线 Jay 2025-12-17 10:25:43 ...
“昆山杯”第二十七届清华大学创业大赛决赛举行

“昆山杯”第二十七届清华大学创业大赛决赛举行

“昆山杯”第二十七届清华大学创业大赛决赛举行 一水 2025-12-22 17:04:24 来源:量子位 本届...
企业级智能体落地,谁没踩这四种大坑?无问芯穹的系统性解法来了

企业级智能体落地,谁没踩这四种大坑?无问芯穹的系统性解法来了

企业级智能体落地,谁没踩这四种大坑?无问芯穹的系统性解法来了 衡宇 2025-12-16 20:10:53 来...
最新评论
ufabet ufabet มีเกมให้เลือกเล่นมากมาย: เกมเดิมพันหลากหลาย ครบทุกค่ายดัง
tornado crypto mixer tornado crypto mixer Discover the power of privacy with TornadoCash! Learn how this decentralized mixer ensures your transactions remain confidential.
ดูบอลสด ดูบอลสด Very well presented. Every quote was awesome and thanks for sharing the content. Keep sharing and keep motivating others.
ดูบอลสด ดูบอลสด Pretty! This has been a really wonderful post. Many thanks for providing these details.
ดูบอลสด ดูบอลสด Pretty! This has been a really wonderful post. Many thanks for providing these details.
ดูบอลสด ดูบอลสด Hi there to all, for the reason that I am genuinely keen of reading this website’s post to be updated on a regular basis. It carries pleasant stuff.
Obrazy Sztuka Nowoczesna Obrazy Sztuka Nowoczesna Thank you for this wonderful contribution to the topic. Your ability to explain complex ideas simply is admirable.
ufabet ufabet Hi there to all, for the reason that I am genuinely keen of reading this website’s post to be updated on a regular basis. It carries pleasant stuff.
ufabet ufabet You’re so awesome! I don’t believe I have read a single thing like that before. So great to find someone with some original thoughts on this topic. Really.. thank you for starting this up. This website is something that is needed on the internet, someone with a little originality!
ufabet ufabet Very well presented. Every quote was awesome and thanks for sharing the content. Keep sharing and keep motivating others.
热评文章
小米语音首席科学家:AI发展的本质就像生物进化,不开源要慢1000倍 | MEET2026

小米语音首席科学家:AI发展的本质就像生物进化,不开源要慢1000倍 | MEET2026

小米语音首席科学家:AI发展的本质就像生物进化,不开源要慢1000倍 | MEET2026 克雷西 2025-...
顶尖技术+标准产品+创新模式+可靠服务,打造大模型商业落地中国范式

顶尖技术+标准产品+创新模式+可靠服务,打造大模型商业落地中国范式

顶尖技术+标准产品+创新模式+可靠服务,打造大模型商业落地中国范式 思邈 2025-12-16 10:24:0...
PPIO姚欣:AI正在进入自主行动与创造时代,智能体需要全新的操作系统|MEET2026

PPIO姚欣:AI正在进入自主行动与创造时代,智能体需要全新的操作系统|MEET2026

PPIO姚欣:AI正在进入自主行动与创造时代,智能体需要全新的操作系统|MEET2026 梦瑶 2025-12...
Dexmal原力灵机提出ManiAgent,用多智能体协作重构机器人操控

Dexmal原力灵机提出ManiAgent,用多智能体协作重构机器人操控

Dexmal原力灵机提出ManiAgent,用多智能体协作重构机器人操控 量子位的朋友们 2025-12-16...
推特吵架吵出篇论文!谢赛宁团队新作iREPA只要3行代码

推特吵架吵出篇论文!谢赛宁团队新作iREPA只要3行代码

推特吵架吵出篇论文!谢赛宁团队新作iREPA只要3行代码 henry 2025-12-16 15:03:31 ...