Closed graemebruce closed 2 weeks ago
Which version are you using?
This is what I see on the latest:
/**
* Inserts all rows from another table (or multiple tables) into this table.
*
* @example
* Basic usage with one table
* ```ts
* // Insert all rows from tableB into this table.
* await tableA.insertTables("tableB")
* ```
*
* @example
* With multiple tables
* ```ts
* // Insert all rows from tableB and tableC into this table.
* await tableA.insertTables([ "tableB", "tableC" ])
* ```
*
* @param tablesToInsert - The name of the table(s) from which rows will be inserted.
*
* @category Importing data
*/
async insertTables(tablesToInsert: SimpleWebTable | SimpleWebTable[]) {
const array = Array.isArray(tablesToInsert)
? tablesToInsert
: [tablesToInsert];
await queryDB(
this,
array
.map(
(tableToInsert) =>
`INSERT INTO ${this.name} BY NAME SELECT * FROM ${tableToInsert.name};`,
)
.join("\n"),
mergeOptions(this, {
table: this.name,
method: "insertTables()",
parameters: { tablesToInsert },
}),
);
}
Closing because I think it's related to a previous version.
insertTables() docs has "insertTable" in examples.