title: Hotel rooms prices: how to manage discounts that changes according to some conditions
body: <p>I'm writing an app to manage rooms in a Hotel and I've to design the DB to manage discounted price.
  I've already made the Room and Price tables and now I've to create some tables where I can store discounts that the admins could apply according to some conditions. The admins could create new discounts too.
  For example:</p>
  
  <ul>
  <li>An user could get 10% discount if the reservation starts in September.</li>
  <li>An user could get 10% discount if he is going to book the room during 2 weeks</li>
  </ul>
  
  <p>So, here are my simplified tables (I omitted fields and relations that are not related to the question):</p>
  
  <p><strong>Rooms:</strong></p>
  
  <pre><code>id | name
  ---|----------------
   1 | Trafalgar Square
   2 | Piccadilly
  </code></pre>
  
  <p><strong>Prices:</strong></p>
  
  <pre><code>id | room_id  | base | promotion 
  ---|----------|------|-----------
   1 |    1     | 10   | 8
   2 |    2     | 25   | 20
  </code></pre>
  
  <p>How can I store conditions as the ones stated above?
  I'm using Rails and the first solution I thought about was to create a table where I can store the discount is going to be applied and the condition to apply it.
  I thought the field condition as a SQL snippet; something like <code>Reservation.start_date &gt; [date]</code>, thus I could apply more discounts concatenating them in Rails. 
  But this is a very ugly solution and is coupled with the DBRMS, so I'd like to avoid this choice.</p>
  
  <p>Do you know how can I implement something to solve this problem?
  I hope to have explained the problem clearly.</p>