CodeIgniter Forums
CI 1.7 - ci_sessions table error - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: CI 1.7 - ci_sessions table error (/showthread.php?tid=12608)



CI 1.7 - ci_sessions table error - El Forum - 10-24-2008

[eluser]gokure[/eluser]
Upgrade CI form 1.6.3 to 1.7, and added sessions tables field "user_data", but when accessing the site, it's have NOT NULL constraint.
I used database is postgres 8.3.1, and update ci_sessions table
Code:
ALTER TABLE ci_sessions ADD COLUMN user_data text NOT NULL;

Error: In the field "user_data" have NOT NULL constraint.

Code:
A Database Error Occurred
Error Number:

错误: 在字段 "user_data" 中空值违反了非空约束

INSERT INTO "ci_sessions" ("session_id", "ip_address", "user_agent", "last_activity") VALUES ('93513eddb16621fbcb236fa24b9a7bfb', '192.168.0.1', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) Ap', 1224910414)



CI 1.7 - ci_sessions table error - El Forum - 10-24-2008

[eluser]gokure[/eluser]
Maybe set default values
Code:
ALTER TABLE ci_sessions ADD COLUMN user_data text NOT NULL DEFAULT ''::text;
that's worked.