Skip to content
This repository has been archived by the owner on May 19, 2020. It is now read-only.

Error on 21. Migration #1178

Open
karakasli opened this issue Jan 29, 2017 · 7 comments
Open

Error on 21. Migration #1178

karakasli opened this issue Jan 29, 2017 · 7 comments

Comments

@karakasli
Copy link

karakasli commented Jan 29, 2017

Summary

On first access of web page after installation, 21. migration throw an exception.
"Null value not allowed: 1138 Invalid use of NULL value"

ALTER TABLE ' . $table . ' CHANGE date date datetime NOT NULL AFTER status

AFTER 'status' cause to problem.

Expected Behaviour

  • All migrations should be ran without error.

Actual Behaviour

    1. migration "21_alter_comment_date.php" doesn't works properly.

Context details (if applicable)

  • Anchor version: 0.12.1
  • Server setup:
  • URL
@TheBrenny
Copy link
Member

I did a fresh install three days ago and didn't hit the problem...

What's your server setup?

@karakasli
Copy link
Author

Server: 5.7.17-0ubuntu0.16.04.1
PHP Version: 7.0.13-0ubuntu0.16.04.1
Database: libmysql - mysqlnd 5.0.12-dev

AFTER keyword does not support for CHANGE keyword. When i remove AFTER part. It was ok and worked.

@TheBrenny
Copy link
Member

Fair enough. I'm glad to hear that it worked for you in the end!

What's happening is that MySQL gives the option to reorder the columns, which is what that AFTER status part is. Don't know why it didn't work for you though... 🤔

@CraigChilds94
Copy link
Member

@msalihkarakasli What is your version of MySQL?

@karakasli
Copy link
Author

@CraigChilds94 mysql Ver 14.14 Distrib 5.7.17, for Linux (x86_64)

@franknoel
Copy link

franknoel commented Feb 19, 2017

Got the same problem.
PHP 7.0.14 (cli)
mysql Ver 14.14 Distrib 5.7.17, for macos10.12 (x86_64)

You only removed the AFTER part in the migration and it worked?

EDIT:

Had to delete the AFTER part of the request in these migration files:
anchor/migrations/21_alter_comments_date.php
anchor/migrations/61_alter_posts_created.php

@karakasli
Copy link
Author

Right. I also got the same problem for same migrations 21 and 61.

This is enough;
ALTER TABLE ' . $table . ' CHANGE date date datetime NOT NULL

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

No branches or pull requests

5 participants