Unsigned integer
Hi, How can i create an unsigned integer field with fizz?
You can use the name your database engine calls it, if it supports it. If the type you specify isn't one of the "common types", it will just be passed unaltered back to the database. README.md#common-types
It appears PostgreSQL doesn't support unsigned integers at all. https://stackoverflow.com/questions/20810134/why-unsigned-integer-is-not-available-in-postgresql
Unsigned integers aren't a separate type, it is an attribute that can be applied to most numeric types in MySQL. For now here is what I am using:
create_table("users") {
t.Column("id", "integer", {primary: true})
t.Column("email", "string", {})
t.Column("password", "string", {})
t.Column("admin", "bool", {"default": false, })
t.Timestamps()
t.Column("deleted_at", "timestamp", {"null": true})
}
add_index("users", "admin", {})
sql("ALTER TABLE `users` CHANGE `id` `id` INT UNSIGNED NOT NULL AUTO_INCREMENT")
The solution for this request could be the same as the second option of https://github.com/gobuffalo/fizz/issues/13#issuecomment-1243624577, which is supporting a custom option.