pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Casey Allen Shobe <cshobe@secureworks.net>
To: Richard Poole <rp@guests.deus.net>
To: pgsql-admin@postgresql.org
Subject: Re: Multiple keys?
Date: Mon, 2 Sep 2002 00:19:27 -0400
Message-ID: <200209020019.27344.cshobe@secureworks.net> (raw)
In-Reply-To: <20020828133648.GA18842@guests.deus.net>
References: <200208280210.44746.cshobe@secureworks.net>
	<200208280634.55534.cshobe@secureworks.net>
	<20020828133648.GA18842@guests.deus.net>

On Wednesday 28 August 2002 09:36 am, Richard Poole wrote:
> You could do it with one more table, perhaps?

Yes, I actually did it as follows to be for further normalization purposes, 
thanks for the tip!

create table	"package_versions" (
	"version_id"	integer		not null unique default 
nextval('package_versions_version_id_seq') primary key,
	"package_id"	integer		not null references "packages" ("package_id"),
	"package_version" varchar(16)	not null default '0.0.1',
	unique ("package_id", "package_version")
);

create table	"package_info" (
	"info_id"	integer		not null unique default 
nextval('package_info_info_id_seq') primary key,
	"package_version_id" integer	not null references "package_versions" 
("version_id"),
	"info_type"	varchar(32)	not null default 'extra_data',
	"info_value"	text		not null default 'Default',
	unique ("package_version_id", "package_version")
);

create table	"box_packages" (
	"install_id"	integer		not null unique default 
nextval('box_packages_install_id_seq') primary key,
	"box_id"	integer		not null references "boxes" ("box_id"),
	"package_version_id" integer	not null references "package_versions" 
("version_id"),
	"install_date"	timestamp with time zone not null,
	"uninstall_date" timestamp with time zone not null default '9999-12-31 
23:59:59',
	unique ("box_id", "package_version_id", "install_date")
);

-- 
Casey Allen Shobe / Network Security Analyst & PHP Developer
SecureWorks, Inc. / 404.327.6339 x169 / Fax: 404.728.0144
cshobe@secureworks.net / http://www.secureworks.net
Content is my own and does not necessarily represent my company.



view thread (5+ messages)

Message-ID: <200209020019.27344.cshobe@secureworks.net>
Permalink:  ../200209020019.27344.cshobe@secureworks.net/
Also on:    postgresql.org/message-id/200209020019.27344.cshobe@secureworks.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: cshobe@secureworks.net, rp@guests.deus.net
  Subject: Re: Multiple keys?
  In-Reply-To: <200209020019.27344.cshobe@secureworks.net>
  References: <200208280210.44746.cshobe@secureworks.net> <200208280634.55534.cshobe@secureworks.net> <20020828133648.GA18842@guests.deus.net> <200209020019.27344.cshobe@secureworks.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox