Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

MySQL ids should be unsigned ints #157

Closed
wants to merge 1 commit into from

5 participants

Felix Middendorf Wes Roberts elliot sawyer Sean M. Collins Clay vanSchalkwijk
Felix Middendorf

MySQL primary keys should be unsigned integers to make better use of the integer space (ids are > 0 anyway).

Wes Roberts

+1

elliot sawyer

Totally agree with this, standard practice for me. How would it behave with non-MySQL databases?

Sean M. Collins

I've never heard of using negative integers for IDs. I think it will be a safe change.

Felix Middendorf

@luminairex My pull request only affects the MysqlAdapter, so side-effects should not be an issue.
See: https://github.com/kla/php-activerecord/pull/157/files

Clay vanSchalkwijk
Collaborator

Thanks, merged.

Felix Middendorf

Cool, thank you very much :).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jul 25, 2011
  1. Felix Middendorf

    MySQL primary keys should be unsigned to make better use of the integ…

    felixmiddendorf authored
    …er space (ids are > 0 anyway).
This page is out of date. Refresh to see the latest.
Showing with 1 addition and 1 deletion.
  1. +1 −1  lib/adapters/MysqlAdapter.php
2  lib/adapters/MysqlAdapter.php
View
@@ -81,7 +81,7 @@ public function accepts_limit_and_order_for_update_and_delete() { return true; }
public function native_database_types()
{
return array(
- 'primary_key' => 'int(11) DEFAULT NULL auto_increment PRIMARY KEY',
+ 'primary_key' => 'int(11) UNSIGNED DEFAULT NULL auto_increment PRIMARY KEY',
'string' => array('name' => 'varchar', 'length' => 255),
'text' => array('name' => 'text'),
'integer' => array('name' => 'int', 'length' => 11),
Something went wrong with that request. Please try again.