mysqlsyncr 1.0.98 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/src/apply.js +5 -3
package/dist/index.cjs
CHANGED
|
@@ -3695,7 +3695,7 @@ var applyDifferences = /*#__PURE__*/function () {
|
|
|
3695
3695
|
break;
|
|
3696
3696
|
}
|
|
3697
3697
|
_tableName2 = diff.tableName, field = diff.field;
|
|
3698
|
-
_defaultClause = field.Default === 'CURRENT_TIMESTAMP' ? 'DEFAULT CURRENT_TIMESTAMP' : field.Default !== undefined && field.Default !== null ? "DEFAULT '".concat(field.Default, "'") : '';
|
|
3698
|
+
_defaultClause = field.Default === 'CURRENT_TIMESTAMP' ? 'DEFAULT CURRENT_TIMESTAMP' : field.Default === 'NULL' ? 'DEFAULT NULL' : field.Default !== undefined && field.Default !== null ? "DEFAULT '".concat(field.Default, "'") : 'DEFAULT NULL';
|
|
3699
3699
|
_dropFieldSQL = "ALTER TABLE `".concat(_tableName2, "` CHANGE `").concat(field.Field, "` `").concat(field.Field, "` ").concat(field.Type, " ").concat(field.NotNull ? 'NOT NULL' : '', " ").concat(_defaultClause, ";");
|
|
3700
3700
|
logger("Executing: ".concat(_dropFieldSQL));
|
|
3701
3701
|
_context.next = 59;
|
package/dist/index.js
CHANGED
|
@@ -3692,7 +3692,7 @@ var applyDifferences = /*#__PURE__*/function () {
|
|
|
3692
3692
|
break;
|
|
3693
3693
|
}
|
|
3694
3694
|
_tableName2 = diff.tableName, field = diff.field;
|
|
3695
|
-
_defaultClause = field.Default === 'CURRENT_TIMESTAMP' ? 'DEFAULT CURRENT_TIMESTAMP' : field.Default !== undefined && field.Default !== null ? "DEFAULT '".concat(field.Default, "'") : '';
|
|
3695
|
+
_defaultClause = field.Default === 'CURRENT_TIMESTAMP' ? 'DEFAULT CURRENT_TIMESTAMP' : field.Default === 'NULL' ? 'DEFAULT NULL' : field.Default !== undefined && field.Default !== null ? "DEFAULT '".concat(field.Default, "'") : 'DEFAULT NULL';
|
|
3696
3696
|
_dropFieldSQL = "ALTER TABLE `".concat(_tableName2, "` CHANGE `").concat(field.Field, "` `").concat(field.Field, "` ").concat(field.Type, " ").concat(field.NotNull ? 'NOT NULL' : '', " ").concat(_defaultClause, ";");
|
|
3697
3697
|
logger("Executing: ".concat(_dropFieldSQL));
|
|
3698
3698
|
_context.next = 59;
|
package/package.json
CHANGED
package/src/apply.js
CHANGED
|
@@ -85,9 +85,11 @@ export const applyDifferences = async (connection, database, differences) => {
|
|
|
85
85
|
const { tableName, field } = diff;
|
|
86
86
|
const defaultClause = field.Default === 'CURRENT_TIMESTAMP'
|
|
87
87
|
? 'DEFAULT CURRENT_TIMESTAMP'
|
|
88
|
-
: field.Default
|
|
89
|
-
?
|
|
90
|
-
:
|
|
88
|
+
: field.Default === 'NULL'
|
|
89
|
+
? 'DEFAULT NULL'
|
|
90
|
+
: field.Default !== undefined && field.Default !== null
|
|
91
|
+
? `DEFAULT '${field.Default}'`
|
|
92
|
+
: 'DEFAULT NULL';
|
|
91
93
|
|
|
92
94
|
const dropFieldSQL = `ALTER TABLE \`${tableName}\` CHANGE \`${field.Field}\` \`${field.Field}\` ${field.Type} ${field.NotNull ? 'NOT NULL' : ''} ${defaultClause};`;
|
|
93
95
|
logger(`Executing: ${dropFieldSQL}`);
|