marshmallow / laravel-open-ai-migrations
Marshmallow - Laravel Migrations using Open AI
Requires
- php: ^8.1
- illuminate/contracts: ^8.0|^9.0|^10.0
Requires (Dev)
- orchestra/testbench: ^6.0|^7.0|^8.0
- phpunit/phpunit: ^9.3|^10.0
This package is auto-updated.
Last update: 2024-10-30 02:10:53 UTC
README
What It Do?!
This command
artisan make:ai-migration "Add is_active and published_at to the posts table after intro" INFO Migration [database/migrations/2023_02_16_082621_change_the_slug_column_in_blogs_to_be_nullable_and_unique.php] created successfully. INFO Estimated costs of [$0.00302] for using [151] tokens.
Will turn into this!!
Schema::table('posts', function (Blueprint $table) { $table->after('intro', function (Blueprint $table) { $table->boolean('is_active')->default(true); $table->dateTime('published_at')->nullable(); }); });
Installation
You can install the package via composer:
Install via Composer
composer require marshmallow/laravel-open-ai-migrations
Publish the config file
php artisan vendor:publish --tag=laravel-open-ai-migrations
Add your API Key
Add your Open AI API key to your .env
file.
OPEN_AI_API_KEY="sk-xxxxxxx"
Update the config file
After you've published the config file, you need to add your Open AI API token. There is also some other magic you can do there, you should realy check it out.
Usage
Run the AI Migration command with a description of what you want this migration to do.
artisan make:ai-migration "Change the slug column in blogs to be nullable and unique"
After this artisan command is ready, you will have a full migration file in your migrations folder with exactly that!
public function up() { Schema::table('blogs', function (Blueprint $table) { $table->string('slug')->nullable()->unique()->change(); }); }
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
License
The MIT License (MIT). Please see License File for more information.