Skip to content

Commit 9e806a0

Browse files
committed
move migrations to seperate
1 parent e5258dc commit 9e806a0

File tree

4 files changed

+29
-4
lines changed

4 files changed

+29
-4
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "mastashake08/laravel-openai-api",
33
"description": "Add an OpenAI API and Artisan command easily into your projects. Generate images, or text. Can be integrated with Laravel Sanctum for token based access.",
4-
"version": "1.7.1",
4+
"version": "1.7.2",
55
"keywords": [
66
"mastashake08",
77
"laravel",
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
3+
use Illuminate\Database\Migrations\Migration;
4+
use Illuminate\Database\Schema\Blueprint;
5+
use Illuminate\Support\Facades\Schema;
6+
7+
return new class extends Migration
8+
{
9+
/**
10+
* Run the migrations.
11+
*/
12+
public function up(): void
13+
{
14+
Schema::create('prompts', function (Blueprint $table) {
15+
$table->unsignedBigInteger('user_id')->nullable();
16+
$table->string('user_type')->nullable();
17+
});
18+
}
19+
20+
/**
21+
* Reverse the migrations.
22+
*/
23+
public function down(): void
24+
{
25+
26+
}
27+
};

database/migrations/create_openai_api_table.php.stub

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ return new class extends Migration
1515
$table->id();
1616
$table->string('prompt_text');
1717
$table->json('data');
18-
$table->unsignedBigInteger('user_id');
19-
$table->string('user_type');
2018
$table->timestamps();
2119
});
2220
}

src/LaravelOpenaiApiServiceProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public function configurePackage(Package $package): void
1919
->name('laravel-openai-api')
2020
->hasConfigFile(['openai'])
2121
->hasRoute('api')
22-
->hasMigration('create_openai_api_table')
22+
->hasMigrations(['create_openai_api_table', 'add_polymorphic_relations_to_prompts'])
2323
->hasCommand(LaravelOpenaiApiCommand::class)
2424
->hasInstallCommand(function(InstallCommand $command) {
2525
$command

0 commit comments

Comments
 (0)