Re: Migrations not being run - (list-migrations) returns empty vector

116 views
Skip to first unread message

Nicolas Buduroi

unread,
Jun 12, 2012, 10:27:44 AM6/12/12
to lobos-...@googlegroups.com
I've not yet tested Lobos with 1.4, I'll have a look at it later today.

On Tuesday, June 12, 2012 9:24:41 AM UTC-4, Leonardo Borges wrote:
Hi,

I'm trying lobos for the first time on a new project, here's my lobos.config:

(ns lobos.config
  (:use lobos.connectivity
        banddit-api.db))


(def db-for-lobos
  (merge
   {:classname "org.postgresql.Driver"
    :subprotocol "postgresql"}
   (db-spec (:database-url app-env))))

(open-global db-for-lobos)

The connection gets properly open. Here's my lobos.migrations:


(ns lobos.migrations
  (:refer-clojure :exclude [alter drop
                            bigint boolean char double float time])
  (:use (lobos [migration :only [defmigration]] core schema
               config)))

(defmigration add-users-table
  (up [] (create
          (table :users
                 (integer :id :unique))))
  (down [] (drop (table :users))))



If I run (migrate), it correctly creates the lobos-migrations table, however it doesn't run the add-users-table migration.

If I run (list-migrations), I get an empty vector back.

Interestingly though, if I just run this:

(create
          (table :users
                 (integer :id :unique)))

I am able to correctly create my table.  It seems I'm missing something when defining the migration? It must be something silly but I can't really figure it out.

Does this ring any bells?  For context, I'm using Clojure 1.4

Cheers,
Leo.

Leonardo Borges

unread,
Jun 12, 2012, 10:33:36 AM6/12/12
to lobos-...@googlegroups.com
Hi Nicolas,

The problem seems to have fixed itself.

To be honest I'm not sure what happened but I'm almost certain I screwed up ;)

I started fresh, redefined my migrations and all seems to be well now.

Thanks,
Leonardo Borges
www.leonardoborges.com

Nicolas Buduroi

unread,
Jun 12, 2012, 10:35:12 AM6/12/12
to lobos-...@googlegroups.com
Good to hear!

Mattox Beckman

unread,
Sep 14, 2013, 11:40:11 PM9/14/13
to lobos-...@googlegroups.com
I just spent a bunch of hours fighting this.  I'm using lobos within an immutant app, and want migrations to run whenever there's a deployment.

For some reason, `migrate` clears the list of migrations before doing them.

My fix was instead of running `(migrate)` by itself, to run

`(binding [lobos.migration/*reload-migrations* false] (lobos.core/migrate))`

Cheers,
Mattox

On Wednesday, February 20, 2013 11:07:24 AM UTC-6, Barry Wark wrote:
I've run into a similar issue, using lobos 1.0.0-beta1 and Clojure 1.4 regarding project folder structure. lobos.migrations is found only in the leinigan-default project structure, even if I define :source-paths appropriately. I wrote it up on stackoverflow: http://stackoverflow.com/questions/14960301/lobos-migrations-not-found-in-maven-style-project-layout. Any ideas?

btw, Nicolas, awesome library.
Reply all
Reply to author
Forward
0 new messages