Jump to content
TNG Community

Are TNG database schemas available?


randalrh

Recommended Posts

randalrh

For my use case, I'm trying to debug an upgrade from V14 to V15.  I can view both schemas in my old and new databases, but I am seeing odd issues that make me think my V15 database tables may not be set up correctly.  Are there reference database schemas for the various versions to refer to?

Thanks,

Randal

Link to comment
Share on other sites

randalrh

I found this, more or less, in upgrade_db14x-15x.php of the incremental upgrade folder as SQL statements of the form alterTable( "ALTER TABLE $medialinks_table ADD ctop SMALLINT NOT NULL after defphoto" );

Those SQL statements would be different in the full install folder or the upgrade V13 to V15 folder, for instance.

What this told me is my V15 database is fine, so I'm going to post my real problem in case it can help me or others.  The media I imported via the gedcom import all looks good, but I have a collection called Histories that, after the upgrade, consisted of all files in my /histories folder, and appeared in the user view with the default thumbnail and the info and linked to fields blank in /browsemedia.php?mediatypeID=histories.  The files are all .php files.  I tried to recover them from my V14 database, using this workflow:

Export medialinks from the V14 database table tng_medialinks where altdescription ended in .php

Import those into the V15 tng_medialinks table, but only updating the matching columns, so not ctop, for instance.

Manually change the mediaID so that it's the value in the V15 database, not the V14 database.

Now I get links showing up in the linked to field of /browsemedia.php?mediatypeID=histories, but when I click on them I don't get any result because they are looking for a place.  Even though in tng_medialinks the linktype is I and the personID is of the form I123, clicking on the link brings up placesearch.php?psearch=I123&tree=tree1, and the type field in admin_editmedia.php?mediaID=220 is place.

In short, I don't know why links to a person are looking for a place.  This was supposed to be a shortcut instead of replacing all the links, but it's not turning out that way.  Is the whole idea of exporting the person links from the V14 to the V15 database misguided?  Any ideas?

Thanks,

Randal

Link to comment
Share on other sites

If you want to compare your V14 and V15 schemas to make sure (most) things match, you could use this SQL in a report or in phpMyAdmin:

SELECT TABLE_SCHEMA, TABLE_NAME, COLUMN_NAME, IS_NULLABLE, COLUMN_TYPE, COLLATION_NAME FROM `COLUMNS` WHERE TABLE_NAME LIKE 'tng%'

You could also us mysqldump to show how the command line tool exports the data in a table, which includes the schema and data. And since "running" the file that is created will make the table and put the data in, you could modify the file to see if your changes are successful (try it with a different table name to avoid overwriting your existing one!). The syntax for one table would be:

mysqldump -p your_db_name tng_medialinks --password=your_db_password > /var/www/html/medialinks.sql

 

GOGGS

Link to comment
Share on other sites

randalrh

I've figured out the problem, though not the specific details.  I'll document it here in case that will help anyone in the future.  Below are the column headings for tng_medialinks in TNG V15, along with two entries.  The first is imported from V14 with the four extra columns in V15 just as 0s.  The second is a similar link I created in the V15 admin interface.

`tng_medialinks` (`medialinkID`, `gedcom`, `linktype`, `personID`, `eventID`, `mediaID`, `altdescription`, `altnotes`, `ordernum`, `dontshow`, `defphoto`, `ctop`, `cleft`, `cwidth`, `cheight`)

(15313, 'tree1', 'I', 'I825', '', 9426, '', '', 2, 0, '', 0, 0, 0, 0),
(15314, 'rrss20260102', 'I', 'I4769', '', 195, '', '', 1, 0, '', 0, 0, 0, 0);

I was focused on the "I" linktype showing up as a place in the interface and didn't pay any attention to the gedcom column.  In V14, the default is tree1, regardless of the gedcom name.  In V15, it's the name of the imported gedcom file.  When I change tree1 to rrss20260102 in the first line, the person link works as expected.  I still had to change the mediaID from the V14 import to match the proper V15 mediaID value, but I was always going to have to do that.  I don't know what it is about the defaults or particularities of the TNG code that make a media link show up as a place, but this is the fix.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...