data-modeling

What are design patterns to support custom fields in an application?

跟風遠走 提交于 2019-11-27 05:51:07
We develop a commercial application. Our customers are asking for custom fields support. For instance, they want to add a field to the Customer form. What are the known design patterns to store the field values and the meta-data about the fields? I see these options for now: Option 1 : Add Field1, Field2, Field3, Field4 columns of type varchar to my Customer table. Option 2 : Add a single column of type XML in the customer table and store the custom fields' values in xml. Option 3 : Add a CustomerCustomFieldValue table with a column of type varchar and store values in that column. That table

Tools to generate a database diagram/ER diagram from existing Oracle database? [closed]

做~自己de王妃 提交于 2019-11-27 05:25:07
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 5 years ago . Looking for tools (windows platform) to genereate ER diagram (or similar) from an existing Oracle database. Any good tools out there that are free to use or low cost? 回答1: I few years ago, I used Data Architect, part of Power Designer from Sybase. It's a little pricy, but it's excellent. And it makes a fine

Why should I avoid loops when designing relationships for a database?

此生再无相见时 提交于 2019-11-27 05:21:15
问题 Someone told me that it was bad design to have loops in the datamodel. I have heard this before a couple of times but didn't pay much attention. For example you have entities User, Project, Activity. A project is owned by a User, so we have a one-to-many relationship from user to Project. An activity can be assigned to a single User, another one-to-many relationship from User to Activity. Of course a project is defined by a set of activities, another one-to-many relationship from Project to

ExtJS 4: Models with Associations and Stores

坚强是说给别人听的谎言 提交于 2019-11-27 04:15:30
问题 Introduction I'm facing an application design problem with the Ext.data.Model class in ExtJS. I will try to develop my ideas to a very common online store scenario here, so you can follow me. I would really appreciate any comments on my thoughts and conclusions! Models Let's suppose you want to map the fact that " Every customer can order multiple products " to ExtJS. From the bare words one can identify these three models involved: Customer , Order , and Product . The Order in this case is

Best way to model Customer <--> Address

余生长醉 提交于 2019-11-27 03:51:20
Every Customer has a physical address and an optional mailing address. What is your preferred way to model this? Option 1. Customer has foreign key to Address Customer (id, phys_address_id, mail_address_id) Address (id, street, city, etc.) Option 2. Customer has one-to-many relationship to Address , which contains a field to describe the address type Customer (id) Address (id, customer_id, address_type, street, city, etc.) Option 3. Address information is de-normalized and stored in Customer Customer (id, phys_street, phys_city, etc. mail_street, mail_city, etc.) One of my overriding goals is

Common one-to-many table for multiple entities

痴心易碎 提交于 2019-11-27 03:33:35
问题 Suppose I have two tables, Customer and Vendor. I want to have a common address table for customer and vendor addresses. Customers and Vendors can both have one to many addresses. Option 1 Add columns for the AddressID to the Customer and Vendor tables. This just doesn't seem like a clean solution to me. Customer Vendor Address -------- --------- --------- CustomerID VendorID AddressID AddressID1 AddressID1 Street AddressID2 AddressID2 City... Option 2 Move the foreign key to the Address

How to implement has_many :through relationships with Mongoid and mongodb?

那年仲夏 提交于 2019-11-27 02:29:56
Using this modified example from the Rails guides , how does one model a relational "has_many :through" association using mongoid? The challenge is that mongoid does not support has_many :through as ActiveRecord does. # doctor checking out patient class Physician < ActiveRecord::Base has_many :appointments has_many :patients, :through => :appointments has_many :meeting_notes, :through => :appointments end # notes taken during the appointment class MeetingNote < ActiveRecord::Base has_many :appointments has_many :patients, :through => :appointments has_many :physicians, :through =>

What are the principles behind, and benefits of, the “party model”?

假装没事ソ 提交于 2019-11-27 00:32:31
The "party model" is a "pattern" for relational database design. At least part of it involves finding commonality between many entities, such as Customer, Employee, Partner, etc., and factoring that into some more "abstract" database tables. I'd like to find out your thoughts on the following: What are the core principles and motivating forces behind the party model? What does it prescribe you do to your data model? (My bit above is pretty high level and quite possibly incorrect in some ways. I've been on a project that used it, but I was working with a separate team focused on other issues).

Alternatives to Entity-Attribute-Value (EAV)?

一曲冷凌霜 提交于 2019-11-27 00:02:54
Our database is designed based on EAV (Entity-Attribute-Value) model. Those who have worked with EAV models know all the crap that comes with for the purpose of flexibility. I asked my client about the reasons why using EAV model (flexibility), and their response was: Their entities change over time. So, today they may have a table with a few attributes, but in a month time, a few new attributes may be added, or an existing attribute may be renamed. They need to produce reports to get back to any stage in time and query the data based on the shape of entities at that stage. I understand this

Facebook like notifications tracking (DB Design)

試著忘記壹切 提交于 2019-11-26 23:46:06
I am just trying to figure out how Facebook's database is structured for tracking notifications. I won't go much into complexity like Facebook is. If we imagine a simple table structure for notificaitons: notifications (id, userid, update, time); We can get the notifications of friends using: SELECT `userid`, `update`, `time` FROM `notifications` WHERE `userid` IN (... query for getting friends...) However, what should be the table structure to check out which notifications have been read and which haven't? Atif Mohammed Ameenuddin I dont know if this is the best way to do this, but since I