We have a so called *note comments* table:

```sql
CREATE TABLE public.note_comments (
    id bigint NOT NULL,
    note_id bigint NOT NULL,
    visible boolean NOT NULL,
    created_at timestamp without time zone NOT NULL,
    author_ip inet,
    author_id bigint,
    body text, -- (a) not always a comment
    event public.note_event_enum -- (b) not a comment
);
```

As you can see, it contains things that are *not* comments:
- *(a)*: `text` is a description in case of opening events
- *(b)*: `event` is not a comment of course, other comment tables don't have 
*events*

Here's the changeset comments table for comparison:

```sql
CREATE TABLE public.changeset_comments (
    id integer NOT NULL,
    changeset_id bigint NOT NULL,
    author_id bigint NOT NULL,
    body text NOT NULL,
    created_at timestamp without time zone NOT NULL,
    visible boolean NOT NULL
);
```

You can turn `note_comments` table into an actual comments table if you remove 
things that are not comments (opening event rows, rows without comment text, 
`event` column). But you can also turn it into a note version table if you 
remove other things (comment event rows), modify some (`text` to always contain 
the description) and add what's missing (version numbers).

If we replace `note_comments` with two tables as described above, we'll have a 
pure comments table and a versions table. Then we can add tags referencing the 
versions table.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/issues/5294#issuecomment-2541527509
You are receiving this because you are subscribed to this thread.

Message ID: 
<openstreetmap/openstreetmap-website/issues/5294/2541527...@github.com>
_______________________________________________
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev

Reply via email to