(c *ColumnConstraint)
| 1471 | } |
| 1472 | |
| 1473 | func columnConstraintSQL(c *ColumnConstraint) string { |
| 1474 | switch c.Type { |
| 1475 | case "NOT NULL", "UNIQUE", "PRIMARY KEY": |
| 1476 | return c.Type |
| 1477 | case "DEFAULT": |
| 1478 | return "DEFAULT " + exprSQL(c.Default) |
| 1479 | case "REFERENCES": |
| 1480 | if c.References != nil { |
| 1481 | return referenceSQL(c.References) |
| 1482 | } |
| 1483 | return "REFERENCES" |
| 1484 | case "CHECK": |
| 1485 | return "CHECK (" + exprSQL(c.Check) + ")" |
| 1486 | default: |
| 1487 | if c.AutoIncrement { |
| 1488 | return "AUTO_INCREMENT" |
| 1489 | } |
| 1490 | return c.Type |
| 1491 | } |
| 1492 | } |
| 1493 | |
| 1494 | func tableConstraintSQL(tc *TableConstraint) string { |
| 1495 | sb := getBuilder() |
no test coverage detected