Im using Rails 4.2.3 with a PostGre database. I want the column in my database to store a few milliseconds - note, not the timestamp, but the duration in milliseconds. So I created my column like this
time_in_ms | bigint
However, when I go to store the value in Rails, I get the following error
ActiveRecord::StatementInvalid (PG::NumericValueOutOfRange: ERROR: value "3000002000" is out of range for type integer : INSERT INTO "my_object_times" ("time_in_ms", "my_object_id", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "id"): app/controllers/my_objects_controller.rb:31:in `update'
It would seem that the number "3000002000" is less than the maximum value for the column (reading of which is "9223372036854775807"), so I wonder what else is going wrong and how I can fix it.
Edit: To provide more information, in my db / schema.rb file, the column in question is described this way ...
create_table "my_object_times", force: :cascade do |t| ... t.integer "time_in_ms", limit: 8
Edit 2: Here is the result of creating a table in PSQL
CREATE TABLE my_object_times ( id integer NOT NULL, first_name character varying, last_name character varying, time_in_ms bigint, created_at timestamp without time zone NOT NULL, updated_at timestamp without time zone NOT NULL, name character varying, age integer, city character varying, state_id integer, country_id integer, overall_rank integer, age_group_rank integer, gender_rank integer );