voyager icon indicating copy to clipboard operation
voyager copied to clipboard

Exception: The "oldName" column option is not supported.

Open dmatis2 opened this issue 1 year ago • 7 comments

Laravel version

10

PHP version

8.1.18

Voyager version

dev-1.6-l10

Database

SQLite

Description

When creating a table, I get this error:

Exception: The "oldName" column option is not supported.

Steps to reproduce

  • create new Laravel project
  • install Voyager
  • open Admin panel
  • click Tools > Database
  • populate columns
  • click "Create New Table"

Expected behavior

Table created

Screenshots

image

Additional context

No response

dmatis2 avatar May 11 '23 10:05 dmatis2

same with PostgreSQL 15

doanbaanh avatar May 11 '23 12:05 doanbaanh

same error

mragwa avatar Aug 06 '23 11:08 mragwa

same issue

ouadiadiv avatar Aug 19 '23 22:08 ouadiadiv

sime issue

ouadiadiv avatar Aug 19 '23 22:08 ouadiadiv

same issue with MySQL

unabomber87 avatar Aug 21 '23 11:08 unabomber87

i find the problem inside namespace Doctrine\DBAL\Schema; in this path vendor\doctrine\dbal\src\Schema\Column.php in the function public function setOptions(array $options) this old code before change

public function setOptions(array $options)
    {
        foreach ($options as $name => $value) {
            $method = 'set' . $name;

            if (! method_exists($this, $method)) {
                throw UnknownColumnOption::new($name);
            }

            $this->$method($value);
        }

        return $this;
    }

and this new code after change

   public function setOptions(array $options)
    {
        foreach ($options as $name => $value) {
            $method = 'set' . $name;
            if (!method_exists($this, $method)) {
                // next major: throw an exception
                Deprecation::trigger(
                    'doctrine/dbal',
                    'https://github.com/doctrine/dbal/pull/2846',
                    'The "%s" column option is not supported,' .
                        ' setting unknown options is deprecated and will cause an error in Doctrine DBAL 3.0',
                    $name
                );

                continue;
            }

            $this->$method($value);
        }

        return $this;
    }

or can only change this code

if (!method_exists($this, $method)) {
    throw UnknownColumnOption::new($name);
}

to Using continue; to Skip Unsupported Options:

if (!method_exists($this, $method)) {
//throw UnknownColumnOption::new($name);
    continue;
}

but I don't know if this solution is accepted or not

hasanhadi avatar Sep 11 '23 07:09 hasanhadi

Is working :

or can only change this code

if (!method_exists($this, $method)) { throw UnknownColumnOption::new($name); } to Using continue; to Skip Unsupported Options:

if (!method_exists($this, $method)) { //throw UnknownColumnOption::new($name); continue; }

Thank you hasanhadi 😍

hashebul avatar Nov 04 '23 05:11 hashebul