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

Unsigned integer #46

Open
fnaysee opened this issue Mar 29, 2019 · 3 comments
Open

Unsigned integer #46

fnaysee opened this issue Mar 29, 2019 · 3 comments
Milestone

Comments

@fnaysee
Copy link

fnaysee commented Mar 29, 2019

Hi, How can i create an unsigned integer field with fizz?

@duckbrain
Copy link
Contributor

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

@pitchinnate
Copy link

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")

@sio4 sio4 added the s: triage label Sep 7, 2022
@sio4 sio4 added this to the v1 / cleanup milestone Sep 7, 2022
@sio4
Copy link
Member

sio4 commented Sep 15, 2022

The solution for this request could be the same as the second option of #13 (comment), which is supporting a custom option.

@sio4 sio4 modified the milestones: v1 / cleanup, v2 Sep 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants