ores.sql.schema.domain_entity_drop

Table of Contents

Drop script for an entity's table and dependents: a thin {{#domain_entity}} section over component / entity_plural / product. sql profile; output projects/ores.sql/drop/{component}/{component}_{entity_plural}_drop.sql. The <<paste:5E47F108-1350-4540-B3C2-E83DD5379B2D>> marker is replaced with any entity-model-defined extra drop statements (e.g. the validate function generated by the companion _table.org model). If no entity implements the kind the marker expands to an empty string.

See the Template variable reference for the complete list of available variables and their semantics. See SQL naming conventions for the official object-name patterns all SQL templates follow.

Template

The full template source. Edit here and re-tangle with compass build --direct tangle_codegen_templates to regenerate library/templates/sql_schema_domain_entity_drop.mustache.

{{! GENERATED FILE — tangled from projects/ores.codegen/library/templates/sql_schema.org. Edit the org source. }}
{{! Template to generate SQL drop script for a domain entity table }}
{{{sql_license}}}
{{#domain_entity}}

{{#sql.bitemporal_soft_update}}
drop trigger if exists {{sql_name_base}}_delete_trg on "{{sql_name_base}}_tbl";
drop function if exists {{sql_name_base}}_delete_fn;
{{/sql.bitemporal_soft_update}}
{{^sql.bitemporal_soft_update}}
drop rule if exists {{sql_name_base}}_delete_rule on "{{sql_name_base}}_tbl";
{{/sql.bitemporal_soft_update}}
drop trigger if exists {{sql_name_base}}_insert_trg on "{{sql_name_base}}_tbl";
drop function if exists {{sql_name_base}}_insert_fn;
<<paste:5E47F108-1350-4540-B3C2-E83DD5379B2D>>
drop table if exists "{{sql_name_base}}_tbl";
<<paste:0A8B6774-1112-4C01-997B-8D1AA708C955>>
{{/domain_entity}}

See also

Emacs 29.3 (Org mode 9.6.15)