List Info

Thread: Re: how to change a story's element_type in the database




Re: how to change a story's element_type in the database
user name
2007-03-14 19:15:11
On 14-Mar-07, at 11:57 AM, David E. Wheeler wrote:

> On Mar 13, 2007, at 16:43, Dawn Buie wrote:
>
>> I will add it if I figure it out -  but before I do
so- surely  
>> someone who wrote bricolage knows how element_types
are added, and  
>> is it fool hearty for me to try to change the
element_type of a  
>> story and keep the same story ID?  Should I just be
making a whole  
>> bunch new stories with a new story element type and
use bric_soap  
>> to create them?
>
> Sorry, haven't been following. If what you want to do
is to change  
> the element type of a story, you simply have to change
it in the  
> story table and then in the story_element table for all
story  
> instance IDs  (story_element.object_instance_id)
associated with  
> the original story ID (join through story_instance).

Ok so the primary ID field for the table 'story_instance'
correlates  
to the 'object_instance_id' field in the 'story_element'
table.

or in other words:  story_instance.id is connected to  
story_element.object_instance_id .

I wasn't sure what the object_instance_id field referred
to.

I wonder why it is called 'story_element.object_instance_id'
  and  
not 'story_element.story_instance_id' ?

Anyway thank you and I will try that.

Also has anyone thought of adding that functionality to a
Bricolage  
method? IS this something I could request?


Dawn


>
> HTH,
>
> David
>


Re: how to change a story's element_type in the database
user name
2007-03-15 04:10:21
On Wed, 14 Mar 2007, Dawn Buie wrote:
> Ok so the primary ID field for the table
'story_instance' correlates to the 
> 'object_instance_id' field in the 'story_element'
table.
>
> or in other words:  story_instance.id is connected to 
> story_element.object_instance_id .
>
> I wasn't sure what the object_instance_id field
referred to.

For future reference, do this in `psql`:

d story_element

Near the bottom it says:

     "fk_story__sc_tile" FOREIGN KEY
(object_instance_id) REFERENCES 
story_instance(id) ON DELETE CASCADE

Re: how to change a story's element_type in the database
user name
2007-03-15 23:17:48
On Mar 14, 2007, at 17:15, Dawn Buie wrote:

> Ok so the primary ID field for the table
'story_instance'  
> correlates to the 'object_instance_id' field in the
'story_element'  
> table.

Yes.

> or in other words:  story_instance.id is connected to 

> story_element.object_instance_id .

Yes.

> I wasn't sure what the object_instance_id field
referred to.
>
> I wonder why it is called
'story_element.object_instance_id'   and  
> not 'story_element.story_instance_id' ?

It's because it's the same class using the same queries for
both  
media and stories. But it was pretty arbitrary, to be
honest, as were  
a lot of decisions early on in the development of
Bricolage.

> Anyway thank you and I will try that.
>
> Also has anyone thought of adding that functionality to
a Bricolage  
> method? IS this something I could request?

I think it'd be nice, but then we'd also have to teach
Bricolage how  
to determine the compatibility of different element types,
to make  
sure fields and subelements are all correct. For me, it has
made more  
sense to just go ahead and manually make the change in the
database  
on those few occasions when I needed to. And believe me,
it's a *lot*  
better in Bricolage 1.10. It used to be a complete
nightmare. Now  
it's merely annoying. 

Best,

David


[1-3]

about | contact  Other archives ( Real Estate discussion Medical topics )