ddl.sql.mustache 514 Bytes
-- 由 M3-deploy.yaml (tableMappings) + M1-domain.yaml (字段类型) 生成
-- 渲染上下文:{ aggregates: [ { tables: [ { table, pk, columns:[{col,type,isPk}], parentFk } ] } ] }
{{#aggregates}}
{{#tables}}
CREATE TABLE IF NOT EXISTS {{table}} (
{{#columns}}
  {{col}} {{type}}{{#isPk}} PRIMARY KEY{{/isPk}},
{{/columns}}
{{#parentFk}}
  {{parentFk}} VARCHAR(64),  -- 组合子实体父外键(据 M1 composition)
{{/parentFk}}
  _row_ts TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
{{/tables}}
{{/aggregates}}