In my database i have a table with schema like below
create_table "external_source", force: :cascade do |t|
t.string "external_id"
t.string "permalink", null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.boolean "is_deleted", default: false, null: false
t.string "company_name", default: ""
t.boolean "hide_salary", default: true, null: false
end
But when i tried to insert values without is_deleted
parameter, Rails
server throws null constraint violation error like:
ActiveRecord::StatementInvalid (PG::NotNullViolation: ERROR: null value in column "is_deleted" violates not-null constraint
Now when I have set its default value I am not expecting this error. can you tell me what wrong am I doing. Thank You
here is the JSON to insert
{
"data":
[
{
"external_id":"2262a0228sf-1b9e-sd4e76-b5d7-a8ba01783ebb9i3413139",
"permalink": '234242341',
"hide": true,
"company_name": "com1",
}
]
}