PropelORM + PostgreSQL:如何在' schema.xml'中的列上定义类似SQL的CHECK约束?

时间:2016-06-03 01:08:01

标签: postgresql schema propel check-constraint

我试图在我的" schema.xml"中尝试定义的一小段数据库模式。文件:

  <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>

在PostgreSQL中为此&#34;价格&#34;专栏我会写CHECK (price > 0::numeric),但我似乎无法找到任何方法来实现这一目标。我已经检查了文档(http://propelorm.org/documentation/reference/schema.html),但无法#&# 39;找不到任何东西。 谢谢你的时间。

1 个答案:

答案 0 :(得分:0)

你使用v1。*,但是从上面的doc链接看来,你似乎正在使用Propel v2。

我认为你正在寻找仅从v2开始提供的var locationsFundet = [ <?php $i = 1; while ( $loop->have_posts() ) : $loop->the_post(); ?> <?php foreach( $terms as $term ) { ?> <?php if ((get_post_meta($loop->ID, '_location', true) !== '') && (($term->term_id) == 112)) : ?> { latlng:new google.maps.LatLng(<?php echo get_post_meta($post->ID, '_location', true) ?>), info : document.getElementById('itemFundet<?php echo $i; ?>') }, <?php endif; ?> <?php } ?> <?php $i++; ?> <?php endwhile; ?> ]; var locationsTabt = [ <?php $b = 1; while ( $loop->have_posts() ) : $loop->the_post(); ?> <?php foreach( $terms as $term ) { ?> <?php if ((get_post_meta($loop->ID, '_location', true) !== '') && (($term->term_id) == 113)) : ?> { latlng:new google.maps.LatLng(<?php echo get_post_meta($post->ID, '_location', true) ?>), info : document.getElementById('itemTabt<?php echo $b; ?>') }, <?php endif; ?> <?php } ?> <?php $b++; ?> <?php endwhile; ?> ];

var locationsFundet = [{
    latlng: new google.maps.LatLng(56.69244163539978, 11.612548828125),
    info: document.getElementById('itemFundet1')
}, {
    latlng: new google.maps.LatLng(55.20395325785898, 8.953857421875),
    info: document.getElementById('itemFundet2')
}, {
    latlng: new google.maps.LatLng(55.66519318443606, 10.601806640625),
    info: document.getElementById('itemFundet3')
}, {
    latlng: new google.maps.LatLng(56.292156685076456, 8.162841796875),
    info: document.getElementById('itemFundet4')
}, {
    latlng: new google.maps.LatLng(55.329535012504195, 12.457809448242188),
    info: document.getElementById('itemFundet5')
}, {
    latlng: new google.maps.LatLng(56.85375917920851, 10.267839431762695),
    info: document.getElementById('itemFundet6')
}, ];
var locationsTabt = [];