Skip to content
This repository has been archived by the owner on Jun 29, 2023. It is now read-only.

Commit

Permalink
Anonymous migrations
Browse files Browse the repository at this point in the history
  • Loading branch information
spawnia committed Jul 5, 2022
1 parent 0df383d commit c929480
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 16 deletions.
13 changes: 12 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
4 changes: 2 additions & 2 deletions src/stubs/console.stub
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ final class {{ class }} extends Command
{
protected $signature = '{{ command }}';

public function handle(): int
public function handle(): void
{
return 0;
//
}
}
2 changes: 1 addition & 1 deletion src/stubs/factory.stub
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);

namespace {{ factoryNamespace }};

Expand Down
4 changes: 2 additions & 2 deletions src/stubs/migration.create.stub
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
$table->id();
});
}
}
};
4 changes: 2 additions & 2 deletions src/stubs/migration.stub
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

use Illuminate\Database\Migrations\Migration;

final class {{ class }} extends Migration
return new class() extends Migration
{
public function up(): void
{
//
}
}
};
6 changes: 3 additions & 3 deletions src/stubs/migration.update.stub
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
//
});
}
}
};
2 changes: 1 addition & 1 deletion src/stubs/seeder.stub
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);

namespace Database\Seeders;

Expand Down

0 comments on commit c929480

Please sign in to comment.