« first day (1273 days earlier)      last day (1385 days later) » 

12:41 AM
@TehShrike, at the end i changed the way to retrieve the information
@TehShrike are you here? :O
 
@acasanovas :-)
 
@TehShrike i'm working on a new db design and I'm asking my self what's the best way to relate elements from the same table, for instance elements that have N subelements, events that have N subevents, and the events and subevents are exactly the same
 
@acasanovas So you're storing a hierarchy?
 
@TehShrike yes
@TehShrike i'm tying to do it with something like this cdn.imghack.se/images/c713782d6c5a2ab9d014f6be650d2d78.png
 
You could give your event table a nullable parent_event_id, or you could use nested sets
Can children have more than one parent?
 
12:54 AM
children can't have more than one parent, but a children could have subchildrens, let me check it...
thank's I'll do it with parent_event_id, it's better to make a relation to get the parent_event_id or i put just the int?
 
@acasanovas what's the question?
Personally I prefer nested set to adjacency list in a lot of cases
lets you get an event and all of its descendants in a single query
 
Answered! thank you very much!
@TehShrike Mmm and if have to relate an Event with two types of places (stored in two different tables). Is there some way to avoid to make a boolean to determinate which table I need to query ?
 
1:18 AM
@acasanovas what kinds of places do events have?
Wouldn't places have events?
 
@TehShrike in this case, I've a places pre-introduced (existing physically places, a theater that represents an opera every day) or a Festival that occur on specific place ( a place that will no have nothing else than this event)
occur on no specific*
 
@acasanovas so by "event" you mean a calendar event
and these calendar events have a geographic location
Why would you have geographical locations in multiple tables?
 
exactly, mmm why not? the all year places hosts lots of events, and the others when the event has expired it will be marked to remove
I don't want to save that information for long
so I have two tables Events, Places and the table of the expirable places
three*
Three main tables ( with the X_id as a primary key and AI)
 
1:39 AM
You should have just one "places" table
with a nullable expiration date
Breaking them out into different tables is asking for lots and lots of pain
 
It looks more o less like this: http://cdn.imghack.se/images/3ba22ab155cc34da72f1ed76ace9e743.png
And on the table coll_events_related_places is where i'm stacked
I know... but the db is working online and full of places, and modify it is so hard
 
@acasanovas it will only get more difficult in the future.
Working with a complicated schema will be more difficult in the long run (and even the medium run)
Events can have more than one location?
 
hypothetically yes, an theater can make an outdoor representation, but it isn't yet on the schema i send you.
I'll try to do it by the hardest way modificating all the code and db and tying to not die on the process haha, so there isn't any other middle efficient way to do it?
 
2:01 AM
@acasanovas Having to look for locations in two different tables depending on slight variations seems like a conceptual nightmare
why not have a third table for locations with attendees who have RSVPd, and a fourth table for locations that have hosted events before?
 
well to distinct i'm using a boolean like outdor_location
what's RSVPd?
 
In the context of social invitations, RSVP is a request for a response from the invited person or people. It is an initialism derived from the French phrase Répondez s'il vous plaît, literally "Reply if it pleases you". == Emily Post == The high society of England adopted French etiquette in the late 18th century, and the writings of Emily Post aim to offer a standard no more stringent than that tradition. Late 20th century editions building on her 1920s work say, e.g., that "Anyone receiving an invitation with an R.S.V.P. on it is obliged to reply....", and some recent editions describe breaching...
It's not enough to have that one boolean in one table
Locations have their own identity outside of events
How would you write a query to get all locations with a photo?
You would have to query two different tables
It breaks the idea of a foreign key to a location
Instead of a foreign key to another table, the relation is defined by the combination of "this is the table to look in, and this is the value to look for"
It essentially breaks your ability to use SQL to describe relationships
 
So, i'm doing it so wrong... :'( how should I design the tables of the image I send you
?
 
events have locations, and locations have photos, right?
what's a "photo_lng"?
Should places be able to have multiple descriptions?
what are k_f and n_l in an event? I would highly recommend spelling out all column names
What is a collaborator?
 
Events has locations, the locations has photos and the photo description has languages
aha, places should have multiple descriptions for each language, k_f is kids and family a filter, has_no_collaborator is if the place is from a table or another, because who introduces the places it's a 'collaborator'
I'll take you advice
your*
 
2:20 AM
 
Well, I see i was missing the auto-incremental id's on some tables (because it was under construction haha) but on the image i sent you the tables coll_events_place and the other related with was the temporal places where an event just occur one time and don't have any other interest (the final user can search for the places or for the events). I'm in agree with you to unify the places, even with a type or something to distinct the 365 places from the others
 

« first day (1273 days earlier)      last day (1385 days later) »