Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PostgreSQL adapter can't use smallserial type #1693

Closed
badmansan opened this issue Jan 17, 2020 · 4 comments
Closed

PostgreSQL adapter can't use smallserial type #1693

badmansan opened this issue Jan 17, 2020 · 4 comments

Comments

@badmansan
Copy link

$smallSerial = (new \Phinx\Db\Table\Column())->setName('id')
	->setType(\Phinx\Db\Adapter\AdapterInterface::PHINX_TYPE_SMALL_INTEGER)
	->setIdentity(TRUE);

$this->table('test', ['id' => FALSE, 'primary_key' => ['id']])
	->addColumn($smallSerial)
	->create();

The result table contains column id with type integer instead smallint.
This is because of this code:

$buffer[] = $column->getType() == 'biginteger' ? 'BIGSERIAL' : 'SERIAL';

Can any one fix this?

@dereuromark
Copy link
Member

Why are you not using normal integers?
Are u able to make a pr here?

@badmansan
Copy link
Author

badmansan commented Jan 17, 2020

Why are you not using normal integers?

My reference table is very small, but related table is very large.

Are u able to make a pr here?

Sure, here

@dereuromark
Copy link
Member

My tip for you: Don't nano-optimize.
It only creates problems without any benefit for you.
In this case you also don't gain anything.

@badmansan
Copy link
Author

May be you right)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants