| 1583 | * Column options for the model schema attributes |
| 1584 | */ |
| 1585 | export interface ModelAttributeColumnOptions<M extends Model = Model> extends ColumnOptions { |
| 1586 | /** |
| 1587 | * A string or a data type |
| 1588 | */ |
| 1589 | type: DataType; |
| 1590 | |
| 1591 | /** |
| 1592 | * If true, the column will get a unique constraint. If a string is provided, the column will be part of a |
| 1593 | * composite unique index. If multiple columns have the same string, they will be part of the same unique |
| 1594 | * index |
| 1595 | */ |
| 1596 | unique?: boolean | string | { name: string; msg: string }; |
| 1597 | |
| 1598 | /** |
| 1599 | * Primary key flag |
| 1600 | */ |
| 1601 | primaryKey?: boolean; |
| 1602 | |
| 1603 | /** |
| 1604 | * Is this field an auto increment field |
| 1605 | */ |
| 1606 | autoIncrement?: boolean; |
| 1607 | |
| 1608 | /** |
| 1609 | * If this field is a Postgres auto increment field, use Postgres `GENERATED BY DEFAULT AS IDENTITY` instead of `SERIAL`. Postgres 10+ only. |
| 1610 | */ |
| 1611 | autoIncrementIdentity?: boolean; |
| 1612 | |
| 1613 | /** |
| 1614 | * Comment for the database |
| 1615 | */ |
| 1616 | comment?: string; |
| 1617 | |
| 1618 | /** |
| 1619 | * An object with reference configurations or the column name as string |
| 1620 | */ |
| 1621 | references?: string | ModelAttributeColumnReferencesOptions; |
| 1622 | |
| 1623 | /** |
| 1624 | * What should happen when the referenced key is updated. One of CASCADE, RESTRICT, SET DEFAULT, SET NULL or |
| 1625 | * NO ACTION |
| 1626 | */ |
| 1627 | onUpdate?: string; |
| 1628 | |
| 1629 | /** |
| 1630 | * What should happen when the referenced key is deleted. One of CASCADE, RESTRICT, SET DEFAULT, SET NULL or |
| 1631 | * NO ACTION |
| 1632 | */ |
| 1633 | onDelete?: string; |
| 1634 | |
| 1635 | |
| 1636 | /** |
| 1637 | * An object of validations to execute for this column every time the model is saved. Can be either the |
| 1638 | * name of a validation provided by validator.js, a validation function provided by extending validator.js |
| 1639 | * (see the |
| 1640 | * `DAOValidator` property for more details), or a custom validation function. Custom validation functions |
| 1641 | * are called with the value of the field, and can possibly take a second callback argument, to signal that |
| 1642 | * they are asynchronous. If the validator is sync, it should throw in the case of a failed validation, it |
no outgoing calls
no test coverage detected