[cl-migrations-devel] first test ...

Vamsee Kanakala vamlists at gmail.com
Fri Apr 20 09:46:53 UTC 2007


Nicolas Lamirault wrote:
> hello,
> i'm trying your cl-migrations tool.
> it seems very interesting ...
> i've some remarks :

Thank you. I'll try to address them one by one:

> 
> 1 - for cl-migrations' newbie (like me), it could be interesting
> to write  in your example  page (on cl.net)  that we could  change the
> *migration-dir* :
> 
> CL-USER> (setf cl-migrations:*migration-dir* "/home/nicolas/tmp/")
> 

I am not sure if this is a good idea - I exported that var so that
people can print it out for checking - it gets set along with the
database config, so the appropriate way to set this would be by creating
the config file properly and then running the generate/migrate
functions. I am thinking of not exporting this variable anymore, but I
will see if there's a way decouple database spec from directory setting
and handle this properly.


> 2 - i try to creates the 1-.... file :
> 
> CL-USER> (cl-migrations:generate "add-employees-table")
> junk in string "foo.lisp"
>    [Condition of type SB-INT:SIMPLE-PARSE-ERROR]
> 

Looks like you have a regular file in the directory - it's always good
to create a separate directory just for migrations. This happens because
cl-migrations reads all the files in the directory and sorts them
according to their migration numbers in the filenames. Anyways, I will
try to fix this so that regular files (without numbers) get ignored.

> 
> 3- try to creates the database model :
> 
> CL-USER> (cl-migrations:generate "add-employees-table")
> "1-add-employees-table.lisp"
> 
> CL-USER> (cl-migrations:migrate)
> WARNING: Exiting - .migrate.conf not found in the home directory
> A database error occurred: NIL / NIL
>   NIL is not a database.
>    [Condition of type CLSQL-SYS:SQL-DATABASE-ERROR]
> 

Most probably because you set the *migration-dir* directly and didn't
create the .migrate.conf. Creating this file should fix the problem.

> 
> 
> 4- creates the database model with default configuration
> 
> CL-USER> (cl-migrations:generate "add-employees-table")
> 
> Setting up migrations directory: "/home/nicolas/tmp/migrations/"
> 
> The path
>   #P"/home/nicolas/tmp/migrations/1-add-employees-table.lisp"
> does not exist.
>    [Condition of type SB-INT:SIMPLE-FILE-ERROR]
> 
> 
> in the "generate" method, i think this could correct the problem :
> 
> (ensure-directories-exist
>   (directory-namestring #p"/home/nicolas/tmp/migrations/1-add-employees-table.lisp"))

Thanks, will patch this into the next release.


> 
> 
> 5- Database model 
> 
> 
> mysql> UPDATE SCHEMA_INFO SET VERSION = 1 WHERE (VERSION = 0);
> ERROR 1146 (42S02): Table 'test.SCHEMA_INFO' doesn't exist
> 
> 
> mysql> UPDATE schema_info SET VERSION = 1 WHERE (VERSION = 0);
> Query OK, 1 row affected (0.01 sec)
> Rows matched: 1 Changed: 1 Warnings: 0
> 
> 
> with mysql the problem comes from the table name.
> 

Wow, I'm very surprised about this. Sorry, I mostly tested in
PostgreSQL, so I missed this one. Isn't SQL supposed to be
case-insensitive? Will fix this anyways.

> 
> i've got  a question  about this  tool and the  Ror equivalent  : what
> about def-view-class ?
> in ror, you creates the SQL model and you generate objects wrapper ?
> in some  project, i use def-view-class  and i generate  the SQL tables
> from theses objects ...
> 

Hmm. Actually it's the other way round. There's a part of RoR called
ActiveRecord that looks at the table (created by migrations or by hand
with sql) and then automagically sets up the object and it's attributes
(field names as slots). So, there's no need for something like
def-view-class of CLSQL. Perhaps we need something like ActiveRecord in
CL. But I think this behavior can be easily retrofitted to CLSQL or
Postmodern.

> i thinks it's a great tool ...
> i'll use it in some of my projects 
> 
> 

Thanks a lot for the inputs. I will be a lot more careful about the bugs
now. Little busy now, will push out a new version over the weekend.


Best regards,
Vamsee.



More information about the Cl-migrations-devel mailing list