Skip to content

Conversation

@dereuromark
Copy link
Member

RFC
Issue: cakephp/phinx#2267

Auto-generated primary keys default to unsigned, but manually added integer columns default to signed. This creates FK mismatches and requires explicit 'signed' => false declarations.

So we can either

  • default all ints to unsigned (this PR)
  • revert the defaulting and require unsigned to be explicitly set
  • try to limit this to foreign keys only (which then would fit again to the primary keys)

Any takes?

*
* @return bool|null
*/
public function getUnsigned(): ?bool
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why add these? they are on the parent class.

$column = new Column();
$column->setName('user_id')->setType('integer');

$this->assertTrue($column->isUnsigned());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changing this default will break existing applications. I'm also not convinced it is a sensible default.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Before we go into details we should first assess, as outlined in the PR descr above, which strategy is best.
Currently its a bit messy, and we should move in one direction.

If unsigned by default is not sensible, maybe the default in general should be signed, including the primary keys.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants