entity-attribute-value

How do you model custom attributes of entities?

痴心易碎 提交于 2019-11-28 17:15:22
问题 Let's say we're having an application which should be able to store all kind of products. Each product has at least an ID and a Name but all other attributes can be defined by the user himself. E.g. He could create a productgroup Ipods which would contain attributes capacity and generation E.g. He could create a productgroup TShirts with the attributes size and color We need to store the definition of a product and the concrete products itself. We want to ensure that it is easily possible to

Symfony2 - how to create form based on dynamic parameters from db? (EAV)

▼魔方 西西 提交于 2019-11-28 16:33:01
问题 I would like to create form based on dynamic parameters that are stored in DB. So I've created an entity called Parameter that defines parameter name, which should be displayed as form field label. /** * @ORM\Entity */ class Parameter { /** * @ORM\Id * @ORM\Column(type="integer") * @ORM\GeneratedValue(strategy="AUTO") */ protected $id; /** * @ORM\Column(type="string", length="255") * @Assert\NotBlank() */ protected $name; /** * @ORM\OneToMany(targetEntity="ParameterValue", mappedBy="parameter

(Database Design - products attributes): What is better option for product attribute database design?

旧街凉风 提交于 2019-11-28 16:03:28
问题 I new in database design. What is better option for product attribute database design for cms?(Please suggest other options also). option 1: 1 table products{ id product_name color price attribute_name1 attribute_value1 attribute_name2 attribute_value2 attribute_name3 attribute_value3 } option 2: 3 tables products{ id product_name color price } attribute{ id name value } products_attribute{ products_id attribute_id } 回答1: You're making a common mistake of database design, storing name in one

How to design a database schema to support tagging with categories?

懵懂的女人 提交于 2019-11-28 15:26:03
I am trying to so something like Database Design for Tagging , except each of my tags are grouped into categories. For example, let's say I have a database about vehicles. Let's say we actually don't know very much about vehicles, so we can't specify the columns all vehicles will have. Therefore we shall "tag" vehicles with information. 1. manufacture: Mercedes model: SLK32 AMG convertible: hardtop 2. manufacture: Ford model: GT90 production phase: prototype 3. manufacture: Mazda model: MX-5 convertible: softtop Now as you can see all cars are tagged with their manufacture and model, but the

Is using a Master Table for shared columns good practice for an entire database?

南楼画角 提交于 2019-11-28 14:49:22
Below, I explain a basic design for a database I am working on. As I am not a DB, I am concerned if I am on a good track or a bad one so I wanted to float this on stack for some advice. I was not able to find a similar discussion that fit's my design. In my database, every table is considered an entity. An Entity could be a customer account, a person, a user, a set of employee information, contractor information, a truck, a plane, a product, a support ticket, etc etc. Here are my current entities (Tables)... People Users Accounts AccountUsers Addresses Employee Information Contractor

Key value pair in PostgreSQL [closed]

◇◆丶佛笑我妖孽 提交于 2019-11-28 10:56:29
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 6 years ago . I need to save key value pairs in PostgreSQL database which will have some basic info regarding the record. After some googling on the topic I found out hstore is one of the options. But even after going through

What is best performance for Retrieving MySQL EAV results as Relational Table

你。 提交于 2019-11-28 06:58:38
I want to extract results from EAV (entity-attribute-value) tables, or more specifically entity-metadata tables (think like wordpress wp_posts and wp_postmeta ) as a "nicely formatted relational table", in order to do some sorting and/or filtering . I've found some examples of how to format the results within the query (as opposed to writing 2 queries and joining the results in code), but I would like to know the "most efficient" method for doing so, especially for larger result sets. And when I say "most efficient", I mean for something like the following scenarios: Get all Entities with last

Key/Value pairs in a database table

血红的双手。 提交于 2019-11-28 05:33:17
I need to design a Key/value table in my database and I'm looking for guidance on the best way to do this. Basically, I need to be able to associate values to a dynamic set of named properties and apply them to an external key. The operations I need to be able to support are: Apply a key/value pair to a group of items Enumerate all of the currently-active keys Determine all of the items that have a value for a given key Determine all of the items where the value associated with a given key matches some criteria. It seems that the simplest way to do this is to define a table: CREATE TABLE

Pivoting EAV data from the client to a Relational Model on the server

时间秒杀一切 提交于 2019-11-28 01:37:40
I am building a software platform for mobile electronic data collection. It should support any type of data. For example, the government might use it for a population survey; a manufacturing company might use it to evaluate plant condition at their factories; a research organizations might use it for clinical trials, e.t.c As such, the software is powered by a database, with standard relational design for the metadata and entity attribute value for the actual data. Client software then reads the metadata and renders the appropriate user interface, complete with rules, validations, skip logic

Performance of large EAV/open schema systems on SQL Server

北城余情 提交于 2019-11-27 11:22:22
问题 Has anyone implemented a very large EAV or open schema style database in SQL Server? I'm wondering if there are performance issues with this and how you were able to overcome those obstacles. 回答1: Regardless of MS SQL Server versus any other brand of database, the worst performance issue with EAV is that people try to do monster queries to reconstruct an entity on a single row. This requires a separate join per attribute . SELECT e.id, a1.attr_value as "cost", a2.attr_value as "color", a3