#296 invalid
Postmodern

DataMapper needs a way to create file-based stores

Reported by Postmodern | May 21st, 2008 @ 04:43 AM

DataMapper does not provide a way to create file-based data stores, such as SQLite3 or YAML files.

For instance when I use the sqlite adapter and run DataMapper.auto_migrate!, I receive the exception "Sqlite3Error: unable to open database file". This is unexpected when initializing new files.

Comments and changes to this ticket

  • Postmodern

    Postmodern May 28th, 2008 @ 07:01 AM

    Created a patch that fixes the way DataMapper::Adapters::Sqlite3Adapter#normalize_uri expands file paths. Now non-memory SQLite3 database files will be automatically created.

  • Sam Smoot

    Sam Smoot June 2nd, 2008 @ 04:10 PM

    • State changed from “new” to “invalid”

    From the patch, I'm not exactly sure what this is changing behaviour wise since DM works as you describe I believe. The integration specs depend on it.

    Marking as invalid until we get some specs. If you have some time to whip up a spec, I'd be happy to merge the patch.

    Thanks, -Sam

  • Postmodern

    Postmodern June 2nd, 2008 @ 09:37 PM

    I will try to get some specs together ASAP.

    The problem in question is how Sqlite3Adapter#normalize_uri mangles db paths. The bug occurs when you have an absolute db path that does not exist yet, such as "/home/user/.myapp/database.db". When passed to Sqlite3Adapter#normalize_uri it returns the path of "/current/pwd/home/user/.myapp/database.db".

    Using File.expand_path fixes this path mangling issue, since it only joins Dir.pwd with relative paths. Hope that clarifies the issue, until I have some specs written.

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

People watching this ticket

Attachments

Pages