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E,QAAQ,CAAC,WAAW;YACjC,qBAAqB,EAAE,QAAQ,CAAC,qBAAqB;YACrD,mBAAmB,EAAE,QAAQ,CAAC,mBAAmB;YACjD,QAAQ,EAAE,QAAQ,CAAC,QAAQ;YAC3B,QAAQ,EAAE,QAAQ,CAAC,QAAQ;YAC3B,UAAU,EAAE,QAAQ,CAAC,UAAU;SAClC,CAAC,CAAC;IACP,CAAC;IAEL,sBAAC;AAAD,CAhGA,AAgGC,IAAA;AAhGY,0CAAe","file":"TableForeignKey.js","sourcesContent":["import {ForeignKeyMetadata} from \"../../metadata/ForeignKeyMetadata\";\nimport {TableForeignKeyOptions} from \"../options/TableForeignKeyOptions\";\n\n/**\n * Foreign key from the database stored in this class.\n */\nexport class TableForeignKey {\n\n // -------------------------------------------------------------------------\n // Public Properties\n // -------------------------------------------------------------------------\n\n /**\n * Name of the foreign key constraint.\n */\n name?: string;\n\n /**\n * Column names which included by this foreign key.\n */\n columnNames: string[] = [];\n\n /**\n * Table referenced in the foreign key.\n */\n referencedTableName: string;\n\n /**\n * Column names which included by this foreign key.\n */\n referencedColumnNames: string[] = [];\n\n /**\n * \"ON DELETE\" of this foreign key, e.g. what action database should perform when\n * referenced stuff is being deleted.\n */\n onDelete?: string;\n\n /**\n * \"ON UPDATE\" of this foreign key, e.g. what action database should perform when\n * referenced stuff is being updated.\n */\n onUpdate?: string;\n\n /**\n * Set this foreign key constraint as \"DEFERRABLE\" e.g. check constraints at start \n * or at the end of a transaction\n */\n deferrable?: string;\n\n // -------------------------------------------------------------------------\n // Constructor\n // -------------------------------------------------------------------------\n\n constructor(options: TableForeignKeyOptions) {\n this.name = options.name;\n this.columnNames = options.columnNames;\n this.referencedColumnNames = options.referencedColumnNames;\n this.referencedTableName = options.referencedTableName;\n this.onDelete = options.onDelete;\n this.onUpdate = options.onUpdate;\n this.deferrable = options.deferrable;\n }\n\n // -------------------------------------------------------------------------\n // Public Methods\n // -------------------------------------------------------------------------\n\n /**\n * Creates a new copy of this foreign key with exactly same properties.\n */\n clone(): TableForeignKey {\n return new TableForeignKey(<TableForeignKeyOptions>{\n name: this.name,\n columnNames: [...this.columnNames],\n referencedColumnNames: [...this.referencedColumnNames],\n referencedTableName: this.referencedTableName,\n onDelete: this.onDelete,\n onUpdate: this.onUpdate,\n deferrable: this.deferrable,\n });\n }\n\n // -------------------------------------------------------------------------\n // Static Methods\n // -------------------------------------------------------------------------\n\n /**\n * Creates a new table foreign key from the given foreign key metadata.\n */\n static create(metadata: ForeignKeyMetadata): TableForeignKey {\n return new TableForeignKey(<TableForeignKeyOptions>{\n name: metadata.name,\n columnNames: metadata.columnNames,\n referencedColumnNames: metadata.referencedColumnNames,\n referencedTableName: metadata.referencedTablePath,\n onDelete: metadata.onDelete,\n onUpdate: metadata.onUpdate,\n deferrable: metadata.deferrable,\n });\n }\n\n}\n"],"sourceRoot":"../.."}
|