Skip to content
This repository was archived by the owner on Apr 17, 2018. It is now read-only.
This repository was archived by the owner on Apr 17, 2018. It is now read-only.

Ability to have non-primary key Serial properties #48

Closed

Description

@solnic

One should be able to create a field whose value defaults to being a guaranteed unique value.

Most databases have methods for creating guaranteed-unique default values that are not primary keys. For example, Postgres has SERIAL, SQLite has AUTOINCREMENT, MySQL has AUTO_INCREMENT, Mongo has ObjectIDs, etc. It would be useful to be able to set a property's default value to be unique without making it a primary key or imposing a uniqueness constraint on the field.

Currently, specifying property :id, Serial, :key => false, :unique => false will still generate a primary key and a uniqueness constraint on the field. It would be very useful if this would work as expected.


Created by Joshua Griffith - 2011-02-08 02:48:56 UTC

Original Lighthouse ticket: http://datamapper.lighthouseapp.com/projects/20609/tickets/1483

Activity

  1. solnic commented on May 17, 2011

    @solnic
    ContributorAuthor

    There’s an idea of a unique object identifier which will probably replace Serial at some point. If you need a unique property which is not an identifier you can use UUID from dm-types.

    by Piotr Solnica (solnic)

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions