Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3433752
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T07:36:53+00:00 2026-05-18T07:36:53+00:00

I am currently working on restructuring my site’s database. As the schema I have

  • 0

I am currently working on restructuring my site’s database. As the schema I have now is not one of the best, I thought it would be useful to hear some suggestions from you.

To start off, my site actually consists of widgets. For each widget I need a table for settings (where each instance of the widget has its user defined settings), a table for common (shared items between instances of the same widget) and userdata (users’ saved data within an instance of a widget).

Until now, I had the following schema, consisting of 2 databases:

  • the first database, where I had all site-maintenance tables (e.g. users, widgets installed, logs, notifications, messages etc.) PLUS a table where I joined each widget instance to each user that instanciated it, having assigned a unique ID (so, I have the following columns: user_id, widget_id and unique_id).
  • the second database, where I kept all widget-related data. That means, for each widget (unique by its widget_id) I had three tables: [widget_id]_settings, [widget_id]_common and [widget_id]_userdata. In each of these tables, each row held that unique_id of the users’ widget. Actually here was all the users’ data stored within a widget.

To give a short example of how my databases worked:

First database:

  • In the users table I have user_id = 1
  • In the widgets table I have widget_id = 1
  • In the users_widgets table I have user_id = 1, widget_id = 1, unique_id = 1

Second database:

  • In the 1_settings I have unique_id = 1, ..., where … represents the user’s widget settings
  • In the 1_common I have several rows which represent shared data between instances of the same widget (so, no user specific data here)
  • In the 1_userdata I have unique_id = 1, ..., where … represents the user’s widget data. An important notice here is that this table may contain several rows with the same unique_id (e.g. For a tasks widget, a user can have several tasks for a widget instance)

Hope you understood in the rough my database schema.

Now, I want to develop a ‘cleaner’ schema, so it won’t be necessary to have 2 databases and switch each time from one to another in my application. It would be also great if I found a way NOT to dinamically generate tables in the second database (1_settings, 2_settings, … , n_settings).

I will greatly appreciate any effort in suggesting any better way of achieving this. Thank you very much in advance!

EDIT:
Shall I have databases like MongoDB or CouchDB in my mind when restructurating my databases? I mean, for the second database, where it would be better if I didn’t have a fixed schema.
Also, how would traditional SQL’s and NoSQL’s get along on the same site?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T07:36:53+00:00Added an answer on May 18, 2026 at 7:36 am

    A possible schema for the users_widgets table could be:

    id | user_id | widget_id
    

    You don’t need the unique_id field in the users_widgets table, unless you want to hide the primary key for some reason. In fact, I would rename this table to something a little more memorable like widget_instances, and use widget_instance_id in the remaining tables of the second database.

    One way to handle the second set of tables is by using a metadata style:

    widget_instance_settings

    id | widget_instance_id | key | value
    

    This would include the userdata, because user_id is related to the widget_instance_id, unless you want to allow a user to create multiple instances of the same widget, and have the same data across all instances for some reason.

    widget_common_settings

    id | widget_id | key | value
    

    This type of schema can be seen in packages like Elgg.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I currently working on an issue tracker for my company to help them keep
I am currently working on a project and my goal is to locate text
I'm currently working on creating a new C# project that needs to interact with
I am currently working on a project with specific requirements. A brief overview of
The system I am currently working on requires some role-based security, which is well
I'm currently working at a small web development company, we mostly do campaign sites
The company I'm currently working for is using Selenium for Uniting-Testing our User Interface.
We are currently working in a private beta and so are still in the
I'm currently working on an internal sales application for the company I work for,
I'm currently working on an application with a frontend written in Adobe Flex 3.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.