drizzle-kit 0.24.1-e2677cd → 0.24.1-e2f75fb
Sign up to get free protection for your applications and to get access to all the features.
- package/api.js +9 -9
- package/api.mjs +9 -9
- package/bin.cjs +2732 -8804
- package/package.json +1 -1
package/api.js
CHANGED
@@ -11545,11 +11545,11 @@ var init_sqlgenerator = __esm({
|
|
11545
11545
|
const schemaPrefix = column4.typeSchema && column4.typeSchema !== "public" ? `"${column4.typeSchema}".` : "";
|
11546
11546
|
const type = isPgNativeType(column4.type) ? column4.type : `${schemaPrefix}"${column4.type}"`;
|
11547
11547
|
const generated = column4.generated;
|
11548
|
-
const generatedStatement = ` GENERATED ALWAYS AS (${generated?.as}) STORED
|
11548
|
+
const generatedStatement = generated ? ` GENERATED ALWAYS AS (${generated?.as}) STORED` : "";
|
11549
11549
|
const unsquashedIdentity = column4.identity ? PgSquasher.unsquashIdentity(column4.identity) : void 0;
|
11550
11550
|
const identityWithSchema = schema4 ? `"${schema4}"."${unsquashedIdentity?.name}"` : `"${unsquashedIdentity?.name}"`;
|
11551
11551
|
const identity = unsquashedIdentity ? ` GENERATED ${unsquashedIdentity.type === "always" ? "ALWAYS" : "BY DEFAULT"} AS IDENTITY (sequence name ${identityWithSchema}${unsquashedIdentity.increment ? ` INCREMENT BY ${unsquashedIdentity.increment}` : ""}${unsquashedIdentity.minValue ? ` MINVALUE ${unsquashedIdentity.minValue}` : ""}${unsquashedIdentity.maxValue ? ` MAXVALUE ${unsquashedIdentity.maxValue}` : ""}${unsquashedIdentity.startWith ? ` START WITH ${unsquashedIdentity.startWith}` : ""}${unsquashedIdentity.cache ? ` CACHE ${unsquashedIdentity.cache}` : ""}${unsquashedIdentity.cycle ? ` CYCLE` : ""})` : "";
|
11552
|
-
statement += ` "${column4.name}" ${type}${primaryKeyStatement}${defaultStatement}${
|
11552
|
+
statement += ` "${column4.name}" ${type}${primaryKeyStatement}${defaultStatement}${generatedStatement}${notNullStatement}${uniqueConstraint4}${identity}`;
|
11553
11553
|
statement += i === columns.length - 1 ? "" : ",\n";
|
11554
11554
|
}
|
11555
11555
|
if (typeof compositePKs !== "undefined" && compositePKs.length > 0) {
|
@@ -11595,7 +11595,7 @@ var init_sqlgenerator = __esm({
|
|
11595
11595
|
const onUpdateStatement = column4.onUpdate ? ` ON UPDATE CURRENT_TIMESTAMP` : "";
|
11596
11596
|
const autoincrementStatement = column4.autoincrement ? " AUTO_INCREMENT" : "";
|
11597
11597
|
const generatedStatement = column4.generated ? ` GENERATED ALWAYS AS (${column4.generated?.as}) ${column4.generated?.type.toUpperCase()}` : "";
|
11598
|
-
statement += ` \`${column4.name}\` ${column4.type}${autoincrementStatement}${primaryKeyStatement}${notNullStatement}${defaultStatement}${onUpdateStatement}
|
11598
|
+
statement += ` \`${column4.name}\` ${column4.type}${autoincrementStatement}${primaryKeyStatement}${generatedStatement}${notNullStatement}${defaultStatement}${onUpdateStatement}`;
|
11599
11599
|
statement += i === columns.length - 1 ? "" : ",\n";
|
11600
11600
|
}
|
11601
11601
|
if (typeof compositePKs !== "undefined" && compositePKs.length > 0) {
|
@@ -11643,7 +11643,7 @@ var init_sqlgenerator = __esm({
|
|
11643
11643
|
const autoincrementStatement = column4.autoincrement ? " AUTOINCREMENT" : "";
|
11644
11644
|
const generatedStatement = column4.generated ? ` GENERATED ALWAYS AS ${column4.generated.as} ${column4.generated.type.toUpperCase()}` : "";
|
11645
11645
|
statement += " ";
|
11646
|
-
statement += `\`${column4.name}\` ${column4.type}${primaryKeyStatement}${autoincrementStatement}${defaultStatement}${
|
11646
|
+
statement += `\`${column4.name}\` ${column4.type}${primaryKeyStatement}${autoincrementStatement}${defaultStatement}${generatedStatement}${notNullStatement}`;
|
11647
11647
|
statement += i === columns.length - 1 ? "" : ",\n";
|
11648
11648
|
}
|
11649
11649
|
compositePKs.forEach((it) => {
|
@@ -12033,8 +12033,8 @@ var init_sqlgenerator = __esm({
|
|
12033
12033
|
const unsquashedIdentity = identity ? PgSquasher.unsquashIdentity(identity) : void 0;
|
12034
12034
|
const identityWithSchema = schema4 ? `"${schema4}"."${unsquashedIdentity?.name}"` : `"${unsquashedIdentity?.name}"`;
|
12035
12035
|
const identityStatement = unsquashedIdentity ? ` GENERATED ${unsquashedIdentity.type === "always" ? "ALWAYS" : "BY DEFAULT"} AS IDENTITY (sequence name ${identityWithSchema}${unsquashedIdentity.increment ? ` INCREMENT BY ${unsquashedIdentity.increment}` : ""}${unsquashedIdentity.minValue ? ` MINVALUE ${unsquashedIdentity.minValue}` : ""}${unsquashedIdentity.maxValue ? ` MAXVALUE ${unsquashedIdentity.maxValue}` : ""}${unsquashedIdentity.startWith ? ` START WITH ${unsquashedIdentity.startWith}` : ""}${unsquashedIdentity.cache ? ` CACHE ${unsquashedIdentity.cache}` : ""}${unsquashedIdentity.cycle ? ` CYCLE` : ""})` : "";
|
12036
|
-
const generatedStatement = ` GENERATED ALWAYS AS (${generated?.as}) STORED
|
12037
|
-
return `ALTER TABLE ${tableNameWithSchema} ADD COLUMN "${name2}" ${fixedType}${primaryKeyStatement}${defaultStatement}${
|
12036
|
+
const generatedStatement = generated ? ` GENERATED ALWAYS AS (${generated?.as}) STORED` : "";
|
12037
|
+
return `ALTER TABLE ${tableNameWithSchema} ADD COLUMN "${name2}" ${fixedType}${primaryKeyStatement}${defaultStatement}${generatedStatement}${notNullStatement}${identityStatement};`;
|
12038
12038
|
}
|
12039
12039
|
};
|
12040
12040
|
MySqlAlterTableAddColumnConvertor = class extends Convertor {
|
@@ -12058,7 +12058,7 @@ var init_sqlgenerator = __esm({
|
|
12058
12058
|
const autoincrementStatement = `${autoincrement ? " AUTO_INCREMENT" : ""}`;
|
12059
12059
|
const onUpdateStatement = `${onUpdate ? " ON UPDATE CURRENT_TIMESTAMP" : ""}`;
|
12060
12060
|
const generatedStatement = generated ? ` GENERATED ALWAYS AS (${generated?.as}) ${generated?.type.toUpperCase()}` : "";
|
12061
|
-
return `ALTER TABLE \`${tableName}\` ADD \`${name2}\` ${type}${primaryKeyStatement}${autoincrementStatement}${defaultStatement}${
|
12061
|
+
return `ALTER TABLE \`${tableName}\` ADD \`${name2}\` ${type}${primaryKeyStatement}${autoincrementStatement}${defaultStatement}${generatedStatement}${notNullStatement}${onUpdateStatement};`;
|
12062
12062
|
}
|
12063
12063
|
};
|
12064
12064
|
SQLiteAlterTableAddColumnConvertor = class extends Convertor {
|
@@ -12074,7 +12074,7 @@ var init_sqlgenerator = __esm({
|
|
12074
12074
|
const referenceAsObject = referenceData ? SQLiteSquasher.unsquashFK(referenceData) : void 0;
|
12075
12075
|
const referenceStatement = `${referenceAsObject ? ` REFERENCES ${referenceAsObject.tableTo}(${referenceAsObject.columnsTo})` : ""}`;
|
12076
12076
|
const generatedStatement = generated ? ` GENERATED ALWAYS AS ${generated.as} ${generated.type.toUpperCase()}` : "";
|
12077
|
-
return `ALTER TABLE \`${tableName}\` ADD \`${name2}\` ${type}${primaryKeyStatement}${defaultStatement}${
|
12077
|
+
return `ALTER TABLE \`${tableName}\` ADD \`${name2}\` ${type}${primaryKeyStatement}${defaultStatement}${generatedStatement}${notNullStatement}${referenceStatement};`;
|
12078
12078
|
}
|
12079
12079
|
};
|
12080
12080
|
PgAlterTableAlterColumnSetTypeConvertor = class extends Convertor {
|
@@ -12534,7 +12534,7 @@ var init_sqlgenerator = __esm({
|
|
12534
12534
|
columnGenerated = statement.columnGenerated ? ` GENERATED ALWAYS AS (${statement.columnGenerated?.as}) ${statement.columnGenerated?.type.toUpperCase()}` : "";
|
12535
12535
|
}
|
12536
12536
|
columnDefault = columnDefault instanceof Date ? columnDefault.toISOString() : columnDefault;
|
12537
|
-
return `ALTER TABLE \`${tableName}\` MODIFY COLUMN \`${columnName}\`${columnType}${columnAutoincrement}${columnNotNull}${columnDefault}${columnOnUpdate}
|
12537
|
+
return `ALTER TABLE \`${tableName}\` MODIFY COLUMN \`${columnName}\`${columnType}${columnAutoincrement}${columnGenerated}${columnNotNull}${columnDefault}${columnOnUpdate};`;
|
12538
12538
|
}
|
12539
12539
|
};
|
12540
12540
|
SqliteAlterTableAlterColumnDropDefaultConvertor = class extends Convertor {
|
package/api.mjs
CHANGED
@@ -11550,11 +11550,11 @@ var init_sqlgenerator = __esm({
|
|
11550
11550
|
const schemaPrefix = column4.typeSchema && column4.typeSchema !== "public" ? `"${column4.typeSchema}".` : "";
|
11551
11551
|
const type = isPgNativeType(column4.type) ? column4.type : `${schemaPrefix}"${column4.type}"`;
|
11552
11552
|
const generated = column4.generated;
|
11553
|
-
const generatedStatement = ` GENERATED ALWAYS AS (${generated?.as}) STORED
|
11553
|
+
const generatedStatement = generated ? ` GENERATED ALWAYS AS (${generated?.as}) STORED` : "";
|
11554
11554
|
const unsquashedIdentity = column4.identity ? PgSquasher.unsquashIdentity(column4.identity) : void 0;
|
11555
11555
|
const identityWithSchema = schema4 ? `"${schema4}"."${unsquashedIdentity?.name}"` : `"${unsquashedIdentity?.name}"`;
|
11556
11556
|
const identity = unsquashedIdentity ? ` GENERATED ${unsquashedIdentity.type === "always" ? "ALWAYS" : "BY DEFAULT"} AS IDENTITY (sequence name ${identityWithSchema}${unsquashedIdentity.increment ? ` INCREMENT BY ${unsquashedIdentity.increment}` : ""}${unsquashedIdentity.minValue ? ` MINVALUE ${unsquashedIdentity.minValue}` : ""}${unsquashedIdentity.maxValue ? ` MAXVALUE ${unsquashedIdentity.maxValue}` : ""}${unsquashedIdentity.startWith ? ` START WITH ${unsquashedIdentity.startWith}` : ""}${unsquashedIdentity.cache ? ` CACHE ${unsquashedIdentity.cache}` : ""}${unsquashedIdentity.cycle ? ` CYCLE` : ""})` : "";
|
11557
|
-
statement += ` "${column4.name}" ${type}${primaryKeyStatement}${defaultStatement}${
|
11557
|
+
statement += ` "${column4.name}" ${type}${primaryKeyStatement}${defaultStatement}${generatedStatement}${notNullStatement}${uniqueConstraint4}${identity}`;
|
11558
11558
|
statement += i === columns.length - 1 ? "" : ",\n";
|
11559
11559
|
}
|
11560
11560
|
if (typeof compositePKs !== "undefined" && compositePKs.length > 0) {
|
@@ -11600,7 +11600,7 @@ var init_sqlgenerator = __esm({
|
|
11600
11600
|
const onUpdateStatement = column4.onUpdate ? ` ON UPDATE CURRENT_TIMESTAMP` : "";
|
11601
11601
|
const autoincrementStatement = column4.autoincrement ? " AUTO_INCREMENT" : "";
|
11602
11602
|
const generatedStatement = column4.generated ? ` GENERATED ALWAYS AS (${column4.generated?.as}) ${column4.generated?.type.toUpperCase()}` : "";
|
11603
|
-
statement += ` \`${column4.name}\` ${column4.type}${autoincrementStatement}${primaryKeyStatement}${notNullStatement}${defaultStatement}${onUpdateStatement}
|
11603
|
+
statement += ` \`${column4.name}\` ${column4.type}${autoincrementStatement}${primaryKeyStatement}${generatedStatement}${notNullStatement}${defaultStatement}${onUpdateStatement}`;
|
11604
11604
|
statement += i === columns.length - 1 ? "" : ",\n";
|
11605
11605
|
}
|
11606
11606
|
if (typeof compositePKs !== "undefined" && compositePKs.length > 0) {
|
@@ -11648,7 +11648,7 @@ var init_sqlgenerator = __esm({
|
|
11648
11648
|
const autoincrementStatement = column4.autoincrement ? " AUTOINCREMENT" : "";
|
11649
11649
|
const generatedStatement = column4.generated ? ` GENERATED ALWAYS AS ${column4.generated.as} ${column4.generated.type.toUpperCase()}` : "";
|
11650
11650
|
statement += " ";
|
11651
|
-
statement += `\`${column4.name}\` ${column4.type}${primaryKeyStatement}${autoincrementStatement}${defaultStatement}${
|
11651
|
+
statement += `\`${column4.name}\` ${column4.type}${primaryKeyStatement}${autoincrementStatement}${defaultStatement}${generatedStatement}${notNullStatement}`;
|
11652
11652
|
statement += i === columns.length - 1 ? "" : ",\n";
|
11653
11653
|
}
|
11654
11654
|
compositePKs.forEach((it) => {
|
@@ -12038,8 +12038,8 @@ var init_sqlgenerator = __esm({
|
|
12038
12038
|
const unsquashedIdentity = identity ? PgSquasher.unsquashIdentity(identity) : void 0;
|
12039
12039
|
const identityWithSchema = schema4 ? `"${schema4}"."${unsquashedIdentity?.name}"` : `"${unsquashedIdentity?.name}"`;
|
12040
12040
|
const identityStatement = unsquashedIdentity ? ` GENERATED ${unsquashedIdentity.type === "always" ? "ALWAYS" : "BY DEFAULT"} AS IDENTITY (sequence name ${identityWithSchema}${unsquashedIdentity.increment ? ` INCREMENT BY ${unsquashedIdentity.increment}` : ""}${unsquashedIdentity.minValue ? ` MINVALUE ${unsquashedIdentity.minValue}` : ""}${unsquashedIdentity.maxValue ? ` MAXVALUE ${unsquashedIdentity.maxValue}` : ""}${unsquashedIdentity.startWith ? ` START WITH ${unsquashedIdentity.startWith}` : ""}${unsquashedIdentity.cache ? ` CACHE ${unsquashedIdentity.cache}` : ""}${unsquashedIdentity.cycle ? ` CYCLE` : ""})` : "";
|
12041
|
-
const generatedStatement = ` GENERATED ALWAYS AS (${generated?.as}) STORED
|
12042
|
-
return `ALTER TABLE ${tableNameWithSchema} ADD COLUMN "${name2}" ${fixedType}${primaryKeyStatement}${defaultStatement}${
|
12041
|
+
const generatedStatement = generated ? ` GENERATED ALWAYS AS (${generated?.as}) STORED` : "";
|
12042
|
+
return `ALTER TABLE ${tableNameWithSchema} ADD COLUMN "${name2}" ${fixedType}${primaryKeyStatement}${defaultStatement}${generatedStatement}${notNullStatement}${identityStatement};`;
|
12043
12043
|
}
|
12044
12044
|
};
|
12045
12045
|
MySqlAlterTableAddColumnConvertor = class extends Convertor {
|
@@ -12063,7 +12063,7 @@ var init_sqlgenerator = __esm({
|
|
12063
12063
|
const autoincrementStatement = `${autoincrement ? " AUTO_INCREMENT" : ""}`;
|
12064
12064
|
const onUpdateStatement = `${onUpdate ? " ON UPDATE CURRENT_TIMESTAMP" : ""}`;
|
12065
12065
|
const generatedStatement = generated ? ` GENERATED ALWAYS AS (${generated?.as}) ${generated?.type.toUpperCase()}` : "";
|
12066
|
-
return `ALTER TABLE \`${tableName}\` ADD \`${name2}\` ${type}${primaryKeyStatement}${autoincrementStatement}${defaultStatement}${
|
12066
|
+
return `ALTER TABLE \`${tableName}\` ADD \`${name2}\` ${type}${primaryKeyStatement}${autoincrementStatement}${defaultStatement}${generatedStatement}${notNullStatement}${onUpdateStatement};`;
|
12067
12067
|
}
|
12068
12068
|
};
|
12069
12069
|
SQLiteAlterTableAddColumnConvertor = class extends Convertor {
|
@@ -12079,7 +12079,7 @@ var init_sqlgenerator = __esm({
|
|
12079
12079
|
const referenceAsObject = referenceData ? SQLiteSquasher.unsquashFK(referenceData) : void 0;
|
12080
12080
|
const referenceStatement = `${referenceAsObject ? ` REFERENCES ${referenceAsObject.tableTo}(${referenceAsObject.columnsTo})` : ""}`;
|
12081
12081
|
const generatedStatement = generated ? ` GENERATED ALWAYS AS ${generated.as} ${generated.type.toUpperCase()}` : "";
|
12082
|
-
return `ALTER TABLE \`${tableName}\` ADD \`${name2}\` ${type}${primaryKeyStatement}${defaultStatement}${
|
12082
|
+
return `ALTER TABLE \`${tableName}\` ADD \`${name2}\` ${type}${primaryKeyStatement}${defaultStatement}${generatedStatement}${notNullStatement}${referenceStatement};`;
|
12083
12083
|
}
|
12084
12084
|
};
|
12085
12085
|
PgAlterTableAlterColumnSetTypeConvertor = class extends Convertor {
|
@@ -12539,7 +12539,7 @@ var init_sqlgenerator = __esm({
|
|
12539
12539
|
columnGenerated = statement.columnGenerated ? ` GENERATED ALWAYS AS (${statement.columnGenerated?.as}) ${statement.columnGenerated?.type.toUpperCase()}` : "";
|
12540
12540
|
}
|
12541
12541
|
columnDefault = columnDefault instanceof Date ? columnDefault.toISOString() : columnDefault;
|
12542
|
-
return `ALTER TABLE \`${tableName}\` MODIFY COLUMN \`${columnName}\`${columnType}${columnAutoincrement}${columnNotNull}${columnDefault}${columnOnUpdate}
|
12542
|
+
return `ALTER TABLE \`${tableName}\` MODIFY COLUMN \`${columnName}\`${columnType}${columnAutoincrement}${columnGenerated}${columnNotNull}${columnDefault}${columnOnUpdate};`;
|
12543
12543
|
}
|
12544
12544
|
};
|
12545
12545
|
SqliteAlterTableAlterColumnDropDefaultConvertor = class extends Convertor {
|