postgres-plugin / tags-system

A reusable tags system
4 stars 0 forks source link

Documentation database structure #11

Open SimonLab opened 7 years ago

SimonLab commented 7 years ago

Add on the readme the database structure and the explanation

possible tables:

tags (list of tags)

tags-categories (categories of tags/"parent tags")

joint table which link the tags to the categories

I think we should start with just the tags table and add the other on the next iteration. Any thoughts or other tables to add @JMurphyWeb @mk4111 ?

mk4111 commented 7 years ago

@SimonLab - I agree! :D

jay-meister commented 7 years ago

Sounds good. I wonder if categories is too generic a table name.. but we can come to that later.

mk4111 commented 7 years ago

@SimonLab - can I start working on this please? :D

mk4111 commented 7 years ago

I'm going to start by adding a bit more detail to the main description

mk4111 commented 7 years ago

Taking a 5 min break to fix #19 Back to it!

jay-meister commented 7 years ago

@mk4111s readme update:

Tag-Categories

This table will list the details of the groups or types of tags.

Each group will detail:

field data-type
id serial
name varchar(50)
active boolean

Categories-Tags

This table will detail the relationships between a tag and a group; i.e. it will list which tag belongs in which group.

Each group will detail:

field data-type
category- id varchar(50)
tag-id varchar(50)

Each tag will have an id associated to it, so that the name of the tag can be changed as and when is convenient to the user. The id will be generated by postgres so the data type will be 'serial'.

We assume here that the name of a tag or category will be shorter than 50 characters, but this can easily be changed.

We create an option for users of this module to be able to 'switch on/off' a certain tag or category. Both tags and categories will have this feature, so that both a single tag, and a whole group of tags can be set to active/inactive by one command.

In our first iteration, we will create a table to host all our tags, as this is naturally the simplest part to start on. We will then create the categories table and finally relate the two tables by creating the categories-tags table.

jay-meister commented 7 years ago

Is there a naming convention for a table that only holds the links/relations?

mk4111 commented 7 years ago

@JMurphyWeb - we probably should have one! If an issue on it hasn't been created yet, I'll do that