@nuxodin/item 0.6.15 → 0.6.17
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
|
@@ -52,7 +52,8 @@ export function schemaFromField(row) {
|
|
|
52
52
|
prop.maxLength = len;
|
|
53
53
|
} else if (type in textBytes) {
|
|
54
54
|
prop.type = "string";
|
|
55
|
-
|
|
55
|
+
// also for TEXT: without its bound, a wider declaration would never widen it
|
|
56
|
+
prop.maxLength = Math.floor(textBytes[type] / B);
|
|
56
57
|
} else if (type === "binary") {
|
|
57
58
|
prop.type = "string";
|
|
58
59
|
prop.contentEncoding = "base64";
|
|
@@ -102,6 +102,9 @@ export async function schemaToDb(schema, query, { force = false, patch = false }
|
|
|
102
102
|
const primaries = fields.filter(([, f]) => f['x-index'] === 'primary').map(([n]) => n)
|
|
103
103
|
|
|
104
104
|
if (!currTables.includes(table)) {
|
|
105
|
+
// Idea: WITHOUT ROWID when the primary key is not a single integer column and all other columns
|
|
106
|
+
// are narrow (numbers, booleans, short strings), e.g. measurement tables: about half the size.
|
|
107
|
+
// Requires NOT NULL key columns; only applies to newly created tables.
|
|
105
108
|
stmts.push(`CREATE TABLE ${quoteId(table)} (\n${createBody(table, fields, primaries)}\n);`)
|
|
106
109
|
stmts.push(...indexStatements(table, fields, primaries))
|
|
107
110
|
} else {
|