?? a2billing-pgsql-schema-v1.0.6.sql
字號:
---- A2Billing database---- Default values - Please change them to whatever you want -- Database name is: mya2billing-- Database user is: a2billinguser-- User password is: a2billing-- 1. make sure that the Database user is GRANT to access the database in pg_hba.conf!-- a line like this will do it -- # TYPE DATABASE USER IP-ADDRESS IP-MASK METHOD-- # Database asterisk/a2billing login with password for a non real user-- #-- local mya2billing all md5 -- DON'T FORGET TO RESTART Postgresql SERVER IF YOU MADE ANY MODIFICATION ON THIS FILE -- 2. open a terminal and enter the below commands. We assume our superuser to be postgres.-- Please adapt to your setup.-- su - postgres-- psql -f a2billing-pgsql-schema-v1.0.2.sql template1-- NOTE: the errors you will see about missing tables are OK, it's the default behaviour of pgsql. -- When prompted for the password, please enter the one you choose. In our case, it's 'a2billing'. CREATE TABLE cc_didgroup ( id bigserial NOT NULL, idreseller integer DEFAULT 0 NOT NULL, creationdate timestamp without time zone DEFAULT now(), didgroupname text NOT NULL);ALTER TABLE ONLY cc_didgroup ADD CONSTRAINT cc_didgroup_pkey PRIMARY KEY (id);CREATE TABLE cc_did ( id bigserial NOT NULL, id_cc_didgroup bigint NOT NULL, id_cc_country integer NOT NULL, activated integer DEFAULT 1 NOT NULL, iduser integer DEFAULT 0 NOT NULL, did text NOT NULL, creationdate timestamp without time zone DEFAULT now(), startingdate timestamp without time zone DEFAULT now(), expirationdate timestamp without time zone, description text, secondusedreal integer DEFAULT 0, billingtype integer DEFAULT 0, fixrate numeric(12,4) NOT NULL);-- billtype: 0 = fix per month + dialoutrate, 1= fix per month, 2 = dialoutrate, 3 = freeALTER TABLE ONLY cc_did ADD CONSTRAINT cc_did_pkey PRIMARY KEY (id);ALTER TABLE ONLY cc_did ADD CONSTRAINT cons_did_cc_did UNIQUE (did); CREATE TABLE cc_did_destination ( id bigserial NOT NULL, destination text NOT NULL, priority integer DEFAULT 0 NOT NULL, id_cc_card bigint NOT NULL, id_cc_did bigint NOT NULL, creationdate timestamp without time zone DEFAULT now(), activated integer DEFAULT 1 NOT NULL, secondusedreal integer DEFAULT 0, voip_call integer DEFAULT 0);ALTER TABLE ONLY cc_did_destination ADD CONSTRAINT cc_did_destination_pkey PRIMARY KEY (id);CREATE TABLE cc_charge ( id bigserial NOT NULL, id_cc_card bigint NOT NULL, iduser integer DEFAULT 0 NOT NULL, creationdate timestamp without time zone DEFAULT now(), amount numeric(12,4) NOT NULL, chargetype integer DEFAULT 0, description text);ALTER TABLE ONLY cc_charge ADD CONSTRAINT cc_charge_pkey PRIMARY KEY (id);-- chargetype : 1 - connection charge for DID setup, 2 - Montly charge for DID use, 3 - just wanted to charge you for extra, 4 - cactus renting charges, etc...CREATE TABLE cc_paypal ( id bigserial NOT NULL, payer_id character varying(60) default NULL, payment_date character varying(50) default NULL, txn_id character varying(50) default NULL, first_name character varying(50) default NULL, last_name character varying(50) default NULL, payer_email character varying(75) default NULL, payer_status character varying(50) default NULL, payment_type character varying(50) default NULL, memo text, item_name character varying(127) default NULL, item_number character varying(127) default NULL, quantity bigint NOT NULL default '0', mc_gross numeric(9,2) default NULL, mc_fee numeric(9,2) default NULL, tax numeric(9,2) default NULL, mc_currency character varying(3) default NULL, address_name character varying(255) NOT NULL default '', address_street character varying(255) NOT NULL default '', address_city character varying(255) NOT NULL default '', address_state character varying(255) NOT NULL default '', address_zip character varying(255) NOT NULL default '', address_country character varying(255) NOT NULL default '', address_status character varying(255) NOT NULL default '', payer_business_name character varying(255) NOT NULL default '', payment_status character varying(255) NOT NULL default '', pending_reason character varying(255) NOT NULL default '', reason_code character varying(255) NOT NULL default '', txn_type character varying(255) NOT NULL default '');ALTER TABLE ONLY cc_paypalADD CONSTRAINT cc_paypal_pkey PRIMARY KEY (id);ALTER TABLE ONLY cc_paypal ADD CONSTRAINT cons_txn_id_cc_paypal UNIQUE (txn_id); CREATE TABLE cc_voucher ( id bigserial NOT NULL, creationdate timestamp without time zone DEFAULT now(), usedate timestamp without time zone, expirationdate timestamp without time zone, voucher text NOT NULL, usedcardnumber text, tag text, credit numeric(12,4) NOT NULL, activated boolean DEFAULT true NOT NULL, used integer DEFAULT 0, currency character varying(3) DEFAULT 'USD'::character varying);ALTER TABLE ONLY cc_voucher ADD CONSTRAINT cc_voucher_pkey PRIMARY KEY (id);ALTER TABLE ONLY cc_voucher ADD CONSTRAINT cons_voucher_cc_voucher UNIQUE (voucher);CREATE TABLE cc_service ( id bigserial NOT NULL, name text NOT NULL, amount double precision NOT NULL, period integer NOT NULL DEFAULT 1, rule integer NOT NULL DEFAULT 0, daynumber integer NOT NULL DEFAULT 0, stopmode integer NOT NULL DEFAULT 0, maxnumbercycle integer NOT NULL DEFAULT 0, status integer NOT NULL DEFAULT 0, numberofrun integer NOT NULL DEFAULT 0, datecreate timestamp(0) without time zone DEFAULT now(), datelastrun timestamp(0) without time zone DEFAULT now(), emailreport text, totalcredit double precision NOT NULL DEFAULT 0, totalcardperform integer NOT NULL DEFAULT 0);ALTER TABLE ONLY cc_serviceADD CONSTRAINT cc_service_pkey PRIMARY KEY (id); CREATE TABLE cc_service_report ( id bigserial NOT NULL, cc_service_id bigserial NOT NULL, daterun timestamp(0) without time zone DEFAULT now(), totalcardperform integer, totalcredit double precision);ALTER TABLE ONLY cc_service_reportADD CONSTRAINT cc_service_report_pkey PRIMARY KEY (id);CREATE TABLE cc_callerid ( id bigserial NOT NULL, cid text NOT NULL, id_cc_card bigint NOT NULL, activated boolean DEFAULT true NOT NULL);ALTER TABLE ONLY cc_callerid ADD CONSTRAINT cc_calleridd_pkey PRIMARY KEY (id);ALTER TABLE ONLY cc_callerid ADD CONSTRAINT cc_callerid_cid_key UNIQUE (cid);CREATE TABLE cc_ui_authen ( userid bigserial NOT NULL, login text NOT NULL, "password" text NOT NULL, groupid integer, perms integer, confaddcust integer, name text, direction text, zipcode text, state text, phone text, fax text, datecreation timestamp with time zone DEFAULT now());CREATE TABLE cc_call ( id bigserial NOT NULL, sessionid text NOT NULL, uniqueid text NOT NULL, username text NOT NULL, nasipaddress text, starttime timestamp without time zone, stoptime timestamp without time zone, sessiontime integer, calledstation text, startdelay integer, stopdelay integer, terminatecause text, usertariff text, calledprovider text, calledcountry text, calledsub text, calledrate double precision, sessionbill double precision, destination text, id_tariffgroup integer, id_tariffplan integer, id_ratecard integer, id_trunk integer, sipiax integer DEFAULT 0, src text, id_did integer);CREATE TABLE cc_templatemail ( mailtype text, fromemail text, fromname text, subject text, messagetext text, messagehtml text);CREATE TABLE cc_tariffgroup ( id serial NOT NULL, iduser integer DEFAULT 0 NOT NULL, idtariffplan integer DEFAULT 0 NOT NULL, tariffgroupname text NOT NULL, lcrtype integer DEFAULT 0 NOT NULL, creationdate timestamp without time zone DEFAULT now(), removeinterprefix integer DEFAULT 0 NOT NULL);CREATE TABLE cc_tariffgroup_plan ( idtariffgroup integer NOT NULL, idtariffplan integer NOT NULL);
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -