volatiletech / sqlboiler

Generate a Go ORM tailored to your database schema.
BSD 3-Clause "New" or "Revised" License
6.73k stars 544 forks source link

null.Uint64 for BIGINT (MYSQL) type #199

Closed olehbozhok closed 7 years ago

olehbozhok commented 7 years ago

mysql scheme:

-- auto-generated definition
CREATE TABLE podkasts
(
  id                    INT(10) UNSIGNED AUTO_INCREMENT
    PRIMARY KEY,
  created_at            TIMESTAMP    NULL,
  updated_at            TIMESTAMP    NULL,
  raw_date              VARCHAR(15)  NOT NULL,
  channel_name          VARCHAR(30)  NOT NULL,
  description           TEXT         NOT NULL,
  href                  VARCHAR(190) NOT NULL,
  tg_msg_id_description BIGINT       NOT NULL,
  tg_msg_file_id        BIGINT       NULL,
  tg_from_id_chat       BIGINT       NOT NULL,
  CONSTRAINT href
  UNIQUE (href)
);

generated scheme: // Podkast is an object representing the database table. type Podkast struct { ID uintboil:"id" json:"id" toml:"id" yaml:"id" CreatedAt null.Timeboil:"created_at" json:"created_at,omitempty" toml:"created_at" yaml:"created_at,omitempty" UpdatedAt null.Timeboil:"updated_at" json:"updated_at,omitempty" toml:"updated_at" yaml:"updated_at,omitempty" RawDate stringboil:"raw_date" json:"raw_date" toml:"raw_date" yaml:"raw_date" ChannelName stringboil:"channel_name" json:"channel_name" toml:"channel_name" yaml:"channel_name" Description stringboil:"description" json:"description" toml:"description" yaml:"description" Href stringboil:"href" json:"href" toml:"href" yaml:"href" TGMSGIDDescription int64boil:"tg_msg_id_description" json:"tg_msg_id_description" toml:"tg_msg_id_description" yaml:"tg_msg_id_description" TGMSGFileID null.Uint64boil:"tg_msg_file_id" json:"tg_msg_file_id,omitempty" toml:"tg_msg_file_id" yaml:"tg_msg_file_id,omitempty" TGFromIDChat int64boil:"tg_from_id_chat" json:"tg_from_id_chat" toml:"tg_from_id_chat" yaml:"tg_from_id_chat"`

R *podkastR `boil:"-" json:"-" toml:"-" yaml:"-"`
L podkastL  `boil:"-" json:"-" toml:"-" yaml:"-"`

} why for field tg_msg_file_id BIGINT NULL` was generated type null.Uint64 ? I think it a bug and need to fix it

olehbozhok commented 7 years ago

// Podkast is an object representing the database table. type Podkast struct { ID uint boil:"id" json:"id" toml:"id" yaml:"id" CreatedAt null.Time boil:"created_at" json:"created_at,omitempty" toml:"created_at" yaml:"created_at,omitempty" UpdatedAt null.Time boil:"updated_at" json:"updated_at,omitempty" toml:"updated_at" yaml:"updated_at,omitempty" RawDate string boil:"raw_date" json:"raw_date" toml:"raw_date" yaml:"raw_date" ChannelName string boil:"channel_name" json:"channel_name" toml:"channel_name" yaml:"channel_name" Description string boil:"description" json:"description" toml:"description" yaml:"description" Href string boil:"href" json:"href" toml:"href" yaml:"href" TGMSGIDDescription int64 boil:"tg_msg_id_description" json:"tg_msg_id_description" toml:"tg_msg_id_description" yaml:"tg_msg_id_description" TGMSGFileID null.Uint64 boil:"tg_msg_file_id" json:"tg_msg_file_id,omitempty" toml:"tg_msg_file_id" yaml:"tg_msg_file_id,omitempty" TGFromIDChat int64 boil:"tg_from_id_chat" json:"tg_from_id_chat" toml:"tg_from_id_chat" yaml:"tg_from_id_chat"

R *podkastR boil:"-" json:"-" toml:"-" yaml:"-" L podkastL boil:"-" json:"-" toml:"-" yaml:"-" }

aarondl commented 7 years ago

This was fixed in v2.5.1 https://github.com/volatiletech/sqlboiler/commit/f0f386e97b5b072c48d8fbfc05856459d05e835e

olehbozhok commented 7 years ago

thanks