CREATE TABLE dbo.ci_sessions (
session_id varchar(40) DEFAULT '0' NOT NULL,
ip_address varchar(16) DEFAULT '0' NOT NULL,
user_agent varchar(120) NOT NULL,
last_activity int DEFAULT 0 NOT NULL,
user_data varchar(max) NOT NULL, -- use varchar(max) instead of MySQL TEXT data type
PRIMARY KEY (session_id)
)
GO
-- Simalate MySQL 'UNSIGNED' field option
ALTER TABLE dbo.ci_sessions ADD CONSTRAINT last_activity_unsigned
CHECK (last_activity >= 0)
GO
CREATE INDEX last_activity_idx
ON dbo.ci_sessions (last_activity)