# Class TableConstraint

TableConstraint class

- Defined in packages/saltcorn-data/models/table_constraints.ts:24

##### Index

### Constructors

constructor

### Properties

configuration
id?
table?
table_id?
type

### Accessors

toJson
type_options

### Methods

delete
create
delete_field_constraints
find
findOne

## Constructors

### constructor

- new TableConstraint(o: TableConstraintCfg): TableConstraint

  #### Parameters

  - o: TableConstraintCfg

  #### Returns TableConstraint

  - Defined in packages/saltcorn-data/models/table_constraints.ts:33

## Properties

### configuration

configuration: any

- Defined in packages/saltcorn-data/models/table_constraints.ts:28

### `Optional` id

id?: number | null

- Defined in packages/saltcorn-data/models/table_constraints.ts:27

### `Optional` table

table?: Table

- Defined in packages/saltcorn-data/models/table_constraints.ts:29

### `Optional` table_id

table_id?: number

- Defined in packages/saltcorn-data/models/table_constraints.ts:25

### type

type: "Unique" | "Index" | "Formula"

- Defined in packages/saltcorn-data/models/table_constraints.ts:26

## Accessors

### toJson

- get toJson(): { configuration: any; type: "Unique" | "Index" | "Formula" }

  #### Returns { configuration: any; type: "Unique" | "Index" | "Formula" }

  - Defined in packages/saltcorn-data/models/table_constraints.ts:48

### `Static` type_options

- get type_options(): ("Unique" | "Index" | "Formula")[]

  #### Returns ("Unique" | "Index" | "Formula")[]

  - Defined in packages/saltcorn-data/models/table_constraints.ts:197

## Methods

### delete

- delete(): Promise<void>

  #### Returns Promise<void>

  - Defined in packages/saltcorn-data/models/table_constraints.ts:152

### `Static` create

- create(f: TableConstraintCfg): Promise<TableConstraint>

  #### Parameters

  - f: TableConstraintCfg

  #### Returns Promise<TableConstraint>

  - Defined in packages/saltcorn-data/models/table_constraints.ts:81

### `Static` delete_field_constraints

- delete_field_constraints(table: Table, field: Field): Promise<void>

  #### Parameters

  - table: Table
  - field: Field

  #### Returns Promise<void>

  - Defined in packages/saltcorn-data/models/table_constraints.ts:181

### `Static` find

- find(where: Where, selectopts?: SelectOptions): Promise<TableConstraint[]>

  #### Parameters

  - where: Where
  - `Optional` selectopts: SelectOptions

  #### Returns Promise<TableConstraint[]>

  - Defined in packages/saltcorn-data/models/table_constraints.ts:60

### `Static` findOne

- findOne(where: Where): Promise<TableConstraint | null>

  #### Parameters

  - where: Where

  #### Returns Promise<TableConstraint | null>

  - Defined in packages/saltcorn-data/models/table_constraints.ts:72