【发布时间】:2016-03-10 05:03:54
【问题描述】:
请帮我将此 PostgreSQL 表转换为 Rails 迁移文件和模型
CREATE DATABASE ip2location WITH ENCODING 'UTF8'; \c ip2location
CREATE TABLE ip2location_db1(
ip_from integer(10) NOT NULL,
ip_to integer(10) NOT NULL,
country_code character(2) NOT NULL,
country_name character varying(64) NOT NULL,
CONSTRAINT ip2location_db1_pkey PRIMARY KEY (ip_from, ip_to)
);
- 我想创建 Rails 模型来检索数据吗
【问题讨论】:
标签: ruby-on-rails postgresql rails-migrations composite-primary-key