Skip to content

Bug: duplicate the "DEFAULT" when trying to migrate #9671

Description

@avegacms

PHP Version

8.2

CodeIgniter4 Version

4.6.1

CodeIgniter4 Installation Method

Composer (using codeigniter4/appstarter)

Which operating systems have you tested for this bug?

Linux

Which server did you use?

nginx

Database

PostgreSQL

What happened?

When I tried to perform a migration with a modification of the default value, a DEFAULT duplication error occurs.

SYSTEMPATH/Database/Postgre/Connection.php:206
pg_query(Object(PgSql\Connection), 'ALTER TABLE "stores" ALTER COLUMN "delivery_sum" SET DEFAULT  DEFAULT 100')

Steps to Reproduce

Make migration via spark command migrate --all

<?php

declare(strict_types=1);

namespace App\Database\Migrations;

use CodeIgniter\Database\Migration;

class UpdateDefaultDeliverySumValue extends Migration
{
    public function up(): void
    {
        $this->forge->modifyColumn('stores', [
            'delivery_sum'      => ['type' => 'int', 'constraint' => 6, 'default' => 100],
            'delivery_free_sum' => ['type' => 'int', 'constraint' => 6, 'default' => 1000],
        ]);
    }

    public function down(): void
    {
        
    }
}

Expected Output

The command is expected to be executed correctly

Anything else?

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugVerified issues on the current code behavior or pull requests that will fix them

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions