Hello There I am importing the database into one of my test servers and wanted to know if TAGs per ChangeSets are one-to-one mapped, or one-to-may? The reason I ask is because I am developing the ChangeSet table on SQL, and wondered is it best to have a TAG with a ForeignKey pointing to the original ChangeSet, or can I have all possible tags are fields in the same ChangeSet tables? I don't have any tools to see any live examples or view the data, would appreciate if I'm pointed out in the right direction. Thanks & Regards Heider asked 25 Sep '23, 20:58 Heider |
Perhaps it would help to look at something that processes changesets and changeset discussions These queries are the ones that the ChangesetMD software uses to manage its database, which stores changesets, changeset tags, and in a separate table, changeset discussions. (note the original author of this is ToeBee. not me!) answered 26 Sep '23, 16:39 SomeoneElse ♦ |
As with nodes, ways and relations, a changeset can have many tags. Each key is unique, so there can only be one tag with the key "comment", for example. As for approaches for storing this in a SQL database, the two main ones are to have a ChangesetTag table, with foreign keys to a Changeset table, or alternatively use a dynamic storage column (e.g. json type) called tags on the Changeset table. Both approaches are used in different parts of the ecosystem. answered 26 Sep '23, 15:02 Andy Allan |
Thank you Andy I appreciate getting back to me, so, from what I understand I can safely create a "comment" column field into the ChangeSet table knowing there will be always one comment per ChangeSet. Is that right? i.e. there would not be the following scenario:
I think the above example explains my query better, in this case, we would only expect one comment line (which is either Comment-1, or 2, or 3) but not all Tags of similar keys getting into the same ChangeSet. Thanks again Andy. answered 26 Sep '23, 16:25 Heider |
Thank you for the info SomeoneElse, I appreciate your help. From the link you sent from ToeBee's work, there is another table for "comments' therefore, I have to assume that the Change-to-Comments is a one-to-many relationship and that comments can be multiple for the same change set. Thank you very much for all your help, I will proceed with my development this way in this case. answered 26 Sep '23, 16:46 Heider |
You can only have one tag with "comment" as a key, but you can have multiple tags on a changeset, with different keys, eg :
If you care only about the comment tag, you can store its value in your ChangeSet table. Otherwise you need to have another table with key, value and reference to the changeset (or json store as Andy said). What you saw (I guess), on the ChangesetMD page are other comments, displayed on the changeset page under the header "Discussion". These are not tags, and are stored differently. The xml, from the documentation, looks like this :
answered 29 Sep '23, 20:27 H_mlet |
Thank you very much H_mlet I think your answer is the one I was looking for, and yes I totally understand that tags can have multiple different keys. I appreciate your time and effort to help. Kind Regards Heider answered 29 Sep '23, 21:28 Heider |
Thank you very much H_mlet I think your answer is the one I was looking for, and yes I totally understand that tags can have multiple different keys. I appreciate your time and effort to help. Kind Regards Heider answered 29 Sep '23, 21:28 Heider |