Re: Database Design Advice

2013-11-07 Thread Smylers
William Blunn writes: > On 07/11/2013 13:03, Smylers wrote: > > > That is, if there is a record for document_id = 3846, version = 6 > > then there should also be records for version 1 to 5 of that > > document ID. Is there a way of enforcing that at the DB level? > > We're using Postgres,

Re: Database Design Advice

2013-11-07 Thread Smylers
William Blunn writes: > On 07/11/2013 13:03, Smylers wrote: > > > A purchase consists of ordering one product from a supplier. Each > > product is only available from a single supplier. So a record in > > the purchase table just needs to store a product ID, and by > > linking through the

Re: Database Design Advice

2013-11-07 Thread William Blunn
On 07/11/2013 13:03, Smylers wrote: A purchase consists of ordering one product from a supplier. Each product is only available from a single supplier. So a record in the purchase table just needs to store a product ID, and by linking through the product table that defines the supplier t

Re: One More (Possibly Unusual) Info Request

2013-11-07 Thread Andrew
I don't know much about Russian. But I have heard about Ruski's Tavern re-opening, so if you fancy some Russian flavour, you can try there, =). www.ruskis.com 1 Kensington High Street.

Re: Database Design Advice

2013-11-07 Thread William Blunn
On 07/11/2013 13:03, Smylers wrote: That is, if there is a record for document_id = 3846, version = 6 then there should also be records for version 1 to 5 of that document ID. Is there a way of enforcing that at the DB level? We're using Postgres, if that makes a difference. Instead of

Re: Database Design Advice

2013-11-07 Thread Jérôme Étévé
On Postgres and triggers. You can have them to run at any time you want: http://www.postgresql.org/docs/9.1/static/sql-createtrigger.html

Re: Database Design Advice

2013-11-07 Thread Mark Stringer
On 11/07/2013 01:28 PM, Abigail wrote: I'm not familiar with Postgres, but I've used triggers to enforce business rules like this in the past (using Sybase). In Sybase, triggers are run before a transaction is committed, and you can rollback a transaction frow within a trigger. On an insert, yo

Re: Database Design Advice

2013-11-07 Thread Abigail
On Thu, Nov 07, 2013 at 01:03:00PM +, Smylers wrote: > Hello. I'm designing a database schema, and am interested in any wisdom > folk can share over a few aspects of it: > > • A document can have versions. There's a document table and a > document_version_contents table, where each document_

Database Design Advice

2013-11-07 Thread Smylers
Hello. I'm designing a database schema, and am interested in any wisdom folk can share over a few aspects of it: • A document can have versions. There's a document table and a document_version_contents table, where each document_version_contents record references document.id and has a version