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

Ability to have non-primary key Serial properties #48

Closed
solnic opened this issue May 17, 2011 · 1 comment
Closed

Ability to have non-primary key Serial properties #48

solnic opened this issue May 17, 2011 · 1 comment
Labels

Comments

@solnic
Copy link
Contributor

solnic commented May 17, 2011

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

@solnic
Copy link
Contributor Author

solnic commented May 17, 2011

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 subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

1 participant