Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrations in Postgres #54

Closed
fiestacasey opened this issue Apr 2, 2012 · 0 comments
Closed

Migrations in Postgres #54

fiestacasey opened this issue Apr 2, 2012 · 0 comments

Comments

@fiestacasey
Copy link

I'm trying to do a migration for postgres (new or existing table) and it doesn't seem to work. I can run queries fine, just no migration. Code follows:

conString = 'postgres://user:pass@localhost:5432/test'
jugglingdb = require('jugglingdb')
Schema = jugglingdb.Schema
pg_db = new Schema('postgres', { 'url': conString })

# Question model
Question = pg_db.define('Question', {
    text:   { type: String, length: 255 }
}, {table: 'questions'})
Question.validatesPresenceOf('text')

if !pg_db.isActual()
        console.log 'migrating datatables'
        pg_db.autoupdate (err) -> 
            if err?
                console.log 'error during migration '+err
            else
                console.log 'migration successful'

Log output

migrating datatables
DEBUG: TypeError: Object #<Object> has no method 'table'
    at /Users/casey/Documents/siide_learn/node_modules/jugglingdb/lib/adapters/postgres.js:277:176
    at Array.forEach (native)
    at PG.autoupdate (/Users/casey/Documents/siide_learn/node_modules/jugglingdb/lib/adapters/postgres.js:275:31)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants