Re: [CDBI] Cascading Update
[prev]
[thread]
[next]
[Date index for 2006/02/06]
Sorry James - obviously I'm not making myself clear:
mysql> desc news;
+---------------+--------------+------+-----+------------+-------+
| Field | Type | Null | Key | Default | Extra |
+---------------+--------------+------+-----+------------+-------+
| news_id | varchar(50) | NO | PRI | | |
| date | date | NO | | 0000-00-00 | |
| title | varchar(50) | NO | | | |
| summary | varchar(250) | YES | | NULL | |
| story | text | NO | | | |
| news_category | varchar(50) | NO | | | |
+---------------+--------------+------+-----+------------+-------+
mysql> desc newscategories;
+------------------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+------------------+-------------+------+-----+---------+-------+
| news_category_id | varchar(50) | NO | PRI | | |
| title | varchar(50) | NO | | | |
| description | text | YES | | NULL | |
+------------------+-------------+------+-----+---------+-------+
So a News item has a NewsCategory and thus a NewsCategory has MANY News
items...
My reasoning behind the change to the news_category_id was that I wanted
something more readable as this is now to be used as part of a URL. In
the previous configuration my main concern was to make the
news_category_id unique and difficult to replicate - I didn't want
people guessing at possible news_category_ids - thus I used an
encryption of the datetime when the entry was created.
But now I am intending to use this as part of a URL I want something
more intuitive - so the user can select all News items for a particular
NewsCategory using something like:
http://www.example.com/cgi-bin/news.cgi?news_category_id=my_readable_id
Thus I came to modify the news_category_id only to find that doing so
deleted all News items for this id!!
Hope this makes a bit more sense!
Thanks
Jay
yoorobot wrote:
> Jay Hargreaves wrote:
>
>> Thanks for your reply James - I'm talking about the NewsCategory.id
>> and so yes I'm talking about modifying a primary key. There must be
>> some way to do this?
>
> well now, I am even more confused. I'm not sure why the NewsCategory id
> even needs to change. Perhaps you could post the schema and rephrase
> your table relationships and how they are intended to interact.
> - James
>
>
--
bingo, bango, bosh...
_______________________________________________
ClassDBI mailing list
ClassDBI@xxxxx.xxxxxxxxxxxxxxxx.xxx
http://lists.digitalcraftsmen.net/mailman/listinfo/classdbi
|
(message missing)
|