postgres=# CREATE USER ast_user with password 'xxxxxxx';
CREATE ROLE
postgres=# CREATE DATABASE ast_db with owner ast_user;
CREATE DATABASE
postgres=#exit
psql ast_db ast_user |
postgres=# CREATE USER ast_user with password 'xxxxxxx';
CREATE ROLE
postgres=# CREATE DATABASE ast_db with owner ast_user;
CREATE DATABASE
postgres=#exit
psql ast_db ast_user
ast_db=> CREATE TABLE cdr (
calldate TIMESTAMP WITH TIME zone DEFAULT now() NOT NULL,
clid CHARACTER VARYING(80) DEFAULT '' NOT NULL,
src CHARACTER VARYING(80) DEFAULT '' NOT NULL,
dst CHARACTER VARYING(80) DEFAULT '' NOT NULL,
dcontext CHARACTER VARYING(80) DEFAULT '' NOT NULL,
channel CHARACTER VARYING(80) DEFAULT '' NOT NULL,
dstchannel CHARACTER VARYING(80) DEFAULT '' NOT NULL,
lastapp CHARACTER VARYING(80) DEFAULT '' NOT NULL,
lastdata CHARACTER VARYING(80) DEFAULT '' NOT NULL,
duration BIGINT DEFAULT 0::BIGINT NOT NULL,
billsec BIGINT DEFAULT 0::BIGINT NOT NULL,
disposition CHARACTER VARYING(45) DEFAULT '' NOT NULL,
amaflags BIGINT DEFAULT 0::BIGINT NOT NULL,
accountcode CHARACTER VARYING(20) DEFAULT '' NOT NULL,
uniqueid CHARACTER VARYING(32) DEFAULT '' NOT NULL,
userfield CHARACTER VARYING(255) DEFAULT '' NOT NULL
);
CREATE TABLE |
ast_db=> CREATE TABLE cdr (
calldate timestamp with time zone DEFAULT now() NOT NULL,
clid character varying(80) DEFAULT '' NOT NULL,
src character varying(80) DEFAULT '' NOT NULL,
dst character varying(80) DEFAULT '' NOT NULL,
dcontext character varying(80) DEFAULT '' NOT NULL,
channel character varying(80) DEFAULT '' NOT NULL,
dstchannel character varying(80) DEFAULT '' NOT NULL,
lastapp character varying(80) DEFAULT '' NOT NULL,
lastdata character varying(80) DEFAULT '' NOT NULL,
duration bigint DEFAULT 0::bigint NOT NULL,
billsec bigint DEFAULT 0::bigint NOT NULL,
disposition character varying(45) DEFAULT '' NOT NULL,
amaflags bigint DEFAULT 0::bigint NOT NULL,
accountcode character varying(20) DEFAULT '' NOT NULL,
uniqueid character varying(32) DEFAULT '' NOT NULL,
userfield character varying(255) DEFAULT '' NOT NULL
);
CREATE TABLE
Устанавливаем поддержку постгреса в Perl:
perl -e shell -MCPAN
install DBI::DBD
install DBD::Pg |
perl -e shell -MCPAN
install DBI::DBD
install DBD::Pg
Создаем скрипт для переноса даных:
Read more