-
Notifications
You must be signed in to change notification settings - Fork 20
[Bug] The migration are ran even if table already exists #14
Copy link
Copy link
Open
Description
Use case :
You have a lot of migration files and to sanitize your migration folder you use the "php artisan schema:dump --prune" command to write all you migrations in an sql dump file.
After installing the package, when i run : "php artisan migrate:fresh --seed", i have an error saying that the table "file_system_items" already exists:
The fix is to add a condition to the migration file :
if(!Schema::hasTable('file_system_items')) {
// The "file_system_items" table do not exists exists...
Schema::create('file_system_items', function (Blueprint $table) {
$table->id();
$table->foreignId('parent_id')->nullable()->constrained('file_system_items')->cascadeOnDelete();
$table->string('name');
$table->string('type');
$table->string('file_type')->nullable();
$table->unsignedBigInteger('size')->nullable();
$table->unsignedInteger('duration')->nullable();
$table->string('thumbnail')->nullable();
$table->string('storage_path')->nullable();
$table->timestamps();
$table->index('type');
$table->index('file_type');
$table->unique(['parent_id', 'name']);
});
};
`Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels