Running migrations from a .clj file.

27 views
Skip to first unread message

Manoj Waikar

unread,
May 23, 2011, 7:05:31 AM5/23/11
to lobos-...@googlegroups.com
Hi Nicholas,

I am trying out the lobos library, thanks for the work on it.
Sorry for my naive question but how can I specify my migrations in a .clj file and run them not from a REPL but from another clojure code?

Also if I run dump, run or rollback one after the other from the REPL, I get an error - "relation lobos_migration already exists".

Thanks and regards,
Manoj.

Nicolas Buduroi

unread,
May 25, 2011, 4:17:54 PM5/25/11
to lobos-...@googlegroups.com
On Mon, May 23, 2011 at 7:05 AM, Manoj Waikar <mmwa...@gmail.com> wrote:
I am trying out the lobos library, thanks for the work on it.

You're welcome.
 
Sorry for my naive question but how can I specify my migrations in a .clj file and run them not from a REPL but from another clojure code?

Currently, by default, migrations files are found in the 'lobos/migrations/' directory as .clj file although they're not truly runnable Clojure code files. You should be able to use the migration command, like `run`, from normal Clojure code as long as you have access to the migration files. Also the migrations directory can be changed by rebinding the `lobos.migration/*default-directory*` variable.

Note that this implementation isn't perfect in that it require access to the migration files which is not always possible. Thus I'm rewritting the migration backend as was proposed in that post:

https://groups.google.com/d/topic/lobos-library/GnFBKahrhY0/discussion
 
So the migration files will soon change format, probably by next week.

Also if I run dump, run or rollback one after the other from the REPL, I get an error - "relation lobos_migration already exists".

That's certainly a bug, could you fill an issue on github, make sure to include the database you're using and the full stacktrace.

Manoj Waikar

unread,
May 26, 2011, 8:50:18 AM5/26/11
to lobos-...@googlegroups.com
Thanks for your response. I filed a bug on github - https://github.com/budu/lobos/issues/4
I was using it with Postgresql 9.0.

Regards,
Manoj.
Reply all
Reply to author
Forward
0 new messages