0

A little snippet of a database schema I'm trying to define in my "schema.xml" file:

  <table name="hotelroom" phpName="hotelroom">
   <column name="id" type="integer" required="true" primaryKey="true" autoIncrement="true" />
   <column name="room_number" type="varchar" size="10" required="true" />
   <column name="price" type="numeric" defaultValue="1000" required="true" />
   <unique>
  <unique-column name="room_number" />
    </unique>
  </table>

In PostgreSQL for that "price" column I would've written CHECK (price > 0::numeric),but I can't seem to find any way to achieve this here.I've checked the documentation (http://propelorm.org/documentation/reference/schema.html), but couldn't find anything on this. Thank you for the time.

1 Answers1

0

You're using v1, but from the doc link above, looks like you're using v2,

I think you're looking for the GreaterThan which is only available from v2 onwards.

<behavior name="validate">
    <parameter name="rule1" value="{column: price, validator: GreaterThan, options: {value: 0, message=Price is not valid}}" />
</behavior>
Qiniso
  • 2,587
  • 1
  • 24
  • 30