Framework: [Proposal] VARBINARY mysql type

Created on 19 Jan 2014  路  3Comments  路  Source: laravel/framework

There is actually BINARY, but not VARBINARY.

VARBINARY is great for storing ip addresses. VARBINARY field is compatible with ipv4 and ipv6 at the same time, BINARY only with ipv6. This will avoid using VARCHAR.

Most helpful comment

Can you just use a varchar field? I don't want to get into adding too many custom fields. You can add the alter table SQL manually in the migration if you really need something custom.

All 3 comments

Is it safe to assume there are similar types in other databases besides mysql? Take a look at the list of supported PDO engines.

Can you just use a varchar field? I don't want to get into adding too many custom fields. You can add the alter table SQL manually in the migration if you really need something custom.

@taylorotwell varchar is slow/unefficient for this, but thanks for the alter table tip in migration. i was altering the table using mysql tools, but that loses sync with the migrations. I will use laravel's alter table instead.

Was this page helpful?
0 / 5 - 0 ratings