Skip to content

sync does not create tables on PostgreSQL #71

Closed

Description

sync(function(err) { /*...*/ } in release 2.0.4 does neither produce an error nor create the underlying tables. Reproducable by this snippet on PostgreSQL 9.0:

var orm = require('orm'),
    config = require('../config');

orm.connect('postgresql://' +
    config.database.username + ':' + config.database.password +
    '@' + config.database.host + '/' + config.database.name,
    function(err, db) {
        if(err) console.error(err);

        var Test = db.define('test', {
            val1: String,
            val2: Number,
            val3: Boolean,
            val4: [ 'A', 'B', 'C' ],
            val5: Buffer
        });

        Test.sync(function(err) {
            if(err) console.error(err);
            else console.log('Test synced');
        })

        db.sync(function(err) {
            if(err) console.error(err);
            else console.log('Database synced');
        });
    }
);

Output:

Test synced
Database synced

The database exists and the user does have the rights to access it and create tables.

Activity

  1. dresende commented on Mar 12, 2013

    @dresende
    Owner

    This is because of the ENUM property, postgresql needs to be changed to create the TYPEs first. I'm making a commit right now, please test it.

  2. dresende commented on Mar 13, 2013

    @dresende
    Owner

    It's not related but it's a bug, I'm going to create another issue to solve it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions