• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

typeorm / typeorm / 15219332477

23 May 2025 09:13PM UTC coverage: 17.216% (-59.1%) from 76.346%
15219332477

Pull #11332

github

naorpeled
cr comments - move if block
Pull Request #11332: feat: add new undefined and null behavior flags

1603 of 12759 branches covered (12.56%)

Branch coverage included in aggregate %.

0 of 31 new or added lines in 3 files covered. (0.0%)

14132 existing lines in 166 files now uncovered.

4731 of 24033 relevant lines covered (19.69%)

60.22 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

11.11
/src/schema-builder/table/TableUnique.ts
1
import { TableUniqueOptions } from "../options/TableUniqueOptions"
2
import { UniqueMetadata } from "../../metadata/UniqueMetadata"
3

4
/**
5
 * Database's table unique constraint stored in this class.
6
 */
7
export class TableUnique {
1✔
UNCOV
8
    readonly "@instanceof" = Symbol.for("TableUnique")
×
9

10
    // -------------------------------------------------------------------------
11
    // Public Properties
12
    // -------------------------------------------------------------------------
13

14
    /**
15
     * Constraint name.
16
     */
17
    name?: string
18

19
    /**
20
     * Columns that contains this constraint.
21
     */
UNCOV
22
    columnNames: string[] = []
×
23

24
    /**
25
     * Set this foreign key constraint as "DEFERRABLE" e.g. check constraints at start
26
     * or at the end of a transaction
27
     */
28
    deferrable?: string
29

30
    // -------------------------------------------------------------------------
31
    // Constructor
32
    // -------------------------------------------------------------------------
33

34
    constructor(options: TableUniqueOptions) {
UNCOV
35
        this.name = options.name
×
UNCOV
36
        this.columnNames = options.columnNames
×
UNCOV
37
        this.deferrable = options.deferrable
×
38
    }
39

40
    // -------------------------------------------------------------------------
41
    // Public Methods
42
    // -------------------------------------------------------------------------
43

44
    /**
45
     * Creates a new copy of this constraint with exactly same properties.
46
     */
47
    clone(): TableUnique {
UNCOV
48
        return new TableUnique(<TableUniqueOptions>{
×
49
            name: this.name,
50
            columnNames: [...this.columnNames],
51
            deferrable: this.deferrable,
52
        })
53
    }
54

55
    // -------------------------------------------------------------------------
56
    // Static Methods
57
    // -------------------------------------------------------------------------
58

59
    /**
60
     * Creates unique from the unique metadata object.
61
     */
62
    static create(uniqueMetadata: UniqueMetadata): TableUnique {
UNCOV
63
        return new TableUnique(<TableUniqueOptions>{
×
64
            name: uniqueMetadata.name,
65
            columnNames: uniqueMetadata.columns.map(
UNCOV
66
                (column) => column.databaseName,
×
67
            ),
68
            deferrable: uniqueMetadata.deferrable,
69
        })
70
    }
71
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc