Framework: Schema builder not removing unsigned flag from column.

Created on 13 Apr 2017  路  2Comments  路  Source: laravel/framework

  • Laravel Version: 5.4.16
  • PHP Version: 7.1.3-3
  • Database Driver & Version: MySQL 5.7.17

Description:

I've added the doctrine/dbal package and created the migration below. It doesn't seem to want to remove the unsigned flag from the column though. My column is still unsigned after the migration completes.

Steps To Reproduce:

Create the following migration for a table and run it.

    public function up()
    {
        Schema::table('sales', function (Blueprint $table) {
            $table->decimal('amount', 19, 4)->change();
        });
    }

    public function down()
    {
        Schema::table('sales', function (Blueprint $table) {
            $table->decimal('amount', 19, 4)->unsigned()->change();
        });
    }

Most helpful comment

I believe that the first line doesn't change the unsigned flag at all, and the second one sets it. Try ->unsigned(false) to disable it.

All 2 comments

I believe that the first line doesn't change the unsigned flag at all, and the second one sets it. Try ->unsigned(false) to disable it.

Interesting, I just did some more testing and by omitting unsigned() on an integer field, it'll remove the unsigned from the field. However, if you omit it on a decimal field like above, it does not remove it. Now sure if that's intended behaviour or a bug.

However, using unsigned(false) does in fact remove the unsigned from both field types, so thank you for that.

I'll close this but I'll ping @taylorotwell @themsaid in case that is in fact a bug.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kerbylav picture kerbylav  路  3Comments

SachinAgarwal1337 picture SachinAgarwal1337  路  3Comments

Fuzzyma picture Fuzzyma  路  3Comments

iivanov2 picture iivanov2  路  3Comments

jackmu95 picture jackmu95  路  3Comments