Questions tagged [database-design]
For questions about structuring the data within a database. How to lay out tables, whether to use a relational DB or not, etc.
1,346 questions
1
vote
1
answer
128
views
Where should authentication data be stored in a modular monolith with multiple authentication strategies? (NestJS)
I’m implementing the authentication module in a modular monolith built with NestJS.
Initial Draft
In the first draft, the User entity included the hashed password, refresh token, and refresh token ...
0
votes
2
answers
154
views
Designing a social media notification system, would a single table with JSON column be the correct approach for data?
I am trying to create a notification system similar to Instagram, for the lack of better comparasion.
The Goal:
Getting user notifications in a unify way, for easy unparsing and displaying to user.
...
3
votes
2
answers
154
views
How to determine which service keeps the relation to the other?
Suppose I have (micro)services:
The following is simplified a lot, you may assume they're significant enough to be a micro.
Reseller Service - Our code is turned into whitelabel software. This is the ...
0
votes
1
answer
164
views
Reorganize data with pattern while migrating from SQL to MongoDB
I have several tables in Oracle, in each of them are stored data about a different kind of tax declaration (house tax, hotel tax, and so on). All of them have some data in common, so I want to migrate ...
0
votes
1
answer
166
views
How to Design a Database for Both Flexibility and Data Isolation?
I am designing a system that serves multiple customers, providing data visualization for revenue and membership information.
Currently I use a separate schema approach to isolate customer data. Each ...
21
votes
5
answers
4k
views
How manage inventory discrepancies due to measurement errors in warehouse management systems
I'm developing an enterprise-grade warehouse management application for a chemistry laboratory. A critical feature involves mixing multiple stock solutions to create new solutions based on predefined ...
2
votes
3
answers
418
views
Should I break a large user table into smaller tables for specific roles and information?
I am designing a database for a system that has a users table. Currently, the table has around 50 columns, which include:
Personal information (e.g. name, email, phone_number, address, etc.)
Work-...
6
votes
9
answers
950
views
If services own their data, how do you deal with relations?
I've been studying different flavors of Service Oriented Architecture (SOA), Event-Driven Architecture (EDA), micro-services and related topics for the past few days.
I see it often recommended that ...
17
votes
8
answers
4k
views
How do we distinguish between "not filled in" and "unknown" in our data store?
In our domain model "not filled in" and "unknown" are two different concepts. For example, time of death may be missing or, on the other hand, may be filled in as "unknown&...
0
votes
1
answer
119
views
Database structure for two-step registration flow
I'm trying to design a database for supporting a multi-step registration flow. The registration flow goes like this: the user logs in via OAuth (which creates a session and user), then they're asked ...
1
vote
1
answer
140
views
Fixed vs dynamic properties for a system with customization and changing requirements
Edit: writing a more specific question, as per comment, I guess my question boils down to: are dynamic properties designs appropriate for applications with rich UI and complex business logic (as ...
0
votes
1
answer
101
views
if an entity depends on two other entities(that have a relationship between them) should I make the enitity depend on the relationship instead?
If I have three entities (end-user, country, tier) in my system that has relationships as follows:
Where each country has its own tiers with specified points per year, and each end-user has a country ...
1
vote
2
answers
358
views
How to design user-defined ordering of items?
I've got a site (here) that lets users publish labs. I'm looking at adding a feature where users can customise the order that their labs appear in. To be clear, I mean that they can manually control ...
2
votes
1
answer
308
views
What is an optimal system design for tracking product views per user that is scalable?
I have a web application that contains products and users. There are 10,000+ products and 100,000+ users to give a sense of the scale that's required.
For some application specific reasons, I need to ...
2
votes
1
answer
919
views
Designing a flexible and comprehensive restaurant menu database schema?
I am working on developing a MySQL database schema for a restaurant menu system inspired by platforms like DoorDash, UberEats, and Yelp. My aim is to design a schema that is flexible and can handle ...
-1
votes
1
answer
77
views
Ensuring unique indexes on nosql datastores [closed]
I am building a User Service. User would be able to register with emailId or phone no. Upon successful registration, they can choose a username (which should be unique)
It is easy to do on SQL ...
-1
votes
1
answer
753
views
Would it be a good design to have multiple repositories for one entity?
I am working on a project. I have designed the codebase all the way from the scratch. Basic thing is the project is divided in individual modules. The modules represent one complete part of a business ...
0
votes
1
answer
61
views
Where to store config when using a external binary in a web service?
I'm making a vpn service that can be controlled through admin web page.
So I have a web page that consists of front-end page and a backend API + DB.
In this admin web page, I can execute a vpn binary ...
3
votes
1
answer
249
views
Handling Back-dated Transactions and "Online" Transactions on ERP/Banking Systems
I was currently developing a PoC of a "core banking system" in my current company, a pawn shop that generally offers lending services to retail customer and deposit services. We've built a ...
0
votes
1
answer
134
views
Better way to track and analyze downloads (or any other events)
I need to decide about my database architecture. The app provides files for download. I can add a counter to every file and track total events. But the client may want some analysis and ask for the ...
1
vote
1
answer
176
views
Monolithic Database to Microservices, but with Radical Data Model Changes
We are finishing up a long (over 1 year) project to retire our monolith. We have been moving pieces of functionality into microservices guided by domain driven design.
So far we have been leaving the ...
1
vote
1
answer
806
views
Designing a graph database structure for an application with a large amount of connections
I'm looking for advice on how to design the data model for a project I'm working on. I'm not really sure where to ask such a question. I've been using StackOverflow for years, but this problem is a ...
12
votes
5
answers
8k
views
Is it an anti-pattern to create ORM entities based on existing database schema?
I maintain a large legacy app working with SQL database. The app uses raw SQL queries to query the database. Together with app rewrite I plan to introduce ORM to work with the database.
The simplest ...
2
votes
3
answers
946
views
Dynamically transform EAV data into standard SQL table
I use MariaDB to store data using EAV model. I need EAV, because each attribute of each entity can have its own validity (validFrom, validTo).
For example, I have entity person and I track changes ...
3
votes
2
answers
227
views
how to deal with schema/constraint changes in insert-only Relational DBs?
as per request, I'll reduce this whole set of questions to 1-2 core points (thanks for the feedback ;)).
I'm considering using insert-only tables for keeping the history of my data. while the ...