Ah! That fixed it, thanks a lot Jeppe ;) I'm not sure what to say in the ticket though, the column-name blob was a bad choise made by me.
On Mar 4, 1:32 pm, Jeppe Nejsum Madsen <je...@ingolfs.dk> wrote: > On Thu, Mar 4, 2010 at 1:25 PM, Mads Hartmann <mads...@gmail.com> wrote: > > Hello everyone, > > I'm not sure if this is a lift problem or it's me. I'm trying to add > > the ability to upload images to a project - I'm using the code > > explained here: > >http://groups.google.com/group/liftweb/browse_thread/thread/b0509263e... > > > I added two mapper classes: > > ------- > > class ImageInfo extends LongKeyedMapper[ImageInfo] with IdPK { > > def getSingleton = ImageInfo > > > object date extends MappedLong(this) { > > override def defaultValue = Helpers.millis > > } > > object mimeType extends MappedPoliteString(this, 64) > > object name extends MappedPoliteString(this, 256) { > > override def dbIndexed_? = true > > override def defaultValue = "" > > > private def noSlashes(s: String) : List[FieldError] = > > if (s.contains("/")) > > List(FieldError(this, Text("Image name \"" + > > s + "\" may not > > contain \"/\""))) > > else > > Nil > > > override def validations = > > valMinLen(1, "Image name must not be empty") _ :: > > valUnique("Image name must be unique") _ :: > > noSlashes _ :: > > super.validations > > } > > > object blob extends MappedLongForeignKey(this, ImageBlob) > > > def deleteWithBlob { > > this.blob.obj match { > > case Full(x) => x.delete_! > > case _ => > > } > > this.delete_! > > } > > } > > --------- > > and > > ---------- > > class ImageBlob extends LongKeyedMapper[ImageBlob] with IdPK { > > def getSingleton = ImageBlob > > > object image extends MappedBinary(this) > > } > > --------- > > > The schemifier couldn't create the tables it gave to following > > error :: > > 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 'blob BIGINT UNSIGNED) ENGINE = InnoDB' at line 1 > > > this is the sql statement it tried to execute > > > CREATE TABLE imageinfo (name VARCHAR(256) , id BIGINT UNSIGNED NOT > > NULL AUTO_INCREMENT UNIQUE KEY , date_c BIGINT , mimetype > > VARCHAR(64) , blob BIGINT UNSIGNED) ENGINE = InnoDB > > I looks like it tries to create a column named blob, afaiks blob is a > reserved word in > MySqlhttp://dev.mysql.com/doc/refman/5.0/en/reserved-words.html > > You could try renaming the field. If this solves the problem, please > file a ticket > > /Jeppe -- You received this message because you are subscribed to the Google Groups "Lift" group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.