5

There's standard system tables that will tell you the names of the custom user-defined tables and their columns and types (metadata packaged as well-known tables & columns).  And this is how some abstract database user interfaces, management tools, and debugging tools can be made to work against any (SQL, user-defined) database that they have never ...


3

Alternatives for the user relationship What are the theoretical alternatives: you have a class User with an association to Company and another one to Distributor. You also have a constraint between the two associations, that only one can be active at a given moment in time. Consequence: the association can change over time and a user once assigned to a ...


3

Yes, this smells and proves to be very inflexible. If it would just be about important vs. less important tags, I'd just mark those in the tags table with a property is_important. But your code example suggests that there may also some special, application specific behavior behind it. This creates an issue since the application behavior is tightly ...


3

If files can be associated either with sessions or subsessions, you should consider using separate association tables for that. Session table Id ... SubSession table Id Session -> references Sessions.Id ... Files table Id FileName ... SessionFiles table Session -> references Session.Id File -> references Files.Id SubSessionFiles table SubSession -> ...


2

There is no general design rule for storing or not storing line or record numbers of a CSV file. You store them when you have a requirement for storing them (like you want to to store the file line-by-line and need to preserve the order of the lines). Otherwise, you don't. (Note most relational databases do not guarantee to preserve the order in which ...


2

all the users who still have 1.2 installed on their phone are still able to use the app without problem? Not being an expert of mobile dev, but it seem to me forcing updates is the regular workflow for phone apps in these cases, if such breaking change would happen the v1.2 should have a mechanism to refuse launching until it is updated. This is at least ...


1

I'd need to know better the situation in which you had to do that, otherwise my answer may not be what you're looking for. In general you know the structure; either you created the application and thus the tables and obviously then you know their structure, or the person who created it documented to you, or provided a script to create the tables that you ...


1

do I GET/fetch the homescreen data from the SERVER or from the LOCAL DB? Yes. When offline, fetch it from the local database. When you first come online, sync the data with the server. If already online, sync the data if it hasn't been sync'd by the end of the last user session. If already online and you have already sync'd the data at the end of the ...


1

Having efficient access is never going to correspond with being human editable. With that said, it sounds like to me your use case requirement here exactly matches what sqlite is built for: fast, well supported, single file database. SQLite database isn't readable in a plain text editor, but there are a lot of very good GUI SQLite tools. You can create a ...


1

Yes it does smell just a little :) The first improvement you could make is to encapsulate the id comparisons inside the Tag class by providing boolean methods like tag->isDepositPaid() and customer->hasPaidDeposit(). There will be a tiny performance hit - probably impossible to measure as database operations are likely going to be the performance limiting ...


1

There is no universal best answer. It depends of the context and your intent: On one side you could view your metadata repository as an extension of the RDBMS metadata. In this case, you would not need the redundant information. You should even avoid it to prevent inconsistencies. On the other side, in a security aware environment, you could consider ...


Only top voted, non community-wiki answers of a minimum length are eligible