Building relational tables

Hi all

I’ve been tasked with creating a custom field type option for when comparing our products so that if there are preset values then they can be compared with each other.

I’ve created my controllers and models as well as my views but i’m not sure that my table creation is 100%

Our DB has multiple products tables prefixed with the relevant site name eg: cur_products

The tables i have created are like this

create TABLE custom_field_name

(ID integer NOT NULL PRIMARY KEY,

GROUP_ID integer NOT NULL,

Name character varying (25) NOT NULL,

FOREIGN KEY (ID) REFERENCES custom_field_value(ID_FV),

FOREIGN KEY (GROUP_ID) REFERENCES custom_field_group(ID_FG)

)

create TABLE custom_field_value

(ID_FV integer NOT NULL PRIMARY KEY,

PROD_ID integer NOT NULL,

CUSTOM_FIELD_ID INTEGER NOT NULL,

VALUE INTEGER NOT NULL

)

create TABLE custom_field_group

(ID_FG integer NOT NULL PRIMARY KEY,

Name_FG character varying (25) NOT NULL

)

Can someone advise me if this is the best way ?