Answer the question
In order to leave comments, you need to log in
Store 2D array in json or create table?
The database must have users, each user has its own set of cards, each card has its own set of events and config. The question arises how best to store events for the map?
I have two options :
1) storing in json
CREATE TABLE maps(
map_id serial primary key NOT NULL,
user_id integer references users(user_id) NOT NULL,
map_name varchar (30) NOT NULL,
map_description text,
map_events json,
map_config jsonb
);
CREATE TABLE maps(
map_id serial primary key NOT NULL,
user_id integer references users(user_id) NOT NULL,
map_name varchar (30) NOT NULL,
map_description text,
map_config jsonb
);
/*структура события*/
CREATE TABLE events(
event_id serial primary key NOT NULL,
map_id integer references maps(map_id) NOT NULL,
event_header varchar (30),
event_description text,
event_media_url varchar (100),
event_location varchar (100)
);
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question