/*
Navicat PGSQL Data Transfer

Source Server         : IWAY-Server:5432
Source Server Version : 90223
Source Host           : 10.50.1.28:5432
Source Database       : appv3
Source Schema         : public

Target Server Type    : PGSQL
Target Server Version : 90223
File Encoding         : 65001

Date: 2018-06-09 00:22:07
*/


-- ----------------------------
-- Sequence structure for "public"."account_types_id_seq"
-- ----------------------------
-- DROP SEQUENCE "public"."account_types_id_seq";
CREATE SEQUENCE "public"."account_types_id_seq"
 INCREMENT 1
 MINVALUE 1
 MAXVALUE 9223372036854775807
 START 3
 CACHE 1;

-- ----------------------------
-- Sequence structure for "public"."campaigns_id_seq"
-- ----------------------------
-- DROP SEQUENCE "public"."campaigns_id_seq";
CREATE SEQUENCE "public"."campaigns_id_seq"
 INCREMENT 1
 MINVALUE 1
 MAXVALUE 9223372036854775807
 START 1
 CACHE 1;

-- ----------------------------
-- Sequence structure for "public"."campaigns_to_plans_id_seq"
-- ----------------------------
-- DROP SEQUENCE "public"."campaigns_to_plans_id_seq";
CREATE SEQUENCE "public"."campaigns_to_plans_id_seq"
 INCREMENT 1
 MINVALUE 1
 MAXVALUE 9223372036854775807
 START 1
 CACHE 1;

-- ----------------------------
-- Sequence structure for "public"."combinations_id_seq"
-- ----------------------------
-- DROP SEQUENCE "public"."combinations_id_seq";
CREATE SEQUENCE "public"."combinations_id_seq"
 INCREMENT 1
 MINVALUE 1
 MAXVALUE 9223372036854775807
 START 9
 CACHE 1;

-- ----------------------------
-- Sequence structure for "public"."download_limits_id_seq"
-- ----------------------------
-- DROP SEQUENCE "public"."download_limits_id_seq";
CREATE SEQUENCE "public"."download_limits_id_seq"
 INCREMENT 1
 MINVALUE 1
 MAXVALUE 9223372036854775807
 START 4
 CACHE 1;

-- ----------------------------
-- Sequence structure for "public"."filter_types_id_seq"
-- ----------------------------
-- DROP SEQUENCE "public"."filter_types_id_seq";
CREATE SEQUENCE "public"."filter_types_id_seq"
 INCREMENT 1
 MINVALUE 1
 MAXVALUE 9223372036854775807
 START 4
 CACHE 1;

-- ----------------------------
-- Sequence structure for "public"."filters_id_seq"
-- ----------------------------
-- DROP SEQUENCE "public"."filters_id_seq";
CREATE SEQUENCE "public"."filters_id_seq"
 INCREMENT 1
 MINVALUE 1
 MAXVALUE 9223372036854775807
 START 6
 CACHE 1;

-- ----------------------------
-- Sequence structure for "public"."menus_id_seq"
-- ----------------------------
-- DROP SEQUENCE "public"."menus_id_seq";
CREATE SEQUENCE "public"."menus_id_seq"
 INCREMENT 1
 MINVALUE 1
 MAXVALUE 9223372036854775807
 START 1
 CACHE 1;

-- ----------------------------
-- Sequence structure for "public"."plans_id_seq"
-- ----------------------------
-- DROP SEQUENCE "public"."plans_id_seq";
CREATE SEQUENCE "public"."plans_id_seq"
 INCREMENT 1
 MINVALUE 1
 MAXVALUE 9223372036854775807
 START 7
 CACHE 1;

-- ----------------------------
-- Sequence structure for "public"."plans_to_filters_id_seq"
-- ----------------------------
-- DROP SEQUENCE "public"."plans_to_filters_id_seq";
CREATE SEQUENCE "public"."plans_to_filters_id_seq"
 INCREMENT 1
 MINVALUE 1
 MAXVALUE 9223372036854775807
 START 2
 CACHE 1;

-- ----------------------------
-- Sequence structure for "public"."profiles_id_seq"
-- ----------------------------
-- DROP SEQUENCE "public"."profiles_id_seq";
CREATE SEQUENCE "public"."profiles_id_seq"
 INCREMENT 1
 MINVALUE 1
 MAXVALUE 9223372036854775807
 START 1
 CACHE 1;

-- ----------------------------
-- Sequence structure for "public"."profiles_to_menus_id_seq"
-- ----------------------------
-- DROP SEQUENCE "public"."profiles_to_menus_id_seq";
CREATE SEQUENCE "public"."profiles_to_menus_id_seq"
 INCREMENT 1
 MINVALUE 1
 MAXVALUE 9223372036854775807
 START 1
 CACHE 1;

-- ----------------------------
-- Sequence structure for "public"."recharges_id_seq"
-- ----------------------------
-- DROP SEQUENCE "public"."recharges_id_seq";
CREATE SEQUENCE "public"."recharges_id_seq"
 INCREMENT 1
 MINVALUE 1
 MAXVALUE 9223372036854775807
 START 19
 CACHE 1;

-- ----------------------------
-- Sequence structure for "public"."speeds_id_seq"
-- ----------------------------
-- DROP SEQUENCE "public"."speeds_id_seq";
CREATE SEQUENCE "public"."speeds_id_seq"
 INCREMENT 1
 MINVALUE 1
 MAXVALUE 9223372036854775807
 START 6
 CACHE 1;

-- ----------------------------
-- Sequence structure for "public"."subscribers_id_seq"
-- ----------------------------
-- DROP SEQUENCE "public"."subscribers_id_seq";
CREATE SEQUENCE "public"."subscribers_id_seq"
 INCREMENT 1
 MINVALUE 1
 MAXVALUE 9223372036854775807
 START 15
 CACHE 1;

-- ----------------------------
-- Sequence structure for "public"."users_id_seq"
-- ----------------------------
-- DROP SEQUENCE "public"."users_id_seq";
CREATE SEQUENCE "public"."users_id_seq"
 INCREMENT 1
 MINVALUE 1
 MAXVALUE 9223372036854775807
 START 1
 CACHE 1;

-- ----------------------------
-- Sequence structure for "public"."users_to_profiles_id_seq"
-- ----------------------------
-- DROP SEQUENCE "public"."users_to_profiles_id_seq";
CREATE SEQUENCE "public"."users_to_profiles_id_seq"
 INCREMENT 1
 MINVALUE 1
 MAXVALUE 9223372036854775807
 START 1
 CACHE 1;

-- ----------------------------
-- Table structure for "public"."account_types"
-- ----------------------------
-- DROP TABLE "public"."account_types";
CREATE TABLE "public"."account_types" (
"id" int4 DEFAULT nextval('account_types_id_seq'::regclass) NOT NULL,
"name" varchar(200) NOT NULL,
"is_active" char(1) DEFAULT '1'::bpchar NOT NULL
)
WITH (OIDS=FALSE)

;

-- ----------------------------
-- Records of account_types
-- ----------------------------
INSERT INTO "public"."account_types" VALUES ('1', 'Pre - Pago', '1');
INSERT INTO "public"."account_types" VALUES ('2', 'Post - Pago', '1');
INSERT INTO "public"."account_types" VALUES ('3', 'Otro', '1');

-- ----------------------------
-- Table structure for "public"."campaigns"
-- ----------------------------
-- DROP TABLE "public"."campaigns";
CREATE TABLE "public"."campaigns" (
"id" int4 DEFAULT nextval('campaigns_id_seq'::regclass) NOT NULL,
"name" varchar(2044) NOT NULL,
"start_date" int8 NOT NULL,
"end_date" int8 NOT NULL
)
WITH (OIDS=FALSE)

;

-- ----------------------------
-- Records of campaigns
-- ----------------------------

-- ----------------------------
-- Table structure for "public"."campaigns_to_plans"
-- ----------------------------
-- DROP TABLE "public"."campaigns_to_plans";
CREATE TABLE "public"."campaigns_to_plans" (
"campaigns_id" int4 NOT NULL,
"plans_id" int4 NOT NULL,
"id" int4 DEFAULT nextval('campaigns_to_plans_id_seq'::regclass) NOT NULL
)
WITH (OIDS=FALSE)

;

-- ----------------------------
-- Records of campaigns_to_plans
-- ----------------------------

-- ----------------------------
-- Table structure for "public"."combinations"
-- ----------------------------
-- DROP TABLE "public"."combinations";
CREATE TABLE "public"."combinations" (
"filter_types_id" int4 NOT NULL,
"filters_id" int4 NOT NULL,
"id" int4 DEFAULT nextval('combinations_id_seq'::regclass) NOT NULL
)
WITH (OIDS=FALSE)

;

-- ----------------------------
-- Records of combinations
-- ----------------------------
INSERT INTO "public"."combinations" VALUES ('1', '1', '1');
INSERT INTO "public"."combinations" VALUES ('2', '2', '2');
INSERT INTO "public"."combinations" VALUES ('3', '3', '3');
INSERT INTO "public"."combinations" VALUES ('4', '4', '4');
INSERT INTO "public"."combinations" VALUES ('4', '6', '7');
INSERT INTO "public"."combinations" VALUES ('3', '6', '8');
INSERT INTO "public"."combinations" VALUES ('1', '6', '9');

-- ----------------------------
-- Table structure for "public"."download_limits"
-- ----------------------------
-- DROP TABLE "public"."download_limits";
CREATE TABLE "public"."download_limits" (
"id" int4 DEFAULT nextval('download_limits_id_seq'::regclass) NOT NULL,
"code" char(2) NOT NULL,
"value" int4 NOT NULL,
"is_active" char(1) DEFAULT '0'::bpchar NOT NULL
)
WITH (OIDS=FALSE)

;

-- ----------------------------
-- Records of download_limits
-- ----------------------------
INSERT INTO "public"."download_limits" VALUES ('1', 'GB', '3', '1');
INSERT INTO "public"."download_limits" VALUES ('2', 'GB', '4', '1');
INSERT INTO "public"."download_limits" VALUES ('3', 'GB', '5', '1');
INSERT INTO "public"."download_limits" VALUES ('4', 'GB', '10', '1');

-- ----------------------------
-- Table structure for "public"."filter_types"
-- ----------------------------
-- DROP TABLE "public"."filter_types";
CREATE TABLE "public"."filter_types" (
"id" int4 DEFAULT nextval('filter_types_id_seq'::regclass) NOT NULL,
"name" varchar(200) NOT NULL,
"is_active" char(1) DEFAULT '1'::bpchar NOT NULL
)
WITH (OIDS=FALSE)

;

-- ----------------------------
-- Records of filter_types
-- ----------------------------
INSERT INTO "public"."filter_types" VALUES ('1', 'XXX', '1');
INSERT INTO "public"."filter_types" VALUES ('2', 'RS', '1');
INSERT INTO "public"."filter_types" VALUES ('3', 'GM', '1');
INSERT INTO "public"."filter_types" VALUES ('4', 'VIDEO', '1');

-- ----------------------------
-- Table structure for "public"."filters"
-- ----------------------------
-- DROP TABLE "public"."filters";
CREATE TABLE "public"."filters" (
"id" int4 DEFAULT nextval('filters_id_seq'::regclass) NOT NULL,
"name" varchar(200) NOT NULL
)
WITH (OIDS=FALSE)

;

-- ----------------------------
-- Records of filters
-- ----------------------------
INSERT INTO "public"."filters" VALUES ('1', 'Contenido Adulto');
INSERT INTO "public"."filters" VALUES ('2', 'Redes Sociales');
INSERT INTO "public"."filters" VALUES ('3', 'Gaming');
INSERT INTO "public"."filters" VALUES ('4', 'Streaming');
INSERT INTO "public"."filters" VALUES ('6', 'Whatsapp');

-- ----------------------------
-- Table structure for "public"."master_accounts"
-- ----------------------------
-- DROP TABLE "public"."master_accounts";
CREATE TABLE "public"."master_accounts" (
"ciu" varchar(20) NOT NULL,
"first_name" varchar(2044),
"last_name" varchar(2044),
"phone" varchar(2044),
"email" varchar(2044),
"account_types_id" int4 NOT NULL,
"type_ciu" varchar(10) NOT NULL
)
WITH (OIDS=FALSE)

;

-- ----------------------------
-- Records of master_accounts
-- ----------------------------
INSERT INTO "public"."master_accounts" VALUES ('1', 'a', 'a', '1', 'qeqw@fthjty.po', '1', 'RUC');
INSERT INTO "public"."master_accounts" VALUES ('111', null, null, null, null, '1', 'RUC');
INSERT INTO "public"."master_accounts" VALUES ('123', 'tEST', 'test', '451', '123.mohts@sdf.lo', '2', 'RUC');
INSERT INTO "public"."master_accounts" VALUES ('2233', 'Raul', 'Fuentes', '987654321', 'adwerf@joiesgf.pi', '1', 'RUC');
INSERT INTO "public"."master_accounts" VALUES ('321', 'pablo', 'perez', '8890', '12wq.oi@jos.com', '2', 'RUC');
INSERT INTO "public"."master_accounts" VALUES ('43693825', null, null, null, null, '1', 'RUC');
INSERT INTO "public"."master_accounts" VALUES ('43703825', null, null, null, null, '1', 'DNI');
INSERT INTO "public"."master_accounts" VALUES ('45567678', null, null, null, null, '1', 'DNI');
INSERT INTO "public"."master_accounts" VALUES ('47179115', 'erick', 'molina', '991621274', null, '2', 'DNI');
INSERT INTO "public"."master_accounts" VALUES ('555', 'A', 'A', '1', 'eq@iyi.po', '1', 'RUC');

-- ----------------------------
-- Table structure for "public"."menus"
-- ----------------------------
-- DROP TABLE "public"."menus";
CREATE TABLE "public"."menus" (
"id" int4 DEFAULT nextval('menus_id_seq'::regclass) NOT NULL,
"name" varchar(2044) NOT NULL,
"icon" varchar(2044),
"menus_id" int4
)
WITH (OIDS=FALSE)

;

-- ----------------------------
-- Records of menus
-- ----------------------------

-- ----------------------------
-- Table structure for "public"."plans"
-- ----------------------------
-- DROP TABLE "public"."plans";
CREATE TABLE "public"."plans" (
"id" int4 DEFAULT nextval('plans_id_seq'::regclass) NOT NULL,
"code" varchar(50) NOT NULL,
"name" varchar(200) NOT NULL,
"description" text,
"valid_since" int8 NOT NULL,
"valid_to" int8 NOT NULL,
"duration" int8 NOT NULL,
"allow_recharges" char(1) DEFAULT '0'::bpchar NOT NULL,
"speed_up" int4 NOT NULL,
"speed_down" int4 NOT NULL,
"download_limits_id" int4 NOT NULL
)
WITH (OIDS=FALSE)

;

-- ----------------------------
-- Records of plans
-- ----------------------------
INSERT INTO "public"."plans" VALUES ('1', 'PLAN01', 'Plan 01', 'Plan descripción', '1527489814574', '1527489818574', '3600', '1', '1', '2', '1');
INSERT INTO "public"."plans" VALUES ('2', 'iway123', 'Promo Papa', 'Promocion del dia del padre', '1528736400000', '1529341200000', '3600', '1', '1', '1', '1');
INSERT INTO "public"."plans" VALUES ('3', '123iway', 'Promo papa', 'sdqawr', '1528736400000', '1529341200000', '3600', '0', '1', '1', '1');
INSERT INTO "public"."plans" VALUES ('4', 'iway123', 'Prop papa', 'tests padre', '1528736400000', '1529341200000', '3600', '1', '1', '1', '1');
INSERT INTO "public"."plans" VALUES ('5', 'iway123', 'plan del dia del padre', 'plan del dia del padre', '1529341200000', '1529946000000', '3600', '1', '1', '1', '1');
INSERT INTO "public"."plans" VALUES ('6', '123qwe', 'testigo', 'Plan test', '1529341200000', '1529859600000', '3600', '1', '4', '3', '3');
INSERT INTO "public"."plans" VALUES ('7', '123qwe', 'Plan app', 'Aplicativos', '1529946000000', '1530378000000', '2500', '1', '2', '5', '4');

-- ----------------------------
-- Table structure for "public"."plans_to_filters"
-- ----------------------------
-- DROP TABLE "public"."plans_to_filters";
CREATE TABLE "public"."plans_to_filters" (
"plans_id" int4 NOT NULL,
"filters_id" int4 NOT NULL,
"id" int4 DEFAULT nextval('plans_to_filters_id_seq'::regclass) NOT NULL
)
WITH (OIDS=FALSE)

;

-- ----------------------------
-- Records of plans_to_filters
-- ----------------------------
INSERT INTO "public"."plans_to_filters" VALUES ('1', '1', '1');
INSERT INTO "public"."plans_to_filters" VALUES ('1', '4', '2');

-- ----------------------------
-- Table structure for "public"."profiles"
-- ----------------------------
-- DROP TABLE "public"."profiles";
CREATE TABLE "public"."profiles" (
"id" int4 DEFAULT nextval('profiles_id_seq'::regclass) NOT NULL,
"name" varchar(2044) NOT NULL
)
WITH (OIDS=FALSE)

;

-- ----------------------------
-- Records of profiles
-- ----------------------------

-- ----------------------------
-- Table structure for "public"."profiles_to_menus"
-- ----------------------------
-- DROP TABLE "public"."profiles_to_menus";
CREATE TABLE "public"."profiles_to_menus" (
"profiles_id" int4 NOT NULL,
"menus_id" int4 NOT NULL,
"id" int4 DEFAULT nextval('profiles_to_menus_id_seq'::regclass) NOT NULL
)
WITH (OIDS=FALSE)

;

-- ----------------------------
-- Records of profiles_to_menus
-- ----------------------------

-- ----------------------------
-- Table structure for "public"."recharges"
-- ----------------------------
-- DROP TABLE "public"."recharges";
CREATE TABLE "public"."recharges" (
"id" int4 DEFAULT nextval('recharges_id_seq'::regclass) NOT NULL,
"start_date" int8 NOT NULL,
"start_hour" char(5) DEFAULT '00:00'::bpchar NOT NULL,
"end_date" int8 NOT NULL,
"end_hour" char(5) DEFAULT '00:00'::bpchar NOT NULL,
"is_finished" char(1) DEFAULT '0'::bpchar NOT NULL,
"plans_id" int4 NOT NULL,
"subscribers_id" int4 NOT NULL
)
WITH (OIDS=FALSE)

;

-- ----------------------------
-- Records of recharges
-- ----------------------------
INSERT INTO "public"."recharges" VALUES ('1', '1528131600000', '00:00', '1528135200000', '18:00', '0', '1', '1');
INSERT INTO "public"."recharges" VALUES ('2', '1529946000000', '10:13', '1529986380000', '04:13', '0', '4', '2');
INSERT INTO "public"."recharges" VALUES ('3', '1529341200000', '04:13', '1529359980000', '22:13', '0', '2', '3');
INSERT INTO "public"."recharges" VALUES ('4', '1528304400000', '15:13', '1528362780000', '09:13', '0', '5', '1');
INSERT INTO "public"."recharges" VALUES ('5', '1530291600000', '13:16', '1530342960000', '07:16', '0', '1', '4');
INSERT INTO "public"."recharges" VALUES ('6', '1528736400000', '16:13', '1528798380000', '10:13', '0', '5', '5');
INSERT INTO "public"."recharges" VALUES ('7', '1528736400000', '15:14', '1528794840000', '09:14', '0', '5', '6');
INSERT INTO "public"."recharges" VALUES ('8', '1528822800000', '10:09', '1528862940000', '04:09', '0', '5', '7');
INSERT INTO "public"."recharges" VALUES ('9', '1528131600000', '18:03', '1528200180000', '12:03', '0', '1', '8');
INSERT INTO "public"."recharges" VALUES ('10', '1528131600000', '18:03', '1528200180000', '12:03', '0', '5', '9');
INSERT INTO "public"."recharges" VALUES ('11', '1528822800000', '00:00', '1528826400000', '18:00', '0', '5', '10');
INSERT INTO "public"."recharges" VALUES ('12', '1528218000000', '13:00', '1528268400000', '07:00', '0', '5', '7');
INSERT INTO "public"."recharges" VALUES ('13', '1528304400000', '15:00', '1528362000000', '09:00', '0', '1', '7');
INSERT INTO "public"."recharges" VALUES ('14', '1528822800000', '16:16', '1528884960000', '10:16', '0', '5', '11');
INSERT INTO "public"."recharges" VALUES ('15', '1528304400000', '13:00', '1528354800000', '07:00', '0', '5', '12');
INSERT INTO "public"."recharges" VALUES ('16', '1528822800000', '15:17', '1528881420000', '09:17', '0', '5', '11');
INSERT INTO "public"."recharges" VALUES ('17', '1528304400000', '00:00', '1528306900000', '17:41', '0', '7', '13');
INSERT INTO "public"."recharges" VALUES ('18', '1528304400000', '00:00', '1528306900000', '17:41', '0', '7', '14');
INSERT INTO "public"."recharges" VALUES ('19', '1528304400000', '00:00', '1528306900000', '17:41', '0', '7', '15');

-- ----------------------------
-- Table structure for "public"."speeds"
-- ----------------------------
-- DROP TABLE "public"."speeds";
CREATE TABLE "public"."speeds" (
"id" int4 DEFAULT nextval('speeds_id_seq'::regclass) NOT NULL,
"code" char(4) NOT NULL,
"value" int4 NOT NULL,
"is_active" char(1) DEFAULT '0'::bpchar NOT NULL
)
WITH (OIDS=FALSE)

;

-- ----------------------------
-- Records of speeds
-- ----------------------------
INSERT INTO "public"."speeds" VALUES ('1', 'Mbps', '10', '1');
INSERT INTO "public"."speeds" VALUES ('2', 'Mbps', '20', '1');
INSERT INTO "public"."speeds" VALUES ('3', 'Mbps', '30', '1');
INSERT INTO "public"."speeds" VALUES ('4', 'Mbps', '50', '1');
INSERT INTO "public"."speeds" VALUES ('5', 'Mbps', '100', '1');
INSERT INTO "public"."speeds" VALUES ('6', 'Mbps', '1000', '1');

-- ----------------------------
-- Table structure for "public"."subscribers"
-- ----------------------------
-- DROP TABLE "public"."subscribers";
CREATE TABLE "public"."subscribers" (
"id" int4 DEFAULT nextval('subscribers_id_seq'::regclass) NOT NULL,
"first_name" varchar(200),
"last_name" varchar(200),
"phone" varchar(50),
"email" varchar(100),
"type_ciu" varchar(10),
"master_accounts_id" varchar(2044) NOT NULL,
"mac" varchar(12) NOT NULL,
"is_master_account" char(1) DEFAULT '1'::bpchar NOT NULL,
"ciu" varchar(20)
)
WITH (OIDS=FALSE)

;

-- ----------------------------
-- Records of subscribers
-- ----------------------------
INSERT INTO "public"."subscribers" VALUES ('1', null, null, null, null, null, '111', '123456789000', '1', null);
INSERT INTO "public"."subscribers" VALUES ('2', null, null, null, null, null, '123', '111222333444', '1', null);
INSERT INTO "public"."subscribers" VALUES ('3', null, null, null, null, null, '321', '443322116655', '1', null);
INSERT INTO "public"."subscribers" VALUES ('4', 'Rafael', 'Mijarez', '000999888777', 'qw@jo.co', 'RUC', '111', '123123123123', '0', '11112');
INSERT INTO "public"."subscribers" VALUES ('5', null, null, null, null, 'RUC', '321', '999888777666', '0', '111');
INSERT INTO "public"."subscribers" VALUES ('6', 'q', 'q', '1', 'qwqwe@oio.po', 'RUC', '123', '999888777666', '0', '222');
INSERT INTO "public"."subscribers" VALUES ('7', null, null, null, null, null, '555', '666555444333', '1', null);
INSERT INTO "public"."subscribers" VALUES ('8', null, null, null, null, null, '47179115', 'B4FBF98E9C76', '1', null);
INSERT INTO "public"."subscribers" VALUES ('9', 'erick', 'molina', null, null, 'DNI', '47179115', 'B4FBF98E9C76', '0', '471791156');
INSERT INTO "public"."subscribers" VALUES ('10', null, null, null, null, null, '1', '111222333444', '1', null);
INSERT INTO "public"."subscribers" VALUES ('11', 'ws', 'ws', '123', 'asdaw@dhj.po', 'RUC', '321', '111222333444', '0', '1112');
INSERT INTO "public"."subscribers" VALUES ('12', null, null, null, null, null, '2233', '555444666333', '1', null);
INSERT INTO "public"."subscribers" VALUES ('13', null, null, null, null, null, '43703825', '8014A8992E89', '1', null);
INSERT INTO "public"."subscribers" VALUES ('14', null, null, null, null, null, '43693825', '8014A8992E89', '1', null);
INSERT INTO "public"."subscribers" VALUES ('15', null, null, null, null, null, '45567678', 'B4FBF98E9C76', '1', null);

-- ----------------------------
-- Table structure for "public"."users"
-- ----------------------------
-- DROP TABLE "public"."users";
CREATE TABLE "public"."users" (
"id" int4 DEFAULT nextval('users_id_seq'::regclass) NOT NULL,
"username" varchar(200) NOT NULL,
"password" varchar(200) NOT NULL
)
WITH (OIDS=FALSE)

;

-- ----------------------------
-- Records of users
-- ----------------------------
INSERT INTO "public"."users" VALUES ('1', 'orange', '$2y$10$yOg0U49r45KDEqceQNW.heE0frKpPOzGslc/klt/8Ad3LnWg.0RYm');

-- ----------------------------
-- Table structure for "public"."users_to_profiles"
-- ----------------------------
-- DROP TABLE "public"."users_to_profiles";
CREATE TABLE "public"."users_to_profiles" (
"users_id" int4 NOT NULL,
"profiles_id" int4 NOT NULL,
"id" int4 DEFAULT nextval('users_to_profiles_id_seq'::regclass) NOT NULL
)
WITH (OIDS=FALSE)

;

-- ----------------------------
-- Records of users_to_profiles
-- ----------------------------

-- ----------------------------
-- Alter Sequences Owned By
-- ----------------------------
ALTER SEQUENCE "public"."account_types_id_seq" OWNED BY "account_types"."id";
ALTER SEQUENCE "public"."campaigns_id_seq" OWNED BY "campaigns"."id";
ALTER SEQUENCE "public"."campaigns_to_plans_id_seq" OWNED BY "campaigns_to_plans"."id";
ALTER SEQUENCE "public"."combinations_id_seq" OWNED BY "combinations"."id";
ALTER SEQUENCE "public"."download_limits_id_seq" OWNED BY "download_limits"."id";
ALTER SEQUENCE "public"."filter_types_id_seq" OWNED BY "filter_types"."id";
ALTER SEQUENCE "public"."filters_id_seq" OWNED BY "filters"."id";
ALTER SEQUENCE "public"."menus_id_seq" OWNED BY "menus"."id";
ALTER SEQUENCE "public"."plans_id_seq" OWNED BY "plans"."id";
ALTER SEQUENCE "public"."plans_to_filters_id_seq" OWNED BY "plans_to_filters"."id";
ALTER SEQUENCE "public"."profiles_id_seq" OWNED BY "profiles"."id";
ALTER SEQUENCE "public"."profiles_to_menus_id_seq" OWNED BY "profiles_to_menus"."id";
ALTER SEQUENCE "public"."recharges_id_seq" OWNED BY "recharges"."id";
ALTER SEQUENCE "public"."speeds_id_seq" OWNED BY "speeds"."id";
ALTER SEQUENCE "public"."subscribers_id_seq" OWNED BY "subscribers"."id";
ALTER SEQUENCE "public"."users_id_seq" OWNED BY "users"."id";
ALTER SEQUENCE "public"."users_to_profiles_id_seq" OWNED BY "users_to_profiles"."id";

-- ----------------------------
-- Primary Key structure for table "public"."account_types"
-- ----------------------------
ALTER TABLE "public"."account_types" ADD PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table "public"."campaigns"
-- ----------------------------
ALTER TABLE "public"."campaigns" ADD PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table "public"."campaigns_to_plans"
-- ----------------------------
ALTER TABLE "public"."campaigns_to_plans" ADD PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table "public"."combinations"
-- ----------------------------
ALTER TABLE "public"."combinations" ADD PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table "public"."download_limits"
-- ----------------------------
ALTER TABLE "public"."download_limits" ADD PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table "public"."filter_types"
-- ----------------------------
ALTER TABLE "public"."filter_types" ADD PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table "public"."filters"
-- ----------------------------
ALTER TABLE "public"."filters" ADD PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table "public"."master_accounts"
-- ----------------------------
ALTER TABLE "public"."master_accounts" ADD PRIMARY KEY ("ciu");

-- ----------------------------
-- Primary Key structure for table "public"."menus"
-- ----------------------------
ALTER TABLE "public"."menus" ADD PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table "public"."plans"
-- ----------------------------
ALTER TABLE "public"."plans" ADD PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table "public"."plans_to_filters"
-- ----------------------------
ALTER TABLE "public"."plans_to_filters" ADD PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table "public"."profiles"
-- ----------------------------
ALTER TABLE "public"."profiles" ADD PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table "public"."profiles_to_menus"
-- ----------------------------
ALTER TABLE "public"."profiles_to_menus" ADD PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table "public"."recharges"
-- ----------------------------
ALTER TABLE "public"."recharges" ADD PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table "public"."speeds"
-- ----------------------------
ALTER TABLE "public"."speeds" ADD PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table "public"."subscribers"
-- ----------------------------
ALTER TABLE "public"."subscribers" ADD PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table "public"."users"
-- ----------------------------
ALTER TABLE "public"."users" ADD PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table "public"."users_to_profiles"
-- ----------------------------
ALTER TABLE "public"."users_to_profiles" ADD PRIMARY KEY ("id");

-- ----------------------------
-- Foreign Key structure for table "public"."campaigns_to_plans"
-- ----------------------------
ALTER TABLE "public"."campaigns_to_plans" ADD FOREIGN KEY ("campaigns_id") REFERENCES "public"."campaigns" ("id") ON DELETE NO ACTION ON UPDATE CASCADE;
ALTER TABLE "public"."campaigns_to_plans" ADD FOREIGN KEY ("plans_id") REFERENCES "public"."plans" ("id") ON DELETE NO ACTION ON UPDATE CASCADE;

-- ----------------------------
-- Foreign Key structure for table "public"."combinations"
-- ----------------------------
ALTER TABLE "public"."combinations" ADD FOREIGN KEY ("filters_id") REFERENCES "public"."filters" ("id") ON DELETE NO ACTION ON UPDATE CASCADE;
ALTER TABLE "public"."combinations" ADD FOREIGN KEY ("filter_types_id") REFERENCES "public"."filter_types" ("id") ON DELETE NO ACTION ON UPDATE CASCADE;

-- ----------------------------
-- Foreign Key structure for table "public"."master_accounts"
-- ----------------------------
ALTER TABLE "public"."master_accounts" ADD FOREIGN KEY ("account_types_id") REFERENCES "public"."account_types" ("id") ON DELETE NO ACTION ON UPDATE CASCADE;

-- ----------------------------
-- Foreign Key structure for table "public"."menus"
-- ----------------------------
ALTER TABLE "public"."menus" ADD FOREIGN KEY ("menus_id") REFERENCES "public"."menus" ("id") ON DELETE NO ACTION ON UPDATE CASCADE;

-- ----------------------------
-- Foreign Key structure for table "public"."plans"
-- ----------------------------
ALTER TABLE "public"."plans" ADD FOREIGN KEY ("download_limits_id") REFERENCES "public"."download_limits" ("id") ON DELETE NO ACTION ON UPDATE CASCADE;
ALTER TABLE "public"."plans" ADD FOREIGN KEY ("speed_down") REFERENCES "public"."speeds" ("id") ON DELETE NO ACTION ON UPDATE CASCADE;
ALTER TABLE "public"."plans" ADD FOREIGN KEY ("speed_up") REFERENCES "public"."speeds" ("id") ON DELETE NO ACTION ON UPDATE CASCADE;

-- ----------------------------
-- Foreign Key structure for table "public"."plans_to_filters"
-- ----------------------------
ALTER TABLE "public"."plans_to_filters" ADD FOREIGN KEY ("filters_id") REFERENCES "public"."filters" ("id") ON DELETE NO ACTION ON UPDATE CASCADE;
ALTER TABLE "public"."plans_to_filters" ADD FOREIGN KEY ("plans_id") REFERENCES "public"."plans" ("id") ON DELETE NO ACTION ON UPDATE CASCADE;

-- ----------------------------
-- Foreign Key structure for table "public"."profiles_to_menus"
-- ----------------------------
ALTER TABLE "public"."profiles_to_menus" ADD FOREIGN KEY ("menus_id") REFERENCES "public"."menus" ("id") ON DELETE NO ACTION ON UPDATE CASCADE;
ALTER TABLE "public"."profiles_to_menus" ADD FOREIGN KEY ("profiles_id") REFERENCES "public"."profiles" ("id") ON DELETE NO ACTION ON UPDATE CASCADE;

-- ----------------------------
-- Foreign Key structure for table "public"."recharges"
-- ----------------------------
ALTER TABLE "public"."recharges" ADD FOREIGN KEY ("plans_id") REFERENCES "public"."plans" ("id") ON DELETE NO ACTION ON UPDATE CASCADE;
ALTER TABLE "public"."recharges" ADD FOREIGN KEY ("subscribers_id") REFERENCES "public"."subscribers" ("id") ON DELETE NO ACTION ON UPDATE CASCADE;

-- ----------------------------
-- Foreign Key structure for table "public"."subscribers"
-- ----------------------------
ALTER TABLE "public"."subscribers" ADD FOREIGN KEY ("master_accounts_id") REFERENCES "public"."master_accounts" ("ciu") ON DELETE NO ACTION ON UPDATE CASCADE;

-- ----------------------------
-- Foreign Key structure for table "public"."users_to_profiles"
-- ----------------------------
ALTER TABLE "public"."users_to_profiles" ADD FOREIGN KEY ("users_id") REFERENCES "public"."users" ("id") ON DELETE NO ACTION ON UPDATE CASCADE;
ALTER TABLE "public"."users_to_profiles" ADD FOREIGN KEY ("profiles_id") REFERENCES "public"."profiles" ("id") ON DELETE NO ACTION ON UPDATE CASCADE;
