gencow 0.1.19 → 0.1.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gencow",
3
- "version": "0.1.19",
3
+ "version": "0.1.20",
4
4
  "description": "Gencow — Backend OS for AI Agents",
5
5
  "type": "module",
6
6
  "bin": {
package/server/index.js CHANGED
@@ -71246,10 +71246,20 @@ function createAdminRoutes(db, rawSql, driver, getCtx, storage) {
71246
71246
  }
71247
71247
  }
71248
71248
  admin.get("/tables", async (c) => {
71249
+ let schemaName = "public";
71250
+ try {
71251
+ const spRows = await rawSql(`SHOW search_path`);
71252
+ const sp = spRows[0]?.search_path || "public";
71253
+ const firstSchema = sp.split(",")[0].trim().replace(/"/g, "");
71254
+ if (firstSchema && firstSchema !== '"$user"' && firstSchema !== "$user") {
71255
+ schemaName = firstSchema;
71256
+ }
71257
+ } catch {
71258
+ }
71249
71259
  const rows = await rawSql(`
71250
71260
  SELECT table_name, column_name, data_type, is_nullable, column_default
71251
71261
  FROM information_schema.columns
71252
- WHERE table_schema = 'public'
71262
+ WHERE table_schema = '${schemaName}'
71253
71263
  ORDER BY table_name, ordinal_position
71254
71264
  `);
71255
71265
  const tables = {};