This commit is contained in:
yumoqing 2020-05-11 12:13:36 +08:00
parent 94bf65620f
commit 777b15e5f8
4 changed files with 9 additions and 15 deletions

View File

@ -31,11 +31,9 @@ NOT NULL
{%- endif -%} {%- endif -%}
{% endmacro %} {% endmacro %}
{% macro primary() %} {% macro primary() %}
{% if len(','.join(summary[0].primary))>0 %} ,primary key({{summary[0].primary}})
,primary key({{','.join(summary[0].primary)}})
{% endif %}
{% endmacro %} {% endmacro %}
drop table {{summary[0].name}}; drop table if exists {{summary[0].name}};
CREATE TABLE {{summary[0].name}} CREATE TABLE {{summary[0].name}}
( (
{% for field in fields %} {% for field in fields %}

View File

@ -25,9 +25,7 @@ NOT NULL
{%- endif -%} {%- endif -%}
{% endmacro %} {% endmacro %}
{% macro primary() %} {% macro primary() %}
{% if len(','.join(summary[0].primary))>0 %} ,primary key({{summary[0].primary}})
,primary key({{','.join(summary[0].primary)}})
{% endif %}
{% endmacro %} {% endmacro %}
drop table {{summary[0].name}}; drop table {{summary[0].name}};
CREATE TABLE {{summary[0].name}} CREATE TABLE {{summary[0].name}}

View File

@ -23,7 +23,7 @@ NOT NULL
{%- endif -%} {%- endif -%}
{% endmacro %} {% endmacro %}
{% macro primary() %} {% macro primary() %}
primary key({{','.join(summary[0].primary)}}) primary key({{summary[0].primary}})
{% endmacro %} {% endmacro %}
DROP TABLE IF EXISTS {{summary[0].name}}; DROP TABLE IF EXISTS {{summary[0].name}};
CREATE TABLE {{summary[0].name}} CREATE TABLE {{summary[0].name}}

View File

@ -26,9 +26,7 @@ NOT NULL
{% endmacro %} {% endmacro %}
{% macro primary() %} {% macro primary() %}
{% if len(','.join(summary[0].primary))>0 %} ,primary key({{summary[0].primary}})
,primary key({{','.join(summary[0].primary)}})
{% endif %}
{% endmacro %} {% endmacro %}
drop table dbo.{{summary[0].name}}; drop table dbo.{{summary[0].name}};