0

I have for an initial implementation of a Database with a table for Projects. Each project can have a number of Chapters, Characters, Events, etc.

I have an API that a client can consume and CRUD each Projects Chapters, Characters etc.

I want to add a functionality that enables a user to create a customized item for example an item, lets say "Place", and give it attributes, like "Post Code", "Climate", "Crime rate", "Special Characteristics", etc. Until now my tables are hard coded by me. What bothers me even more, is how could I enable that user to enable connections between Tables. For example I would like the user to be able to connect a "Place" and an "Event".

If it was two tables generated by me I could establish a junction table for a Many-to-Many relationship. Could the same work for a customized, randomized table ?

How should I go about implementing this functionality? I feel that it's a bad idea letting a user creating tables in the database as this cannot be easily controlled.

This is not code related, more like general approach. It is my first time attempting to generate an API, Database, Front End using different technologies(Smyfony for REST API. MySQL and Angular framework). Also any book recommendations regarding any helpful topic would be highly appreciated.

Pavel_K
  • 10,748
  • 13
  • 73
  • 186
Nick
  • 825
  • 1
  • 8
  • 20
  • You can consider using mongodb for your purpose where you dont know what is the data that is coming in. – Vikhyath Maiya Aug 31 '17 at 14:07
  • I had a similar idea about using any type NoSQL – Nick Aug 31 '17 at 14:12
  • 1
    Well yeah,the database can store any data without any predefined structure and angular can help you display any data.The only problem you might face is relation between different entities.You should design the database in such way that minimum relationships are there (In your case no relationship as it too dynamic) – Vikhyath Maiya Aug 31 '17 at 14:17
  • have you considered creating only one table and add attributes as rows instead of columns. Like a table will be UserSelectedInfo columns (user | Parent | ChlildKey | Value ) and it will have rows as below XM1234 | Place | Code | 123 XM1234 | Place | Cimate |Hot XM1234 | Place | Rate |Low XM1234 | Event | Balloon Fest |Today XM1234 |event |marathon |tomorrow – Rohit Ramname Aug 31 '17 at 14:50
  • Sounds like a duplicate of [this](https://stackoverflow.com/questions/5106335/how-to-design-a-database-for-user-defined-fields) – Simon Sadetsky Aug 31 '17 at 21:40

0 Answers0