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

shopblocks picture shopblocks  路  3Comments

lzp819739483 picture lzp819739483  路  3Comments

digirew picture digirew  路  3Comments

felixsanz picture felixsanz  路  3Comments

JamborJan picture JamborJan  路  3Comments