/** * Get the constraint name and remaining definition * @param constraintSql constraint SQL * @return array with name or null at index 0, definition at index 1 */ static getNameAndDefinition(constraintSql: string): string[] { let parts = [null, constraintSql]; const matches = ConstraintParser.CONSTRAINT_PATTERN(constraintSql.trim()); if (matches !== null && matches.length > ConstraintParser.CONSTRAINT_PATTERN_DEFINITION_GROUP) { let name = StringUtils.quoteUnwrap(matches[ConstraintParser.CONSTRAINT_PATTERN_NAME_GROUP]); if (name !== null && name !== undefined) { name = name.trim(); } let definition = matches[ConstraintParser.CONSTRAINT_PATTERN_DEFINITION_GROUP]; if (definition !== null && definition !== undefined) { definition = definition.trim(); } parts = [name, definition]; } return parts; }