@supacloud/cli 0.12.0 → 0.12.1
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.js +7 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6477,6 +6477,12 @@ function appliedMigrationKeys(data) {
|
|
|
6477
6477
|
}
|
|
6478
6478
|
return keys;
|
|
6479
6479
|
}
|
|
6480
|
+
function isAlreadyAppliedMigrationResponse(response) {
|
|
6481
|
+
if (response.status !== 409 || !response.data || typeof response.data !== "object")
|
|
6482
|
+
return false;
|
|
6483
|
+
const body = response.data;
|
|
6484
|
+
return body.code === "409" && body.message === "Migration already applied";
|
|
6485
|
+
}
|
|
6480
6486
|
function sqlReferencesVector(sql) {
|
|
6481
6487
|
return /\bvector\s*\(\s*\d+\s*\)/i.test(sql) || /::\s*vector\b/i.test(sql) || /\bvector_(cosine|l2|ip)_ops\b/i.test(sql) || /<=>|<#>|<->/.test(sql);
|
|
6482
6488
|
}
|
|
@@ -6734,7 +6740,7 @@ Actions: ${allActions.join(", ")}${readOnly ? " (read-only mode)" : ""}`, {
|
|
|
6734
6740
|
const r = await http.post(`/v1/projects/${ref}/database/migrations`, { name, sql, version });
|
|
6735
6741
|
if (r.ok) {
|
|
6736
6742
|
applied.push(file);
|
|
6737
|
-
} else if (r
|
|
6743
|
+
} else if (isAlreadyAppliedMigrationResponse(r)) {
|
|
6738
6744
|
skipped.push(file);
|
|
6739
6745
|
} else {
|
|
6740
6746
|
text = [
|