2

I'm stuck with that. Can't find anywhere in docs how to declare such spatial data types as inet and jsonb or json.

ruby 2.4.1, sequel 4.47

Plain ruby script with require 'sequel'.

Declaration such as

DB.create_table :requests do
  primary_key :id
  foreign_key :client_id, :clients
  foreign_key :service_id, :services
  DateTime :created_at, null: false
  DateTime :answered_at, null: false
  JsonBType :request, null: false
end
2
  • Are you refering to the postgres docs? Are you using rails? or are you trying to add a row through the psql console? Commented Jun 27, 2017 at 16:37
  • Did that work? Did you get an error? If so, what was the error? Commented Jun 27, 2017 at 16:54

1 Answer 1

5

You can use the alternative way of defining columns by using the column method - details can be found here. In your example this becomes:

DB.create_table :requests do
  primary_key :id
  foreign_key :client_id, :clients
  foreign_key :service_id, :services
  DateTime :created_at, null: false
  DateTime :answered_at, null: false
  column :request, :jsonb, null: false
end
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.