Skip to content

Commit

Permalink
backticks around each field in primary key (#1840)
Browse files Browse the repository at this point in the history
  • Loading branch information
phiSgr authored and cjus committed Oct 21, 2024
1 parent eb2b585 commit f33ad2b
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ CREATE TABLE IF NOT EXISTS `{{db_name}}`.`{{table_name}}`
{{/each}}
)
ENGINE = {{engine}}
{{#if primary_key_string}}PRIMARY KEY (`{{primary_key_string}}`) {{/if}}
{{#if primary_key_string}}PRIMARY KEY ({{primary_key_string}}) {{/if}}
{{#if order_by_string}}ORDER BY ({{order_by_string}}) {{/if}}
"#;

Expand Down Expand Up @@ -150,7 +150,7 @@ pub fn create_table_query(
"table_name": table.name,
"fields": builds_field_context(&table.columns)?,
"primary_key_string": if !primary_key.is_empty() {
Some(primary_key.join(", "))
Some(format!("`{}`", primary_key.join("`, `")))
} else {
None
},
Expand Down

0 comments on commit f33ad2b

Please sign in to comment.