We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
As far as I can tell, the type tinyint, or 1-byte integer, does not exist for PostgreSQL: https://www.postgresql.org/docs/14/datatype-numeric.html
tinyint
I suppose one solution is to define the column with a CHECK constraint, but it would cause hassle around forcing into a i8/u8 type:
room_bed_count SMALLINT CHECK (room_bed_count >=-128 && room_bed_count <= 127)
SeaORM definition:
impl ColumnTrait for Column { type EntityName = Entity; fn def(&self) -> ColumnDef { match self { Self::RoomId => ColumnType::BigInteger.def(), Self::RoomTag => ColumnType::String(Some(64)).def(), Self::RoomLocation => ColumnType::String(Some(32)).def().nullable(), Self::RoomType => ColumnType::String(Some(32)).def().nullable(), Self::RoomTypeOther => ColumnType::String(Some(32)).def().nullable(), Self::RoomRate => ColumnType::Decimal(Some((8, 2))).def().nullable(), Self::RoomRateUnit => ColumnType::String(Some(16)).def().nullable(), Self::RoomBedCount => ColumnType::TinyInteger.def(), } } }
Resulting statement:
CREATE TABLE "asset_room" ( "room_id" bigserial NOT NULL PRIMARY KEY, "room_tag" varchar(64) NOT NULL, "room_location" varchar(32), "room_type" varchar(32), "room_type_other" varchar(32), "room_rate" decimal(8, 2), "room_rate_unit" varchar(16), "room_bed_count" tinyint NOT NULL );
Resulting psql error:
ERROR: type "tinyint" does not exist LINE 1: ...), "room_rate_unit" varchar(16), "room_bed_count" tinyint NO...
The text was updated successfully, but these errors were encountered:
Hey @nickb937, sorry for the delay.
For now, I will map ColumnType::TinyInteger to smallint
ColumnType::TinyInteger
smallint
sea-query/src/backend/postgres/table.rs
Lines 32 to 35 in b9876ba
REF: https://www.postgresql.org/docs/current/datatype.html
Sorry, something went wrong.
billy1624
Successfully merging a pull request may close this issue.
As far as I can tell, the type
tinyint
, or 1-byte integer, does not exist for PostgreSQL: https://www.postgresql.org/docs/14/datatype-numeric.htmlI suppose one solution is to define the column with a CHECK constraint, but it would cause hassle around forcing into a i8/u8 type:
room_bed_count SMALLINT CHECK (room_bed_count >=-128 && room_bed_count <= 127)
SeaORM definition:
Resulting statement:
Resulting psql error:
The text was updated successfully, but these errors were encountered: