Add foreign key to schema using hook_update_N I've written a module that establishes a child/parent relation ship between magazine issues and the articles in each issue.  The idea is that by associating articles with magazine issues they can all be automatically published on a given date via cron.  That all works fine.

The problem is I'm trying to use a View to list a subset of those articles and list them according the parent issues date, but that isn't showing up as a relationship.  I assume the problem is that I haven't defined a foreign key in my schema.  

Is it possible to add one in hook_update_N or whatever?

To clarify, the relationship is created using fields defined in a custom module using the Field API where the parent node has the date info and the child node has a field for the parent NID.
You can add keys to tables using native SQL. It's not supported by drupal 7 core api. I answered this previously elsewhere:
Is there a way to add a foreign key to a table?

I doubt that simply adding a key will expose the relationship for you in Views though.

In order for Views to see this information you likely need to supply the info via hook_views_data() about your custom tables and relationships. A recent blog post I found about this today actually was:
https://chacadwa.com/blog/2014/08/12/adding-full-views-support-custom-entities

From this blog post you can see that for a table that needs a join to add extra fields (and to do so by default in Views) they add the following array to their hook_views_data() function.

// Define a default relationship to the staffdir extra data table.

$data['hank_hrper']['table']['default_relationship'] = array(
  'hank_hrper_extra_data' =&gt; array(
    'table' =&gt; 'hank_hrper_extra_data',
    'field' =&gt; 'hrper_id',
  ),
);

// Now define the staffdir extra data table, so views can use it.

$data['hank_hrper_extra_data'] = array(
  'table' =&gt; array(
    'group' =&gt; t('Staff directory'),
    'entity type' =&gt; 'staffdir',
    'join' =&gt; array(
      'hank_hrper' =&gt; array(
        'left_field' =&gt; 'hrper_id',
        'field' =&gt; 'hrper_id',
      ),
    ),
    'default_relationship' =&gt; array(
      'hank_hrper' =&gt; array(
        'table' =&gt; 'hank_hrper',
        'field' =&gt; 'hrper_id',
      ),
    ),
  ),
);

// Now we can define fields from the staffdir extra data table for use in the relationship.

$data['hank_hrper_extra_data']['opt_out'] = array(
  'title' =&gt; t('Opt out'),
  'help' =&gt; t('Allows for users to be excluded from the directory.'),
  'field' =&gt; array(
    'handler' =&gt; 'views_handler_field_boolean',
    'click sortable' =&gt; FALSE, // could be TRUE, but why?
  ),
  'filter' =&gt; array(
    'handler' =&gt; 'views_handler_filter_boolean_operator',
     'accept null' =&gt; TRUE,
    'help' =&gt; t('Filter results to a particular result set'),
  ),
);