mirror of
https://github.com/chartdb/chartdb.git
synced 2025-11-05 14:35:25 +00:00
fix(export-sql): add unique to export script (#422)
This commit is contained in:
@@ -82,6 +82,8 @@ export const exportBaseSQL = (diagram: Diagram): string => {
|
||||
// Add size for character types
|
||||
if (field.characterMaximumLength) {
|
||||
sqlScript += `(${field.characterMaximumLength})`;
|
||||
} else if (field.type.name.toLowerCase().includes('varchar')) {
|
||||
sqlScript += `(500)`;
|
||||
}
|
||||
|
||||
// Add precision and scale for numeric types
|
||||
@@ -96,6 +98,11 @@ export const exportBaseSQL = (diagram: Diagram): string => {
|
||||
sqlScript += ' NOT NULL';
|
||||
}
|
||||
|
||||
// Handle UNIQUE value
|
||||
if (!field.primaryKey && field.unique) {
|
||||
sqlScript += ` UNIQUE`;
|
||||
}
|
||||
|
||||
// Handle DEFAULT value
|
||||
if (field.default) {
|
||||
// Temp remove default user-define value when it have it
|
||||
|
||||
Reference in New Issue
Block a user