Laravel Dacapo 2019-09-06 YYPHP 99

Laravel Dacapo 2019-09-06 YYPHP 99

Laravel Dacapo (ダカーポ) マイグレーション生成サポートツール 作りました!

39e7d3ad2417a5fd26d816a51c99e7ce?s=128

ゆうきゃん

September 06, 2019
Tweet

Transcript

  1. Laravel Dacapo(μΧʔϙ) ϚΠάϨʔγϣϯੜ੒αϙʔτπʔϧ ࡞Γ·ͨ͠ʂ 2019.09.06 YYPHP#99 @ucan_lab

  2. ࣗݾ঺հ ࢲ͕Ώ͏͖ΌΜͰ͢ɻ

  3. LaravelͷϚΠάϨʔγϣϯ ॻ͘ͷɺ μϧ͘ͳ͍Ͱ͔͢ʁ

  4. جຊͷϚΠάϨʔγϣϯ 1. ϚΠάϨʔγϣϯͻͳܗੜ੒ίϚϯυ 2. ϚΠάϨʔγϣϯͷup ͱ down Λॻ͘ 3. ϚΠάϨʔγϣϯ࣮ߦίϚϯυ

  5. ࡞੒ͷϚΠάϨʔγϣϯ $ php artisan make:migration create_articles_table Created Migration: 2019_09_06_031620_create_articles_table class

    CreateArticlesTable extends Migration { public function up() { Schema::create('articles', function (Blueprint $table) { $table->bigIncrements('id'); $table->mediumText('content'); $table->timestamps(); }); } public function down() { Schema::dropIfExists('articles'); } } php artisan migrate
  6. มߋͷϚΠάϨʔγϣϯ $ php artisan make:migration add_title_to_articles_table Created Migration: 2019_09_06_031659_add_title_to_articles_table class

    AddTitleToArticlesTable extends Migration { public function up() { Schema::table('articles', function (Blueprint $table) { $table->string('title')->after('id'); }); } public function down() { Schema::table('articles', function (Blueprint $table) { $table->dropColumn('string'); }); } } php artisan migrate
  7. ͜ΕΛ܁Γฦ͠·͢

  8. None
  9. μϧ͍ϙΠϯτ

  10. μϧ͍ϙΠϯτ • ࠷৽ͷςʔϒϧߏ੒͕෼͔Βͳ͍ • ςʔϒϧมߋͷίετ͕େ͖͍ • Ϋϥε໊͸ϢχʔΫʹ͢Δඞཁ͕͋Δ • up, down

    ͷ੔߹ੑΛؾʹ͢Δ • ࡧҾ΍֎෦Ωʔ͕ೖΔͱ͞Βʹ΍΍͘͜͠...
  11. ͱʹ͔͘ΊΜͲ͍͘͞

  12. ୭͔͕ݴ͍·ͨ͠ɻ

  13. ਓ͕ؒ΍Δ΂͖Ͱͳ͍͜ͱ͸ ϓϩάϥϜʹπʔϧʹ೚ͤΑ͏ @nrslib ͞Μͷ͓ݴ༿ΑΓ

  14. ͜ͷ໰୊Λղܾ͢Δͷ͕ μΧʔϙͰ͢ʂ

  15. ucan-lab/laravel-dacapo

  16. μΧʔϙͷΠϯετʔϧ $ composer require --dev ucan-lab/laravel-dacapo

  17. articles: columns: id: bigIncrements title: string content: mediumText users: columns:

    id: bigIncrements name: string email: type: string unique: true email_verified_at: type: timestamp nullable: true password: string rememberToken: true timestamps: true schema.yml Λఆٛ $ php artisan dacapo:generate
  18. None
  19. μΧʔϙͷػೳᶃ • طଘͷϚΠάϨʔγϣϯΛ࡟আ͠ɺ
 schema.yml ͷهड़Λݩʹ࠷৽ͷঢ়ଶͷϚΠάϨʔ γϣϯϑΝΠϧΛੜ੒͠·͢ɻ • php artisan migrate:fresh

    Ͱશςʔϒϧͷ࡟আ͠ɺ
 ϚΠάϨʔγϣϯΛ࣮ߦ͢Δӡ༻Ͱ͢ɻ
  20. μΧʔϙͷػೳᶄ • ςʔϒϧ࡞੒ͷϚΠάϨʔγϣϯϑΝΠϧΛੜ੒ • ֎෦Ωʔ੍໿ͷϚΠάϨʔγϣϯϑΝΠϧΛੜ੒ • Ұҙ੍໿ɺࡧҾͷϚΠάϨʔγϣϯϑΝΠϧΛੜ੒ • Eloquent ModelͷͻͳܗΛੜ੒

  21. μΧʔϙͷ஫ҙɾཹҙࣄ߲ • ಛੑ্ɺϓϩδΣΫτͷॳظϑΣʔζʹ࢖༻͢Δϥ ΠϒϥϦͰ͢ɻ • ӡ༻ϑΣʔζʹೖͬͨΒμΧʔϙ͸ΞϯΠϯετʔ ϧ͠ɺ௨ৗͷϚΠάϨʔγϣϯӡ༻ʹ໭͠·͢ɻ • ຊ൪ͷσʔλ͕શ෦ফ͑ͯ͠·͏ͷͰ...ɻɻ

  22. μΧʔϙͷಋೖͨ͠ϝϦοτ • ৗʹ࠷৽ͷςʔϒϧߏ੒Ͱݟ΍͍͢ • ςʔϒϧɺ֎෦ɺࡧҾͱ෼͔Εͯͯݟ΍͍͢ • schema.yml Ұݩ؅ཧͷͨΊݟ΍͍͢ • yml

    ͸άϧʔϓ͝ͱʹ෼ׂͰ͖ͯ෼͔Γ΍͍͢
  23. μΧʔϙͷࠓޙ ver3.0

  24. ͱ͜ΖͰ

  25. 2019.09.03 Laravel 6 Released

  26. ͓ΊͰͱ͏͍͟͝·͢

  27. ΋ͪΖΜ

  28. μΧʔϙ͸ Laravel 6.0 αϙʔτࡁΈ

  29. ͍͞͝ʹ • ػձ͕͋ͬͨΒͥͻ࢖ͬͯΈ͍ͯͩ͘͞ʂ • GitHubʹstar͍ͩ͘͞ɻ
 ʢ͓ئ͍͠·͢ԿͰ΋͠·͔͢Βʣ