CREATE TABLE order_service.orders (
id VARCHAR,
client_order_id VARCHAR,
portfolio_id VARCHAR,
security_account_id VARCHAR,
initiator JSONB,
asset_id VARCHAR,
side VARCHAR,
workflow_state VARCHAR,
execution_state VARCHAR,
etag VARCHAR,
customer_relationship_id VARCHAR,
instruction JSONB,
execution_spec JSONB,
cost_estimate JSONB,
filled_quantity DECIMAL,
created_at TIMESTAMPTZ,
deleted_at TIMESTAMPTZ,
termination_reason VARCHAR,
executed_at TIMESTAMPTZ,
termination_detail VARCHAR,
PRIMARY KEY (id),
WATERMARK FOR created_at AS created_at - INTERVAL '5 YEARS' WITH TTL
)
WITH (
snapshot='true'
) FROM order_service.order_service_source TABLE 'oms.orders'