The options for the model. All parameters except autoIncrement, withRowId, and uniqueKeys are required.
The D1Orm instance to use - optional. If not set initially, you must use SetOrm() to set before querying.
The column to use for auto incrementing. If specified, only one primary key is allowed, and must be of type INTEGER.
The primary key or keys of the table.
The name of the table to use.
The unique keys of the table. For example
[ ['id'], ['username', 'discriminator'] ] would cause ID to be unique, as well as the combination of username and discriminator.
Whether or not D1 should generate a
rowid column automatically. Defaults to false.
The columns for the model. The keys are the column names, and the values are the column options. See ModelColumn
A CreateTable definition for the model, which can be used in a CREATE TABLE statement.
The options for creating the table. Currently only contains strategy, which is the strategy to use when creating the table.
If true, will ignore the table not existing. If false, will throw an error if the table does not exist.
Upserting is a way to insert a row into the table, or update it if it already exists. This is done by using SQLITE's ON CONFLICT clause. As a result, this method should control the primary key for the insert & where clauses, and should not be used with auto incrementing keys.
Generated using TypeDoc