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

db.sync() creates sqlite3 files with a ':' at the end of the filename #270

Closed
beaugunderson opened this issue Aug 1, 2013 · 2 comments
Closed
Labels

Comments

@beaugunderson
Copy link

For example:

var orm = require('orm');

orm.connect('sqlite://storage.sqlite3', function (err, db) {
  if (err) throw err;

  var Alert = db.define('alert', {
    title: String,
    url: String,
    date: Date,
    body: Buffer
  }, {

  });

  db.sync(function (err) {
    if (err) throw err;

    console.log('Synced');
  });
});

This creates the file storage.sqlite3: in the current directory.

I'm using [email protected] and [email protected] with node v0.10.12.

@beaugunderson
Copy link
Author

lib/ORM.js:60 uses url.parse to fill in opts given a connection URL like "sqlite://storage.sqlite3".

lib/Drivers/DML/sqlite.js:17 has conditional logic to append a : if opts.host exists. Support for Windows drive letters appears to be breaking support for relative file paths in this case.

The workaround is to supply an opts object with pathname filled in.

dresende added a commit that referenced this issue Aug 2, 2013
1. Only add on win32 platforms
2. Only add if host is a letter

The only case this can't avoid (right now) is realtive paths where the
first folder is a letter. Please avoid it.
@dresende
Copy link
Owner

dresende commented Aug 2, 2013

Please try the latest git version, it should be fixed :)

npm install dresende/node-orm2

@dresende dresende closed this as completed Aug 2, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants