anycodex 0.0.19 → 0.0.20
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/bin.js +6 -6
- package/package.json +1 -1
package/dist/bin.js
CHANGED
|
@@ -22,7 +22,7 @@ import fs5 from "fs";
|
|
|
22
22
|
import readline from "readline";
|
|
23
23
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
24
24
|
|
|
25
|
-
// ../server/dist/chunk-
|
|
25
|
+
// ../server/dist/chunk-BNE5CZR2.js
|
|
26
26
|
import http from "http";
|
|
27
27
|
import https from "https";
|
|
28
28
|
import { fileURLToPath } from "url";
|
|
@@ -1589,23 +1589,24 @@ async function startServer() {
|
|
|
1589
1589
|
const cols = sharedStorage.query(`PRAGMA table_info("user_session")`);
|
|
1590
1590
|
if (cols.length > 0) {
|
|
1591
1591
|
const hasIsDefault = cols.some((c2) => c2.name === "is_default");
|
|
1592
|
+
const hasUserId = cols.some((c2) => c2.name === "user_id");
|
|
1592
1593
|
const pkCol = cols.find((c2) => c2.pk === 1);
|
|
1593
1594
|
const needsPkMigration = pkCol && pkCol.name === "user_id";
|
|
1594
|
-
|
|
1595
|
+
const needsMigration = !hasIsDefault || needsPkMigration || hasUserId;
|
|
1596
|
+
if (needsMigration) {
|
|
1595
1597
|
console.log("\u{1F504} Migrating user_session table\u2026");
|
|
1596
1598
|
if (!hasIsDefault) {
|
|
1597
1599
|
sharedStorage.exec(`ALTER TABLE "user_session" ADD COLUMN "is_default" INTEGER NOT NULL DEFAULT 0`);
|
|
1598
1600
|
sharedStorage.exec(`UPDATE "user_session" SET "is_default" = 1`);
|
|
1599
1601
|
}
|
|
1600
|
-
if (needsPkMigration) {
|
|
1602
|
+
if (needsPkMigration || hasUserId) {
|
|
1601
1603
|
sharedStorage.exec(`CREATE TABLE "user_session_new" (
|
|
1602
1604
|
"session_id" TEXT PRIMARY KEY,
|
|
1603
|
-
"user_id" TEXT NOT NULL,
|
|
1604
1605
|
"directory" TEXT NOT NULL DEFAULT '',
|
|
1605
1606
|
"time_created" INTEGER NOT NULL,
|
|
1606
1607
|
"is_default" INTEGER NOT NULL DEFAULT 0
|
|
1607
1608
|
)`);
|
|
1608
|
-
sharedStorage.exec(`INSERT INTO "user_session_new" SELECT "session_id","
|
|
1609
|
+
sharedStorage.exec(`INSERT INTO "user_session_new" SELECT "session_id","directory","time_created","is_default" FROM "user_session"`);
|
|
1609
1610
|
sharedStorage.exec(`DROP TABLE "user_session"`);
|
|
1610
1611
|
sharedStorage.exec(`ALTER TABLE "user_session_new" RENAME TO "user_session"`);
|
|
1611
1612
|
}
|
|
@@ -1615,7 +1616,6 @@ async function startServer() {
|
|
|
1615
1616
|
sharedStorage.exec(`
|
|
1616
1617
|
CREATE TABLE IF NOT EXISTS "user_session" (
|
|
1617
1618
|
"session_id" TEXT PRIMARY KEY,
|
|
1618
|
-
"user_id" TEXT NOT NULL,
|
|
1619
1619
|
"directory" TEXT NOT NULL DEFAULT '',
|
|
1620
1620
|
"time_created" INTEGER NOT NULL,
|
|
1621
1621
|
"is_default" INTEGER NOT NULL DEFAULT 0
|