geddy / model

Datastore-agnostic ORM in JavaScript
265 stars 55 forks source link

Indexes and Browser Support #2

Open nevf opened 12 years ago

nevf commented 12 years ago

Model looks like a welcome addition to the JS ORM world, thanks.

I can't see any mention of the ability to create indexes, is that planned?

Are you considering implementing Model for use in the Browser with IndexedDB and WebSQL?

-Neville

mde commented 12 years ago

Can you explain a little bit more about what you mean about indexes? The DB admin stuff is very limited at this point -- basically limited to creating tables in the Postgres adapter. Do ActiveRecord, SQLAlchemy, et al support this?

As far as the browser -- yes, the original version of this code ran in the browser, and the next thing on the roadmap is getting that working again. Kind of crazy, but I hadn't even considered how we could use it with local storage in the browser -- I think that's an awesome idea.

nevf commented 12 years ago

I mean databases indexes that are used to speed up queries etc. ex. SQL CREATE INDEX and in MongoDB collection.ensureIndex.

In the Browser IndexedDB and WebSQL are the best targets as local storage is too limited in both functionality and quota (database size). The are Javascript shim's that allow you to target just IndexedDB and they convert this to WebSQL for environments where IndexedDB isn't yet available. I think this is the best way forward as WebSQL is deprecated and IndexedDB appears to be the only candidate to replace it at this time.

techwraith commented 12 years ago

@nevf I'm of the opinion that indexes should be maintained by a DB admin type role, not by the ORM itself. It feels like this should live on the infrastructure side of things, not the application side of things.

As far as the localStorage and IndexedDB stuff goes, I'm all for it. (both even, I could see use cases for either of them)

nevf commented 12 years ago

@Techwraith My interest is packaged Web/Mobile apps so there is no DB admin. I'm using Persistence.js in one app and it supports indexes. See the schema page.