dbTalk Databases Forums  

parent-child relation with two children...

comp.databases.theory comp.databases.theory


Discuss parent-child relation with two children... in the comp.databases.theory forum.



Reply
 
Thread Tools Display Modes
  #11  
Old   
-CELKO-
 
Posts: n/a

Default Re: parent-child relation with two children... - 08-02-2008 , 09:44 AM






I hope the real names are not as vague and "meta-data-ish" as
"Entities" and "id" in the real data. Being live and preview are
attributes, if I understand your intent. But Ia m not sure about the
key -- is it version_id or (version_id, version_type), so here is one
guess:

CREATE TABLE Entities
(version_id INTEGER NOT NULL PRIMARY KEY,
version_type CHAR(1) DEFAULT 'P' NOT NULL
CHECK (version_type IN ('P', 'L')),
parent_version_id INTEGER
REFERENCE Entities(version_id)); -- null is first prototype



Quote:
entity (id, live_version_id NULL, preview_version_id NULL)
version (id, parent_entity_id)

where version.parent_entity_id must be a valid entity.id, and that
entity must have the version.id in either live/preview version_id. Is
this a common set up? Does it make sense? Is there a way to express
this requirement at the DB level (I'm specifically using MySQL, but in
general I'd like to know)

Or, did I model my data in a bad way?

Thanks,
Daniel.
--
Daniel Pitts' Tech Blog: <http://virtualinfinity.net/wordpress/


Reply With Quote
  #12  
Old   
-CELKO-
 
Posts: n/a

Default Re: parent-child relation with two children... - 08-02-2008 , 09:44 AM






I hope the real names are not as vague and "meta-data-ish" as
"Entities" and "id" in the real data. Being live and preview are
attributes, if I understand your intent. But Ia m not sure about the
key -- is it version_id or (version_id, version_type), so here is one
guess:

CREATE TABLE Entities
(version_id INTEGER NOT NULL PRIMARY KEY,
version_type CHAR(1) DEFAULT 'P' NOT NULL
CHECK (version_type IN ('P', 'L')),
parent_version_id INTEGER
REFERENCE Entities(version_id)); -- null is first prototype



Quote:
entity (id, live_version_id NULL, preview_version_id NULL)
version (id, parent_entity_id)

where version.parent_entity_id must be a valid entity.id, and that
entity must have the version.id in either live/preview version_id. Is
this a common set up? Does it make sense? Is there a way to express
this requirement at the DB level (I'm specifically using MySQL, but in
general I'd like to know)

Or, did I model my data in a bad way?

Thanks,
Daniel.
--
Daniel Pitts' Tech Blog: <http://virtualinfinity.net/wordpress/


Reply With Quote
  #13  
Old   
-CELKO-
 
Posts: n/a

Default Re: parent-child relation with two children... - 08-02-2008 , 09:44 AM



I hope the real names are not as vague and "meta-data-ish" as
"Entities" and "id" in the real data. Being live and preview are
attributes, if I understand your intent. But Ia m not sure about the
key -- is it version_id or (version_id, version_type), so here is one
guess:

CREATE TABLE Entities
(version_id INTEGER NOT NULL PRIMARY KEY,
version_type CHAR(1) DEFAULT 'P' NOT NULL
CHECK (version_type IN ('P', 'L')),
parent_version_id INTEGER
REFERENCE Entities(version_id)); -- null is first prototype



Quote:
entity (id, live_version_id NULL, preview_version_id NULL)
version (id, parent_entity_id)

where version.parent_entity_id must be a valid entity.id, and that
entity must have the version.id in either live/preview version_id. Is
this a common set up? Does it make sense? Is there a way to express
this requirement at the DB level (I'm specifically using MySQL, but in
general I'd like to know)

Or, did I model my data in a bad way?

Thanks,
Daniel.
--
Daniel Pitts' Tech Blog: <http://virtualinfinity.net/wordpress/


Reply With Quote
  #14  
Old   
-CELKO-
 
Posts: n/a

Default Re: parent-child relation with two children... - 08-02-2008 , 09:44 AM



I hope the real names are not as vague and "meta-data-ish" as
"Entities" and "id" in the real data. Being live and preview are
attributes, if I understand your intent. But Ia m not sure about the
key -- is it version_id or (version_id, version_type), so here is one
guess:

CREATE TABLE Entities
(version_id INTEGER NOT NULL PRIMARY KEY,
version_type CHAR(1) DEFAULT 'P' NOT NULL
CHECK (version_type IN ('P', 'L')),
parent_version_id INTEGER
REFERENCE Entities(version_id)); -- null is first prototype



Quote:
entity (id, live_version_id NULL, preview_version_id NULL)
version (id, parent_entity_id)

where version.parent_entity_id must be a valid entity.id, and that
entity must have the version.id in either live/preview version_id. Is
this a common set up? Does it make sense? Is there a way to express
this requirement at the DB level (I'm specifically using MySQL, but in
general I'd like to know)

Or, did I model my data in a bad way?

Thanks,
Daniel.
--
Daniel Pitts' Tech Blog: <http://virtualinfinity.net/wordpress/


Reply With Quote
  #15  
Old   
-CELKO-
 
Posts: n/a

Default Re: parent-child relation with two children... - 08-02-2008 , 09:44 AM



I hope the real names are not as vague and "meta-data-ish" as
"Entities" and "id" in the real data. Being live and preview are
attributes, if I understand your intent. But Ia m not sure about the
key -- is it version_id or (version_id, version_type), so here is one
guess:

CREATE TABLE Entities
(version_id INTEGER NOT NULL PRIMARY KEY,
version_type CHAR(1) DEFAULT 'P' NOT NULL
CHECK (version_type IN ('P', 'L')),
parent_version_id INTEGER
REFERENCE Entities(version_id)); -- null is first prototype



Quote:
entity (id, live_version_id NULL, preview_version_id NULL)
version (id, parent_entity_id)

where version.parent_entity_id must be a valid entity.id, and that
entity must have the version.id in either live/preview version_id. Is
this a common set up? Does it make sense? Is there a way to express
this requirement at the DB level (I'm specifically using MySQL, but in
general I'd like to know)

Or, did I model my data in a bad way?

Thanks,
Daniel.
--
Daniel Pitts' Tech Blog: <http://virtualinfinity.net/wordpress/


Reply With Quote
  #16  
Old   
-CELKO-
 
Posts: n/a

Default Re: parent-child relation with two children... - 08-02-2008 , 09:44 AM



I hope the real names are not as vague and "meta-data-ish" as
"Entities" and "id" in the real data. Being live and preview are
attributes, if I understand your intent. But Ia m not sure about the
key -- is it version_id or (version_id, version_type), so here is one
guess:

CREATE TABLE Entities
(version_id INTEGER NOT NULL PRIMARY KEY,
version_type CHAR(1) DEFAULT 'P' NOT NULL
CHECK (version_type IN ('P', 'L')),
parent_version_id INTEGER
REFERENCE Entities(version_id)); -- null is first prototype



Quote:
entity (id, live_version_id NULL, preview_version_id NULL)
version (id, parent_entity_id)

where version.parent_entity_id must be a valid entity.id, and that
entity must have the version.id in either live/preview version_id. Is
this a common set up? Does it make sense? Is there a way to express
this requirement at the DB level (I'm specifically using MySQL, but in
general I'd like to know)

Or, did I model my data in a bad way?

Thanks,
Daniel.
--
Daniel Pitts' Tech Blog: <http://virtualinfinity.net/wordpress/


Reply With Quote
  #17  
Old   
-CELKO-
 
Posts: n/a

Default Re: parent-child relation with two children... - 08-02-2008 , 09:44 AM



I hope the real names are not as vague and "meta-data-ish" as
"Entities" and "id" in the real data. Being live and preview are
attributes, if I understand your intent. But Ia m not sure about the
key -- is it version_id or (version_id, version_type), so here is one
guess:

CREATE TABLE Entities
(version_id INTEGER NOT NULL PRIMARY KEY,
version_type CHAR(1) DEFAULT 'P' NOT NULL
CHECK (version_type IN ('P', 'L')),
parent_version_id INTEGER
REFERENCE Entities(version_id)); -- null is first prototype



Quote:
entity (id, live_version_id NULL, preview_version_id NULL)
version (id, parent_entity_id)

where version.parent_entity_id must be a valid entity.id, and that
entity must have the version.id in either live/preview version_id. Is
this a common set up? Does it make sense? Is there a way to express
this requirement at the DB level (I'm specifically using MySQL, but in
general I'd like to know)

Or, did I model my data in a bad way?

Thanks,
Daniel.
--
Daniel Pitts' Tech Blog: <http://virtualinfinity.net/wordpress/


Reply With Quote
  #18  
Old   
-CELKO-
 
Posts: n/a

Default Re: parent-child relation with two children... - 08-02-2008 , 09:44 AM



I hope the real names are not as vague and "meta-data-ish" as
"Entities" and "id" in the real data. Being live and preview are
attributes, if I understand your intent. But Ia m not sure about the
key -- is it version_id or (version_id, version_type), so here is one
guess:

CREATE TABLE Entities
(version_id INTEGER NOT NULL PRIMARY KEY,
version_type CHAR(1) DEFAULT 'P' NOT NULL
CHECK (version_type IN ('P', 'L')),
parent_version_id INTEGER
REFERENCE Entities(version_id)); -- null is first prototype



Quote:
entity (id, live_version_id NULL, preview_version_id NULL)
version (id, parent_entity_id)

where version.parent_entity_id must be a valid entity.id, and that
entity must have the version.id in either live/preview version_id. Is
this a common set up? Does it make sense? Is there a way to express
this requirement at the DB level (I'm specifically using MySQL, but in
general I'd like to know)

Or, did I model my data in a bad way?

Thanks,
Daniel.
--
Daniel Pitts' Tech Blog: <http://virtualinfinity.net/wordpress/


Reply With Quote
  #19  
Old   
-CELKO-
 
Posts: n/a

Default Re: parent-child relation with two children... - 08-02-2008 , 09:44 AM



I hope the real names are not as vague and "meta-data-ish" as
"Entities" and "id" in the real data. Being live and preview are
attributes, if I understand your intent. But Ia m not sure about the
key -- is it version_id or (version_id, version_type), so here is one
guess:

CREATE TABLE Entities
(version_id INTEGER NOT NULL PRIMARY KEY,
version_type CHAR(1) DEFAULT 'P' NOT NULL
CHECK (version_type IN ('P', 'L')),
parent_version_id INTEGER
REFERENCE Entities(version_id)); -- null is first prototype



Quote:
entity (id, live_version_id NULL, preview_version_id NULL)
version (id, parent_entity_id)

where version.parent_entity_id must be a valid entity.id, and that
entity must have the version.id in either live/preview version_id. Is
this a common set up? Does it make sense? Is there a way to express
this requirement at the DB level (I'm specifically using MySQL, but in
general I'd like to know)

Or, did I model my data in a bad way?

Thanks,
Daniel.
--
Daniel Pitts' Tech Blog: <http://virtualinfinity.net/wordpress/


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.