Overcoming 255 character URI limit for files_managed
You can alter the database defined from another module, but this is generally a bad idea. As said from Letharion, it is probable you are going to cause issues with other modules that take assumptions.

If you really need to do it, then you should implement code that (at least):


Alters the database table defined from the other module
Implements hook_schema_alter() to make other functions know the new schema used for the database table


The latter step is necessary because there are functions, such as drupal_write_record(), that use drupal_get_schema(), which invokes hook_schema(), and hook_schema_alter() to know the schema used for a table.

Your code should be at least the following one.

mymodule.install

function mymodule_install() {
  if (db_table_exists('file_managed') &amp;&amp; db_field_exists('file_managed', 'uri')) {
    $schema = drupal_get_schema_unprocessed('system');
    $schema['file_managed']['uri']['type'] = 'varchar';
    $schema['file_managed']['uri']['length'] = 12288;
    db_drop_unique_key('file_managed', 'uri');
    db_change_field('file_managed', 'uri', 'uri', $schema['file_managed']['uri']);
    db_add_unique_key('file_managed', 'uri', array('uri'));
  }
}

function mymodule_schema_alter(&amp;$schema) {
  if (isset($schema['file_managed']['uri'])) {
    $schema['file_managed']['uri']['type'] = 'varchar';
    $schema['file_managed']['uri']['length'] = 12288;
  }
}


What is missing in the code I shown is the code to unistall the module. It should change the database table as it was before the module was installed, but what happens if another module installed after yours alters the same field in that table?

Notice that, generally, managed files have a URI that is similar to public://field/image/100_0140.JPG. If the problem is the path being too long, then you should use less directories, or a shorter filename.