Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 5 years ago.
Improve this question
I am creating an invoice application. Does the following flow diagram is the proper & complete application?
Am I missing any model?
Is there any other better way to design?
Is there any option to reduce the number of tables?
In the current model, when a user adds new invoice - I need to interact with almost all the tables.
When a user edits the same invoice - Again I need to interact with all the mentioned tables.
Well it's hard to say, because only you know the specification of your application and what it should do and you are posting some concept not a design (eg. UML diagrams). But giving the information you provide:
Invoice have one contact. Would be better having issuer and contractor (two contacts) in case you want to issue an invoice from many clients.
I can answer that question when I see UML diagrams.
Why you want to reduce a number of tables? If you want to you can have one big table but that's not the point. Just keep your database desing normalized (3rd normal form) and don't care about number of tables.
On a must, I think you don't need tax and currency relations, you can move them to Invoice attributes - but once again, I don't have the whole picture.
No, you don't. When you issue a new invoice to the same customer and sell him the same items you just add records to two tables (invoices, invoice items). Anyway don't think about modyfing the database that way, you have the DB to work on it :)
As mentioned above - no.
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
I want to save and display Historical Prices of 2500 CryptoCurrencies. Wich is the best strategy to save all that data on my database? I think is not a good idea create 2500 Tables with a row for every price...
Database: Postgres
Thank you very much
That is a very broad question, but most likely a star schema would help you setting this up in a flexible and scalable way.
I can envisage this as a very simple setup with a fact table holding the historical data about prices by a timestamp, and a couple of dimension tables holding informations about the coins (i.e exchange rates, merchants) etc.
This is a simple guide about star schema
MongoDB could be an good option. Create for each currency one collection. Take care to do not load to big collections at once, rather create a aggregated collection.
In my humble opinion questions like this don't seem "too broad".
You can always create a table and have it partitioned by year, possibly crypto code if you have lots of price points.
I personally am a fan of denormalized data models but if you are thinking of storing the crypto code in a separate table and the price points in another there may be some small advantage in terms of query time - indexing the price points table based on an integer (crypto_id) may result in faster queries.
https://www.postgresql.org/docs/10/ddl-partitioning.html
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
Our have a ERP project. There are over 1000 tables in this project and there are more than 10 class library in solution. The project is opening very slowly. Maybe 4 - 5 minute. An then if I run the project it is working too late. Very simple queries last 8 - 40 seconds.
select * from VeicleColors
In this table there are 50 row. But 8 seconds.
What are your suggestions?
Thanks.
Answering the old question, it might be helpful for others having the same issue.
All ERP modules do not use all tables, therefore, it is important to group related table by modules. There will be certain tables (organization structure, user and preferences tables, masters) that are used across modules. Analyze the tables and usage and then:
Break the EF model into smaller models with tables from related module in one model.
Try to keep number of tables per model less than 250 (approximately)
Keep common tables in one or more separate models. You can reference common model in other classes.
You can use frequently used common tables in other models (plan your namespaces), but restrict table update operations to one base model only.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 6 years ago.
Improve this question
In most ASP.NET Mvc tutorials, you see people creating simple models and then scaffolding controllers with views, using Entity Framework.
In most tutorials you will also see that they create a new DbContext class which will have the DbSets. I understand that this is a good thing to do for educational purpose, to help the person understand how it works.
But the account system that comes with a default Mvc project always links to "DefaultConnection".
Some tutorials will also make use of the account system to advance further, but that means that at this point you would have 2 databases running to support your web app.
one for the account info
one for the details of your model(s)
Is this the correct way to work? or do most developers/companies just use 1 database for both of these?
My reason for asking is because i found this tutorial which uses both of these aspects and works on 1 database and it is the first time i see this being done.
There's no right or wrong way. You need to evaluate the requirements and time lines for your projects and decide which options suits you best.From personal experience, in all the projects I worked on, the account info and the models reside on the same database.
Remember that if you have two databases you will need to create two data contexts to access them.If the database needs to be moved to another server, you would need to move two databases and change the connection string in two places, also the maintainance and upkeep on the DB would need to be performed in two different places.It's really a maintainance headache and should be avoided in my opinion unless your requirements have some compelling reason that you should place account info into a separate DB.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I currently have three models: Business, Charity, and Organization. A business and charity are both types of organizations because they share many similar attributes (e.g. address, hours, website, etc.) however they each have their own unique attributes. How should I best handle the creation of the models in Active Record? Use STI or Polymorphism? Or should I break out each one into their own model with duplicate information and get rid of the Organization model?
You can use both, so it is not necessarily an either/or situation. Most importantly, however, is how you will structure your tables and the logic surrounding them, which depends on how you are going to query the data, and how these elements relate to one another.
There is not enough information above to give you very clear direction on what to use. However, if after reading:
Rails Guides
How and When to Use STI
... the solution isn't clear, here are some simple rules:
if the types of objects you are using mostly have the same attributes but have different business logic attached to them (ie, the behavior written into their Model classes), then STI is a good baseline idea, but
if they have the same logic as well, it may make sense just to create them as a single class with a "type" flag (but not the attribute type, since it is only for STI)
As far as polymorphism goes, it seems like these Models are all very similar and interchangeable -- polymorphism is more useful for relating unlike things (such as comments and photos) to another Model (such as a FB post). In that case, using either a single table or STI and relating based on the parent table may make more sense.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
i have a little system with some users.
An user with admin-rights can create a new lecture.
Thats already working.
Now i want to solve the problem that users can sign up to lectures.
So i want to add a new column (boolean type) e.g. to lecture1 in my users database when i create a new lecture. So i can set the variable to true if an user sign up.
Is that a good idea or would it be better to have a database (e.g. signupstatus) with an exercise_id, an user_id. When there is an entry the user has already sign up to the lecture.
Or does anyone have an better idea?
Thanks :)
The table is always better. You will never want to create such columns(lecture1...) in User table, for each new lecture which to added in your system. Imagine the series of such columns [lecture1,lecture2,lecture3,lecturen...] => Totally unconventional and against the design principles.
What you want is a simple Many-to-Many relationship. A Lecture can be enrolled by many users; a User can subscribe to many lectures.
You should follow this guide to achieve it.
This will create a table - lectures_users and store lecture_id and user_id to maintain the relationship