[baseten-users] Self made primary key

Marko Karppinen marko at karppinen.fi
Mon Jan 25 13:24:44 EET 2010


On 25.1.2010, at 18.48, Michael Ruepp wrote:
> is it possble to get a code example how you create a database table with a custom primary key (say, an uuid) and how to install the baseten schema, because this is not possible with the xcode datamodeler and baseten assistant.

BaseTen Assistant supports installing the BaseTen schema and enabling tables for BaseTen with all PostgreSQL databases, not just those created from an Xcode data model. So you should just create the table with the CREATE TABLE command in Postgres (see the Postgres manual for details), and then use BaseTen Assistant on it.

> And, how would you create a new database object in code with the custom primary key then?

If the primary key column has a default value set on the database side, everything will work like you'd expect. If not, you need to provide the primary key field values manually when creating the object.

Marko



More information about the baseten-users mailing list