I have the following table declared in MySQL:
CREATE TABLE IF NOT EXISTS `ci_sessions` (
`session_id` varchar(40) COLLATE utf8_bin NOT NULL DEFAULT '0',
`ip_address` varchar(16) COLLATE utf8_bin NOT NULL DEFAULT '0',
`user_agent` varchar(150) COLLATE utf8_bin NOT NULL,
`last_activity` int(10) unsigned NOT NULL DEFAULT '0',
`user_data` text COLLATE utf8_bin NOT NULL,
PRIMARY KEY (`session_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
What would be an equivalent definition of the table in postgres, assuming my database is already using UTF-8 encoding?
The modifier IF NOT EXISTS has IMHO just been added to one of the newest PostgreSQL versions.
EDIT: As unnamed horse recommended, I changed the 4th attribute from decimal(10) to int4. But I would prefer a timestamp(0) here, also. Use just timestamp without the (0) if you need microsecond precision here.