FIX: extra-ddl modified to be compatible with different platfoms (#1094)

This commit is contained in:
Roland Praml
2017-08-30 17:51:41 +12:00
committed by Rob Bygrave
parent 457c1356a4
commit f471961f06
+20 -2
View File
@@ -1,16 +1,34 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<extra-ddl xmlns="http://ebean-orm.github.io/xml/ns/extraddl">
<ddl-script name="order views" platforms="generic,db2,h2,hsqldb,postgres,oracle,sqlite,mysql">
<ddl-script name="order views" platforms="generic,db2,h2,postgres,oracle,mysql">
create or replace view order_agg_vw as
select d.order_id, sum(d.order_qty * d.unit_price) as order_total,
sum(d.ship_qty * d.unit_price) as ship_total
from o_order_detail d
group by d.order_id;
</ddl-script>
<ddl-script name="order views hsqldb" platforms="hsqldb">
drop view order_agg_vw if exists ;
create view order_agg_vw as
select d.order_id, sum(d.order_qty * d.unit_price) as order_total,
sum(d.ship_qty * d.unit_price) as ship_total
from o_order_detail d
group by d.order_id;
</ddl-script>
<ddl-script name="order views sqlite" platforms="sqlite">
drop view if exists order_agg_vw;
create view order_agg_vw as
select d.order_id, sum(d.order_qty * d.unit_price) as order_total,
sum(d.ship_qty * d.unit_price) as ship_total
from o_order_detail d
group by d.order_id;
</ddl-script>
<ddl-script name="order views mssql" platforms="sqlserver">
IF EXISTS (SELECT TABLE_NAME FROM INFORMATION_SCHEMA.VIEWS WHERE TABLE_NAME = 'order_agg_vw')
DROP VIEW order_agg_vw;