Sorry for the double post, I had this up on the general discussion forum and then realized that this is probably a better place to ask this question.
I would like to write a select query against the MySQL database for my Gallery2 instance. Is the db structure documented anywhere?
Essentially, I want to query out all image records (title, caption, albumname) where a custom field named 'custom2' is not null. The custom field is a 'common field'.
Any help would be appreciated.
Thanks,
David.
Posts: 8601
there are some quite old diagrams here:
http://gallery.menalto.com/gallery/miscellaneous/
entity tables match the class structure, so if you look at modules/core/classes/GalleryItem.class and see what it extends then you'll find all the related tables. Each of these tables are linked by a common g_id value.
Posts: 11
Thanks,
That has gotten me started. I can't seem to find a key between CustomFieldMap and Item tables. CustomFieldMap uses g_itemid as a primary key, Item uses g_id.
I can grab the custom field names and values that I want, now I just want to join that data with the photo and album attribute data for each related record.
Posts: 8601
g_id links to g_itemId.
actual entity tables use g_id (ie, GalleryItem extends Gallery..... each will use g_id)
other tables with related data, but not actually part of the same entity, usually use g_itemId.
Posts: 11
Thank you for your response!