[jifty-devel] Tutorial questions
Rob Kinyon
rob.kinyon at gmail.com
Thu Jan 5 10:15:21 EST 2006
On 1/4/06, Jesse Vincent <jesse at bestpractical.com> wrote:
> Rob Kinyon wrote:
> > 1) If you run the following commands, you hit an error (No
> > inc::Module::Install found)
> > jifty app --name MyWebLog
> > cd MyWebLog
> > perl Makefile.PL
> > Having remedied that by copying the inc found in SVN, I am now able to
> > run "make test" with the base Post model and I'm happy.
> >
>
> Jifty should depend on Module::Install
Once I installed Module::Install, everything worked just fine. Cool. Patch:
Index: Makefile.PL
===================================================================
--- Makefile.PL (revision 450)
+++ Makefile.PL (working copy)
@@ -42,6 +42,7 @@
requires('Locale::Maketext::Simple');
requires('Log::Log4perl');
requires('Math::BigInt');
+requires('Module::Install');
requires('Module::Pluggable' => '2.95');
requires('Module::Refresh');
requires('Pod::Simple::Text');
> > 3) I fix the schema name issue and run "make test" again. This time, I
> > hit the following:
> >
> > error creating a table: Couldn't execute the query 'CREATE TABLE posts (
> > id INTEGER NOT NULL AUTO_INCREMENT,
> > body text NULL ,
> > title text NULL DEFAULT 'Untitled post' ,
> > PRIMARY KEY (id)
> > )
> > 'BLOB/TEXT column 'title' can't have a default value at
> > /usr/lib/perl5/site_perl/5.8.6/i486-linux/Jifty/Script/Schema.pm line
> > 224.
> >
> > That's not a MySQL idiosyncracy, that's a SQLite idiosyncracy.
> >
> > 4) I change the columntype for title to "varchar". Now, it complains
> > about the syntax:
> >
> > error creating a table: Couldn't execute the query 'CREATE TABLE posts (
> > id INTEGER NOT NULL AUTO_INCREMENT,
> > body text NULL ,
> > title varchar NULL DEFAULT 'Untitled post' ,
> > PRIMARY KEY (id)
> > )
> > '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 'NULL DEFAULT 'Untitled post' ,
> >
> > I fix this by changing varchar => varchar(255) and the tests pass. I
> > would've thought that Jifty::DBI::mysql would be smart enough to fix
> > this problem.
>
> It should be passing everything on. I'm not sure where that's coming from.
We talked about this a bit on IRC, but I'll mention it here. The basic
issue is that my code shouldn't care about my datastore. If I have to
put "varchar(255)" for MySQL and "varchar2(255)" for Oracle and "text"
for SQLite, then it's not very divorced.
Personally, I like how ActiveRecord does it, intuiting from the
datastore, but that's just me.
Rob
More information about the jifty-devel
mailing list