File tree Expand file tree Collapse file tree 3 files changed +4
-4
lines changed Expand file tree Collapse file tree 3 files changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -187,7 +187,7 @@ export function jsonToMySQL(obj) {
187
187
return `${ obj . tables
188
188
. map (
189
189
( table ) =>
190
- `CREATE TABLE \`${ table . name } \` (\n${ table . fields
190
+ `CREATE TABLE IF NOT EXISTS \`${ table . name } \` (\n${ table . fields
191
191
. map (
192
192
( field ) =>
193
193
`\t\`${
@@ -294,7 +294,7 @@ export function jsonToPostgreSQL(obj) {
294
294
)
295
295
. join ( "\n" ) } \n`
296
296
: ""
297
- } CREATE TABLE "${ table . name } " (\n${ table . fields
297
+ } CREATE TABLE IF NOT EXISTS "${ table . name } " (\n${ table . fields
298
298
. map (
299
299
( field ) =>
300
300
`${ field . comment === "" ? "" : `\t-- ${ field . comment } \n` } \t"${
Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ export function toMySQL(diagram) {
24
24
return `${ diagram . tables
25
25
. map (
26
26
( table ) =>
27
- `CREATE TABLE \`${ table . name } \` (\n${ table . fields
27
+ `CREATE TABLE IF NOT EXISTS \`${ table . name } \` (\n${ table . fields
28
28
. map (
29
29
( field ) =>
30
30
`\t\`${ field . name } \` ${ parseType ( field ) } ${
Original file line number Diff line number Diff line change @@ -81,7 +81,7 @@ export function toPostgres(diagram) {
81
81
)
82
82
. join ( "\n" ) ;
83
83
84
- return `CREATE TABLE "${ table . name } " (\n${ fieldDefinitions } ${ primaryKeyClause } ${ inheritsClause } ;\n\n${ commentStatements } \n${ indexStatements } ` ;
84
+ return `CREATE TABLE IF NOT EXISTS "${ table . name } " (\n${ fieldDefinitions } ${ primaryKeyClause } ${ inheritsClause } ;\n\n${ commentStatements } \n${ indexStatements } ` ;
85
85
} )
86
86
. join ( "\n\n" ) ;
87
87
You can’t perform that action at this time.
0 commit comments