Skip to content

Need ability to assign indexes and manually assign primary key column #32

Closed

Description

@Trakkasure

I have not seen anywhere where I can define a column to have an index associated with it. This could really increase the speed of searches based on other columns than ID or foreign keys.
Forcing of a primary key "id" when I want a different column to be that key.

What I have is an existing data model that I want to utilize with this library. One other thing that I feel is bad is that when defining a model, "user", the library adds an "s" to it automatically making it "users". This change, I believe, is not something that should happen as it changes the developer's expectation of the data model on the back-end. And it makes integration with other systems that would use the back-end data difficult if they are the ones that originally defined the model.

Activity

  1. sdepold commented on Sep 27, 2010

    @sdepold
    Member

    hey there,

    @indexes: right... nice one :)
    @primary key "id": there is already an issue. that's pretty difficulty. will take some time to prepare the code for that i guess.
    @adding a s: the app isn't adding a s but transforming the word into plural :) I used that behavoir due to my background as rails developer. they are doing it as well and i never had problems with that. but i will think about that :)

  2. Trakkasure commented on Sep 27, 2010

    @Trakkasure
    Author

    I've started working on potential solutions on this.
    I have a field that defines the key column. I was thinking that it is possible to have multiple primary keys in the case of a complex table definition. An example of I am working on right now a radius SQL backend where there is no ID field, but a userID and an attribute field, combined they make a primary key. I didn't write it, I'm just working with it. I've added an ID field to make it work. But to ensure unique user/attribute I wanted to be able to define it in the object as it is in the DB.

  3. Trakkasure commented on Sep 27, 2010

    @Trakkasure
    Author

    I have completed this... however.. I'm having some difficulty with the association code.. (You got some complex stuff in there)
    I am chugging through it. So everything works.. until you want to work with associations.

    Added Index specification.
    Added Primary key option
    Added ability to specify multiple primary key columns.
    Added the ability to specify the size of a string in column definition (letting the DB truncate data for you)

  4. Trakkasure commented on Sep 28, 2010

    @Trakkasure
    Author

    Check pull request for completed code.

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions