From c9294802d678060f104fc0c1656b8ec3810911ad Mon Sep 17 00:00:00 2001 From: Benedikt Franke Date: Tue, 5 Jul 2022 14:17:36 +0200 Subject: [PATCH] Anonymous migrations --- CHANGELOG.md | 13 ++++++++++++- composer.json | 8 ++++---- src/stubs/console.stub | 4 ++-- src/stubs/factory.stub | 2 +- src/stubs/migration.create.stub | 4 ++-- src/stubs/migration.stub | 4 ++-- src/stubs/migration.update.stub | 6 +++--- src/stubs/seeder.stub | 2 +- 8 files changed, 27 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2c2dd14..e8b5c1f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,11 +2,22 @@ All notable changes to this project will be documented in this file. -The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## Unreleased +## v2.0.0 + +### Fixed + +- Use `Schema::table` in update migration + +### Changed + +- Use anonymous migrations +- Require Laravel `^8.37 || ^9` + ## v1.5.0 ### Added diff --git a/composer.json b/composer.json index 0a83bf2..2ef46ea 100644 --- a/composer.json +++ b/composer.json @@ -11,12 +11,12 @@ } ], "require": { - "php": "^7.2 || ^8", - "illuminate/contracts": "^6 || ^7 || ^8 || ^9" + "php": "^8", + "illuminate/contracts": "^8.37 || ^9" }, "require-dev": { - "orchestra/testbench": "^4 || ^5 || ^6 || ^7", - "nunomaduro/larastan": "^0.6 || ^1" + "orchestra/testbench": "^6 || ^7", + "nunomaduro/larastan": "^1 || ^2" }, "autoload": { "psr-4": { diff --git a/src/stubs/console.stub b/src/stubs/console.stub index 344d1a2..ab4c269 100644 --- a/src/stubs/console.stub +++ b/src/stubs/console.stub @@ -8,8 +8,8 @@ final class {{ class }} extends Command { protected $signature = '{{ command }}'; - public function handle(): int + public function handle(): void { - return 0; + // } } diff --git a/src/stubs/factory.stub b/src/stubs/factory.stub index a1368a1..22869ac 100644 --- a/src/stubs/factory.stub +++ b/src/stubs/factory.stub @@ -1,4 +1,4 @@ -id(); }); } -} +}; diff --git a/src/stubs/migration.stub b/src/stubs/migration.stub index b8911e7..10d9433 100644 --- a/src/stubs/migration.stub +++ b/src/stubs/migration.stub @@ -2,10 +2,10 @@ use Illuminate\Database\Migrations\Migration; -final class {{ class }} extends Migration +return new class() extends Migration { public function up(): void { // } -} +}; diff --git a/src/stubs/migration.update.stub b/src/stubs/migration.update.stub index f02b66b..0652d52 100644 --- a/src/stubs/migration.update.stub +++ b/src/stubs/migration.update.stub @@ -4,12 +4,12 @@ use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -final class {{ class }} extends Migration +return new class() extends Migration { public function up(): void { - Schema::create('{{ table }}', function (Blueprint $table): void { + Schema::table('{{ table }}', function (Blueprint $table): void { // }); } -} +}; diff --git a/src/stubs/seeder.stub b/src/stubs/seeder.stub index 8b206f6..9f7c022 100644 --- a/src/stubs/seeder.stub +++ b/src/stubs/seeder.stub @@ -1,4 +1,4 @@ -