Coder Social home page Coder Social logo

thedragoncode / laravel-actions Goto Github PK

View Code? Open in Web Editor NEW
186.0 2.0 12.0 3.99 MB

Performing any actions during the deployment process

Home Page: https://actions.dragon-code.pro

License: MIT License

PHP 100.00%
laravel laravel-framework lumen lumen-framework actions action migration migrations migration-tool

laravel-actions's Introduction

laravel-actions's People

Contributors

actions-user avatar adelf avatar andrey-helldar avatar dependabot[bot] avatar kuodster avatar saintpeter avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

laravel-actions's Issues

Cannot install inside a fresh laravel 10 project

Environment

  • PHP Version: 8.1
  • Database Driver & Version: mysql 8.0
  • Actions Version: ^4.2
  • Laravel Version: 10

Issue description

Composer install fails when installing inside a fresh laravel 10 project

Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - dragon-code/support[v6.0.1, ..., v6.11.0] require dragon-code/contracts ^2.18 -> found dragon-code/contracts[2.x-dev] but it does not match your minimum-stability.
    - dragon-code/laravel-actions dev-main requires dragon-code/support ^6.6 -> satisfiable by dragon-code/support[v6.6.0, ..., v6.11.0].
    - Root composer.json requires dragon-code/laravel-actions dev-main -> satisfiable by dragon-code/laravel-actions[dev-main].

Steps to reproduce

  1. Install Laravel 10
  2. composer require dragon-code/laravel-actions

Add the ability to automatically generate a file name when creating

Now, when creating a file, you must enter the name yourself to form the file. It would be cool to do it automatically.

How will it look like:

If you don't fill in the name parameter when creating the command, it should automatically generate a name for the file.

As a prefix, can take the current branch name from the repository, if it exists.

For example,

# with git

php artisan make:migration:action

// 2022_01_28_184116_main_1643384476.php
// 2022_01_28_184117_main_1643384477.php
// 2022_01_28_184118_crm_2345_1643384478.php
// 2022_01_28_184119_crm_2345_1643384479.php
# without git

php artisan make:migration:action

// 2022_01_28_184116_auto_1643384476.php
// 2022_01_28_184117_auto_1643384477.php
// 2022_01_28_184118_auto_1643384478.php
// 2022_01_28_184119_auto_1643384479.php
# with name parameter

php artisan make:migration:action FooBar

// 2022_01_28_184116_foo_bar.php
// 2022_01_28_184117_foo_bar.php
// 2022_01_28_184118_foo_bar.php
// 2022_01_28_184119_foo_bar.php

The idea is that if the developer does not need meaningful names, then auto-creation can be applied, leaving only the check of the current active branch in the repository.

Upgrading from 2.x to 4.x fails on database migrations

Environment

  • PHP Version: 8.1.3
  • Database Driver & Version: pgsql (Postgresql 14.5)
  • Actions Version: 4.1.0
  • Laravel Version: 9.41.0

Issue description

This likely won't impact many people at this stage, but I am in the process of upgrading from Laravel-Migration-Actions 2.x to Laravel-Actions 4.x, and ran into an issue because the BaseChangeColumn migration uses $this->config->table to determine the table name.

However, by 4.x, the configured default table name is 'actions' rather than 'migration_actions', and because of that, the changes in BaseChangeColumn are not actually applied.

The result was that while php artisan migrate appeared to work, but on the first run of php artisan actions, it did not recognize that any of the actions had already run and tried to run them again. An SQL error then arose after the first action completed, because it could not save the action name/batch number into the database since the 'migration' field no longer existed:

[previous exception] [object] (PDOException(code: 42703): SQLSTATE[42703]: Undefined column: 7 ERROR:  column \"action\" of relation \"actions\" does not exist
LINE 1: insert into \"actions\" (\"action\", \"batch\") values ($1, $2)

My solution was to add an additional migration in the app itself to make those changes -after- the rename was completed.

<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration {
    public function up(): void
    {
        Schema::table('actions', function (Blueprint $table) {
            $table->renameColumn('migration', 'action');
            $table->unsignedInteger('batch')->change();
        });
    }
};

Steps to reproduce

php artisan migrate followed by php artisan actions after upgrading from 2.x to 4.x

Add the ability to execute a specific file

Description:

Calling migrations allows you to execute one file:

php artisan migrate --path=2021_12_06_144806_test.php
php artisan migrate --path=custom/directory/2021_12_06_144806_test.php

We need to add the same functionality to invoke actions but with a features:

php artisan migrate --file=2021_12_06_144806_test.php
php artisan migrate --file=custom/directory/2021_12_06_144806_test.php
// or
php artisan migrate --file=2021_12_06_144806_test
php artisan migrate --file=custom/directory/2021_12_06_144806_test

Isolated option

Feature description

Hello,

First of all, thank you for this bookshop, it is really useful. I would like to know if it was possible to add the isolated option to this package in the same way as laravel migration which allows launching the migration on a single server during a deployment on several servers.

Thanks in advance

Execution of actions during deployment in two stages

Feature description

Now the call of actions is carried out in one stage and you have to choose when to do it - before updating the symlink during zero-downtime deploy or after.

It is planned to add the possibility of a two-stage deployment.

For example with deployer:

task('deploy', [
    // ...
    'artisan:migrate',
    'artisan:migrate:actions --before', // here
    'deploy:publish',
    'php-fpm:reload',
    'artisan:queue:restart',
    'artisan:migrate:actions', // here
]);

Environment

No response

Anonymous migrations do not work with Laravel 8

  • Laravel Actions Version: 2.4.0
  • Laravel/Lumen Version: 8.64
  • PHP Version: 7.4
  • Database: mysql
  • Database Version: 8

Description:

Currently the detection of the anonymous migrations feature is not ideal since anonymous migrations has been introduced in Laravel 8.37 and the code checks if the major version of the app is 9.

Steps To Reproduce:

Create Laravel >8.37 project, create anonymous migration and try to migrate. It will fail.

Warn: "Actions repository already exists" every run

Environment

  • PHP Version: 8.0.15
  • Database Driver & Version: MariaDB 10.4.22
  • Actions Version: 4.2.1
  • Laravel Version: 9.52.5

Issue description

Whenever I run the php artisan actions command I get a warning "Actions repository already exists".

My migration actions execute properly, but I get the warning none-the-less.

Looking at the source code it looks like the Install class is running the handle function which generates this warning every time. It's unclear why it should run at all.

Steps to reproduce

It's unclear, but I just updated from 2.x to using the migrate:actions:upgrade command to 3.x, then to 4.x.

Migration Action throws error when there are non Action files within the actions folder

Environment

  • PHP Version: 8.1
  • Database Driver & Version: MySQL
  • Migration Actions Version: 3.x
  • Laravel Version: 9.x

Issue description

I have a subfolder within my actions folder that does not contain Action classes.. example:

image

By Running php artisan migrate:actions I get the following error:

  DragonCode\LaravelActions\Services\Migrator::resolveAction(): Return value must be of type DragonCode\LaravelActions\Action, int returned

I think files that do not extend Action shouldn't be taken into account or files that don't start with xxxx_xx_xx_xxxxx_..... etc...

Steps to reproduce

Create any file within a subfolder inside the actions directory and run php artisan migrate:actions

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.