【问题标题】:Set Integer To Zerofill In Sequel Migration (Ruby ORM)在 Sequel 迁移中将整数设置为 Zerofill (Ruby ORM)
【发布时间】:2023-03-07 23:13:02
【问题描述】:

我正在尝试构建一个迁移,其中包含一个 IP 地址作为一个零填充的无符号整数。

我的迁移目前看起来像这样,但 zerofill: true 不起作用

up do
  create table :ip do
    Integer :id, size: 7, default: nil
    Integer :ip_address_integer, size: 10, unsigned: true, zerofill: true
    varchar :scan_time, size: 32
    primary_key :id
  end
end

如何使用续集 ORM 将 IP 地址填充为零

【问题讨论】:

    标签: ruby orm sequel padrino


    【解决方案1】:

    Sequel 不支持使用:zerofill 参数来定义列。您可能只想直接使用以下内容指定类型:

    column :ip_address_integer, 'integer(10) unsigned zerofill'
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-05-07
      • 1970-01-01
      • 2017-03-06
      • 1970-01-01
      • 1970-01-01
      • 2012-09-22
      • 1970-01-01
      相关资源
      最近更新 更多