cfwheels-dbmigrate-plugin icon indicating copy to clipboard operation
cfwheels-dbmigrate-plugin copied to clipboard

Using null argument in references() bug (MySQL)

Open tdm00 opened this issue 13 years ago • 8 comments

What steps will reproduce the problem?

  1. MySQL database (and potentially other engines)
  2. Add column(s) using references() with the null argument
  3. Run migration script

What is the expected output? What do you see instead? I expect for the migration to run completely. Instead, it creates tables up to the point where the erroneous call appears and just stops. The interface loads back up, failing silently, with no indication of an error message or any change to the schema (though there could have been some partial changes).

tdm00 avatar Sep 12 '11 14:09 tdm00

Chris, I see you opened this issue originally back in 2010, does it still occur or has it been resolved?

tdm00 avatar Sep 19 '11 14:09 tdm00

AFAIK, the issue is still there.

chrisdpeters avatar Sep 19 '11 17:09 chrisdpeters

This is also as issue for me, however I receive a message "Invalid default value for 'personid'"

Caused by either of the following: t.references(referenceNames="person,credential", null=false) t.references(referenceNames="person,credential", null=false, default="")

SQL generated is 'personid' INT DEFAULT NULL NOT NULL

chapmandu avatar Oct 27 '11 23:10 chapmandu

@chapmandu

If you don't use a reference but use a .column() function for each, does it work?

Are you using the latest version of DBMigrate?

tdm00 avatar Oct 27 '11 23:10 tdm00

Using the snippet below works: t = createTable("mytable")' t.column(columnName="myid", columnType="integer", null=false); t.create()

I am using version 0.8.0. I upgraded to 0.8.1 and receive the same error.

MySQL Version 5.2.34. Railo 3.2.3

chapmandu avatar Nov 04 '11 02:11 chapmandu

So the code you show works, but when you use similar code as a reference it doesn't?

On Nov 3, 2011, at 10:56 PM, Adam Chapman [email protected] wrote:

Using the snippet below works: t = createTable("mytable")' t.column(columnName="myid", columnType="integer", null=false); t.create()

I am using version 0.8.0. I upgraded to 0.8.1 and receive the same error.

MySQL Version 5.2.34. Railo 3.2.3


Reply to this email directly or view it on GitHub: https://github.com/talltroym/cfwheels-dbmigrate-plugin/issues/3#issuecomment-2626732

tdm00 avatar Nov 04 '11 11:11 tdm00

@talltroym : "So the code you show works, but when you use similar code as a reference it doesn't?"

Correct!

chapmandu avatar Nov 07 '11 00:11 chapmandu

Hey I have this same problem. If I put a default value in, the migration will run, but if I just use this: t.references(referenceNames='companyproduct,productoption',null=false); it will throw an error

cshapiro avatar Apr 18 '12 03:04 cshapiro