title: Class table Inheritance, runtime schema changes and ORM
body: <p>I am thinking about a model for product attributes. Class Table inheritance looks great, but I'm wondering if it is possible to use an ORM with such a model.</p>
  
  <p>If you take the example of a commerce software, the vendor may want to create new product types (ie new tables).</p>
  
  <p>Example :</p>
  
  <pre><code>product {
    id,
    name,
    creation_date
  }
  </code></pre>
  
  <p>The vendor creates a new tshirts type, it creates the table :</p>
  
  <pre><code>product_tshirts {
    product_id (fk to a product in the products table),
    size,
    color
  }
  </code></pre>
  
  <p>The ORM must adapt to runtime schema changes (ie having some kind of dynamic entity that can be mapped to any product table).</p>
  
  <p>It should be possible to do :</p>
  
  <pre><code>// Should return all tshirts having a size = 10
  tshirts = orm-&gt;find('tshirts', 'size', 10)
  </code></pre>
  
  <p>And if you use a convention for table names like product_*</p>
  
  <pre><code>// Should return all products from different tables having a "size" column
  // and a size = 10
  products = orm-&gt;find('size', 10)
  </code></pre>
  
  <p>I'm wondering if such an ORM exist (no matter the language, it's just for the information).</p>