Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migration Failed Due To Syntax Error #1

Open
imtiazmahbub opened this issue Oct 29, 2015 · 0 comments
Open

Migration Failed Due To Syntax Error #1

imtiazmahbub opened this issue Oct 29, 2015 · 0 comments

Comments

@imtiazmahbub
Copy link

Migration fails due to syntax error on line 18.
'id_left' => Schema::TYPE_INTEGER.' NOT NULL DEFAULT (-1)',

Here is my yii error message:

Apply the above migration? (yes|no) [no]:yes
*** applying m150127_082652_amilna_cap
    > create table cap_account ...Exception 'yii\db\Exception' with message 'SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(-1),
        `id_right` int(11) NOT NULL DEFAULT 0,
        `id_level` int(11) NOT NULL DEFAU' at line 9
The SQL being executed was: CREATE TABLE `cap_account` (
        `id` int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
        `code` int(11) NOT NULL,
        `name` varchar(255) NOT NULL,
        `parent_id` int(11),
        `increaseon` smallint(6) NOT NULL,
        `isbalance` tinyint(1) NOT NULL DEFAULT FALSE,
        `exchangable` tinyint(1) NOT NULL DEFAULT FALSE,
        `id_left` int(11) NOT NULL DEFAULT (-1),
        `id_right` int(11) NOT NULL DEFAULT 0,
        `id_level` int(11) NOT NULL DEFAULT 0,
        `isdel` smallint(6) NOT NULL DEFAULT 0
)'

So I changed the line to instead:
'id_left' => Schema::TYPE_INTEGER.' NOT NULL DEFAULT \'-1\'',
And it worked
I'm on windows environment. Using UniserverZ as my wamp server

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant