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

unknown property types #305

Closed
ghazel opened this issue Aug 20, 2013 · 3 comments
Closed

unknown property types #305

ghazel opened this issue Aug 20, 2013 · 3 comments

Comments

@ghazel
Copy link

ghazel commented Aug 20, 2013

My model has a column of type "geography(Point)" (from the PostGis extension for postgresql).

However when I try to define:

db.define("place", { name: String, location:'geography(Point)' })

I get:

/project/node_modules/orm/lib/Property.js:34
        throw ErrorCodes.generateError(ErrorCodes.NO_SUPPORT, "Unknown property type
                         ^
Error: Unknown property type: geography(Point)
    at Object.defineProperty.value (/project/node_modules/orm/lib/ErrorCodes.js:12:13)
    at Object.exports.normalize (/project/node_modules/orm/lib/Property.js:34:20)
    at new Model (/project/node_modules/orm/lib/Model.js:173:33)
    at ORM.define (/project/node_modules/orm/lib/ORM.js:208:22)
    at csv.from.path.on.name (/project/cities.js:15:20)
    at /project/node_modules/orm/lib/ORM.js:121:13
    at null.<anonymous> (/project/node_modules/pg/lib/client.js:134:7)
    at g (events.js:175:14)
    at EventEmitter.emit (events.js:117:20)
    at Socket.<anonymous> (/project/node_modules/pg/lib/connection.js:89:12)

How do I make orm work with types it doesn't know about? (I intend on writing the relevant where clauses by hand).

@dxg
Copy link
Collaborator

dxg commented Sep 1, 2013

User defined types would be nice to have.
A plugin seems overkill for every single type, so I think a basic API would be best.
API would accept code for DDL CREATE TABLE column definition and DML valueToProperty & propertyToValue functions.
Not sure how the pg driver would need any special treatment.

@ghazel
Copy link
Author

ghazel commented Sep 2, 2013

I'd be pretty happy, as a simple starting point, to be able to pass type names as strings and shuffle untranslated data to and from the database. You know, like the underlying database libraries do.

dxg added a commit that referenced this issue Sep 3, 2013
dxg added a commit that referenced this issue Sep 3, 2013
@dxg
Copy link
Collaborator

dxg commented Sep 3, 2013

Have a look at the doco in the wiki, install ORM from master, and see if it works for you as expected.
I installed postgis and gave it a try yesterday, and it seemed to work in my very simple test case.

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

3 participants