docs: def _get_text_id(self, witness):
          """Returns the database ID of the Text record for `witness`.
  
          This may require creating such a record.
  
          If `text`\'s checksum does not match an existing record's
          checksum, the record's checksum is updated and all associated
          TextNGram and TextHasNGram records are deleted.
  
          :param witness: witness to add a record for
          :type witness: `WitnessText`
          :rtype: `int`
  
          """
          name, siglum = witness.get_names()
          text_record = self._conn.execute(constants.SELECT_TEXT_SQL,
                                           [name, siglum]).fetchone()
          if text_record is None:
              text_id = self._add_text_record(witness)
          else:
              text_id = text_record['id']
              if text_record['checksum'] != witness.get_checksum():
                  filename = witness.get_filename()
                  self._logger.info('Text {} has changed since it was added to '
                                    'the database'.format(filename))
                  self._update_text_record(witness, text_id)
                  self._logger.info('Deleting potentially out-of-date n-grams')
                  self._delete_text_ngrams(text_id)
          return text_id