diff --git a/2.2/Makefile b/2.2/Makefile new file mode 100644 index 0000000..e2894f9 --- /dev/null +++ b/2.2/Makefile @@ -0,0 +1,28 @@ +PROJECT = ci +DEPLOY = docker +RAILS_ENV = test +SPHINX_PATH = tmp/sphinx +BUNDLE = RAILS_ENV=${RAILS_ENV} bundle +BUNDLE_OPTIONS = -j 3 --quiet --without=development +BUNDLER_VERSION = 1.17.3 +BUILD_OPTIONS = VERBOSE=1 NO_VERBOSE_RAILS_LOGS=1 +RAKE = ${BUNDLE} exec rake + +all: test + +test: package/symlinks bundler/install project/env sphinx/env + ${BUILD_OPTIONS} ${RAKE} --trace build 2>&1 + +package/symlinks: + DEPLOY=${DEPLOY} PROJECT=${PROJECT} script/config_env + +bundler/install: + gem list -i bundler -v ${BUNDLER_VERSION} > /dev/null || gem install bundler -v ${BUNDLER_VERSION} + ${BUNDLE} install ${BUNDLE_OPTIONS} + +project/env: + mkdir -p tmp + +sphinx/env: + mkdir -p db/sphinx/test + mkdir -p db/sphinx/test/binlog diff --git a/2.2/config/amazon_s3.yml b/2.2/config/amazon_s3.yml new file mode 100644 index 0000000..f2ddc12 --- /dev/null +++ b/2.2/config/amazon_s3.yml @@ -0,0 +1,4 @@ +test: + bucket: dk_ci + access_key_id: AKIAJR44XLNRQVCSDJTQ + secret_access_key: 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 diff --git a/2.2/config/bg_executor.yml b/2.2/config/bg_executor.yml new file mode 100644 index 0000000..79ffba2 --- /dev/null +++ b/2.2/config/bg_executor.yml @@ -0,0 +1,11 @@ +--- +bg_executor: + log: "log/bg_executor.log" + environment: "test" + concurrency: 10 + queue_timeout: 300 +redis: + host: redis.dev + port: 6379 + namespace: dk_bgexecutor_ci + driver: hiredis diff --git a/2.2/config/database.yml b/2.2/config/database.yml new file mode 100644 index 0000000..481cf06 --- /dev/null +++ b/2.2/config/database.yml @@ -0,0 +1,9 @@ +test: &TEST_DB_DEFAULTS + adapter: postgresql + database: dk_ci<%= ENV['TEST_DATABASE_POSTFIX'] %> + username: docker + host: db.dev + min_messages: warning + +test_stat: + <<: *TEST_DB_DEFAULTS diff --git a/2.2/config/hosts.rb b/2.2/config/hosts.rb new file mode 100644 index 0000000..3abb4dc --- /dev/null +++ b/2.2/config/hosts.rb @@ -0,0 +1,9 @@ +# coding: utf-8 +HOST = "www.dk.dev" +HOST_SHORT = "www.dk.dev" +ASSETS_HOST = "www.dk.dev" +SITES_HOST = "site.dk.dev" +ADMIN_HOST = "admin.dk.dev" +DO_NOT_REPLY = "dk.dev " +DO_NOT_REPLY_RETURN_PATH = "noreply@dk.dev" +SUPPORT = "dk.dev " diff --git a/2.2/config/memcache.yml b/2.2/config/memcache.yml new file mode 100644 index 0000000..2486afa --- /dev/null +++ b/2.2/config/memcache.yml @@ -0,0 +1,5 @@ +test: + servers: cache.dev + namespace: dk_ci + autofix_keys: true + compress: true diff --git a/2.2/config/newrelic.yml b/2.2/config/newrelic.yml new file mode 100644 index 0000000..8e8e29e --- /dev/null +++ b/2.2/config/newrelic.yml @@ -0,0 +1,193 @@ +# +# This file configures the NewRelic RPM Agent, NewRelic RPM monitors +# Rails applications with deep visibility and low overhead. For more +# information, visit www.newrelic.com. +# +# This configuration file is custom generated for pulscen +# +# here are the settings that are common to all environments +common: &default_settings + # ============================== LICENSE KEY =============================== + + # You must specify the licence key associated with your New Relic + # account. This key binds your Agent's data to your account in the + # New Relic RPM service. + license_key: '' + + # Agent Enabled (Rails Only) + # Use this setting to force the agent to run or not run. + # Default is 'auto' which means the agent will install and run only + # if a valid dispatcher such as Mongrel is running. This prevents + # it from running with Rake or the console. Set to false to + # completely turn the agent off regardless of the other settings. + # Valid values are true, false and auto. + # agent_enabled: auto + + # Application Name + # Set this to be the name of your application as you'd like it show + # up in RPM. RPM will then auto-map instances of your application + # into a RPM "application" on your home dashboard page. If you want + # to map this instance into multiple apps, like "AJAX Requests" and + # "All UI" then specify a semicolon separated list of up to three + # distinct names. If you comment this out, it defaults to the + # capitalized RAILS_ENV (i.e., Production, Staging, etc) + app_name: dkvartal_test + + # When "true", the agent collects performance data about your + # application and reports this data to the NewRelic RPM service at + # newrelic.com. This global switch is normally overridden for each + # environment below. (formerly called 'enabled') + monitor_mode: false + + # Developer mode should be off in every environment but + # development as it has very high overhead in memory. + developer_mode: false + + # The newrelic agent generates its own log file to keep its logging + # information separate from that of your application. Specify its + # log level here. + log_level: info + + # The newrelic agent communicates with the RPM service via http by + # default. If you want to communicate via https to increase + # security, then turn on SSL by setting this value to true. Note, + # this will result in increased CPU overhead to perform the + # encryption involved in SSL communication, but this work is done + # asynchronously to the threads that process your application code, + # so it should not impact response times. + ssl: false + + # EXPERIMENTAL: enable verification of the SSL certificate sent by + # the server. This setting has no effect unless SSL is enabled + # above. This may block your application. Only enable it if the data + # you send us needs end-to-end verified certificates. + # + # This means we cannot cache the DNS lookup, so each request to the + # RPM service will perform a lookup. It also means that we cannot + # use a non-blocking lookup, so in a worst case, if you have DNS + # problems, your app may block indefinitely. + # verify_certificate: true + + # Set your application's Apdex threshold value with the 'apdex_t' + # setting, in seconds. The apdex_t value determines the buckets used + # to compute your overall Apdex score. + # Requests that take less than apdex_t seconds to process will be + # classified as Satisfying transactions; more than apdex_t seconds + # as Tolerating transactions; and more than four times the apdex_t + # value as Frustrating transactions. + # For more about the Apdex standard, see + # http://support.newrelic.com/faqs/general/apdex + + apdex_t: 1 + + # Proxy settings for connecting to the RPM server. + # + # If a proxy is used, the host setting is required. Other settings + # are optional. Default port is 8080. + # + # proxy_host: hostname + # proxy_port: 8080 + # proxy_user: + # proxy_pass: + + + # Tells transaction tracer and error collector (when enabled) + # whether or not to capture HTTP params. When true, frameworks can + # exclude HTTP parameters from being captured. + # Rails: the RoR filter_parameter_logging excludes parameters + # Java: create a config setting called "ignored_params" and set it to + # a comma separated list of HTTP parameter names. + # ex: ignored_params: credit_card, ssn, password + capture_params: true + + + # Transaction tracer captures deep information about slow + # transactions and sends this to the RPM service once a + # minute. Included in the transaction is the exact call sequence of + # the transactions including any SQL statements issued. + transaction_tracer: + + # Transaction tracer is enabled by default. Set this to false to + # turn it off. This feature is only available at the Silver and + # above product levels. + enabled: true + + # Threshold in seconds for when to collect a transaction + # trace. When the response time of a controller action exceeds + # this threshold, a transaction trace will be recorded and sent to + # RPM. Valid values are any float value, or (default) "apdex_f", + # which will use the threshold for an dissatisfying Apdex + # controller action - four times the Apdex T value. + transaction_threshold: apdex_f + + # When transaction tracer is on, SQL statements can optionally be + # recorded. The recorder has three modes, "off" which sends no + # SQL, "raw" which sends the SQL statement in its original form, + # and "obfuscated", which strips out numeric and string literals + record_sql: raw + + # Threshold in seconds for when to collect stack trace for a SQL + # call. In other words, when SQL statements exceed this threshold, + # then capture and send to RPM the current stack trace. This is + # helpful for pinpointing where long SQL calls originate from + stack_trace_threshold: 0.500 + + # Determines whether the agent will capture query plans for slow + # SQL queries. Only supported in mysql and postgres. Should be + # set to false when using other adapters. + explain_enabled: true + + # Threshold for query execution time below which query plans will not + # not be captured. Relevant only when `explain_enabled` is true. + # explain_threshold: 0.5 + + # Error collector captures information about uncaught exceptions and + # sends them to RPM for viewing + error_collector: + + # Error collector is enabled by default. Set this to false to turn + # it off. This feature is only available at the Silver and above + # product levels + enabled: true + + # Rails Only - tells error collector whether or not to capture a + # source snippet around the place of the error when errors are View + # related. + capture_source: true + + # To stop specific errors from reporting to RPM, set this property + # to comma separated values. Default is to ignore routing errors + # which are how 404's get triggered. + # + ignore_errors: ActionController::RoutingError, ActiveRecord::RecordNotFound + + # (Advanced) Uncomment this to ensure the cpu and memory samplers + # won't run. Useful when you are using the agent to monitor an + # external resource + # disable_samplers: true + + # If you aren't interested in visibility in these areas, you can disable + # the instrumentation to reduce overhead. + # + # disable_view_instrumentation: true + # disable_activerecord_instrumentation: true + # disable_memcache_instrumentation: true + # disable_dj: true + + # Certain types of instrumentation such as GC stats will not work if + # you are running multi-threaded. Please let us know. + # multi_threaded = false + +# Application Environments +# ------------------------------------------ +# Environment specific settings are in this section. +# For Rails applications, RAILS_ENV is used to determine the environment +# For Java applications, pass -Dnewrelic.environment to set +# the environment + +# NOTE if your application has other named environments, you should +# provide newrelic conifguration settings for these enviromnents here. + +test: + <<: *default_settings + monitor_mode: false diff --git a/2.2/config/redis.yml b/2.2/config/redis.yml new file mode 100644 index 0000000..9468cad --- /dev/null +++ b/2.2/config/redis.yml @@ -0,0 +1,5 @@ +test: + host: redis.dev + port: 6379 + namespace: dk_ci + driver: hiredis diff --git a/2.2/config/resque.yml b/2.2/config/resque.yml new file mode 100644 index 0000000..960fed1 --- /dev/null +++ b/2.2/config/resque.yml @@ -0,0 +1,16 @@ +redis: + host: redis.dev + port: 6379 + namespace: dk_resque_ci + driver: hiredis + +resque: + interval: 1 + verbosity: 1 + log_file: "log/resque.log" + root: /home/dk/current + +workers: + '*': + count: 1 + stop_timeout: 2700 \ No newline at end of file diff --git a/2.2/config/sphinx.yml b/2.2/config/sphinx.yml new file mode 100644 index 0000000..2f6af0a --- /dev/null +++ b/2.2/config/sphinx.yml @@ -0,0 +1,18 @@ +test: + remote: false + + address: localhost + port: 9312 + mysql41: 9308 + listen_all_interfaces: true + + max_matches: 5000 + version: 2.1.2 + mem_limit: 512M + write_buffer: 4M + attr_flush_period: 900 + read_buffer: 1M + workers: threads + + binlog_path: '' + query_log_file: /dev/null diff --git a/2.2/db/structure/dk_ci.sql b/2.2/db/structure/dk_ci.sql new file mode 100644 index 0000000..e4568f7 --- /dev/null +++ b/2.2/db/structure/dk_ci.sql @@ -0,0 +1,77860 @@ +-- +-- PostgreSQL database dump +-- + +SET statement_timeout = 0; +SET client_encoding = 'UTF8'; +SET standard_conforming_strings = on; +SET check_function_bodies = false; +SET client_min_messages = warning; + +-- +-- Name: classes; Type: SCHEMA; Schema: -; Owner: - +-- + +CREATE SCHEMA classes; + + +-- +-- Name: denormalization; Type: SCHEMA; Schema: -; Owner: - +-- + +CREATE SCHEMA denormalization; + + +-- +-- Name: export; Type: SCHEMA; Schema: -; Owner: - +-- + +CREATE SCHEMA export; + + +-- +-- Name: import; Type: SCHEMA; Schema: -; Owner: - +-- + +CREATE SCHEMA import; + + +-- +-- Name: import_full; Type: SCHEMA; Schema: -; Owner: - +-- + +CREATE SCHEMA import_full; + + +-- +-- Name: londiste; Type: SCHEMA; Schema: -; Owner: - +-- + +CREATE SCHEMA londiste; + + +-- +-- Name: mail_deliveries; Type: SCHEMA; Schema: -; Owner: - +-- + +CREATE SCHEMA mail_deliveries; + + +-- +-- Name: mail_delivery; Type: SCHEMA; Schema: -; Owner: - +-- + +CREATE SCHEMA mail_delivery; + + +-- +-- Name: permissions; Type: SCHEMA; Schema: -; Owner: - +-- + +CREATE SCHEMA permissions; + + +-- +-- Name: pgq; Type: SCHEMA; Schema: -; Owner: - +-- + +CREATE SCHEMA pgq; + + +-- +-- Name: pgq_ext; Type: SCHEMA; Schema: -; Owner: - +-- + +CREATE SCHEMA pgq_ext; + + +-- +-- Name: pgq_node; Type: SCHEMA; Schema: -; Owner: - +-- + +CREATE SCHEMA pgq_node; + + +-- +-- Name: search; Type: SCHEMA; Schema: -; Owner: - +-- + +CREATE SCHEMA search; + + +-- +-- Name: search_hints; Type: SCHEMA; Schema: -; Owner: - +-- + +CREATE SCHEMA search_hints; + + +-- +-- Name: service_box; Type: SCHEMA; Schema: -; Owner: - +-- + +CREATE SCHEMA service_box; + + +-- +-- Name: statistics; Type: SCHEMA; Schema: -; Owner: - +-- + +CREATE SCHEMA statistics; + + +-- +-- Name: system; Type: SCHEMA; Schema: -; Owner: - +-- + +CREATE SCHEMA system; + + +-- +-- Name: xls_import; Type: SCHEMA; Schema: -; Owner: - +-- + +CREATE SCHEMA xls_import; + + +-- +-- Name: plperl; Type: PROCEDURAL LANGUAGE; Schema: -; Owner: - +-- + +CREATE OR REPLACE PROCEDURAL LANGUAGE plperl; + + +-- +-- Name: plpgsql; Type: EXTENSION; Schema: -; Owner: - +-- + +CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog; + + +-- +-- Name: EXTENSION plpgsql; Type: COMMENT; Schema: -; Owner: - +-- + +COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language'; + + +-- +-- Name: hstore; Type: EXTENSION; Schema: -; Owner: - +-- + +CREATE EXTENSION IF NOT EXISTS hstore WITH SCHEMA public; + + +-- +-- Name: EXTENSION hstore; Type: COMMENT; Schema: -; Owner: - +-- + +COMMENT ON EXTENSION hstore IS 'data type for storing sets of (key, value) pairs'; + + +SET search_path = classes, pg_catalog; + +-- +-- Name: catalogue_product; Type: TYPE; Schema: classes; Owner: - +-- + +CREATE TYPE catalogue_product AS ( + id integer, + rubric_id integer, + name character varying(255), + url_name character varying(255), + announce character varying(255), + announce_valid boolean, + is_exact_price boolean, + price double precision, + price_max double precision, + currency integer, + "exists" boolean, + actualized_at timestamp(0) without time zone, + created_at timestamp(0) without time zone, + bold boolean, + img_file_name character varying(255), + img_file_name_small character varying(255), + img_file_name_medium character varying(255), + company_id integer, + company_name character varying(255), + company_city character varying(255), + company_city_region_id integer, + company_phone_code character varying(255), + company_phone_number character varying(255), + company_packet integer, + company_products_region character varying(255), + company_has_email boolean, + company_products_count integer, + company_online_store_type character varying(255), + user_id integer, + business_types integer[], + btype character varying(255), + updated_at timestamp without time zone +); + + +SET search_path = public, pg_catalog; + +-- +-- Name: company_about_state; Type: TYPE; Schema: public; Owner: - +-- + +CREATE TYPE company_about_state AS ENUM ( + 'pending', + 'accepted', + 'changed', + 'declined', + 'deleted' +); + + +-- +-- Name: company_rubric; Type: TYPE; Schema: public; Owner: - +-- + +CREATE TYPE company_rubric AS ( + company_id bigint, + rubric_id bigint +); + + +-- +-- Name: product_state; Type: TYPE; Schema: public; Owner: - +-- + +CREATE TYPE product_state AS ENUM ( + 'pending', + 'accepted', + 'changed', + 'declined', + 'deleted' +); + + +-- +-- Name: traits_sort_type; Type: TYPE; Schema: public; Owner: - +-- + +CREATE TYPE traits_sort_type AS ENUM ( + 'alphabetically', + 'popularity' +); + + +SET search_path = search, pg_catalog; + +-- +-- Name: companies_index_fieldset; Type: TYPE; Schema: search; Owner: - +-- + +CREATE TYPE companies_index_fieldset AS ( + company_id integer, + w1 character varying(255), + w2 character varying(255), + w3 character varying(255), + w4 character varying(255), + w5 character varying(255), + w6 character varying(255), + w7 character varying(255), + w8 character varying(255), + w9 character varying(255) +); + + +SET search_path = statistics, pg_catalog; + +-- +-- Name: activities_action; Type: TYPE; Schema: statistics; Owner: - +-- + +CREATE TYPE activities_action AS ENUM ( + 'default_test_hits', + 'product_order_hits', + 'company_event_register_hits' +); + + +SET search_path = export, pg_catalog; + +-- +-- Name: log_message(character varying); Type: FUNCTION; Schema: export; Owner: - +-- + +CREATE FUNCTION log_message(msg character varying) RETURNS integer + LANGUAGE plpgsql + AS $$ +BEGIN + INSERT INTO export.export_log(event_date, message) VALUES (clock_timestamp(), msg); + RETURN 1; +END; +$$; + + +-- +-- Name: queue_company_for_delete(integer); Type: FUNCTION; Schema: export; Owner: - +-- + +CREATE FUNCTION queue_company_for_delete(oferta_id integer) RETURNS void + LANGUAGE sql + AS $_$ +INSERT INTO export.sync_deleted_companies_queue(oferta_id) VALUES ($1); +$_$; + + +-- +-- Name: queue_company_for_update(integer); Type: FUNCTION; Schema: export; Owner: - +-- + +CREATE FUNCTION queue_company_for_update(company_id integer) RETURNS integer + LANGUAGE plpgsql + AS $$ +DECLARE + company RECORD; +BEGIN + SELECT * INTO company FROM companies WHERE id = company_id; + IF NOT FOUND THEN + RETURN 1; + END IF; + + IF company.state = 'deleted' THEN + RETURN export.queue_company_for_delete(company_id); + END IF; + + IF (SELECT COUNT(*) FROM export.sync_companies_queue WHERE site_id = company_id) = 0 THEN + INSERT INTO export.sync_companies_queue(site_id) VALUES (company_id); + END IF; + + RETURN 1; +END; +$$; + + +-- +-- Name: queue_product_for_delete(integer, integer); Type: FUNCTION; Schema: export; Owner: - +-- + +CREATE FUNCTION queue_product_for_delete(_oferta_sync_id integer, _oferta_firm_id integer) RETURNS void + LANGUAGE plpgsql + AS $_$ +BEGIN + INSERT INTO "export"."sync_deleted_products_queue"("oferta_sync_id", "oferta_firm_id") VALUES ($1, $2); +END; +$_$; + + +-- +-- Name: queue_product_for_update(integer); Type: FUNCTION; Schema: export; Owner: - +-- + +CREATE FUNCTION queue_product_for_update(_product_id integer) RETURNS integer + LANGUAGE plpgsql + AS $_$ +DECLARE + product RECORD; +BEGIN + SELECT * INTO product FROM products WHERE id = $1; + IF NOT FOUND THEN + RETURN 1; + END IF; + + IF product.state = 'deleted' THEN + RETURN export.queue_product_for_delete($1); + END IF; + + IF (SELECT COUNT(*) FROM "export"."sync_products_queue" WHERE product_id = $1) = 0 THEN + INSERT INTO "export"."sync_products_queue"(product_id) VALUES ($1); + END IF; + + RETURN 1; +END; +$_$; + + +-- +-- Name: queue_product_for_update(integer, boolean); Type: FUNCTION; Schema: export; Owner: - +-- + +CREATE FUNCTION queue_product_for_update(_product_id integer, _force boolean) RETURNS integer + LANGUAGE plpgsql + AS $_$ +DECLARE + product RECORD; +BEGIN + SELECT + products.*, + companies.oferta_sync_id AS company_oferta_sync_id + INTO + product + FROM + products INNER JOIN + companies ON products.company_id = companies.id + WHERE + products.id = $1; + + IF NOT FOUND THEN + RETURN 1; + END IF; + + IF product.state = 'deleted' THEN + IF product.oferta_sync_id IS NOT NULL AND product.company_oferta_sync_id IS NOT NULL THEN + PERFORM export.queue_product_for_delete(product.oferta_sync_id, product.company_oferta_sync_id); + RETURN 1; + ELSE + RETURN 1; + END IF; + END IF; + + IF (SELECT COUNT(*) FROM "export"."sync_products_queue" WHERE product_id = $1) = 0 THEN + INSERT INTO "export"."sync_products_queue"(product_id, force) VALUES ($1, $2); + ELSE + UPDATE "export"."sync_products_queue" SET force = $2 WHERE product_id = $1; + END IF; + + RETURN 1; +END; +$_$; + + +SET search_path = import, pg_catalog; + +-- +-- Name: company_first_letter_ord(character varying); Type: FUNCTION; Schema: import; Owner: - +-- + +CREATE FUNCTION company_first_letter_ord(str character varying) RETURNS smallint + LANGUAGE plpgsql + AS $$ +DECLARE + l CHAR; +BEGIN + l := substring(trim(regexp_replace(lower(str), '^[^A-Za-z0-9а-яА-ЯЁё]+', '')) from 1 for 1); + IF l = 'ё' THEN + l := 'е'; + END IF; + RETURN ascii(l); +END; +$$; + + +-- +-- Name: company_title_ordinal(character varying); Type: FUNCTION; Schema: import; Owner: - +-- + +CREATE FUNCTION company_title_ordinal(str character varying) RETURNS double precision + LANGUAGE plpgsql + AS $$ +DECLARE + _norm VARCHAR; + _max_ln SMALLINT; + i SMALLINT; + o DOUBLE PRECISION; + sym CHAR; + code SMALLINT; + norm_code SMALLINT; +BEGIN + _max_ln := 8; + _norm := regexp_replace(lower(str), '[^A-Za-z0-9а-яА-ЯЁё]', '', 'g'); + _norm := rpad(_norm, _max_ln, '.'); + + o := 0.0; + FOR i IN 1.._max_ln LOOP + sym := SUBSTRING(_norm FROM i FOR 1)::CHAR; + code := ascii(sym); + norm_code := 0; + + IF code = 46 THEN -- dot => 1 + norm_code := 1; + ELSIF code >= 48 AND code <= 57 THEN -- 0-9 => 2-11 + norm_code := code - 46; + ELSIF code >= 97 AND code <= 122 THEN -- a-z => 12-37 + norm_code := code - 85; + ELSIF code >= 1072 AND code <= 1105 THEN -- а-я + ё + IF code = 1105 THEN -- вставляем на положенное место 'ё' + code := 1078; + ELSIF code >= 1078 THEN -- остальные символы соответственно сдвигаем + code := code + 1; + END IF; + + norm_code := code - 1034; -- => 38-69 + END IF; + + o := o + norm_code * power(69, (_max_ln - i)); + END LOOP; + + RETURN o; +END; +$$; + + +-- +-- Name: import_init(); Type: FUNCTION; Schema: import; Owner: - +-- + +CREATE FUNCTION import_init() RETURNS integer + LANGUAGE plpgsql + AS $$ +BEGIN + TRUNCATE TABLE import.import_log; + + PERFORM import.log_message('Начало импорта'); + + RETURN 1; +END; +$$; + + +-- +-- Name: log_message(character varying); Type: FUNCTION; Schema: import; Owner: - +-- + +CREATE FUNCTION log_message(msg character varying) RETURNS integer + LANGUAGE plpgsql + AS $$ +BEGIN + INSERT INTO import.import_log(event_date, message) VALUES (clock_timestamp(), msg); + PERFORM system.stdout(msg); + RETURN 1; +END; +$$; + + +-- +-- Name: prerender_rubricator(); Type: FUNCTION; Schema: import; Owner: - +-- + +CREATE FUNCTION prerender_rubricator() RETURNS integer + LANGUAGE plpgsql + AS $$ +DECLARE + region_rubric RECORD; + render classes.catalogue_rubric[]; + _row classes.catalogue_rubric; +BEGIN + DELETE FROM prerendered_rubricators; + + FOR region_rubric IN SELECT * FROM rubric_statistics WHERE rubric_id IS NOT NULL LOOP + render := ARRAY[]::classes.catalogue_rubric[]; + + IF region_rubric.rubric_id > 0 THEN + IF region_rubric.products_stat > 0 THEN + FOR _row IN SELECT * FROM render_catalogue_rubricator(region_rubric.rubric_id, region_rubric.region_id) LOOP + render := render || _row; + END LOOP; + END IF; + ELSE + FOR _row IN SELECT * FROM render_catalogue_root_rubricator(region_rubric.region_id, 4) LOOP + render := render || _row; + END LOOP; + END IF; + + INSERT INTO prerendered_rubricators(rubric_id, region_id, prerendered) + VALUES (region_rubric.rubric_id, region_rubric.region_id, render); + END LOOP; + + RETURN 1; +END; +$$; + + +-- +-- Name: process_companies_rubrics(); Type: FUNCTION; Schema: import; Owner: - +-- + +CREATE FUNCTION process_companies_rubrics() RETURNS void + LANGUAGE plpgsql + AS $$ +BEGIN + PERFORM import.log_message('Очищаем company_rubrics'); + DELETE FROM company_rubrics; + -- Сбрасываем ей сиквенс, иначе со временем мы переполним integer + PERFORM setval('company_rubrics_id_seq', 1); + + PERFORM import.log_message('Заполняем company_rubrics на основе привязок товаров к рубрикам'); + INSERT INTO company_rubrics ( + company_id, + rubric_id, + parent_rubric_id, + rubric_level, + created_at, + updated_at + ) + WITH _company_rubrics AS ( + SELECT + DISTINCT company_id, rubric_id -- distinct здесь, т.к. по внутреннему массиву distinct тяжелее + FROM + ( + SELECT + p.company_id, + unnest(ARRAY[ + r.rubric_id, + r.rubric_l1_id, + r.rubric_l2_id, + r.rubric_l3_id, + r.rubric_l4_id + ]) AS rubric_id + FROM products p + INNER JOIN companies c ON p.company_id = c.id + INNER JOIN rubrics_denormalization_tree r ON p.rubric_id = r.rubric_id + WHERE + p.state NOT IN ('declined', 'deleted') AND p.is_public = true + ) _t + ) + SELECT + cr.company_id, + cr.rubric_id, + r.parent_id, + r.cached_level, + import.to_utc(clock_timestamp()), + import.to_utc(clock_timestamp()) + FROM + _company_rubrics cr + INNER JOIN + rubrics r ON r.id = cr.rubric_id; + + PERFORM import.log_message('Обновляем поле с денормализацией для привязок к рубрикам в таблице компаний'); + + UPDATE companies + SET rubrics_denorm = NULL, updated_at = import.to_utc(clock_timestamp()) + WHERE rubrics_denorm IS NOT NULL; + + UPDATE companies + SET rubrics_denorm = joined_rubrics + FROM + ( + SELECT company_id, + array_to_string(array_accum(rubric_id), ',') AS joined_rubrics + FROM + company_rubrics + GROUP BY + company_id + ) t + WHERE + companies.id = t.company_id; +END; +$$; + + +-- +-- Name: process_companies_statistics(); Type: FUNCTION; Schema: import; Owner: - +-- + +CREATE FUNCTION process_companies_statistics() RETURNS void + LANGUAGE plpgsql + AS $$ +BEGIN + DROP TABLE IF EXISTS _companies_has_products; + CREATE TEMPORARY TABLE _companies_has_products AS ( + SELECT company_id, COUNT(*) AS products_count + FROM products + WHERE state != 'deleted' AND is_public + GROUP BY company_id + ); + + CREATE INDEX "_companies_has_products_idx" ON "_companies_has_products" + USING btree ("company_id"); + + UPDATE companies c SET + products_count = f.products_count + FROM + _companies_has_products f + WHERE + c.id = f.company_id; + + DROP TABLE _companies_has_products; +END; +$$; + + +-- +-- Name: process_is_paid(); Type: FUNCTION; Schema: import; Owner: - +-- + +CREATE FUNCTION process_is_paid() RETURNS void + LANGUAGE plpgsql + AS $$ +BEGIN + UPDATE companies SET is_paid = FALSE WHERE is_paid = TRUE; + + UPDATE companies c + SET is_paid = TRUE + FROM ( + SELECT id as company_id + FROM companies + WHERE packet > 1 OR paid_till >= clock_timestamp() AT TIME ZONE 'UTC' + + UNION + + SELECT s.company_id + FROM showcases s + INNER JOIN showcase_orders so ON so.showcase_id = s.id AND so.status = 'paid' + INNER JOIN showcase_order_periods sop ON sop.showcase_order_id = so.id + WHERE + sop."year" = extract(year from clock_timestamp() AT TIME ZONE 'UTC') + AND sop."month" = extract(month from clock_timestamp() AT TIME ZONE 'UTC') + ) q + WHERE c.id = q.company_id; +END; +$$; + + +-- +-- Name: process_new_rubrics(); Type: FUNCTION; Schema: import; Owner: - +-- + +CREATE FUNCTION process_new_rubrics() RETURNS integer + LANGUAGE plpgsql + AS $_$ + BEGIN + -- + -- добавляем новые синонимы из новых рубрик + -- + + -- делаем временную таблицу + DROP TABLE IF EXISTS "_tmp_new_rubrics"; + CREATE TEMPORARY TABLE "_tmp_new_rubrics" ( + "rubric_id" INTEGER, + "synonym_id" INTEGER, + "term" TEXT + ); + + INSERT INTO _tmp_new_rubrics + SELECT * + FROM ( + -- найдём новые рубрики + WITH _new_rubrics AS ( + SELECT id, title + FROM import.vw_site_rubric r + WHERE r.id IN ( + SELECT id FROM import.vw_site_rubric WHERE target_rubric_id IS NULL + EXCEPT + SELECT id FROM rubrics WHERE is_symlink = FALSE + ) + ), + -- получить для названий термы + _terms_all_nested AS ( + SELECT + id, + search.extract_not_stemmed_terms(title) AS terms + FROM _new_rubrics + ), + -- развёртываем композитный тип в две колонки + _terms_all_unnested AS ( + SELECT + id, + (terms).word, + (terms).position + FROM _terms_all_nested + ), + -- достаем базовые формы слов + _dict AS ( + SELECT * + FROM public.search_wordforms + WHERE "form" IN ( + SELECT DISTINCT word + FROM _terms_all_unnested + WHERE word ~* '^[а-я]{3,}' + ) + ), + -- приводим термы к базовой форме + _terms_all_unnested_morphological AS ( + SELECT + t.id, + t.word, + t.position + FROM _terms_all_unnested t + LEFT JOIN _dict d ON t.word = d."form" + WHERE d.word IS NULL + ), + -- делаем все термы уникальными + _terms_unique AS ( + SELECT + id, + word, + MIN(position) AS position + FROM _terms_all_unnested_morphological + GROUP BY id, word + ), + -- поищем уже существующие слова + _rubrics_and_words AS ( + SELECT t.id rubric_id, bw.id synonym_id, t.word term + FROM _terms_unique t + LEFT JOIN public.base_words bw ON bw.name = t.word AND bw.is_deleted = FALSE + ), + -- удалить: Слово имеет синоним без привязки к рубрике, т.е. слово является базовым и имеет синоним (без привязки к рубрике) + _rubrics_words_1 AS ( + SELECT r.* + FROM _rubrics_and_words r + LEFT JOIN public.synonyms s ON s.base_id = r.synonym_id AND s.rubric_id IS NULL AND s.base_id IS NOT NULL + WHERE s.id IS NULL + ) + + SELECT * FROM _rubrics_words_1 + ) a; + + -- удалим связки по фильтру + DELETE FROM _tmp_new_rubrics + WHERE term ~ E'^[0-9]+$' OR term = 'для'; + + -- добавим новые слова + INSERT INTO public.base_words (name, created_at, updated_at) + SELECT a.term, import.to_utc(clock_timestamp()), import.to_utc(clock_timestamp()) + FROM ( + SELECT term + FROM _tmp_new_rubrics + WHERE synonym_id IS NULL + GROUP BY term + ) a; + + -- обновим synonym_id из новых слов + UPDATE _tmp_new_rubrics nr + SET synonym_id = bw.id + FROM public.base_words bw + WHERE bw.is_deleted = FALSE AND nr.synonym_id IS NULL AND nr.term = bw.name; + + -- и наконец вставляем новые связки + INSERT INTO public.synonyms (synonym_id, rubric_id, created_at, updated_at) + SELECT a.synonym_id, a.rubric_id, import.to_utc(clock_timestamp()), import.to_utc(clock_timestamp()) + FROM _tmp_new_rubrics a + LEFT JOIN public.synonyms s + ON s.rubric_id = a.rubric_id + AND s.synonym_id = a.synonym_id + AND s.base_id IS NULL + AND s.is_deleted = FALSE + AND s.state = 'all' + WHERE s.id IS NULL; + + -- почистим мусор + DROP TABLE IF EXISTS "_tmp_new_rubrics"; + + RETURN 1; + END; + $_$; + + +-- +-- Name: process_rubric_log(); Type: FUNCTION; Schema: import; Owner: - +-- + +CREATE FUNCTION process_rubric_log() RETURNS integer + LANGUAGE plpgsql + AS $$ +DECLARE + log_rec RECORD; + deleted INTEGER; + united INTEGER; + united_with_trait INTEGER; + root_rubric_id INTEGER; + parent_rubric_id INTEGER; + a_source_rubric_id INTEGER; + a_target_rubric_id INTEGER; + a_target_trait_value_id INTEGER; + a_target_trait_id INTEGER; + a_parent_id INTEGER; + a_is_prodnorm BOOLEAN; + a_is_another BOOLEAN; + a_product_target_rubric_id INTEGER; + a_trait_target_rubric_id INTEGER; + trait_products_id_current INTEGER; +BEGIN + SELECT id INTO root_rubric_id FROM import.vw_site_rubric WHERE num_left = 1 LIMIT 1; + deleted := 0; + united := 0; + united_with_trait := 0; + + PERFORM import.log_message('Начинаем обработку лога рубрикатора'); + + FOR log_rec IN SELECT * FROM "import"."vw_site_rubric_log" ORDER BY event_date ASC, oid ASC LOOP + CASE log_rec.event_type + -- Удаление рубрики + WHEN 40 THEN + -- 1. cms page rubrics + DELETE FROM cms_page_rubrics WHERE rubric_id = log_rec.rubric_id; + -- 2. news rubrics + DELETE FROM news_rubrics WHERE rubric_id = log_rec.rubric_id; + -- 3. products + WITH _updated_products AS ( + UPDATE products SET + rubric_id = NULL, + rubric_l4_priority = NULL, + rubric_l5_priority = NULL + WHERE rubric_id = log_rec.rubric_id + RETURNING id + ) + UPDATE product_properties pp SET + updated_at = NOW() at time zone 'UTC' + FROM _updated_products p + WHERE pp.product_id = p.id; + + -- 4. showcase order + -- привязываем к коренной рубрике + UPDATE showcase_orders SET rubric_id = root_rubric_id WHERE rubric_id = log_rec.rubric_id; + -- 5. company_rubrics + DELETE FROM company_rubrics WHERE rubric_id = log_rec.rubric_id; + + -- 6. synonyms + SELECT parent_id INTO parent_rubric_id FROM import.vw_site_rubric WHERE id = log_rec.rubric_id LIMIT 1; + + UPDATE synonyms + SET rubric_id = parent_rubric_id, is_changed = TRUE + WHERE rubric_id = log_rec.rubric_id; + + -- 7. wordstat_rubrics + DELETE FROM wordstat_rubrics WHERE rubric_id = log_rec.rubric_id; + + -- 9. YML + UPDATE old_online_store_products SET rubric_id = NULL WHERE rubric_id = log_rec.rubric_id; + DELETE FROM old_online_store_category_rubrics WHERE rubric_id = log_rec.rubric_id; + + -- 10. trait_rubrics + DELETE FROM trait_products WHERE product_id IN ( + SELECT id + FROM products + WHERE rubric_id = log_rec.rubric_id + ); + + DELETE FROM trait_value_redirects WHERE trait_rubric_id IN ( + SELECT id + FROM trait_rubrics + WHERE rubric_id = log_rec.rubric_id + ); + + DELETE FROM trait_rubrics WHERE rubric_id = log_rec.rubric_id; + + -- 11. blog_rubric_mappings + DELETE FROM blog_rubric_mappings WHERE rubric_id = log_rec.rubric_id; + + -- 12. Search Hints + DELETE FROM search_hints.form_rubrics WHERE rubric_id = log_rec.rubric_id; + + -- 13. snippet_rubrics + DELETE FROM snippet_rubrics WHERE rubric_id = log_rec.rubric_id; + + -- 14. seo_entities + UPDATE seo_entities + SET rubric_id = NULL + WHERE rubric_id = log_rec.rubric_id; + + deleted := deleted + 1; + + -- Merge: удаление рубрики в пользу другой рубрики + WHEN 42 THEN + -- 1. cms page rubrics + INSERT INTO cms_page_rubrics (cms_page_id, rubric_id) + SELECT + cms_page_id, CAST(log_rec.event_param AS integer) + FROM cms_page_rubrics + WHERE rubric_id IN (log_rec.rubric_id, CAST(log_rec.event_param AS integer)); + + DELETE FROM cms_page_rubrics WHERE rubric_id = log_rec.rubric_id; + + -- 2. news rubrics + INSERT INTO news_rubrics (news_id, rubric_id) + SELECT nr.news_id, CAST(log_rec.event_param AS integer) + FROM news_rubrics nr + LEFT JOIN news_rubrics nr1 ON nr1.news_id = nr.news_id AND nr1.rubric_id = CAST(log_rec.event_param AS integer) + WHERE nr.rubric_id = log_rec.rubric_id AND nr1.id IS NULL; + + DELETE FROM news_rubrics WHERE rubric_id = log_rec.rubric_id; + + -- 3. products + WITH _updated_products AS ( + UPDATE products SET + rubric_id = CAST(log_rec.event_param AS integer), + rubric_l4_priority = NULL, + rubric_l5_priority = NULL + WHERE rubric_id = log_rec.rubric_id + RETURNING id + ) + UPDATE product_properties pp SET + updated_at = NOW() at time zone 'UTC' + FROM _updated_products p + WHERE pp.product_id = p.id; + + -- 4. showcase orders + UPDATE showcase_orders SET rubric_id = CAST(log_rec.event_param AS integer) + WHERE rubric_id = log_rec.rubric_id; + + -- 5. company_rubrics + DELETE FROM company_rubrics r WHERE rubric_id = log_rec.rubric_id AND + (SELECT COUNT(*) FROM company_rubrics WHERE company_id = r.company_id AND rubric_id = CAST(log_rec.event_param AS integer)) > 0; + UPDATE company_rubrics r SET rubric_id = CAST(log_rec.event_param AS integer) + WHERE rubric_id = log_rec.rubric_id AND + (SELECT COUNT(*) FROM company_rubrics WHERE company_id = r.company_id AND rubric_id = CAST(log_rec.event_param AS integer)) = 0; + + -- 6. synonyms + -- не будем перепривязывать синонимы, которые уже есть в целевой рубрике + DELETE FROM synonyms + WHERE id IN ( + SELECT ss.id + FROM synonyms s + INNER JOIN synonyms ss ON ss.base_id = s.base_id + AND ss.synonym_id = s.synonym_id + AND ss.rubric_id = log_rec.rubric_id + AND ss.is_deleted = FALSE + WHERE + s.rubric_id = CAST(log_rec.event_param AS integer) + AND s.is_deleted = FALSE + ); + + UPDATE synonyms + SET rubric_id = CAST(log_rec.event_param AS integer), is_changed = TRUE + WHERE rubric_id = log_rec.rubric_id; + + -- 7. wordstat_rubrics + DELETE FROM wordstat_rubrics WHERE rubric_id = log_rec.rubric_id; + + -- 9. YML + UPDATE old_online_store_products SET rubric_id = CAST(log_rec.event_param AS integer) WHERE rubric_id = log_rec.rubric_id; + UPDATE old_online_store_category_rubrics SET rubric_id = CAST(log_rec.event_param AS integer) WHERE rubric_id = log_rec.rubric_id; + + -- 10 trait_rubrics + DELETE FROM trait_products WHERE product_id IN ( + SELECT id + FROM products + WHERE rubric_id = log_rec.rubric_id + ); + + -- при объединении рубрик, перепривязываем редиректы к целевым рубрикам, если характеристика привязана к целевой рубрике + UPDATE trait_value_redirects r + SET trait_rubric_id = t.new_trait_rubric_id + FROM ( + SELECT + rd.id, + rb_new.id AS new_trait_rubric_id + FROM trait_value_redirects rd + INNER JOIN trait_rubrics rb_old ON (rb_old.id = rd.trait_rubric_id) AND (rb_old.rubric_id = log_rec.rubric_id) + INNER JOIN trait_rubrics rb_new ON (rb_new.rubric_id = CAST(log_rec.event_param AS integer)) AND (rb_new.trait_id = rb_old.trait_id) + ) t + WHERE r.id = t.id; + + -- редиректы, которые привязаны к характеристикам, не имеющим привязки к целевой рубрике - удаляем + DELETE FROM trait_value_redirects WHERE trait_rubric_id IN ( + SELECT id + FROM trait_rubrics + WHERE rubric_id = log_rec.rubric_id + ); + + DELETE FROM trait_rubrics WHERE rubric_id = log_rec.rubric_id; + + -- 11. blog_rubric_mappings + UPDATE blog_rubric_mappings SET rubric_id = CAST(log_rec.event_param AS integer) WHERE rubric_id = log_rec.rubric_id; + + -- 12. перепривяжем поисковые формы подсказок к рубрикам + INSERT INTO search_hints.form_rubrics ( form_id, rubric_id ) + SELECT + form_id, + CAST(log_rec.event_param AS integer) AS rubric_id + FROM search_hints.form_rubrics + WHERE rubric_id = log_rec.rubric_id + + EXCEPT + + SELECT + form_id, + rubric_id + FROM search_hints.form_rubrics + ; + + DELETE FROM search_hints.form_rubrics WHERE rubric_id = log_rec.rubric_id; + + -- 13. snippet_rubrics + INSERT INTO snippet_rubrics (snippet_id, rubric_id) + SELECT + snippet_id, + CAST(log_rec.event_param AS integer) AS target_rubric_id + FROM snippet_rubrics + WHERE rubric_id = log_rec.rubric_id + + EXCEPT + + SELECT + snippet_id, + rubric_id + FROM snippet_rubrics; + + DELETE FROM snippet_rubrics WHERE rubric_id = log_rec.rubric_id; + + -- 14. seo_entities + UPDATE seo_entities + SET rubric_id = CAST(log_rec.event_param AS integer) + WHERE rubric_id = log_rec.rubric_id; + + united := united + 1; + + -- объединение рубрики в пользу значения характеристики + -- http://http://jira.dev.apress.ru/browse/PC4-9016 + -- + -- по этому эвенту делаем все кроме удаления рубрики: + -- перепривязку товаров + -- привязку характеристики к рубрике + -- привязку значений характеристики к товарам + -- + -- далее должно следовать событие удаления рубрики + -- event_param = 'target_rubric_id#target_trait_value_id' + -- + -- a_target_rubric_id может быть как нормативкой (обычной или another), так и не нормативкой + -- если это не нормативка, то характеристику привязываем к ней + -- если это нормативка another, то характеристику привязываем к родительской рубрике, а товары к ней + -- если это нормативка не another, то характеристику привязываем к ней, и товары к ней + WHEN 60 THEN + a_source_rubric_id := log_rec.rubric_id; + a_target_rubric_id := split_part(log_rec.event_param, '#', 1)::INTEGER; + a_target_trait_value_id := split_part(log_rec.event_param, '#', 2)::INTEGER; + + -- - берем рубрику rubric_id = a_target_rubric_id, ищем ее в новой таблице рубрик + -- - если не нашли, пишем в лог, ничего не делаем + -- - если нашли, смотрим признак is_normativka + -- - если да, то смотрим another это или нет + -- - если да, то: + -- product_rubric_id = rubric_id + -- trait_rubric_id = rubric_id.parent_id + -- - если нет, то: + -- product_rubric_id = rubric_id + -- trait_rubric_id = rubric_id + -- - если нет, то + -- product_rubric_id = rubric_id + -- trait_rubric_id = rubric_id + + -- NOTE Очень хитрый алгоритм, пропитанный логикой ПЦ, посмотреть как оно будет работать для близки. + SELECT + r.parent_id, + r.is_prodnorm, + ( r.prodnorm_new_path = 'another' ) + INTO + a_parent_id, + a_is_prodnorm, + a_is_another + FROM import.vw_site_rubric r + WHERE r.id = a_target_rubric_id + LIMIT 1; + + IF a_parent_id IS NULL THEN + PERFORM import.log_message('Указана не существующая рубрика (' || a_target_trait_value_id || '). Наверное сейчас упадем...'); + CONTINUE; + ELSIF a_is_prodnorm THEN + IF a_is_another THEN + a_product_target_rubric_id := a_target_rubric_id; + a_trait_target_rubric_id := a_parent_id; + ELSE + a_product_target_rubric_id := a_target_rubric_id; + a_trait_target_rubric_id := a_target_rubric_id; + END IF; + ELSE + a_product_target_rubric_id := a_target_rubric_id; + a_trait_target_rubric_id := a_target_rubric_id; + END IF; + + SELECT trait_id INTO a_target_trait_id + FROM trait_values + WHERE id = a_target_trait_value_id; + + -- если не найдена рубрика для перепривязки товаров a_product_target_rubric_id, + -- то отвязываем товары и спрос от рубрики + IF a_product_target_rubric_id IS NULL THEN + PERFORM import.log_message('Не найдена целевая рубрика для перепривязки товаров: ' || a_product_target_rubric_id); + END IF; + + -- добавим привязку целевой характеристики к целевой рубрике, если она еще не привязана + INSERT INTO trait_rubrics ( trait_id, rubric_id ) + SELECT a_target_trait_id, a_trait_target_rubric_id + EXCEPT + SELECT trait_id, rubric_id + FROM trait_rubrics + WHERE trait_id = a_target_trait_id + AND rubric_id = a_trait_target_rubric_id; + + SELECT id FROM trait_products ORDER BY id DESC LIMIT 1 INTO trait_products_id_current; + + -- для товаров привязаных к исходной рубрике a_source_rubric_id, + -- создадим привязки к значению характеристики a_target_trait_value_id, + -- если у товара нет ни одного значения в этой характеристике + INSERT INTO trait_products + ( trait_id, product_id, trait_value_id, is_auto ) + SELECT + a_target_trait_id, p.id, a_target_trait_value_id, true + FROM products p + LEFT JOIN trait_products tp + ON ( tp.product_id = p.id ) + AND ( tp.trait_id = a_target_trait_id ) + WHERE ( p.rubric_id = a_source_rubric_id ) + AND ( tp.id IS NULL ); + + -- добавим товары с измененными харакактеристиками, + -- в очередь для пересчета search_index_products.trait_values + INSERT INTO search_index_queue ( class_name, obj_id, created_at, updated_at ) + SELECT 'Product', product_id, NOW() at time zone 'UTC', NOW() at time zone 'UTC' + FROM trait_products WHERE id > trait_products_id_current; + + + -- сделаем остальные необходимые действия + + -- при объединении рубрик, перепривязываем редиректы к целевым рубрикам, если характеристика привязана к целевой рубрике + UPDATE trait_value_redirects r + SET trait_rubric_id = t.new_trait_rubric_id + FROM ( + SELECT + rd.id, + rb_new.id AS new_trait_rubric_id + FROM trait_value_redirects rd + INNER JOIN trait_rubrics rb_old ON (rb_old.id = rd.trait_rubric_id) AND (rb_old.rubric_id = a_source_rubric_id) + INNER JOIN trait_rubrics rb_new ON (rb_new.rubric_id = a_trait_target_rubric_id) AND (rb_new.trait_id = rb_old.trait_id) + ) t + WHERE r.id = t.id; + + -- products + WITH _updated_products AS ( + UPDATE products SET + rubric_id = a_product_target_rubric_id, + rubric_l4_priority = NULL, + rubric_l5_priority = NULL + WHERE rubric_id = a_source_rubric_id + RETURNING id + ) + UPDATE product_properties pp SET + updated_at = NOW() at time zone 'UTC' + FROM _updated_products p + WHERE pp.product_id = p.id; + + -- YML + UPDATE old_online_store_products SET rubric_id = a_product_target_rubric_id WHERE rubric_id = a_source_rubric_id; + UPDATE old_online_store_category_rubrics SET rubric_id = a_product_target_rubric_id WHERE rubric_id = a_source_rubric_id; + + united_with_trait := united_with_trait + 1; + -- Перемещение рубрики не обрабатываем + WHEN 41 THEN + END CASE; + END LOOP; + + PERFORM import.log_message('Обработано событий удаления: ' || deleted); + PERFORM import.log_message('Обработано событий объединения: ' || united); + PERFORM import.log_message('Обработано событий объединения с характеристикой: ' || united_with_trait); + PERFORM import.log_message('Обработка лога рубрикатора завершена'); + + RETURN 1; +END; +$$; + + +-- +-- Name: process_rubrics(); Type: FUNCTION; Schema: import; Owner: - +-- + +CREATE FUNCTION process_rubrics() RETURNS integer + LANGUAGE plpgsql + AS $$ +BEGIN + PERFORM import.log_message('Начинаем заливку рубрикатора'); + + PERFORM import.log_message('временная таблица для бессмертных данных из таблицы рубрик'); + CREATE TEMPORARY TABLE _rubrics_persistent_data ON COMMIT DROP AS + SELECT + id, + short_title + FROM rubrics; + + PERFORM import.log_message('Индекс на временной таблице _rubrics_persistent_data'); + CREATE INDEX "_rubrics_persistent_data_idx" ON "_rubrics_persistent_data" + USING btree ("id"); + + -- TRUNCATE нельзя, truncate блокирует всю таблицу в эксклюзивном режиме + PERFORM import.log_message('Очищаем rubrics'); + DELETE FROM rubrics; + + PERFORM import.log_message('вставляем рубрики из импорта'); + INSERT INTO rubrics ( + id, parent_id, title, + slug, joined_path, old_path, + created_at, updated_at, cached_level, + is_normativka, next_level_normativka, prefix_normativka, + synonym, lft, rgt, is_published, + is_symlink, symlink_target_id, old_id, project_list, url_name, + -- rubik's extensions + lcase_title, + genitive, dative, accusative, instrumentative, preposition, + is_plural, is_service, is_target + ) + SELECT + id, parent_id, title, + tag, + path, + old_url, + import.to_utc(created), import.to_utc(modified), lev, + is_prodnorm, next_level_prodnorm, prodnorm_prefix, + synonims, num_left, num_right, + CASE + -- прячем непубликуемые ссылки-нормативки + WHEN is_prodnorm = TRUE AND tag = 'another' THEN FALSE + WHEN + ( + (is_prodnorm = TRUE AND prodnorm_position = 2 AND is_publish = TRUE) OR + (is_prodnorm = FALSE) + ) + THEN TRUE + ELSE FALSE + END, + target_rubric_id IS NOT NULL AND target_rubric_id > 0, + target_rubric_id, + old_id, + project_list, + public.rubric_url_name(case when prodnorm_prefix is null then title else prodnorm_prefix || ' ' || title end), + -- rubik's extensions + import.rubric_low_title(prodnorm_prefix, title) AS lcase_title, + genitive, dative, accusative, instrumentative, preposition, + is_plural, is_service, is_referenceable + FROM + "import"."vw_site_rubric"; + + PERFORM import.log_message('применяем бессмертные данные'); + UPDATE rubrics + SET + short_title = _r.short_title + FROM ( + SELECT + r.id, + _rpd.short_title AS short_title + FROM + rubrics AS r + LEFT JOIN _rubrics_persistent_data AS _rpd ON _rpd.id = r.id + ) AS _r + WHERE + _r.id = rubrics.id; + + -- удаляем временную таблицу с бессмертными данными + DROP TABLE IF EXISTS _rubrics_persistent_data; + + -- обновляем корневой элемент + UPDATE rubrics SET title = 'Деловой квартал', joined_path = '/', slug = '' WHERE lft = 1; + + -- устанавливаем joined_path по логике ДК + UPDATE rubrics + SET joined_path = _rubrics.joined_path + FROM ( + SELECT + r.id, + CASE sr.id IS NOT NULL + WHEN TRUE THEN '/' || sr.id || '-' || sr.slug + ELSE '/' || r.id || '-' || r.slug + END AS joined_path + FROM rubrics r + LEFT JOIN rubrics sr ON sr.id = r.symlink_target_id + WHERE r.lft <> 1 + ) AS _rubrics + WHERE rubrics.id = _rubrics.id; + + PERFORM import.log_message('заполняем флаг-привязку is_tree_bindable'); + UPDATE rubrics r + SET is_tree_bindable = q.is_tree_bindable + FROM ( + SELECT + id, + CASE + WHEN is_normativka IS TRUE AND is_symlink IS FALSE AND is_published IS TRUE THEN TRUE + WHEN cached_level = 4 AND is_symlink IS FALSE AND is_published IS TRUE AND (SELECT COUNT(1) FROM rubrics rr WHERE rr.parent_id = rubrics.id AND rr.is_published = true) = 0 THEN TRUE + ELSE FALSE + END AS is_tree_bindable + FROM rubrics + ) q + WHERE q.id = r.id; + + PERFORM import.log_message('Заполняем денормализованное дерево'); + DELETE FROM rubrics_denormalization_tree; + INSERT INTO rubrics_denormalization_tree ( + rubric_id, + rubric_l4_id, + rubric_l3_id, + rubric_l2_id, + rubric_l1_id, + rubric_lft, + rubric_l4_lft, + rubric_l3_lft + ) + WITH leafs AS ( + SELECT id, lft, CASE WHEN cached_level = 5 THEN parent_id ELSE id END AS parent_id + FROM rubrics + WHERE (rgt - lft = 1) OR + (is_normativka = TRUE) + ), + l4 AS ( + SELECT id, lft, parent_id + FROM rubrics + WHERE cached_level = 4 + ), + l3 AS ( + SELECT id, lft, parent_id + FROM rubrics + WHERE cached_level = 3 + ), + l2 AS ( + SELECT id, lft, parent_id + FROM rubrics + WHERE cached_level = 2 + ), + l1 AS ( + SELECT id, lft, parent_id + FROM rubrics + WHERE cached_level = 1 + ) + SELECT + leafs.id AS rubric_id, + l4.id AS rubric_l4_id, + l3.id AS rubric_l3_id, + l2.id AS rubric_l2_id, + l1.id AS rubric_l1_id, + leafs.lft, + l4.lft AS rubric_l4_lft, + l3.lft AS rubric_l3_lft + FROM + leafs INNER JOIN + l4 ON leafs.parent_id = l4.id INNER JOIN + l3 ON l4.parent_id = l3.id INNER JOIN + l2 ON l3.parent_id = l2.id INNER JOIN + l1 ON l2.parent_id = l1.id + + UNION + + SELECT + l4.id, + l4.id, + l3.id, + l2.id, + l1.id, + l4.lft, + l4.lft, + l3.lft + FROM + l4 INNER JOIN + l3 ON l4.parent_id = l3.id INNER JOIN + l2 ON l3.parent_id = l2.id INNER JOIN + l1 ON l2.parent_id = l1.id; + + PERFORM import.log_message('Заливка рубрикатора завершена.'); + + PERFORM import.log_message('Обнуление флага публикации для товаров без привязок'); + UPDATE product_regions SET is_public = FALSE WHERE product_id IN ( + SELECT p.id + FROM products p + LEFT JOIN rubrics r ON p.rubric_id = r.id + WHERE p.rubric_id IS NOT NULL AND r.id IS NULL + ); + + -- обнуление несуществующих более привязок + WITH _updated_products AS ( + UPDATE products SET + rubric_id = NULL, + is_public = FALSE + WHERE id IN ( + SELECT p.id + FROM products p + LEFT JOIN rubrics r ON r.id = p.rubric_id + WHERE p.rubric_id IS NOT NULL AND r.id IS NULL + ) + RETURNING id + ) + UPDATE product_properties pp SET + updated_at = NOW() at time zone 'UTC' + FROM _updated_products p + WHERE pp.product_id = p.id; + + -- заливка редиректов + DELETE FROM rubric_redirects; + INSERT INTO rubric_redirects (rubric_id, redirect_from) + SELECT rubric_id, redirect + FROM "import"."vw_site_rubric_redirect"; + + -- заливка редиректов с рубрики на значение характеристики + DELETE FROM trait_value_redirects; + INSERT INTO trait_value_redirects ( + trait_value_id, + trait_rubric_id, + redirect_from, + created_at, + updated_at + ) + SELECT + redirects.trait_value_id, + tr.id trait_rubric_id, + redirects.redirect_from, + NOW() at time zone 'UTC', + NOW() at time zone 'UTC' + FROM "import"."vw_site_trait_value_redirects" redirects + INNER JOIN trait_values tv ON ( tv.id = redirects.trait_value_id ) + INNER JOIN trait_rubrics tr ON ( tr.trait_id = tv.trait_id ) + AND ( tr.rubric_id = redirects.rubric_id ); + + RETURN 1; +END; +$$; + + +-- +-- Name: process_rubrics_statistics(); Type: FUNCTION; Schema: import; Owner: - +-- + +CREATE FUNCTION process_rubrics_statistics() RETURNS void + LANGUAGE plpgsql + AS $$ +BEGIN + DELETE FROM rubric_statistics; + + INSERT INTO rubric_statistics(region_id, rubric_id, products_stat) + WITH _products AS ( + SELECT + products.id, + rubrics_denormalization_tree.rubric_l1_id, + rubrics_denormalization_tree.rubric_l2_id, + rubrics_denormalization_tree.rubric_l3_id, + rubrics_denormalization_tree.rubric_l4_id, + rubrics_denormalization_tree.rubric_id, + product_regions.region_id + FROM + products INNER JOIN + rubrics_denormalization_tree ON products.rubric_id = rubrics_denormalization_tree.rubric_id INNER JOIN + companies ON products.company_id = companies.id INNER JOIN + product_regions ON product_regions.product_id = products.id + WHERE + products.state NOT IN ('declined', 'deleted') AND + product_regions.is_public = TRUE + ) + SELECT region_id, rubric_id, SUM(products_stat) AS products_stat + FROM + ( + SELECT + region_id, 0 AS rubric_id, COUNT(DISTINCT id) AS products_stat + FROM + _products + GROUP BY region_id + + UNION + + SELECT + region_id, rubric_id, COUNT(DISTINCT id) + FROM + _products + WHERE + rubric_id IS NOT NULL + GROUP BY + region_id, rubric_id + + UNION + + SELECT + region_id, rubric_l1_id, COUNT(DISTINCT id) + FROM + _products + WHERE + rubric_l1_id IS NOT NULL + GROUP BY + region_id, rubric_l1_id + + UNION + + SELECT + region_id, rubric_l2_id, COUNT(DISTINCT id) + FROM + _products + WHERE + rubric_l2_id IS NOT NULL + GROUP BY + region_id, rubric_l2_id + + UNION + + SELECT + region_id, rubric_l3_id, COUNT(DISTINCT id) + FROM + _products + WHERE + rubric_l3_id IS NOT NULL + GROUP BY + region_id, rubric_l3_id + + UNION + + SELECT + region_id, rubric_l4_id, COUNT(DISTINCT id) + FROM + _products + WHERE + rubric_l4_id IS NOT NULL AND + rubric_l4_id <> rubric_id + GROUP BY + region_id, rubric_l4_id + ) statistics + GROUP BY region_id, rubric_id; + + UPDATE regions r + SET products_statistics = rs.products_stat, firms_statistics = NULL, providers_statistics = NULL + FROM ( + SELECT region_id, products_stat + FROM rubric_statistics + WHERE rubric_id = 0 + ) rs + WHERE rs.region_id = r.id; + +END; +$$; + + +-- +-- Name: process_rubrics_statistics_paid(); Type: FUNCTION; Schema: import; Owner: - +-- + +CREATE FUNCTION process_rubrics_statistics_paid() RETURNS void + LANGUAGE plpgsql + AS $$ +BEGIN + DELETE FROM rubric_statistics_paid; + + INSERT INTO rubric_statistics_paid(region_id, rubric_id, products_stat, providers_stat) + WITH _products AS ( + SELECT + products.id, + rubrics_denormalization_tree.rubric_l1_id, + rubrics_denormalization_tree.rubric_l2_id, + rubrics_denormalization_tree.rubric_l3_id, + rubrics_denormalization_tree.rubric_l4_id, + rubrics_denormalization_tree.rubric_id, + product_regions.region_id, + company_id as provider + FROM + products INNER JOIN + rubrics_denormalization_tree ON products.rubric_id = rubrics_denormalization_tree.rubric_id INNER JOIN + companies ON products.company_id = companies.id INNER JOIN + product_regions ON product_regions.product_id = products.id + WHERE + companies.packet > 1 AND + products.state < 'declined' AND + product_regions.is_public = TRUE + ) + SELECT region_id, rubric_id, SUM(products_stat) AS products_stat, SUM(providers_stat) AS providers_stat + FROM + ( + SELECT + region_id, 0 AS rubric_id, COUNT(DISTINCT id) AS products_stat, COUNT(DISTINCT provider) AS providers_stat + FROM + _products + GROUP BY region_id + + UNION + + SELECT + region_id, rubric_id, COUNT(DISTINCT id) AS products_stat, COUNT(DISTINCT provider) AS providers_stat + FROM + _products + WHERE + rubric_id IS NOT NULL + GROUP BY + region_id, rubric_id + + UNION + + SELECT + region_id, rubric_l1_id, COUNT(DISTINCT id) AS products_stat, COUNT(DISTINCT provider) AS providers_stat + FROM + _products + WHERE + rubric_l1_id IS NOT NULL + GROUP BY + region_id, rubric_l1_id + + UNION + + SELECT + region_id, rubric_l2_id, COUNT(DISTINCT id) AS products_stat, COUNT(DISTINCT provider) AS providers_stat + FROM + _products + WHERE + rubric_l2_id IS NOT NULL + GROUP BY + region_id, rubric_l2_id + + UNION + + SELECT + region_id, rubric_l3_id, COUNT(DISTINCT id) AS products_stat, COUNT(DISTINCT provider) AS providers_stat + FROM + _products + WHERE + rubric_l3_id IS NOT NULL + GROUP BY + region_id, rubric_l3_id + + UNION + + SELECT + region_id, rubric_l4_id, COUNT(DISTINCT id) AS products_stat, COUNT(DISTINCT provider) AS providers_stat + FROM + _products + WHERE + rubric_l4_id IS NOT NULL AND + rubric_l4_id <> rubric_id + GROUP BY + region_id, rubric_l4_id + ) statistics + GROUP BY region_id, rubric_id; +END; +$$; + + +-- +-- Name: process_rubrics_total_statistics(); Type: FUNCTION; Schema: import; Owner: - +-- + +CREATE FUNCTION process_rubrics_total_statistics() RETURNS void + LANGUAGE plpgsql + AS $$ +BEGIN + DELETE FROM rubrics_total_statistics; + + INSERT INTO rubrics_total_statistics(rubric_id, products_stat) + WITH _products AS ( + SELECT + products.id, + rubrics_denormalization_tree.rubric_l1_id, + rubrics_denormalization_tree.rubric_l2_id, + rubrics_denormalization_tree.rubric_l3_id, + rubrics_denormalization_tree.rubric_l4_id, + rubrics_denormalization_tree.rubric_id + FROM + products INNER JOIN + rubrics_denormalization_tree ON products.rubric_id = rubrics_denormalization_tree.rubric_id + WHERE + products.state NOT IN ('declined', 'deleted') + ) + SELECT rubric_id, products_stat + FROM + ( + SELECT + 0 AS rubric_id, COUNT(DISTINCT id) AS products_stat + FROM + _products + + UNION + + SELECT + rubric_id, COUNT(DISTINCT id) AS products_stat + FROM + _products + WHERE + rubric_id IS NOT NULL + GROUP BY + rubric_id + + UNION + + SELECT + rubric_l1_id, COUNT(DISTINCT id) AS products_stat + FROM + _products + WHERE + rubric_l1_id IS NOT NULL + GROUP BY + rubric_l1_id + + UNION + + SELECT + rubric_l2_id, COUNT(DISTINCT id) AS products_stat + FROM + _products + WHERE + rubric_l2_id IS NOT NULL + GROUP BY + rubric_l2_id + + UNION + + SELECT + rubric_l3_id, COUNT(DISTINCT id) AS products_stat + FROM + _products + WHERE + rubric_l3_id IS NOT NULL + GROUP BY + rubric_l3_id + + UNION + + SELECT + rubric_l4_id, COUNT(DISTINCT id) AS products_stat + FROM + _products + WHERE + rubric_l4_id IS NOT NULL AND + rubric_l4_id <> rubric_id + GROUP BY + rubric_l4_id + ) AS statistics + ORDER BY rubric_id; +END; +$$; + + +-- +-- Name: rubric_low_title(character varying, character varying); Type: FUNCTION; Schema: import; Owner: - +-- + +CREATE FUNCTION rubric_low_title(prefix character varying, title character varying) RETURNS character varying + LANGUAGE plpgsql IMMUTABLE + AS $$ +DECLARE + full_title varchar; + second_letter varchar; +BEGIN + full_title := COALESCE(prefix || ' ', '') || title; + second_letter := SUBSTRING(full_title from 2 for 1); + + IF second_letter = upper(second_letter) OR second_letter ~ '[0-9]+' THEN + RETURN full_title; + END IF; + + RETURN lower(SUBSTRING(full_title from 1 for 1)) || SUBSTRING(full_title from 2); +END; +$$; + + +-- +-- Name: to_utc(timestamp without time zone); Type: FUNCTION; Schema: import; Owner: - +-- + +CREATE FUNCTION to_utc(timestamp without time zone) RETURNS timestamp without time zone + LANGUAGE sql IMMUTABLE + AS $_$ +SELECT ($1 AT TIME ZONE 'YEKT') AT TIME ZONE 'UTC'; +$_$; + + +-- +-- Name: to_utc(timestamp with time zone); Type: FUNCTION; Schema: import; Owner: - +-- + +CREATE FUNCTION to_utc(timestamp with time zone) RETURNS timestamp without time zone + LANGUAGE sql IMMUTABLE + AS $_$ +SELECT ($1 AT TIME ZONE 'UTC')::TIMESTAMP WITHOUT TIME ZONE; +$_$; + + +SET search_path = import_full, pg_catalog; + +-- +-- Name: companies_mass_update(); Type: FUNCTION; Schema: import_full; Owner: - +-- + +CREATE FUNCTION companies_mass_update() RETURNS void + LANGUAGE plpgsql + AS $$ +BEGIN + PERFORM import_full.log_message('Начинаем синхронизацию компаний'); + -- предварительные действия + PERFORM import_full.log_message('Выполняем предварительные действия'); + -- 1. распарсить денормализованные поля из таблицы firm + PERFORM import_full.companies_parse_denormalized_fields(); + TRUNCATE TABLE import_full.orig_price_to_upload; + TRUNCATE TABLE import_full.new_addresses_ids; + TRUNCATE TABLE import_full.new_companies_ids; + PERFORM setval('addresses_id_seq', (SELECT MAX(id) + 1 FROM addresses)); + PERFORM setval('contacts_id_seq', (SELECT MAX(id) + 1 FROM contacts)); + PERFORM setval('company_sites_id_seq', (SELECT MAX(id) + 1 FROM company_sites)); + PERFORM setval('phones_id_seq', (SELECT MAX(id) + 1 FROM phones)); + PERFORM import_full.log_message('Закончили с предварительными ласками'); + + PERFORM import_full.log_message('Проставляем IDы для новых компаний'); + PERFORM import_full.fill_companies_new_ids(); + PERFORM import_full.log_message('IDы для новых компаний проставлены'); + + -- компании, которые надо обновлять + -- здесь отфильтровываем компании без усадеб и узнаем флаг is_new + BEGIN + DROP TABLE IF EXISTS _companies_to_update; + EXCEPTION + WHEN OTHERS THEN + END; + CREATE TEMPORARY TABLE _companies_to_update AS ( + SELECT f.oferta_id, + f.site_id, + n.oferta_id IS NOT NULL AS is_new + FROM import_full.vw_site_firm f LEFT JOIN + import_full.new_companies_ids n ON f.oferta_id = n.oferta_id + WHERE f.oferta_id IN (SELECT oferta_firm_id FROM import_full.vw_site_estate) + ); + + CREATE INDEX "_companies_to_update_idx" ON "_companies_to_update" + USING btree ("oferta_id"); + CREATE INDEX "_companies_to_update_idx2" ON "_companies_to_update" + USING btree ("site_id"); + + BEGIN + DROP TABLE IF EXISTS _companies_not_online; + EXCEPTION WHEN OTHERS THEN + END; + + CREATE TEMPORARY TABLE _companies_not_online AS ( + SELECT cou.oferta_id, cou.site_id + FROM _companies_to_update cou INNER JOIN + companies ON cou.site_id = companies.id + WHERE companies.oferta_online_flag = FALSE OR + companies.oferta_online_flag IS NULL OR + cou.is_new = TRUE + ); + + CREATE INDEX "_companies_not_online_idx" ON "_companies_not_online" + USING btree ("oferta_id"); + CREATE INDEX "_companies_not_online_idx2" ON "_companies_not_online" + USING btree ("site_id"); + + -- массовый UPDATE свойств компаний + UPDATE companies SET + ( + name, name_rest, synonym, + description, updated_at, + title_ord, first_letter_ord, + oferta_sync_id, oferta_sync_dt, + annonce, oferta_online_flag + ) = ( + firm.name, firm.opf_name, firm.alt_name, + firm.annotation, import_full.to_utc(firm.modified), + import_full.company_title_ordinal(firm.name), + import_full.company_first_letter_ord(firm.name), + firm.oferta_id, import_full.to_utc(now()), + substring(firm.annotation from 1 for 250), + firm.is_online_edit + ) + FROM + _companies_not_online cou INNER JOIN + import_full.vw_site_firm firm ON cou.oferta_id = firm.oferta_id + WHERE + companies.id = firm.site_id; + + -- обновление описаний + UPDATE company_abouts SET + (announce, content, state, updated_at) = + (NULL, firm.annotation, 'accepted', import_full.to_utc(now())) + FROM + _companies_not_online cno INNER JOIN + import_full.vw_site_firm firm ON cno.oferta_id = firm.oferta_id + WHERE + company_abouts.company_id = firm.site_id; + + -- добавить описания, которых не было + INSERT INTO company_abouts (company_id, announce, content, state, created_at, updated_at) + SELECT + firm.site_id, NULL, firm.annotation, 'accepted', import_full.to_utc(now()), import_full.to_utc(now()) + FROM + _companies_not_online cno INNER JOIN + import_full.vw_site_firm firm ON cno.oferta_id = firm.oferta_id LEFT JOIN + company_abouts ON firm.site_id = company_abouts.company_id + WHERE + company_abouts.id IS NULL; + + -- ставим в очередь на заливку (или удаление) прайса компании + INSERT INTO import_full.orig_price_to_upload (firm_id, to_delete) + SELECT f.oferta_id, NOT f.has_original_price + FROM _companies_not_online cou INNER JOIN + import_full.vw_site_firm f ON cou.oferta_id = f.oferta_id; + + -- то же самое с логотипами + INSERT INTO import_full.logo_to_upload (firm_id, to_delete) + SELECT f.oferta_id, NOT f.has_logo + FROM _companies_not_online cou INNER JOIN + import_full.vw_site_firm f ON cou.oferta_id = f.oferta_id; + + -- удалить сайты + DELETE FROM company_sites WHERE company_id IN ( + SELECT site_id FROM _companies_not_online + ); + -- залить сайты + INSERT INTO company_sites(company_id, url, position) + SELECT companies.id, + 'http://' || of.url, + --of.oid + ROW_NUMBER() OVER (PARTITION BY companies.id ORDER BY of.oid ASC) + FROM companies INNER JOIN + _companies_not_online cou ON companies.id = cou.site_id INNER JOIN + import_full.vw_site_firm_site of ON cou.oferta_id = of.oferta_firm_id; + + -- запомнить IDы усадеб во временную таблицу + BEGIN + DROP TABLE IF EXISTS _old_addresses_ids; + EXCEPTION WHEN OTHERS THEN + END; + + CREATE TEMPORARY TABLE _old_addresses_ids AS ( + SELECT companies.id AS company_id, + addresses.id AS address_id, + addresses.position + FROM addresses INNER JOIN + companies ON addresses.company_id = companies.id INNER JOIN + _companies_not_online cou ON companies.id = cou.site_id + ); + -- удалить старые данные + DELETE FROM phones WHERE address_id IN ( + SELECT id FROM addresses WHERE company_id IN ( + SELECT site_id FROM _companies_not_online + ) + ); + DELETE FROM contacts WHERE address_id IN ( + SELECT id FROM addresses WHERE company_id IN ( + SELECT site_id FROM _companies_not_online + ) + ); + DELETE FROM addresses WHERE company_id IN ( + SELECT site_id + FROM _companies_not_online + ); + -- залить адреса + INSERT INTO addresses ( + id, company_id, name, city_id, street_id, + created_at, updated_at, estate, building, comments, + position, oferta_sync_id) + SELECT COALESCE(o.address_id, nextval('addresses_id_seq')::regclass), + companies.id, + e.name, + e.city_id, + e.street_id, + import_full.to_utc(clock_timestamp()), + import_full.to_utc(clock_timestamp()), + e.house, + e.letter, + e.address_other, + --e.oid, + row_number() OVER (PARTITION BY companies.id ORDER BY e.oid), + e.id + FROM import_full.vw_site_estate e INNER JOIN + _companies_not_online cou ON e.oferta_firm_id = cou.oferta_id INNER JOIN + companies ON cou.site_id = companies.id LEFT JOIN + _old_addresses_ids o ON (o.company_id = cou.site_id AND o.position = e.oid) + WHERE e.oferta_firm_id IN (SELECT oferta_id FROM _companies_not_online); + + DELETE FROM phones WHERE address_id IN ( + SELECT DISTINCT addresses.id + FROM import_full.vw_site_estate_phone p INNER JOIN + import_full.vw_site_estate e ON p.estate_id = e.id INNER JOIN + addresses ON e.id = addresses.oferta_sync_id INNER JOIN + _companies_not_online cou ON e.oferta_firm_id = cou.oferta_id INNER JOIN + companies ON cou.site_id = companies.id + ); + + -- залить телефоны + INSERT INTO phones(code, number, address_id, type_id, comment, created_at, updated_at, position) + SELECT p.prefix, p.phone, addresses.id, p.phone_type, p.comm, + import_full.to_utc(clock_timestamp()) AS created_at, + import_full.to_utc(clock_timestamp()) AS updated_at, + p.oid + FROM import_full.vw_site_estate_phone p INNER JOIN + import_full.vw_site_estate e ON p.estate_id = e.id INNER JOIN + addresses ON e.id = addresses.oferta_sync_id INNER JOIN + _companies_not_online cou ON e.oferta_firm_id = cou.oferta_id INNER JOIN + companies ON cou.site_id = companies.id /*LEFT JOIN + phones ON ( + phones.address_id = addresses.id AND + phones.code = p.prefix AND + phones.number = p.phone AND + phones.type_id = p.phone_type + )*/ + WHERE (length(p.prefix) + length(p.phone)) = 10 AND + e.oferta_firm_id IN (SELECT oferta_id FROM _companies_not_online) /*AND + phones.id IS NULL*/; + + DELETE FROM contacts WHERE address_id IN ( + SELECT DISTINCT addresses.id + FROM import_full.vw_site_estate_contact c INNER JOIN + import_full.vw_site_estate e ON c.estate_id = e.id INNER JOIN + addresses ON e.id = addresses.oferta_sync_id INNER JOIN + _companies_not_online cou ON e.oferta_firm_id = cou.oferta_id INNER JOIN + companies ON cou.site_id = companies.id + ); + + -- электронные контакты + INSERT INTO contacts(contact_type_id, address_id, value, created_at, updated_at, position, published) + SELECT c.contact_type - 1, addresses.id, c.value, + import_full.to_utc(clock_timestamp()), import_full.to_utc(clock_timestamp()), c.oid, + c.contact_type <> 3 + FROM import_full.vw_site_estate_contact c INNER JOIN + import_full.vw_site_estate e ON c.estate_id = e.id INNER JOIN + addresses ON e.id = addresses.oferta_sync_id INNER JOIN + _companies_not_online cou ON e.oferta_firm_id = cou.oferta_id INNER JOIN + companies ON cou.site_id = companies.id + WHERE c.contact_type IN (3,4,6) ; + + -- привязки к регионам + DELETE FROM company_regions WHERE company_id IN ( + SELECT cou.site_id + FROM _companies_not_online cou INNER JOIN + companies ON companies.id = cou.site_id + ); + + INSERT INTO company_regions (company_id, region_id, department_id, created_at, updated_at) + SELECT * FROM + ( + SELECT DISTINCT + c.id AS company_id, p.region_id, + ( + SELECT ad.id FROM + addresses ad + INNER JOIN cities cii ON ad.city_id = cii.id + INNER JOIN provinces prov ON cii.province_id = prov.id + WHERE + ad.company_id = c.id AND + prov.region_id = p.region_id + ORDER BY position ASC + LIMIT 1 + ) AS department_id, NOW(), NOW() + FROM + companies c + INNER JOIN addresses a ON a.company_id = c.id + INNER JOIN cities ci ON a.city_id = ci.id + INNER JOIN provinces p ON ci.province_id = p.id + UNION + SELECT + c.id AS company_id, roots.id AS region_id, + ( + SELECT ad.id + FROM + addresses ad + INNER JOIN cities cii ON ad.city_id = cii.id + INNER JOIN provinces prov ON cii.province_id = prov.id + WHERE + prov.region_id IN + ( + SELECT rr.id FROM regions rr WHERE + (rr.rgt - rr.lft) = 1 AND + rr.id != root_region.id AND + rr.lft >= root_region.lft AND + rr.rgt <= root_region.rgt + ) AND + ad.company_id = c.id + ORDER BY ad.position + LIMIT 1 + ) AS department_id, NOW(), NOW() + FROM + companies c + INNER JOIN addresses a ON a.company_id = c.id + INNER JOIN cities ci ON a.city_id = ci.id + INNER JOIN provinces p ON ci.province_id = p.id + INNER JOIN regions r ON p.region_id = r.id + INNER JOIN + ( + SELECT + r.id AS child_id, r.name, + ( + SELECT rr.id FROM regions rr + WHERE rr.lft <= r.lft AND rr.rgt >= r.rgt + ORDER BY rr.lft LIMIT 1 + ) AS id + FROM + regions r + WHERE (r.rgt - r.lft) = 1 + ) roots ON r.id = roots.child_id + INNER JOIN regions AS root_region ON roots.id = root_region.id + ) sub + WHERE + company_id IN ( + SELECT site_id + FROM _companies_not_online + ); + + -- залить привязки к типам деятельности + DELETE FROM company_business_types WHERE company_id IN ( + SELECT site_id + FROM _companies_not_online + ); + INSERT INTO company_business_types(company_id, business_type_id, created_at, updated_at) + SELECT companies.id, b.business_type_id, + import_full.to_utc(clock_timestamp()), import_full.to_utc(clock_timestamp()) + FROM _companies_not_online cou INNER JOIN + companies ON companies.id = cou.site_id INNER JOIN + import_full.vw_site_firm_business b ON cou.oferta_id = b.firm_id; + + ---------------------------------------------------------------------------------------- + -- залить коммерческие регионы + DELETE FROM company_region_commercials WHERE company_id IN ( + SELECT cou.site_id + FROM _companies_to_update cou INNER JOIN + import_full.vw_site_firm f ON cou.oferta_id = f.oferta_id + WHERE f.package IS NOT NULL + ); + + INSERT INTO company_region_commercials ( + company_id, + region_id, + department_id, + is_bold, + print_limit, + created_at, + updated_at + ) + SELECT DISTINCT ON (f.site_id, att.region_id) + f.site_id, + att.region_id, + first_addresses.id AS department_id, + att.is_bold, + att.print_limit, + import_full.to_utc(clock_timestamp()), + import_full.to_utc(clock_timestamp()) + FROM + import_full.companies_regions_attributes att INNER JOIN + import_full.vw_site_firm f ON att.firm_id = f.oferta_id INNER JOIN + companies ON f.site_id = companies.id INNER JOIN + addresses first_addresses ON (first_addresses.company_id = companies.id AND first_addresses.position = 1) + WHERE + f.oferta_id IN (SELECT oferta_id FROM _companies_to_update) AND + f.package IS NOT NULL + ORDER BY + f.site_id, att.region_id, + first_addresses.position, + first_addresses.updated_at DESC, + att.is_bold DESC, + att.print_limit DESC; + + UPDATE company_region_commercials SET department_id = addresses.id + FROM + companies INNER JOIN + addresses ON (addresses.company_id = companies.id AND addresses.position = 1) + WHERE + company_region_commercials.id IN ( + SELECT company_region_commercials.id + FROM company_region_commercials LEFT JOIN + addresses ON company_region_commercials.department_id = addresses.id + WHERE addresses.id IS NULL + ) AND company_region_commercials.company_id = companies.id; + + -- + PERFORM import_full.log_message('Синхронизировать коммерческие привязки с привязками регионов у товаров'); + -- удаление лишних привязок к регионам у товаров + DELETE FROM product_regions + WHERE id IN ( + SELECT pr.id + FROM products_import p + INNER JOIN product_regions pr ON pr.product_id = p.id + LEFT JOIN company_region_commercials cr ON cr.company_id = p.company_id AND cr.region_id = pr.region_id + WHERE + p.company_id IN (SELECT site_id FROM _companies_to_update cou INNER JOIN companies c ON c.id = cou.site_id WHERE c.is_pricelist_online = TRUE) + AND cr.id IS NULL + ); + -- + -- добавление недостающих привязок к регионам у товаров + INSERT INTO product_regions (product_id, region_id, is_printable, is_public, created_at, updated_at) + SELECT * + FROM ( + WITH _products AS ( + SELECT p.id product_id, array_agg(DISTINCT pr.region_id) r_prod, MAX(p.company_id) company_id, bool_or(pr.is_public) is_public + FROM products_import p + INNER JOIN _companies_to_update cou ON cou.site_id = p.company_id + INNER JOIN companies c ON c.id = cou.site_id + INNER JOIN product_regions pr ON pr.product_id = p.id + WHERE c.is_pricelist_online = TRUE + GROUP BY p.id + ) + SELECT p.product_id, cr.region_id, false as is_printable, p.is_public, import_full.to_utc(clock_timestamp()) created_at, import_full.to_utc(clock_timestamp()) updated_at + FROM _products p + INNER JOIN company_region_commercials cr ON cr.company_id = p.company_id + WHERE (cr.region_id = ANY(p.r_prod)) IS FALSE + ) a; + + ---------------------------------------------------------------------------------------- + -- Установить регион первого офиса + UPDATE companies c + SET main_region_id = q.region_id + FROM ( + SELECT a.company_id, p.region_id + FROM _companies_not_online cou + INNER JOIN import.vw_site_firm firm ON cou.oferta_id = firm.oferta_id + INNER JOIN addresses a ON a.company_id = firm.site_id AND a.position = 1 + INNER JOIN cities ct ON ct.id = a.city_id + INNER JOIN provinces p ON p.id = ct.province_id + ) q + WHERE q.company_id = c.id; + + ---------------------------------------------------------------------------------------- + -- Если уменьшился лимит: + -- Если товаров, публикуемых на портале больше, чем положено по лимиту, + -- отсортировать их все по рубрикатору, потом по алфавиту и оставить отметки только у первых Х товаров, где Х - лимит + BEGIN + DROP TABLE IF EXISTS _unpublic_products; + EXCEPTION + WHEN OTHERS THEN + END; + + CREATE TEMPORARY TABLE _unpublic_products AS ( + SELECT q.product_id + FROM ( + WITH _companies_with_lt_limits AS ( + SELECT companies.id company_id, f.inet_limit new_products_limit, companies.products_limit + FROM _companies_to_update cou + INNER JOIN import_full.vw_site_firm f ON cou.oferta_id = f.oferta_id + INNER JOIN companies ON companies.id = cou.site_id + WHERE f.inet_limit < companies.products_limit + ), + _counted_products AS ( + SELECT p.id product_id, p.company_id, row_number() OVER (PARTITION BY p.company_id ORDER BY p.rubric_l4_priority DESC, p.rubric_l5_priority DESC, rubrics.lft ASC, p.name) n + FROM products_import p + INNER JOIN _companies_with_lt_limits c ON c.company_id = p.company_id + LEFT JOIN rubrics ON rubrics.id = p.rubric_id + WHERE p.is_public = TRUE + ) + + SELECT cp.product_id + FROM _companies_with_lt_limits c + INNER JOIN _counted_products cp ON cp.company_id = c.company_id AND cp.n > c.new_products_limit + ) q + ); + + UPDATE product_regions + SET is_public = FALSE + WHERE product_id IN ( + SELECT product_id FROM _unpublic_products + ); + + UPDATE products_import + SET is_public = FALSE + WHERE id IN ( + SELECT product_id FROM _unpublic_products + ); + + DROP TABLE _unpublic_products; + + -- для всех компаний обновляем пакет, лимит и дату модификации из оферты + UPDATE companies + SET + packet = COALESCE(f.package, packet), + oferta_modified_at = f.modified, + products_limit = COALESCE(f.inet_limit, products_limit), + products_region_id = COALESCE(f.main_area_id, products_region_id) + FROM + _companies_to_update cou + INNER JOIN + import_full.vw_site_firm f ON cou.oferta_id = f.oferta_id + WHERE + companies.id = cou.site_id; + + -- обновляем поле regions + -- (денормализация для географической привязки к регионам) + UPDATE companies + SET regions = joined_regions + FROM ( + SELECT company_id, + array_to_string(array_accum(region_id), ',') AS joined_regions + FROM + company_regions + GROUP BY + company_id + ) t + WHERE + companies.id = t.company_id; + + + -- обновляем поле regions_with_comm + -- (денормализация для географической привязки к регионам + коммерческая привязка) + UPDATE companies + SET regions_with_comm = joined_regions + FROM ( + SELECT a.company_id, array_to_string(array_accum(DISTINCT a.region_id), ',') AS joined_regions + FROM ( + SELECT company_id, region_id + FROM company_regions + UNION + SELECT company_id, region_id + FROM company_region_commercials + ) a + GROUP BY a.company_id + ) t + WHERE + companies.id = t.company_id; + + -- обновляем флаг has_email + UPDATE companies SET has_email = TRUE WHERE id IN + (SELECT DISTINCT a.company_id + FROM + contacts c INNER JOIN + addresses a ON c.address_id = a.id + WHERE + c.contact_type_id = 2 + ); + + -- если нам не пришёл основной регион, то берём его из первого адреса + UPDATE companies c + SET products_region_id = q.region_id + FROM ( + SELECT companies.id, provinces.region_id + FROM companies + INNER JOIN addresses a ON a.company_id = companies.id AND a.position = 1 + INNER JOIN cities ON cities.id = a.city_id + INNER JOIN provinces ON provinces.id = cities.province_id + WHERE companies.products_region_id IS NULL + ) q + WHERE q.id = c.id; + + -- ставим в очередь на индексирование + INSERT INTO search_index_queue(obj_id, class_name) + SELECT site_id, 'Company' + FROM _companies_to_update; + + DROP TABLE _companies_not_online; + DROP TABLE _old_addresses_ids; + DROP TABLE _companies_to_update; +END; +$$; + + +-- +-- Name: companies_parse_denormalized_fields(); Type: FUNCTION; Schema: import_full; Owner: - +-- + +CREATE FUNCTION companies_parse_denormalized_fields() RETURNS integer + LANGUAGE plpgsql + AS $$ +DECLARE + company RECORD; +BEGIN + PERFORM import_full.log_message('Начинаем заполнение таблицы companies_regions_attributes'); + TRUNCATE TABLE import_full.companies_regions_attributes; + + PERFORM import_full.log_message('Заполняем жирность и лимиты для регионов из оферты'); + INSERT INTO import_full.companies_regions_attributes + SELECT + firm_id, + matches[1]::int4 AS region_id, + matches[2]::int4 AS print_limit, + matches[3]::boolean AS is_bold + FROM ( + SELECT + oferta_id AS firm_id, + regexp_matches(area_link, '([0-9]+)=([0-9]+),(0|1)', 'g') AS matches + FROM + import_full.vw_site_firm + ) _t; + + PERFORM import_full.log_message('Заполняем жирность и лимиты для родительских регионов'); + INSERT INTO import_full.companies_regions_attributes + SELECT + _t.firm_id, + _t.region_id, + MAX(_t.print_limit) AS print_limit, + MAX(CASE WHEN _t.is_bold THEN 1 ELSE 0 END)::boolean AS is_bold + FROM ( + SELECT + a.firm_id, + (SELECT id FROM regions WHERE + lft < (SELECT lft FROM regions WHERE id = a.region_id) AND + rgt > (SELECT rgt FROM regions WHERE id = a.region_id) + ORDER BY lft ASC LIMIT 1) AS region_id, + a.print_limit, + a.is_bold + FROM + import_full.companies_regions_attributes a + ) _t + WHERE + _t.region_id IS NOT NULL + GROUP BY _t.firm_id, _t.region_id; + PERFORM import_full.log_message('Таблица companies_regions_attributes заполнена'); + + -- + -- + + PERFORM import_full.log_message('Заполняем таблицу companies_regions'); + TRUNCATE TABLE import_full.companies_regions; + + INSERT INTO import_full.companies_regions (company_id, region_id) + SELECT DISTINCT + c.oferta_id AS company_id, p.region_id + FROM + import_full.vw_site_firm c + INNER JOIN import_full.vw_site_estate a ON a.oferta_firm_id = c.oferta_id + INNER JOIN cities ci ON a.city_id = ci.id + INNER JOIN provinces p ON ci.province_id = p.id + UNION + SELECT + c.oferta_id AS company_id, roots.id AS region_id + FROM + import_full.vw_site_firm c + INNER JOIN import_full.vw_site_estate a ON a.oferta_firm_id = c.oferta_id + INNER JOIN cities ci ON a.city_id = ci.id + INNER JOIN provinces p ON ci.province_id = p.id + INNER JOIN regions r ON p.region_id = r.id + INNER JOIN + ( + SELECT + r.id AS child_id, r.name, + ( + SELECT rr.id FROM regions rr + WHERE rr.lft <= r.lft AND rr.rgt >= r.rgt + ORDER BY rr.lft LIMIT 1 + ) AS id + FROM + regions r + WHERE (r.rgt - r.lft) = 1 + ) roots ON r.id = roots.child_id + INNER JOIN regions AS root_region ON roots.id = root_region.id; + + PERFORM import_full.log_message('Таблица companies_regions заполнена'); + + RETURN 1; +END; +$$; + + +-- +-- Name: company_first_letter_ord(character varying); Type: FUNCTION; Schema: import_full; Owner: - +-- + +CREATE FUNCTION company_first_letter_ord(str character varying) RETURNS smallint + LANGUAGE plpgsql + AS $$ +DECLARE + l CHAR; +BEGIN + l := substring(trim(lower(str)) from 1 for 1); + IF l = 'ё' THEN + l := 'е'; + END IF; + RETURN ascii(l); +END; +$$; + + +-- +-- Name: company_title_ordinal(character varying); Type: FUNCTION; Schema: import_full; Owner: - +-- + +CREATE FUNCTION company_title_ordinal(str character varying) RETURNS double precision + LANGUAGE plpgsql + AS $$ +DECLARE + _norm VARCHAR; + i SMALLINT; + o DOUBLE PRECISION; + sym CHAR; + code SMALLINT; + norm_code SMALLINT; +BEGIN + _norm := substring(regexp_replace(lower(str), '[^A-Za-z0-9а-яА-ЯЁё]', '', 'g') from 1 for 8); + o := 0.0; + FOR i IN 1..length(_norm) LOOP + sym := SUBSTRING(_norm FROM i FOR 1)::CHAR; + code := ascii(sym); + norm_code := 0; + + IF code >= 48 AND code <= 57 THEN -- 0-9 + norm_code := code - 47; + END IF; + IF code >= 97 AND code <= 122 THEN -- a-z + norm_code := code - (96 - 9); + END IF; + IF code >= 1072 AND code <= 1105 THEN -- а-я + ё + IF code = 1105 THEN -- ё имеет код больший, чем я, это плохо + code := 1078; + ELSIF code > 1077 THEN + code := code + 1; + END IF; + norm_code := code - (1071 - 35); + END IF; + + o := o + norm_code * power(68, (9 - i)); + END LOOP; + + RETURN o; +END; +$$; + + +-- +-- Name: copy_products_table(); Type: FUNCTION; Schema: import_full; Owner: - +-- + +CREATE FUNCTION copy_products_table() RETURNS integer + LANGUAGE plpgsql + AS $$ + DECLARE prod_t character varying(255); + DECLARE max_id integer; +BEGIN + -- временное уникальное имя таблицы + EXECUTE 'SELECT import_full.get_products_table_name()' INTO prod_t; + + PERFORM import_full.log_message('Копируем products в таблицу ' || prod_t); + BEGIN + DROP TABLE IF EXISTS products_old; + EXCEPTION + WHEN OTHERS THEN + END; + + BEGIN + DROP TABLE IF EXISTS products_import; + EXCEPTION + WHEN OTHERS THEN + END; + + PERFORM import_full.log_message('создаем копию products'); + EXECUTE 'CREATE TABLE '||prod_t||' (LIKE products INCLUDING DEFAULTS)'; + EXECUTE 'ALTER TABLE '||prod_t||' ADD PRIMARY KEY (id)'; + EXECUTE 'INSERT INTO '||prod_t||' SELECT * FROM products'; + + PERFORM import_full.log_message('создадим счётчик'); + EXECUTE 'SELECT max(id) + 1 FROM ' || prod_t INTO max_id; + EXECUTE 'CREATE SEQUENCE ' || prod_t || '_id_seq START ' || max_id; + EXECUTE 'ALTER TABLE ' || prod_t || ' ALTER COLUMN id SET DEFAULT nextval('''|| prod_t ||'_id_seq'')'; + + PERFORM import_full.log_message('накинем индекс на company_id'); + EXECUTE 'CREATE INDEX i_'||prod_t||'_company_id ON '||prod_t||' USING btree (company_id)'; + EXECUTE 'ALTER TABLE '||prod_t||' RENAME TO products_import'; + + RETURN 1; +END; +$$; + + +-- +-- Name: fill_companies_new_ids(); Type: FUNCTION; Schema: import_full; Owner: - +-- + +CREATE FUNCTION fill_companies_new_ids() RETURNS void + LANGUAGE plpgsql + AS $$ +DECLARE + company RECORD; + new_id INTEGER; +BEGIN + FOR company IN + (SELECT oferta_id, name, package FROM "import_full"."vw_site_firm" WHERE site_id IS NULL) + LOOP + INSERT INTO companies (name, packet, state, is_pricelist_online) + VALUES (company.name, COALESCE(company.package, 0), 'accepted', false) + RETURNING "id" INTO new_id; + + INSERT INTO import_full.new_companies_ids(oferta_id, site_id) + VALUES (company.oferta_id, new_id); + END LOOP; + + -- засунуть в экспорт новые IDы + INSERT INTO export.sync_companies_ids_queue(oferta_id, site_id) + SELECT oferta_id, site_id FROM import_full.new_companies_ids; + + -- в офертовской таблице обновить site_id + UPDATE import_full.vw_site_firm f SET + site_id = n.site_id + FROM + import_full.new_companies_ids n + WHERE + f.oferta_id = n.oferta_id; + + UPDATE import_full.vw_site_estate f SET + site_firm_id = n.site_id + FROM + import_full.new_companies_ids n + WHERE + f.oferta_firm_id = n.oferta_id; +END; +$$; + + +-- +-- Name: fill_images_to_delete(); Type: FUNCTION; Schema: import_full; Owner: - +-- + +CREATE FUNCTION fill_images_to_delete() RETURNS integer + LANGUAGE plpgsql + AS $$ +BEGIN + PERFORM import_full.log_message('Заполняем очередь на удаление картинок'); + TRUNCATE TABLE import_full.companies_images_to_delete; + + DELETE FROM import_full.vw_site_deleted_firm WHERE site_id IN ( + SELECT f.site_id + FROM import_full.vw_site_deleted_firm f INNER JOIN + companies c ON c.id = f.site_id + WHERE + c.oferta_online_flag = TRUE + ); + + -- логотипы у удаленных компаний + INSERT INTO import_full.companies_images_to_delete (id, class_name) + SELECT + cl.id, 'CompanyLogo' + FROM + company_logos cl + INNER JOIN companies c ON cl.company_id = c.id + INNER JOIN import_full.vw_site_deleted_firm df ON c.id = df.site_id; + + -- логотипы, которые удалили в оферте + INSERT INTO import_full.companies_images_to_delete (id, class_name) + SELECT + cl.id, 'CompanyLogo' + FROM + company_logos cl + INNER JOIN companies c ON cl.company_id = c.id + INNER JOIN import_full.vw_site_firm f ON c.id = f.site_id + WHERE + f.has_logo = FALSE; + + -- картинки товаров + INSERT INTO import_full.companies_images_to_delete (id, class_name) + SELECT + i.id, 'ProductImage' + FROM + product_images i + INNER JOIN products p ON i.product_id = p.id + INNER JOIN companies c ON p.company_id = c.id + INNER JOIN import_full.vw_site_deleted_firm df ON c.id = df.site_id; + + -- картинки компании + INSERT INTO import_full.companies_images_to_delete (id, class_name) + SELECT + i.id, 'Image' + FROM + images i + INNER JOIN companies c ON i.subject_id = c.id + INNER JOIN import_full.vw_site_deleted_firm df ON c.id = df.site_id + WHERE + i.subject_type = 'Company'; + + -- картинки витрин + INSERT INTO import_full.companies_images_to_delete (id, class_name) + SELECT + i.id, 'ShowcaseImage' + FROM + showcase_images i + INNER JOIN showcases s ON i.showcase_id = s.id + INNER JOIN companies c ON s.company_id = c.id + INNER JOIN import_full.vw_site_deleted_firm df ON c.id = df.site_id; + + PERFORM import_full.log_message('Очередь на удаление картинок заполнена'); + + -- оригинальные прайсы у удаленных компаний + INSERT INTO import_full.orig_price_to_upload (firm_id, to_delete) + SELECT + c.oferta_sync_id, TRUE + FROM + import_full.vw_site_deleted_firm f INNER JOIN + companies c ON f.site_id = c.id + WHERE + c.oferta_sync_id IS NOT NULL AND + c.original_pricelist_file_name IS NOT NULL; + + RETURN 1; +END; +$$; + + +-- +-- Name: get_products_table_name(); Type: FUNCTION; Schema: import_full; Owner: - +-- + +CREATE FUNCTION get_products_table_name() RETURNS character varying + LANGUAGE plpgsql + AS $$ +BEGIN + RETURN 'products_' || CAST((SELECT max(id) FROM migrations) AS character varying); +END; +$$; + + +-- +-- Name: import_init(); Type: FUNCTION; Schema: import_full; Owner: - +-- + +CREATE FUNCTION import_init() RETURNS integer + LANGUAGE plpgsql + AS $$ +BEGIN + TRUNCATE TABLE import_full.import_log; + + PERFORM import_full.log_message('Начало импорта'); + + PERFORM import_full.fill_images_to_delete(); + + TRUNCATE TABLE import_full.logo_to_upload; + TRUNCATE TABLE import_full.orig_price_to_upload; + + RETURN 1; +END; +$$; + + +-- +-- Name: log_message(character varying); Type: FUNCTION; Schema: import_full; Owner: - +-- + +CREATE FUNCTION log_message(msg character varying) RETURNS integer + LANGUAGE plpgsql + AS $$ +BEGIN + INSERT INTO import_full.import_log(event_date, message) VALUES (clock_timestamp(), msg); + PERFORM system.stdout(msg); + RETURN 1; +END; +$$; + + +-- +-- Name: prerender_rubricator(); Type: FUNCTION; Schema: import_full; Owner: - +-- + +CREATE FUNCTION prerender_rubricator() RETURNS integer + LANGUAGE plpgsql + AS $$ +DECLARE + region_rubric RECORD; + render classes.catalogue_rubric[]; + _row classes.catalogue_rubric; +BEGIN + DELETE FROM prerendered_rubricators; + + FOR region_rubric IN SELECT * FROM rubric_statistics WHERE rubric_id IS NOT NULL LOOP + render := ARRAY[]::classes.catalogue_rubric[]; + + IF region_rubric.rubric_id > 0 THEN + IF region_rubric.products_stat > 0 THEN + FOR _row IN SELECT * FROM render_catalogue_rubricator(region_rubric.rubric_id, region_rubric.region_id) LOOP + render := render || _row; + END LOOP; + END IF; + ELSE + FOR _row IN SELECT * FROM render_catalogue_root_rubricator(region_rubric.region_id, 3) LOOP + render := render || _row; + END LOOP; + END IF; + + INSERT INTO prerendered_rubricators(rubric_id, region_id, prerendered) + VALUES (region_rubric.rubric_id, region_rubric.region_id, render); + END LOOP; + + RETURN 1; +END; +$$; + + +-- +-- Name: process_actualized_offer(); Type: FUNCTION; Schema: import_full; Owner: - +-- + +CREATE FUNCTION process_actualized_offer() RETURNS integer + LANGUAGE plpgsql + AS $$ +BEGIN + PERFORM import_full.log_message('Актуализируем товары'); + + UPDATE products_import p SET + actualized_at = import_full.to_utc(v.actualization_date), + updated_at = import_full.to_utc(clock_timestamp()) + FROM + import_full.vw_site_actualize_offer v + WHERE + v.id = p.oferta_sync_id; + + PERFORM import_full.log_message('Актуализация товаров закончена'); + + PERFORM import_full.log_message('Ставим метку актуализации компаниям'); + PERFORM import_full.process_companies_actualization(); + PERFORM import_full.log_message('Метка проставлена'); + + RETURN 1; +END; +$$; + + +-- +-- Name: process_companies_actualization(); Type: FUNCTION; Schema: import_full; Owner: - +-- + +CREATE FUNCTION process_companies_actualization() RETURNS void + LANGUAGE plpgsql + AS $$ +BEGIN + UPDATE companies c SET pricelist_actualized_at = t.pricelist_actualized_at + FROM + ( + SELECT + c.id, + MAX(p.actualized_at) AS pricelist_actualized_at + FROM + companies c LEFT JOIN + products_import p ON c.id = p.company_id AND p.state < 'declined' + GROUP BY c.id + ) t + WHERE + c.id = t.id; +END; +$$; + + +-- +-- Name: FUNCTION process_companies_actualization(); Type: COMMENT; Schema: import_full; Owner: - +-- + +COMMENT ON FUNCTION process_companies_actualization() IS 'Проставляет всем компаниям дату актуализации прайс-листа'; + + +-- +-- Name: process_companies_rubrics(); Type: FUNCTION; Schema: import_full; Owner: - +-- + +CREATE FUNCTION process_companies_rubrics() RETURNS void + LANGUAGE plpgsql + AS $$ +BEGIN + PERFORM import_full.log_message('Очищаем company_rubrics'); + DELETE FROM company_rubrics; + + PERFORM import_full.log_message('Заполняем company_rubrics на основе привязок товаров к рубрикам'); + INSERT INTO company_rubrics ( + company_id, + rubric_id, + rubric_level, + created_at, + updated_at + ) + WITH _company_rubrics AS ( + SELECT + DISTINCT company_id, rubric_id -- distinct здесь, т.к. по внутреннему массиву distinct тяжелее + FROM + ( + SELECT + p.company_id, + unnest(ARRAY[ + r.rubric_id, + r.rubric_l1_id, + r.rubric_l2_id, + r.rubric_l3_id, + r.rubric_l4_id + ]) AS rubric_id + FROM + products_import p INNER JOIN + companies c ON p.company_id = c.id INNER JOIN + rubrics_denormalization_tree r ON p.rubric_id = r.rubric_id + WHERE + p.state < 'declined' + ) _t + ) + SELECT + cr.company_id, + cr.rubric_id, + r.cached_level, + import_full.to_utc(clock_timestamp()), + import_full.to_utc(clock_timestamp()) + FROM + _company_rubrics cr + INNER JOIN + rubrics r ON r.id = cr.rubric_id; + + PERFORM import_full.log_message('Обновляем поле с денормализацией для привязок к рубрикам в таблице компаний'); + + UPDATE companies + SET rubrics_denorm = NULL, updated_at = import_full.to_utc(clock_timestamp()) + WHERE products_count IS NULL AND rubrics_denorm IS NOT NULL; + + UPDATE companies + SET rubrics_denorm = joined_rubrics + FROM + ( + SELECT company_id, + array_to_string(array_accum(rubric_id), ',') AS joined_rubrics + FROM + company_rubrics + GROUP BY + company_id + ) t + WHERE + companies.id = t.company_id; +END; +$$; + + +-- +-- Name: process_companies_statistics(); Type: FUNCTION; Schema: import_full; Owner: - +-- + +CREATE FUNCTION process_companies_statistics() RETURNS void + LANGUAGE plpgsql + AS $$ +BEGIN + DROP TABLE IF EXISTS _companies_has_products; + CREATE TEMPORARY TABLE _companies_has_products AS ( + SELECT + company_id, COUNT(*) AS products_count + FROM + products_import + WHERE + state < 'declined' + GROUP BY company_id + ); + + CREATE INDEX "_companies_has_products_idx" ON "_companies_has_products" + USING btree ("company_id"); + + UPDATE companies c SET + products_count = f.products_count + FROM + _companies_has_products f + WHERE + c.id = f.company_id; + + DROP TABLE _companies_has_products; +END; +$$; + + +-- +-- Name: process_deleted_companies(); Type: FUNCTION; Schema: import_full; Owner: - +-- + +CREATE FUNCTION process_deleted_companies() RETURNS void + LANGUAGE plpgsql + AS $$ +BEGIN + PERFORM import_full.log_message('Удаляем удаленные компании'); + DELETE FROM import_full.vw_site_deleted_firm WHERE site_id IN ( + SELECT f.site_id + FROM import_full.vw_site_deleted_firm f INNER JOIN + companies c ON c.id = f.site_id + WHERE + c.oferta_online_flag = TRUE + ); + + PERFORM import_full.log_message('Удаляем привязки к пользователям'); + DELETE FROM company_users WHERE company_id IN ( + SELECT site_id FROM import_full.vw_site_deleted_firm + ); + + PERFORM import_full.log_message('Чистим логотипы'); + DELETE FROM company_logos WHERE company_id IN ( + SELECT site_id FROM import_full.vw_site_deleted_firm + ); + + PERFORM import_full.log_message('Удаляем статистику'); + DELETE FROM company_statistic_logs WHERE company_id IN ( + SELECT site_id FROM import_full.vw_site_deleted_firm + ); + DELETE FROM company_statistic_geo_by_months WHERE company_id IN ( + SELECT site_id FROM import_full.vw_site_deleted_firm + ); + DELETE FROM company_statistic_geo_by_weeks WHERE company_id IN ( + SELECT site_id FROM import_full.vw_site_deleted_firm + ); + DELETE FROM company_statistic_pages_by_months WHERE company_id IN ( + SELECT site_id FROM import_full.vw_site_deleted_firm + ); + DELETE FROM company_statistic_pages_by_weeks WHERE company_id IN ( + SELECT site_id FROM import_full.vw_site_deleted_firm + ); + DELETE FROM company_statistic_referers_by_months WHERE company_id IN ( + SELECT site_id FROM import_full.vw_site_deleted_firm + ); + DELETE FROM company_statistic_referers_by_weeks WHERE company_id IN ( + SELECT site_id FROM import_full.vw_site_deleted_firm + ); + DELETE FROM company_statistic_total_by_days WHERE company_id IN ( + SELECT site_id FROM import_full.vw_site_deleted_firm + ); + DELETE FROM company_statistic_total_by_months WHERE company_id IN ( + SELECT site_id FROM import_full.vw_site_deleted_firm + ); + DELETE FROM company_statistic_total_by_weeks WHERE company_id IN ( + SELECT site_id FROM import_full.vw_site_deleted_firm + ); + DELETE FROM company_statistic_totals WHERE company_id IN ( + SELECT site_id FROM import_full.vw_site_deleted_firm + ); + + PERFORM import_full.log_message('Удаляем сайты'); + DELETE FROM company_sites WHERE company_id IN ( + SELECT site_id FROM import_full.vw_site_deleted_firm + ); + + PERFORM import_full.log_message('Удаляем товары'); + -- ставим удаленные товары в очередь на удаление из сфинкса + DELETE FROM products_import WHERE company_id IN ( + SELECT site_id FROM import_full.vw_site_deleted_firm + ); + + PERFORM import_full.log_message('Удаляем новости'); + DELETE FROM news WHERE company_id IN ( + SELECT site_id FROM import_full.vw_site_deleted_firm + ); + + PERFORM import_full.log_message('Удаляем настройки'); + DELETE FROM company_settings WHERE company_id IN ( + SELECT site_id FROM import_full.vw_site_deleted_firm + ); + + PERFORM import_full.log_message('Удаляем витрины'); + DELETE FROM showcase_order_periods WHERE showcase_order_id IN ( + SELECT o.id + FROM + showcase_orders o + INNER JOIN showcases s ON o.showcase_id = s.id + INNER JOIN companies c ON s.company_id = c.id + INNER JOIN import_full.vw_site_deleted_firm f ON c.id = f.site_id + ); + DELETE FROM showcase_order_stats WHERE showcase_order_id IN ( + SELECT o.id + FROM + showcase_orders o + INNER JOIN showcases s ON o.showcase_id = s.id + INNER JOIN companies c ON s.company_id = c.id + INNER JOIN import_full.vw_site_deleted_firm f ON c.id = f.site_id + ); + DELETE FROM showcase_orders WHERE showcase_id IN ( + SELECT s.id + FROM + showcases s + INNER JOIN companies c ON s.company_id = c.id + INNER JOIN import_full.vw_site_deleted_firm f ON c.id = f.site_id + ); + + DELETE FROM showcase_images WHERE id IN ( + SELECT id FROM showcase_images WHERE + id IN ( + SELECT id FROM showcase_images WHERE showcase_id IN ( + SELECT s.id + FROM showcases s INNER JOIN + companies c ON s.company_id = c.id INNER JOIN + import_full.vw_site_deleted_firm f ON c.id = f.site_id + ) + ) OR + parent_id IN ( + SELECT id FROM showcase_images WHERE showcase_id IN ( + SELECT s.id + FROM showcases s INNER JOIN + companies c ON s.company_id = c.id INNER JOIN + import_full.vw_site_deleted_firm f ON c.id = f.site_id + ) + ) + ); + + DELETE FROM showcases WHERE company_id IN ( + SELECT site_id FROM import_full.vw_site_deleted_firm + ); + + PERFORM import_full.log_message('Удаляем привязки к рубрикам'); + DELETE FROM company_rubrics WHERE company_id IN ( + SELECT site_id FROM import_full.vw_site_deleted_firm + ); + + PERFORM import_full.log_message('Удаляем привязки к регионам'); + DELETE FROM company_regions WHERE company_id IN ( + SELECT site_id FROM import_full.vw_site_deleted_firm + ); + DELETE FROM company_region_commercials WHERE company_id IN ( + SELECT site_id FROM import_full.vw_site_deleted_firm + ); + + PERFORM import_full.log_message('Удаляем привязки к типам деятельности'); + DELETE FROM company_business_types WHERE company_id IN ( + SELECT site_id FROM import_full.vw_site_deleted_firm + ); + + PERFORM import_full.log_message('Удаляем из поискового индекса'); + DELETE FROM search_index_companies WHERE company_id IN ( + SELECT site_id FROM import_full.vw_site_deleted_firm + ); + + PERFORM import_full.log_message('Удаляем адреса'); + DELETE FROM contacts WHERE address_id IN ( + SELECT a.id + FROM + addresses a + INNER JOIN companies c ON a.company_id = c.id + INNER JOIN import_full.vw_site_deleted_firm f ON c.id = f.site_id + ); + DELETE FROM phones WHERE address_id IN ( + SELECT a.id + FROM + addresses a + INNER JOIN companies c ON a.company_id = c.id + INNER JOIN import_full.vw_site_deleted_firm f ON c.id = f.site_id + ); + DELETE FROM yandex_map_coordinates WHERE address_id IN ( + SELECT a.id + FROM + addresses a + INNER JOIN companies c ON a.company_id = c.id + INNER JOIN import_full.vw_site_deleted_firm f ON c.id = f.site_id + ); + DELETE FROM addresses WHERE company_id IN ( + SELECT site_id FROM import_full.vw_site_deleted_firm + ); + + PERFORM import_full.log_message('Удаляем сами компании'); + DELETE FROM companies WHERE id IN ( + SELECT site_id FROM import_full.vw_site_deleted_firm + ); +END; +$$; + + +-- +-- Name: process_deleted_offer(); Type: FUNCTION; Schema: import_full; Owner: - +-- + +CREATE FUNCTION process_deleted_offer() RETURNS void + LANGUAGE plpgsql + AS $$ +BEGIN + PERFORM import_full.log_message('Удаляем удаленные лоты'); + + INSERT INTO search.sphinx_delete_queue (obj_id, class_name) + SELECT + id, 'PriceListRow' + FROM + "import_full"."vw_site_deleted_offer"; + + UPDATE price_list_rows AS p SET + is_deleted = TRUE, + updated_at = import_full.to_utc(NOW()) + FROM + "import_full"."vw_site_deleted_offer" AS d + WHERE p.id = d.id; + + PERFORM import_full.log_message('Закончили удаление удаленных лотов'); +END; +$$; + + +-- +-- Name: process_new_rubrics(); Type: FUNCTION; Schema: import_full; Owner: - +-- + +CREATE FUNCTION process_new_rubrics() RETURNS integer + LANGUAGE plpgsql + AS $_$ + BEGIN + -- + -- добавляем новые синонимы из новых рубрик + -- + + -- делаем временную таблицу + DROP TABLE IF EXISTS "_tmp_new_rubrics"; + CREATE TEMPORARY TABLE "_tmp_new_rubrics" ( + "rubric_id" INTEGER, + "synonym_id" INTEGER, + "term" TEXT + ); + + INSERT INTO _tmp_new_rubrics + SELECT * + FROM ( + -- найдём новые рубрики + WITH _new_rubrics AS ( + SELECT id, title + FROM import_full.vw_site_rubric r + WHERE r.id IN ( + SELECT id FROM import.vw_site_rubric WHERE target_rubric_id IS NULL + EXCEPT + SELECT id FROM rubrics WHERE is_symlink = FALSE + ) + ), + -- получить для названий термы + _terms_all_nested AS ( + SELECT + id, + search.extract_not_stemmed_terms(title) AS terms + FROM _new_rubrics + ), + -- развёртываем композитный тип в две колонки + _terms_all_unnested AS ( + SELECT + id, + (terms).word, + (terms).position + FROM _terms_all_nested + ), + -- достаем базовые формы слов + _dict AS ( + SELECT * + FROM public.search_wordforms + WHERE "form" IN ( + SELECT DISTINCT word + FROM _terms_all_unnested + WHERE word ~* '^[а-я]{3,}' + ) + ), + -- приводим термы к базовой форме + _terms_all_unnested_morphological AS ( + SELECT + t.id, + t.word, + t.position + FROM _terms_all_unnested t + LEFT JOIN _dict d ON t.word = d."form" + WHERE d.word IS NULL + ), + -- делаем все термы уникальными + _terms_unique AS ( + SELECT + id, + word, + MIN(position) AS position + FROM _terms_all_unnested_morphological + GROUP BY id, word + ), + -- поищем уже существующие слова + _rubrics_and_words AS ( + SELECT t.id rubric_id, bw.id synonym_id, t.word term + FROM _terms_unique t + LEFT JOIN public.base_words bw ON bw.name = t.word AND bw.is_deleted = FALSE + ), + -- удалить: Слово имеет синоним без привязки к рубрике, т.е. слово является базовым и имеет синоним (без привязки к рубрике) + _rubrics_words_1 AS ( + SELECT r.* + FROM _rubrics_and_words r + LEFT JOIN public.synonyms s ON s.base_id = r.synonym_id AND s.rubric_id IS NULL AND s.base_id IS NOT NULL + WHERE s.id IS NULL + ) + + SELECT * FROM _rubrics_words_1 + ) a; + + -- удалим связки по фильтру + DELETE FROM _tmp_new_rubrics + WHERE term ~ E'^[0-9]+$' OR term = 'для'; + + -- добавим новые слова + INSERT INTO public.base_words (name, created_at, updated_at) + SELECT a.term, import_full.to_utc(clock_timestamp()), import_full.to_utc(clock_timestamp()) + FROM ( + SELECT term + FROM _tmp_new_rubrics + WHERE synonym_id IS NULL + GROUP BY term + ) a; + + -- обновим synonym_id из новых слов + UPDATE _tmp_new_rubrics nr + SET synonym_id = bw.id + FROM public.base_words bw + WHERE bw.is_deleted = FALSE AND nr.synonym_id IS NULL AND nr.term = bw.name; + + -- и наконец вставляем новые связки + INSERT INTO public.synonyms (synonym_id, rubric_id, is_new, created_at, updated_at) + SELECT a.synonym_id, a.rubric_id, true, import_full.to_utc(clock_timestamp()), import_full.to_utc(clock_timestamp()) + FROM _tmp_new_rubrics a + LEFT JOIN public.synonyms s + ON s.rubric_id = a.rubric_id + AND s.synonym_id = a.synonym_id + AND s.base_id IS NULL + AND s.is_new = TRUE + AND s.is_deleted = FALSE + AND s.state = 'all' + WHERE s.id IS NULL; + + -- почистим мусор + DROP TABLE IF EXISTS "_tmp_new_rubrics"; + + RETURN 1; + END; + $_$; + + +-- +-- Name: process_offer(); Type: FUNCTION; Schema: import_full; Owner: - +-- + +CREATE FUNCTION process_offer() RETURNS integer + LANGUAGE plpgsql + AS $_$ + DECLARE prod_t character varying(255); +BEGIN + PERFORM import_full.log_message('Начало синхронизации товаров'); + + -- уникальный суфикс для индексов + EXECUTE 'SELECT import_full.get_products_table_name()' INTO prod_t; + -- + -- + PERFORM import_full.log_message('Создаем временную таблицу со списком компаний, у которых прайс не редактируется на сайте'); + BEGIN + DROP TABLE IF EXISTS _companies_for_update; + EXCEPTION + WHEN OTHERS THEN + END; + CREATE TEMPORARY TABLE _companies_for_update AS ( + SELECT id, oferta_sync_id FROM companies WHERE is_pricelist_online = FALSE + ); + PERFORM import_full.log_message('Создаем индексы на временной таблице со списком компаний'); + CREATE INDEX "_companies_for_update_idx" ON "_companies_for_update" + USING btree ("id"); + CREATE INDEX "_companies_for_update_idx1" ON "_companies_for_update" + USING btree ("oferta_sync_id"); + -- + -- + PERFORM import_full.log_message('Создаем временную таблицу со списком компаний, приславших прайсы'); + BEGIN + DROP TABLE IF EXISTS _modified_offer_companies; + EXCEPTION + WHEN OTHERS THEN + END; + CREATE TEMPORARY TABLE _modified_offer_companies AS ( + SELECT DISTINCT + COALESCE(c_by_id.id, c_by_of_id.id) AS company_id + FROM + import_full.vw_site_clear_price_firm AS v INNER JOIN + _companies_for_update c_by_id ON v.site_firm_id = c_by_id.id LEFT JOIN + _companies_for_update c_by_of_id ON v.firm_id = c_by_of_id.oferta_sync_id + ); + + PERFORM import_full.log_message('Удаляем товары тех компаний, которые прислали прайсы'); + UPDATE products_import p + SET state = 'deleted' + FROM _modified_offer_companies c + WHERE p.company_id = c.company_id; + -- + -- + PERFORM import_full.log_message('Делаем препроцессинг данных из Оферты'); + BEGIN + DROP TABLE IF EXISTS _products_prepared; + EXCEPTION + WHEN OTHERS THEN + END; + + EXECUTE ' + CREATE TEMPORARY TABLE _products_prepared AS ( + SELECT tmp.* + FROM + ( + SELECT + COALESCE(p.id, nextval(''' || prod_t || '_id_seq''::regclass)::int4) AS id, + v.id AS oferta_sync_id, + COALESCE( + (SELECT id FROM _companies_for_update WHERE id = v.site_firm_id LIMIT 1), + (SELECT id FROM _companies_for_update WHERE oferta_sync_id = v.firm_id LIMIT 1), + v.site_firm_id, + (SELECT id FROM companies WHERE oferta_sync_id = v.firm_id) + ) AS company_id, + SUBSTRING(v.title FROM 1 FOR 255) AS name, + + import_full.to_utc(COALESCE(v.created_at, clock_timestamp())) AS created_at, + import_full.to_utc(COALESCE(v.prop_modified, clock_timestamp())) AS updated_at, + import_full.to_utc(v.actualization_date) AS actualized_at, + + v.rubric_id, + + v.c_currency_id AS currency_id, + v.price_from AS price, + v.price_to AS price_max, + v.pricesort AS price_uni, + NOT v.is_price_from AS is_exact_price, + + COALESCE( + p.url_name, + product_url_name( COALESCE(p.id, currval(''' || prod_t || '_id_seq''::regclass)::int4 ) , SUBSTRING(v.title FROM 1 FOR 255) ) + ) AS url_name, + + v.is_demand, + v.x_city_link + FROM + import_full.vw_site_modified_offer v + INNER JOIN + rubrics_denormalization_tree r ON v.rubric_id = r.rubric_id + LEFT JOIN + products_import p ON p.oferta_sync_id = v.id + ) AS tmp INNER JOIN + _companies_for_update AS companies ON tmp.company_id = companies.id + )'; + + PERFORM import_full.log_message('Создаем индексы на временной таблице с подготовленными данными'); + CREATE INDEX "_products_prepared_idx" ON "_products_prepared" + USING btree ("id"); + CREATE INDEX "_products_prepared_idx2" ON "_products_prepared" + USING btree ("company_id"); + CREATE INDEX "_products_prepared_idx3" ON "_products_prepared" + USING btree ("is_demand"); + -- + -- + PERFORM import_full.log_message('Удаляем из подготовленных данных спрос'); + DELETE FROM _products_prepared WHERE is_demand = TRUE; + PERFORM import_full.log_message('Удаляем из подготовленных данных товары компаний с online прайсами'); + DELETE FROM _products_prepared WHERE company_id IS NULL; + -- + -- + PERFORM import_full.log_message('Обновляем товары в таблице products_import'); + UPDATE products_import + SET + name = tmp.name, + company_id = tmp.company_id, + oferta_sync_id = tmp.oferta_sync_id, + + price = tmp.price, + price_max = tmp.price_max, + is_exact_price = tmp.is_exact_price, + currency = tmp.currency_id, + + rubric_id = tmp.rubric_id, + is_public = LENGTH(COALESCE(tmp.x_city_link, '')) > 0, + + created_at = tmp.created_at, + updated_at = tmp.updated_at, + actualized_at = tmp.actualized_at, + url_name = tmp.url_name, + state = 'accepted' + FROM + _products_prepared tmp + WHERE + products_import.id = tmp.id; + -- + -- + PERFORM import_full.log_message('Создаем новые товары'); + INSERT INTO products_import ( + id, + name, + company_id, + oferta_sync_id, + state, + + price, + price_max, + is_exact_price, + currency, + + url_name, + is_public, + + created_at, + updated_at, + actualized_at, + modified_at, + + rubric_id, + + rand_sort + ) + SELECT + tmp.id, + tmp.name, + tmp.company_id, + tmp.oferta_sync_id, + 'accepted', + + tmp.price, + tmp.price_max, + tmp.is_exact_price, + tmp.currency_id, + + tmp.url_name, + TRUE, + + tmp.created_at, + tmp.updated_at, + tmp.actualized_at, + NULL, + + tmp.rubric_id, + + trunc(random() * 10000000) + FROM + _products_prepared tmp LEFT JOIN + products_import p ON tmp.id = p.id + WHERE + p.id IS NULL; + + --------------------------------------------------------------------------------------------- + PERFORM import_full.log_message('Актуализируем товары'); + + EXECUTE 'CREATE INDEX i_'||prod_t||'_oferta_sync_id ON products_import USING btree(oferta_sync_id)'; + + UPDATE products_import p SET + actualized_at = import_full.to_utc(v.actualization_date), + updated_at = import_full.to_utc(clock_timestamp()) + FROM + import_full.vw_site_actualize_offer v + WHERE + v.id = p.oferta_sync_id; + + PERFORM import_full.log_message('Актуализация товаров закончена'); + + --------------------------------------------------------------------------------------------- + PERFORM import_full.log_message('Создаём индексы'); + EXECUTE 'CREATE INDEX i_'||prod_t||'_state ON products_import USING btree(state)'; + EXECUTE 'CREATE INDEX i_'||prod_t||'_url_name ON products_import USING btree(url_name)'; + EXECUTE 'CREATE INDEX i_'||prod_t||'_rubric_id ON products_import USING btree(rubric_id)'; + + --------------------------------------------------------------------------------------------- + PERFORM import_full.log_message('Ставим метку актуализации компаниям'); + PERFORM import_full.process_companies_actualization(); + PERFORM import_full.log_message('Метка проставлена'); + --------------------------------------------------------------------------------------------- + -- + PERFORM import_full.log_message('Создаём зависимости'); + EXECUTE ' + ALTER TABLE products_import + ADD CONSTRAINT fk_'||prod_t||'_company_id FOREIGN KEY (company_id) + REFERENCES companies(id) + ON UPDATE NO ACTION ON DELETE NO ACTION DEFERRABLE INITIALLY IMMEDIATE'; + --------------------------------------------------------------------------------------------- + -- + -- + PERFORM import_full.log_message('Удаляем для пришедших товаров все привязки к регионам'); + DELETE FROM product_regions + WHERE product_id IN (SELECT id FROM "_products_prepared"); + + PERFORM import_full.log_message('Создаем для пришедших товаров привязки к регионам'); + INSERT INTO product_regions ( + product_id, + region_id, + is_printable, + is_public, + created_at, + updated_at + ) + SELECT + _t.product_id, + _t.matches[1]::int4 AS region_id, + _t.matches[2]::boolean AS is_printable, + TRUE as is_public, + import_full.to_utc(clock_timestamp()), + import_full.to_utc(clock_timestamp()) + FROM ( + SELECT + p.id AS product_id, + CASE + WHEN x_city_link ~ ('(^|,)' || companies.products_region_id::varchar || E'=\\d+(,|$)') THEN + regexp_matches(x_city_link || ',0=1', '([0-9]+)=(0|1)', 'g') + ELSE + regexp_matches(x_city_link, '([0-9]+)=(0|1)', 'g') + END AS matches + FROM _products_prepared p + INNER JOIN companies ON p.company_id = companies.id + ) _t; + -- + -- + PERFORM import_full.log_message('Удаляем временные таблицы'); + DROP TABLE _products_prepared; + DROP TABLE _modified_offer_companies; + DROP TABLE _companies_for_update; + -- + -- + PERFORM import_full.log_message('Удаляем призраков из поискового индекса'); + DELETE FROM search_index_products WHERE id IN ( + SELECT s.id FROM + search_index_products s LEFT JOIN + products_import p ON s.product_id = p.id + WHERE + p.id IS NULL + ); + -- + -- + PERFORM import_full.log_message('Ставим товары в очередь на индексацию'); + INSERT INTO search_index_queue(class_name, obj_id) + SELECT 'Product', p.id + FROM products_import p + LEFT JOIN search_index_products AS search_index ON p.id = search_index.product_id + WHERE search_index.id IS NULL; + -- + -- + PERFORM import_full.log_message('Синхронизация товаров завершена'); + RETURN 1; +END; +$_$; + + +-- +-- Name: process_products_regions(); Type: FUNCTION; Schema: import_full; Owner: - +-- + +CREATE FUNCTION process_products_regions() RETURNS integer + LANGUAGE plpgsql + AS $$ +BEGIN + PERFORM import_full.log_message('Пересчитываем у товаров привязки к регионам'); + + -- привязки по коммерческим регионам + UPDATE products p + SET regions = _regions + FROM + ( + SELECT c.id, + array_to_string(array_accum("cr"."region_id"), ',') AS "_regions" + FROM + companies c LEFT JOIN + company_region_commercials cr ON c.id = cr.company_id + GROUP BY c.id + ) t + WHERE p.company_id = t.id; + + -- привязки по регионам усадеб для оставшихся + UPDATE products p + SET regions = _regions + FROM + ( + SELECT cr.company_id, + array_to_string(array_accum("cr"."region_id"), ',') AS "_regions" + FROM + company_regions cr + GROUP BY cr.company_id + ) t + WHERE + p.company_id = t.company_id AND + (p.regions IS NULL OR p.regions = ''); + + RETURN 1; +END; +$$; + + +-- +-- Name: process_rubric_log(); Type: FUNCTION; Schema: import_full; Owner: - +-- + +CREATE FUNCTION process_rubric_log() RETURNS integer + LANGUAGE plpgsql + AS $$ +DECLARE + log_rec RECORD; + deleted INTEGER; + united INTEGER; + root_rubric_id INTEGER; + parent_rubric_id INTEGER; +BEGIN + SELECT id INTO root_rubric_id FROM import_full.vw_site_rubric WHERE num_left = 1 LIMIT 1; + deleted := 0; + united := 0; + PERFORM import_full.log_message('Начинаем обработку лога рубрикатора'); + FOR log_rec IN SELECT * FROM "import_full"."vw_site_rubric_log" ORDER BY event_date ASC LOOP + -- delete + IF log_rec.event_type IN (20,30,40) THEN + -- 1. cms page rubrics + DELETE FROM cms_page_rubrics WHERE rubric_id = log_rec.rubric_id; + -- 2. news rubrics + DELETE FROM news_rubrics WHERE rubric_id = log_rec.rubric_id; + -- 3. products + UPDATE products_import SET rubric_id = NULL, updated_at = NOW() + WHERE rubric_id = log_rec.rubric_id; + -- 4. showcase order + -- привязываем к коренной рубрике + UPDATE showcase_orders SET rubric_id = root_rubric_id WHERE rubric_id = log_rec.rubric_id; + -- 5. company_rubrics + DELETE FROM company_rubrics WHERE rubric_id = log_rec.rubric_id; + + -- 6. synonyms + SELECT parent_id INTO parent_rubric_id FROM import_full.vw_site_rubric WHERE id = log_rec.rubric_id LIMIT 1; + + UPDATE synonyms + SET rubric_id = parent_rubric_id, is_new = TRUE, is_changed = TRUE + WHERE rubric_id = log_rec.rubric_id; + + -- 7. wordstat_rubrics + DELETE FROM wordstat_rubrics WHERE rubric_id = log_rec.rubric_id; + + deleted := deleted + 1; + END IF; + + -- union + IF log_rec.event_type IN (22,32,42) THEN + -- 1. cms page rubrics + INSERT INTO cms_page_rubrics (cms_page_id, rubric_id) + SELECT + cms_page_id, log_rec.event_param + FROM cms_page_rubrics + WHERE rubric_id IN (log_rec.rubric_id, log_rec.event_param); + + DELETE FROM cms_page_rubrics WHERE rubric_id = log_rec.rubric_id; + + -- 2. news rubrics + INSERT INTO news_rubrics (news_id, rubric_id) + SELECT + news_id, log_rec.event_param + FROM news_rubrics + WHERE rubric_id IN (log_rec.rubric_id, log_rec.event_param); + + DELETE FROM news_rubrics WHERE rubric_id = log_rec.rubric_id; + + -- 3. products + UPDATE products_import SET rubric_id = log_rec.event_param + WHERE rubric_id = log_rec.rubric_id; + + -- 4. showcase orders + UPDATE showcase_orders SET rubric_id = log_rec.event_param + WHERE rubric_id = log_rec.rubric_id; + + -- 5. company_rubrics + DELETE FROM company_rubrics r WHERE rubric_id = log_rec.rubric_id AND + (SELECT COUNT(*) FROM company_rubrics WHERE company_id = r.company_id AND rubric_id = log_rec.event_param) > 0; + UPDATE company_rubrics r SET rubric_id = log_rec.event_param + WHERE rubric_id = log_rec.rubric_id AND + (SELECT COUNT(*) FROM company_rubrics WHERE company_id = r.company_id AND rubric_id = log_rec.event_param) = 0; + + -- 6. synonyms + UPDATE synonyms + SET rubric_id = log_rec.event_param, is_new = TRUE, is_changed = TRUE + WHERE rubric_id = log_rec.rubric_id; + + -- 7. wordstat_rubrics + DELETE FROM wordstat_rubrics WHERE rubric_id = log_rec.rubric_id; + + united := united + 1; + END IF; + END LOOP; + + PERFORM import_full.log_message('Обработано событий удаления: ' || deleted); + PERFORM import_full.log_message('Обработано событий объединения: ' || united); + PERFORM import_full.log_message('Обработка лога рубрикатора завершена'); + RETURN 1; +END; +$$; + + +-- +-- Name: process_rubrics(); Type: FUNCTION; Schema: import_full; Owner: - +-- + +CREATE FUNCTION process_rubrics() RETURNS integer + LANGUAGE plpgsql + AS $$ +BEGIN + PERFORM import_full.log_message('Начинаем заливку рубрикатора'); + + -- TRUNCATE нельзя, truncate блокирует всю таблицу в эксклюзивном режиме + DELETE FROM rubrics; + + INSERT INTO rubrics ( + id, parent_id, title, + slug, joined_path, old_path, + created_at, updated_at, cached_level, + is_normativka, next_level_normativka, prefix_normativka, + synonym, lft, rgt, is_published, + is_symlink, symlink_target_id) + SELECT + id, parent_id, title, + tag, path, old_url, + import_full.to_utc(created), import_full.to_utc(modified), lev, + is_prodnorm, next_level_prodnorm, prodnorm_prefix, + synonims, num_left, num_right, + CASE + WHEN + ( + (is_prodnorm = TRUE AND prodnorm_position = 2) OR + (is_prodnorm = FALSE) + ) + THEN TRUE + ELSE FALSE + END, + target_rubric_id IS NOT NULL AND target_rubric_id > 0, + target_rubric_id + FROM + "import_full"."vw_site_rubric"; + + -- обновляем корневой элемент + UPDATE rubrics SET title = 'Товары и услуги', joined_path = '/', slug = '' WHERE lft = 1; + + -- прячем непубликуемые ссылки-нормативки + UPDATE rubrics SET is_published = FALSE WHERE id IN ( + SELECT + id + FROM + rubrics + WHERE + parent_id IN ( + SELECT + DISTINCT parent_id + FROM + rubrics + WHERE + is_published = FALSE + ) AND + is_published = TRUE + + UNION + + SELECT + id + FROM + rubrics + WHERE + slug = 'another' AND + is_normativka = TRUE + ); + + PERFORM import_full.log_message('Заполняем денормализованное дерево'); + DELETE FROM rubrics_denormalization_tree; + INSERT INTO rubrics_denormalization_tree ( + rubric_id, + rubric_l4_id, + rubric_l3_id, + rubric_l2_id, + rubric_l1_id, + rubric_lft, + rubric_l4_lft, + rubric_l3_lft + ) + WITH leafs AS ( + SELECT id, lft, CASE WHEN cached_level = 5 THEN parent_id ELSE id END AS parent_id + FROM rubrics + WHERE (rgt - lft = 1) OR + (is_normativka = TRUE) + ), + l4 AS ( + SELECT id, lft, parent_id + FROM rubrics + WHERE cached_level = 4 + ), + l3 AS ( + SELECT id, lft, parent_id + FROM rubrics + WHERE cached_level = 3 + ), + l2 AS ( + SELECT id, lft, parent_id + FROM rubrics + WHERE cached_level = 2 + ), + l1 AS ( + SELECT id, lft, parent_id + FROM rubrics + WHERE cached_level = 1 + ) + SELECT + leafs.id AS rubric_id, + l4.id AS rubric_l4_id, + l3.id AS rubric_l3_id, + l2.id AS rubric_l2_id, + l1.id AS rubric_l1_id, + leafs.lft, + l4.lft AS rubric_l4_lft, + l3.lft AS rubric_l3_lft + FROM + leafs INNER JOIN + l4 ON leafs.parent_id = l4.id INNER JOIN + l3 ON l4.parent_id = l3.id INNER JOIN + l2 ON l3.parent_id = l2.id INNER JOIN + l1 ON l2.parent_id = l1.id + + UNION + + SELECT + l4.id, + l4.id, + l3.id, + l2.id, + l1.id, + l4.lft, + l4.lft, + l3.lft + FROM + l4 INNER JOIN + l3 ON l4.parent_id = l3.id INNER JOIN + l2 ON l3.parent_id = l2.id INNER JOIN + l1 ON l2.parent_id = l1.id; + + PERFORM import_full.log_message('Заливка рубрикатора завершена.'); + + -- обнуление флага публикации для товаров без привязок + UPDATE product_regions SET is_public = FALSE WHERE product_id IN ( + SELECT p.id + FROM products_import p + LEFT JOIN rubrics r ON p.rubric_id = r.id + WHERE r.id IS NULL + ); + + -- обнуление несуществующих более привязок + UPDATE products_import + SET rubric_id = NULL, + is_public = FALSE, + updated_at = import_full.to_utc(clock_timestamp()) + WHERE id IN ( + SELECT p.id + FROM products_import p + LEFT JOIN rubrics r ON p.rubric_id = r.id + WHERE r.id IS NULL + ); + + /* + PERFORM import_full.log_message('Пересчитываем денормализованные привязки к рубрикам у товаров'); + + UPDATE products p SET + (rubric_l1_id, rubric_l2_id, rubric_l3_id, rubric_l4_id) = + ( + (SELECT id FROM rubrics WHERE lft <= r.lft AND rgt >= r.rgt AND cached_level = 1 LIMIT 1), + (SELECT id FROM rubrics WHERE lft <= r.lft AND rgt >= r.rgt AND cached_level = 2 LIMIT 1), + (SELECT id FROM rubrics WHERE lft <= r.lft AND rgt >= r.rgt AND cached_level = 3 LIMIT 1), + (SELECT id FROM rubrics WHERE lft <= r.lft AND rgt >= r.rgt AND cached_level = 4 LIMIT 1) + ) + FROM + rubrics r + WHERE + p.rubric_id = r.id; + + -- те товары, что оказались привязаны к непубликуемым нормативкам, + -- привязываем к вышестоящим рубрикам + UPDATE products SET rubric_id = rubric_l4_id + WHERE id IN ( + SELECT + p.id + FROM + products p INNER JOIN + rubrics r ON p.rubric_id = r.id + WHERE + r.cached_level = 5 AND r.is_published = FALSE + ); + + PERFORM import_full.log_message('Привязки пересчитаны');*/ + + RETURN 1; +END; +$$; + + +-- +-- Name: process_rubrics_statistics(); Type: FUNCTION; Schema: import_full; Owner: - +-- + +CREATE FUNCTION process_rubrics_statistics() RETURNS void + LANGUAGE plpgsql + AS $$ +BEGIN + DELETE FROM rubric_statistics; + + INSERT INTO rubric_statistics(region_id, rubric_id, products_stat) + WITH _products AS ( + SELECT + products_import.id, + rubrics_denormalization_tree.rubric_l1_id, + rubrics_denormalization_tree.rubric_l2_id, + rubrics_denormalization_tree.rubric_l3_id, + rubrics_denormalization_tree.rubric_l4_id, + rubrics_denormalization_tree.rubric_id, + product_regions.region_id + FROM + products_import INNER JOIN + rubrics_denormalization_tree ON products_import.rubric_id = rubrics_denormalization_tree.rubric_id INNER JOIN + companies ON products_import.company_id = companies.id INNER JOIN + product_regions ON product_regions.product_id = products_import.id + WHERE +-- companies.packet > 0 AND + products_import.state < 'declined' AND + product_regions.is_public = TRUE + ) + SELECT region_id, rubric_id, SUM(products_stat) AS products_stat + FROM + ( + SELECT + region_id, 0 AS rubric_id, COUNT(DISTINCT id) AS products_stat + FROM + _products + GROUP BY region_id + + UNION + + SELECT + region_id, rubric_id, COUNT(DISTINCT id) + FROM + _products + WHERE + rubric_id IS NOT NULL + GROUP BY + region_id, rubric_id + + UNION + + SELECT + region_id, rubric_l1_id, COUNT(DISTINCT id) + FROM + _products + WHERE + rubric_l1_id IS NOT NULL + GROUP BY + region_id, rubric_l1_id + + UNION + + SELECT + region_id, rubric_l2_id, COUNT(DISTINCT id) + FROM + _products + WHERE + rubric_l2_id IS NOT NULL + GROUP BY + region_id, rubric_l2_id + + UNION + + SELECT + region_id, rubric_l3_id, COUNT(DISTINCT id) + FROM + _products + WHERE + rubric_l3_id IS NOT NULL + GROUP BY + region_id, rubric_l3_id + + UNION + + SELECT + region_id, rubric_l4_id, COUNT(DISTINCT id) + FROM + _products + WHERE + rubric_l4_id IS NOT NULL AND + rubric_l4_id <> rubric_id + GROUP BY + region_id, rubric_l4_id + ) statistics + GROUP BY region_id, rubric_id; + + UPDATE regions r + SET products_statistics = rs.products_stat + FROM ( + SELECT region_id, products_stat + FROM rubric_statistics + WHERE rubric_id = 0 + ) rs + WHERE rs.region_id = r.id; + +END; +$$; + + +-- +-- Name: process_rubrics_statistics_paid(); Type: FUNCTION; Schema: import_full; Owner: - +-- + +CREATE FUNCTION process_rubrics_statistics_paid() RETURNS void + LANGUAGE plpgsql + AS $$ +BEGIN + DELETE FROM rubric_statistics_paid; + + INSERT INTO rubric_statistics_paid(region_id, rubric_id, products_stat, providers_stat) + WITH _products AS ( + SELECT + products.id, + rubrics_denormalization_tree.rubric_l1_id, + rubrics_denormalization_tree.rubric_l2_id, + rubrics_denormalization_tree.rubric_l3_id, + rubrics_denormalization_tree.rubric_l4_id, + rubrics_denormalization_tree.rubric_id, + product_regions.region_id, + company_id as provider + FROM + products INNER JOIN + rubrics_denormalization_tree ON products.rubric_id = rubrics_denormalization_tree.rubric_id INNER JOIN + companies ON products.company_id = companies.id INNER JOIN + product_regions ON product_regions.product_id = products.id + WHERE + companies.packet > 1 AND + products.state < 'declined' AND + product_regions.is_public = TRUE + ) + SELECT region_id, rubric_id, SUM(products_stat) AS products_stat, SUM(providers_stat) AS providers_stat + FROM + ( + SELECT + region_id, 0 AS rubric_id, COUNT(DISTINCT id) AS products_stat, COUNT(DISTINCT provider) AS providers_stat + FROM + _products + GROUP BY region_id + + UNION + + SELECT + region_id, rubric_id, COUNT(DISTINCT id) AS products_stat, COUNT(DISTINCT provider) AS providers_stat + FROM + _products + WHERE + rubric_id IS NOT NULL + GROUP BY + region_id, rubric_id + + UNION + + SELECT + region_id, rubric_l1_id, COUNT(DISTINCT id) AS products_stat, COUNT(DISTINCT provider) AS providers_stat + FROM + _products + WHERE + rubric_l1_id IS NOT NULL + GROUP BY + region_id, rubric_l1_id + + UNION + + SELECT + region_id, rubric_l2_id, COUNT(DISTINCT id) AS products_stat, COUNT(DISTINCT provider) AS providers_stat + FROM + _products + WHERE + rubric_l2_id IS NOT NULL + GROUP BY + region_id, rubric_l2_id + + UNION + + SELECT + region_id, rubric_l3_id, COUNT(DISTINCT id) AS products_stat, COUNT(DISTINCT provider) AS providers_stat + FROM + _products + WHERE + rubric_l3_id IS NOT NULL + GROUP BY + region_id, rubric_l3_id + + UNION + + SELECT + region_id, rubric_l4_id, COUNT(DISTINCT id) AS products_stat, COUNT(DISTINCT provider) AS providers_stat + FROM + _products + WHERE + rubric_l4_id IS NOT NULL AND + rubric_l4_id <> rubric_id + GROUP BY + region_id, rubric_l4_id + ) statistics + GROUP BY region_id, rubric_id; +END; +$$; + + +-- +-- Name: process_synonyms(); Type: FUNCTION; Schema: import_full; Owner: - +-- + +CREATE FUNCTION process_synonyms() RETURNS integer + LANGUAGE plpgsql + AS $$ +BEGIN + PERFORM import_full.log_message('Загружаем синонимы'); + DELETE FROM search.synonyms; -- truncate нельзя + INSERT INTO search.synonyms (rubric_id, rubric_level, keyword, synonym) + SELECT + rubric_id, lev, lower(keyword), lower(synonym) + FROM + import_full.vw_site_all_synonym; + + PERFORM import_full.log_message('Синонимы загружены'); + RETURN 1; +END; +$$; + + +-- +-- Name: queue_logo_to_delete(integer); Type: FUNCTION; Schema: import_full; Owner: - +-- + +CREATE FUNCTION queue_logo_to_delete(oferta_firm_id integer) RETURNS integer + LANGUAGE plpgsql + AS $$ +BEGIN + INSERT INTO import_full.logo_to_upload (firm_id, to_delete) + VALUES (oferta_firm_id, TRUE); + + RETURN 1; +END; +$$; + + +-- +-- Name: queue_logo_to_upload(integer); Type: FUNCTION; Schema: import_full; Owner: - +-- + +CREATE FUNCTION queue_logo_to_upload(oferta_firm_id integer) RETURNS integer + LANGUAGE plpgsql + AS $$ +BEGIN + INSERT INTO import_full.logo_to_upload (firm_id, to_delete) + VALUES (oferta_firm_id, FALSE); + + RETURN 1; +END; +$$; + + +-- +-- Name: queue_orig_price_to_delete(integer); Type: FUNCTION; Schema: import_full; Owner: - +-- + +CREATE FUNCTION queue_orig_price_to_delete(oferta_firm_id integer) RETURNS integer + LANGUAGE plpgsql + AS $$ +BEGIN + INSERT INTO import_full.orig_price_to_upload (firm_id, to_delete) + VALUES (oferta_firm_id, TRUE); + + RETURN 1; +END; +$$; + + +-- +-- Name: queue_orig_price_to_upload(integer); Type: FUNCTION; Schema: import_full; Owner: - +-- + +CREATE FUNCTION queue_orig_price_to_upload(oferta_firm_id integer) RETURNS integer + LANGUAGE plpgsql + AS $$ +BEGIN + INSERT INTO import_full.orig_price_to_upload (firm_id, to_delete) + VALUES (oferta_firm_id, FALSE); + + RETURN 1; +END; +$$; + + +-- +-- Name: to_utc(timestamp without time zone); Type: FUNCTION; Schema: import_full; Owner: - +-- + +CREATE FUNCTION to_utc(timestamp without time zone) RETURNS timestamp without time zone + LANGUAGE sql IMMUTABLE + AS $_$ +SELECT ($1 AT TIME ZONE 'YEKT') AT TIME ZONE 'UTC'; +$_$; + + +-- +-- Name: to_utc(timestamp with time zone); Type: FUNCTION; Schema: import_full; Owner: - +-- + +CREATE FUNCTION to_utc(timestamp with time zone) RETURNS timestamp without time zone + LANGUAGE sql IMMUTABLE + AS $_$ +SELECT ($1 AT TIME ZONE 'UTC')::TIMESTAMP WITHOUT TIME ZONE; +$_$; + + +-- +-- Name: update_company(integer); Type: FUNCTION; Schema: import_full; Owner: - +-- + +CREATE FUNCTION update_company(firm_id integer) RETURNS integer + LANGUAGE plpgsql + AS $$ +DECLARE + firm RECORD; +BEGIN + SELECT * INTO firm FROM import_full.vw_site_firm WHERE oferta_id = firm_id; + + UPDATE companies SET + ( + name, name_rest, synonym, + description, updated_at, + regions, title_ord, first_letter_ord, + oferta_sync_id, oferta_sync_dt, + annonce, has_email, pricelist_actualized_at, + oferta_online_flag + ) = ( + firm.name, firm.opf_name, firm.alt_name, + firm.annotation, import_full.to_utc(firm.modified), + ( + SELECT + array_to_string(array_accum(region_id), ',') + FROM + import_full.companies_regions + WHERE + company_id = firm.oferta_id + GROUP BY company_id LIMIT 1 + ), -- regions + import_full.company_title_ordinal(firm.name), + import_full.company_first_letter_ord(firm.name), + firm.oferta_id, import_full.to_utc(now()), + substring(firm.annotation from 1 for 250), + CASE WHEN + ( + SELECT + COUNT(*) + FROM + import_full.vw_site_estate e INNER JOIN + import_full.vw_site_estate_contact c ON c.estate_id = e.id AND c.contact_type = 3 + WHERE + e.oferta_firm_id = firm.oferta_id + ) > 0 THEN TRUE ELSE FALSE END, -- has email + import_full.to_utc(COALESCE( + (SELECT MAX(actualization_date) FROM import_full.vw_site_modified_offer WHERE firm_id = firm.oferta_id LIMIT 1), + (SELECT pricelist_actualized_at FROM companies WHERE oferta_sync_id = firm.oferta_id LIMIT 1), + (SELECT MAX(actualization_date) FROM price_list_rows WHERE company_id = firm.site_id AND is_deleted = FALSE LIMIT 1) + )), + firm.is_online_edit + ) + WHERE id = firm.site_id AND (oferta_online_flag = FALSE OR oferta_online_flag IS NULL); + + RETURN 1; +END; +$$; + + +-- +-- Name: update_company_regions_commercials_for_company(integer); Type: FUNCTION; Schema: import_full; Owner: - +-- + +CREATE FUNCTION update_company_regions_commercials_for_company(_company_id integer) RETURNS integer + LANGUAGE plpgsql + AS $$ +DECLARE + rlimit RECORD; + dep_id INTEGER; + region_root INTEGER; +BEGIN + DELETE FROM company_region_commercials WHERE company_id = _company_id; + INSERT INTO company_region_commercials ( + company_id, + region_id, + department_id, + bold, + region_limit, + created_at, + updated_at + ) + SELECT + f.site_id, + rl.region_id, + COALESCE( + ( + SELECT a.id + FROM + addresses a INNER JOIN + cities c ON a.city_id = c.id INNER JOIN + provinces p ON c.province_id = p.id INNER JOIN + regions r ON p.region_id = r.id + WHERE + a.company_id = f.site_id AND + r.id = rl.region_id + ORDER BY position ASC + LIMIT 1 + ), + (SELECT id FROM addresses WHERE company_id = f.site_id ORDER BY position ASC LIMIT 1) + ) AS department_id, + rb.region_id IS NOT NULL AS bold, + rl.limit_value, + import_full.to_utc(clock_timestamp()), + import_full.to_utc(clock_timestamp()) + FROM + import_full.companies_regions_limits rl LEFT JOIN + import_full.companies_regions_bold rb ON rl.firm_id = rb.firm_id AND rl.region_id = rb.region_id INNER JOIN + import_full.vw_site_firm f ON rl.firm_id = f.oferta_id + WHERE + f.site_id = _company_id; + + RETURN 1; +END; +$$; + + +-- +-- Name: FUNCTION update_company_regions_commercials_for_company(_company_id integer); Type: COMMENT; Schema: import_full; Owner: - +-- + +COMMENT ON FUNCTION update_company_regions_commercials_for_company(_company_id integer) IS 'Пересчитывает коммерческие регионы для компании по SITE_ID'; + + +-- +-- Name: update_company_regions_for_company(integer); Type: FUNCTION; Schema: import_full; Owner: - +-- + +CREATE FUNCTION update_company_regions_for_company(_company_id integer) RETURNS void + LANGUAGE plpgsql + AS $$ +BEGIN + DELETE FROM company_regions WHERE company_id = _company_id; + + INSERT INTO company_regions (company_id, region_id, department_id, created_at, updated_at) + SELECT DISTINCT + c.id AS company_id, p.region_id, + ( + SELECT ad.id FROM + addresses ad + INNER JOIN cities cii ON ad.city_id = cii.id + INNER JOIN provinces prov ON cii.province_id = prov.id + WHERE + ad.company_id = c.id AND + prov.region_id = p.region_id + ORDER BY position ASC + LIMIT 1 + ) AS department_id, + import_full.to_utc(clock_timestamp()), + import_full.to_utc(clock_timestamp()) + FROM + companies c + INNER JOIN addresses a ON a.company_id = c.id + INNER JOIN cities ci ON a.city_id = ci.id + INNER JOIN provinces p ON ci.province_id = p.id + WHERE + c.id = _company_id + UNION + SELECT + c.id AS company_id, roots.id AS region_id, + ( + SELECT ad.id + FROM + addresses ad + INNER JOIN cities cii ON ad.city_id = cii.id + INNER JOIN provinces prov ON cii.province_id = prov.id + WHERE + prov.region_id IN + ( + SELECT rr.id FROM regions rr WHERE + (rr.rgt - rr.lft) = 1 AND + rr.id != root_region.id AND + rr.lft >= root_region.lft AND + rr.rgt <= root_region.rgt + ) AND + ad.company_id = c.id + ORDER BY ad.position + LIMIT 1 + ) AS department_id, + import_full.to_utc(clock_timestamp()), + import_full.to_utc(clock_timestamp()) + FROM + companies c + INNER JOIN addresses a ON a.company_id = c.id + INNER JOIN cities ci ON a.city_id = ci.id + INNER JOIN provinces p ON ci.province_id = p.id + INNER JOIN regions r ON p.region_id = r.id + INNER JOIN + ( + SELECT + r.id AS child_id, r.name, + ( + SELECT rr.id FROM regions rr + WHERE rr.lft <= r.lft AND rr.rgt >= r.rgt + ORDER BY rr.lft LIMIT 1 + ) AS id + FROM + regions r + WHERE (r.rgt - r.lft) = 1 + ) roots ON r.id = roots.child_id + INNER JOIN regions AS root_region ON roots.id = root_region.id + WHERE + c.id = _company_id; +END; +$$; + + +SET search_path = londiste, pg_catalog; + +-- +-- Name: _coordinate_copy(text, text); Type: FUNCTION; Schema: londiste; Owner: - +-- + +CREATE FUNCTION _coordinate_copy(i_queue_name text, i_table_name text, OUT copy_role text, OUT copy_pos integer) RETURNS record + LANGUAGE plpgsql STABLE STRICT + AS $$ +-- if the table is in middle of copy from multiple partitions, +-- the copy processes need coordination. +declare + q_part1 text; + q_part_ddl text; + n_parts int4; + n_done int4; + _table_name text; + n_combined_queue text; + merge_state text; + dest_table text; + dropped_ddl text; +begin + copy_pos := 0; + copy_role := null; + + select t.merge_state, t.dest_table, t.dropped_ddl, + min(case when t2.local then t2.queue_name else null end) as _queue1, + min(case when t2.local and t2.dropped_ddl is not null then t2.queue_name else null end) as _queue1ddl, + count(case when t2.local then t2.table_name else null end) as _total, + count(case when t2.local then nullif(t2.merge_state, 'in-copy') else null end) as _done, + min(n.combined_queue) as _combined_queue, + count(nullif(t2.queue_name < i_queue_name and t.merge_state = 'in-copy' and t2.merge_state = 'in-copy', false)) as _copy_pos + from londiste.table_info t + join pgq_node.node_info n on (n.queue_name = t.queue_name) + left join pgq_node.node_info n2 on (n2.combined_queue = n.combined_queue or + (n2.combined_queue is null and n.combined_queue is null)) + left join londiste.table_info t2 on + (coalesce(t2.dest_table, t2.table_name) = coalesce(t.dest_table, t.table_name) and + t2.queue_name = n2.queue_name and + (t2.merge_state is null or t2.merge_state != 'ok')) + where t.queue_name = i_queue_name and t.table_name = i_table_name + group by t.nr, t.table_name, t.local, t.merge_state, t.custom_snapshot, t.table_attrs, t.dropped_ddl, t.dest_table + into merge_state, dest_table, dropped_ddl, q_part1, q_part_ddl, n_parts, n_done, n_combined_queue, copy_pos; + + -- q_part1, q_part_ddl, n_parts, n_done, n_combined_queue, copy_pos, dest_table + + -- be more robust against late joiners + q_part1 := coalesce(q_part_ddl, q_part1); + + -- turn the logic off if no merge is happening + if n_parts = 1 then + q_part1 := null; + end if; + + if q_part1 is not null then + if i_queue_name = q_part1 then + -- lead + if merge_state = 'in-copy' then + if dropped_ddl is null and n_done > 0 then + -- seems late addition, let it copy with indexes + copy_role := 'wait-replay'; + elsif n_done < n_parts then + -- show copy_role only if need to drop ddl or already did drop ddl + copy_role := 'lead'; + end if; + + -- make sure it cannot be made to wait + copy_pos := 0; + end if; + if merge_state = 'catching-up' and dropped_ddl is not null then + -- show copy_role only if need to wait for others + if n_done < n_parts then + copy_role := 'wait-replay'; + end if; + end if; + else + -- follow + if merge_state = 'in-copy' then + if q_part_ddl is not null then + -- can copy, wait in replay until lead has applied ddl + copy_role := 'wait-replay'; + elsif n_done > 0 then + -- ddl is not dropped, others are active, copy without touching ddl + copy_role := 'wait-replay'; + else + -- wait for lead to drop ddl + copy_role := 'wait-copy'; + end if; + elsif merge_state = 'catching-up' then + -- show copy_role only if need to wait for lead + if q_part_ddl is not null then + copy_role := 'wait-replay'; + end if; + end if; + end if; + end if; + + return; +end; +$$; + + +-- +-- Name: drop_table_fkey(text, text); Type: FUNCTION; Schema: londiste; Owner: - +-- + +CREATE FUNCTION drop_table_fkey(i_from_table text, i_fkey_name text) RETURNS integer + LANGUAGE plpgsql STRICT + AS $$ +-- ---------------------------------------------------------------------- +-- Function: londiste.drop_table_fkey(2) +-- +-- Drop one fkey, save in pending table. +-- ---------------------------------------------------------------------- +declare + fkey record; +begin + select * into fkey + from londiste.find_table_fkeys(i_from_table) + where fkey_name = i_fkey_name and from_table = i_from_table; + + if not found then + return 0; + end if; + + insert into londiste.pending_fkeys values (fkey.from_table, fkey.to_table, i_fkey_name, fkey.fkey_def); + + execute 'alter table only ' || londiste.quote_fqname(fkey.from_table) + || ' drop constraint ' || quote_ident(i_fkey_name); + + return 1; +end; +$$; + + +-- +-- Name: drop_table_triggers(text, text); Type: FUNCTION; Schema: londiste; Owner: - +-- + +CREATE FUNCTION drop_table_triggers(i_queue_name text, i_table_name text) RETURNS void + LANGUAGE plpgsql STRICT + AS $$ +-- ---------------------------------------------------------------------- +-- Function: londiste.drop_table_triggers(2) +-- +-- Remove Londiste triggers from table. +-- +-- Parameters: +-- i_queue_name - set name +-- i_table_name - table name +-- +-- Returns: +-- 200 - OK +-- 404 - Table not found +-- ---------------------------------------------------------------------- +declare + logtrg_name text; + b_queue_name bytea; + _dest_table text; +begin + select coalesce(dest_table, table_name) + from londiste.table_info t + where t.queue_name = i_queue_name + and t.table_name = i_table_name + into _dest_table; + if not found then + return; + end if; + + -- skip if no triggers found on that table + perform 1 from pg_catalog.pg_trigger where tgrelid = londiste.find_table_oid(_dest_table); + if not found then + return; + end if; + + -- cast to bytea + b_queue_name := replace(i_queue_name, E'\\', E'\\\\')::bytea; + + -- drop all replication triggers that target our queue. + -- by checking trigger func and queue name there is not + -- dependency on naming standard or side-storage. + for logtrg_name in + select tgname from pg_catalog.pg_trigger + where tgrelid = londiste.find_table_oid(_dest_table) + and londiste.is_replica_func(tgfoid) + and octet_length(tgargs) > 0 + and substring(tgargs for (position(E'\\000'::bytea in tgargs) - 1)) = b_queue_name + loop + execute 'drop trigger ' || quote_ident(logtrg_name) + || ' on ' || londiste.quote_fqname(_dest_table); + end loop; +end; +$$; + + +-- +-- Name: execute_finish(text, text); Type: FUNCTION; Schema: londiste; Owner: - +-- + +CREATE FUNCTION execute_finish(i_queue_name text, i_file_name text, OUT ret_code integer, OUT ret_note text) RETURNS record + LANGUAGE plpgsql STRICT + AS $$ +-- ---------------------------------------------------------------------- +-- Function: londiste.execute_finish(2) +-- +-- Finish execution of DDL. Should be called at the +-- end of the transaction that does the SQL execution. +-- +-- Called-by: +-- Londiste setup tool on root, replay on branches/leafs. +-- +-- Returns: +-- 200 - Proceed. +-- 404 - Current entry not found, execute_start() was not called? +-- ---------------------------------------------------------------------- +declare + is_root boolean; + sql text; +begin + is_root := pgq_node.is_root_node(i_queue_name); + + select execute_sql into sql + from londiste.applied_execute + where queue_name = i_queue_name + and execute_file = i_file_name; + if not found then + select 404, 'execute_file called without execute_start' + into ret_code, ret_note; + return; + end if; + + if is_root then + perform pgq.insert_event(i_queue_name, 'EXECUTE', sql, i_file_name, null, null, null); + end if; + + select 200, 'Execute finished: ' || i_file_name into ret_code, ret_note; + return; +end; +$$; + + +-- +-- Name: execute_start(text, text, text, boolean); Type: FUNCTION; Schema: londiste; Owner: - +-- + +CREATE FUNCTION execute_start(i_queue_name text, i_file_name text, i_sql text, i_expect_root boolean, OUT ret_code integer, OUT ret_note text) RETURNS record + LANGUAGE plpgsql STRICT + AS $$ +-- ---------------------------------------------------------------------- +-- Function: londiste.execute_start(4) +-- +-- Start execution of DDL. Should be called at the +-- start of the transaction that does the SQL execution. +-- +-- Called-by: +-- Londiste setup tool on root, replay on branches/leafs. +-- +-- Parameters: +-- i_queue_name - cascaded queue name +-- i_file_name - Unique ID for SQL +-- i_sql - Actual script (informative, not used here) +-- i_expect_root - Is this on root? Setup tool sets this to avoid +-- execution on branches. +-- +-- Returns: +-- 200 - Proceed. +-- 301 - Already applied +-- 401 - Not root. +-- 404 - No such queue +-- ---------------------------------------------------------------------- +declare + is_root boolean; +begin + is_root := pgq_node.is_root_node(i_queue_name); + if i_expect_root then + if not is_root then + select 401, 'Node is not root node: ' || i_queue_name + into ret_code, ret_note; + return; + end if; + end if; + + perform 1 from londiste.applied_execute + where queue_name = i_queue_name + and execute_file = i_file_name; + if found then + select 301, 'EXECUTE(' || i_file_name || ') already applied' + into ret_code, ret_note; + return; + end if; + + -- this also lock against potetial parallel execute + insert into londiste.applied_execute (queue_name, execute_file, execute_sql) + values (i_queue_name, i_file_name, i_sql); + + select 200, 'Executing: ' || i_file_name into ret_code, ret_note; + return; +end; +$$; + + +-- +-- Name: find_column_types(text); Type: FUNCTION; Schema: londiste; Owner: - +-- + +CREATE FUNCTION find_column_types(tbl text) RETURNS text + LANGUAGE plpgsql STABLE STRICT + AS $$ +-- ---------------------------------------------------------------------- +-- Function: londiste.find_column_types(1) +-- +-- Returns columnt type string for logtriga(). +-- +-- Parameters: +-- tbl - fqname +-- +-- Returns: +-- String of 'kv'. +-- ---------------------------------------------------------------------- +declare + res text; + col record; + tbl_oid oid; +begin + tbl_oid := londiste.find_table_oid(tbl); + res := ''; + for col in + SELECT CASE WHEN k.attname IS NOT NULL THEN 'k' ELSE 'v' END AS type + FROM pg_attribute a LEFT JOIN ( + SELECT k.attname FROM pg_index i, pg_attribute k + WHERE i.indrelid = tbl_oid AND k.attrelid = i.indexrelid + AND i.indisprimary AND k.attnum > 0 AND NOT k.attisdropped + ) k ON (k.attname = a.attname) + WHERE a.attrelid = tbl_oid AND a.attnum > 0 AND NOT a.attisdropped + ORDER BY a.attnum + loop + res := res || col.type; + end loop; + + return res; +end; +$$; + + +-- +-- Name: find_rel_oid(text, text); Type: FUNCTION; Schema: londiste; Owner: - +-- + +CREATE FUNCTION find_rel_oid(i_fqname text, i_kind text) RETURNS oid + LANGUAGE plpgsql STABLE STRICT + AS $$ +-- ---------------------------------------------------------------------- +-- Function: londiste.find_rel_oid(2) +-- +-- Find pg_class row oid. +-- +-- Parameters: +-- i_fqname - fq object name +-- i_kind - relkind value +-- +-- Returns: +-- oid or exception of not found +-- ---------------------------------------------------------------------- +declare + res oid; + pos integer; + schema text; + name text; +begin + pos := position('.' in i_fqname); + if pos > 0 then + schema := substring(i_fqname for pos - 1); + name := substring(i_fqname from pos + 1); + else + schema := 'public'; + name := i_fqname; + end if; + select c.oid into res + from pg_namespace n, pg_class c + where c.relnamespace = n.oid + and c.relkind = i_kind + and n.nspname = schema and c.relname = name; + if not found then + res := NULL; + end if; + + return res; +end; +$$; + + +-- +-- Name: find_seq_oid(text); Type: FUNCTION; Schema: londiste; Owner: - +-- + +CREATE FUNCTION find_seq_oid(seq text) RETURNS oid + LANGUAGE plpgsql STABLE STRICT + AS $$ +-- ---------------------------------------------------------------------- +-- Function: londiste.find_seq_oid(1) +-- +-- Find sequence oid based on fqname. +-- +-- Parameters: +-- seq - fqname +-- +-- Returns: +-- oid +-- ---------------------------------------------------------------------- +begin + return londiste.find_rel_oid(seq, 'S'); +end; +$$; + + +SET default_tablespace = ''; + +SET default_with_oids = false; + +-- +-- Name: pending_fkeys; Type: TABLE; Schema: londiste; Owner: -; Tablespace: +-- + +CREATE TABLE pending_fkeys ( + from_table text NOT NULL, + to_table text NOT NULL, + fkey_name text NOT NULL, + fkey_def text NOT NULL +); + + +-- +-- Name: find_table_fkeys(text); Type: FUNCTION; Schema: londiste; Owner: - +-- + +CREATE FUNCTION find_table_fkeys(i_table_name text) RETURNS SETOF pending_fkeys + LANGUAGE plpgsql STABLE STRICT + AS $$ +-- ---------------------------------------------------------------------- +-- Function: londiste.find_table_fkeys(1) +-- +-- Return all active fkeys. +-- +-- Parameters: +-- i_table_name - fqname +-- +-- Returns: +-- from_table - fqname +-- to_table - fqname +-- fkey_name - name +-- fkey_def - full def +-- ---------------------------------------------------------------------- +declare + fkey record; + tbl_oid oid; +begin + select londiste.find_table_oid(i_table_name) into tbl_oid; + + for fkey in + select n1.nspname || '.' || t1.relname as from_table, n2.nspname || '.' || t2.relname as to_table, + conname::text as fkey_name, + 'alter table only ' || quote_ident(n1.nspname) || '.' || quote_ident(t1.relname) + || ' add constraint ' || quote_ident(conname::text) || ' ' || pg_get_constraintdef(c.oid) + as fkey_def + from pg_constraint c, pg_namespace n1, pg_class t1, pg_namespace n2, pg_class t2 + where c.contype = 'f' and (c.conrelid = tbl_oid or c.confrelid = tbl_oid) + and t1.oid = c.conrelid and n1.oid = t1.relnamespace + and t2.oid = c.confrelid and n2.oid = t2.relnamespace + order by 1,2,3 + loop + return next fkey; + end loop; + + return; +end; +$$; + + +-- +-- Name: find_table_oid(text); Type: FUNCTION; Schema: londiste; Owner: - +-- + +CREATE FUNCTION find_table_oid(tbl text) RETURNS oid + LANGUAGE plpgsql STABLE STRICT + AS $$ +-- ---------------------------------------------------------------------- +-- Function: londiste.find_table_oid(1) +-- +-- Find table oid based on fqname. +-- +-- Parameters: +-- tbl - fqname +-- +-- Returns: +-- oid +-- ---------------------------------------------------------------------- +begin + return londiste.find_rel_oid(tbl, 'r'); +end; +$$; + + +-- +-- Name: get_seq_list(text); Type: FUNCTION; Schema: londiste; Owner: - +-- + +CREATE FUNCTION get_seq_list(i_queue_name text, OUT seq_name text, OUT last_value bigint, OUT local boolean) RETURNS SETOF record + LANGUAGE plpgsql STRICT + AS $$ +-- ---------------------------------------------------------------------- +-- Function: londiste.get_seq_list(1) +-- +-- Returns registered seqs on this Londiste node. +-- +-- Result fiels: +-- seq_name - fully qualified name of sequence +-- last_value - last globally published value +-- local - is locally registered +-- ---------------------------------------------------------------------- +declare + rec record; +begin + for seq_name, last_value, local in + select s.seq_name, s.last_value, s.local from londiste.seq_info s + where s.queue_name = i_queue_name + order by s.nr, s.seq_name + loop + return next; + end loop; + return; +end; +$$; + + +-- +-- Name: get_table_list(text); Type: FUNCTION; Schema: londiste; Owner: - +-- + +CREATE FUNCTION get_table_list(i_queue_name text, OUT table_name text, OUT local boolean, OUT merge_state text, OUT custom_snapshot text, OUT table_attrs text, OUT dropped_ddl text, OUT copy_role text, OUT copy_pos integer, OUT dest_table text) RETURNS SETOF record + LANGUAGE plpgsql STABLE STRICT + AS $$ +-- ---------------------------------------------------------------------- +-- Function: londiste.get_table_list(1) +-- +-- Return info about registered tables. +-- +-- Parameters: +-- i_queue_name - cascaded queue name +-- +-- Returns: +-- table_name - fully-quelified table name +-- local - does events needs to be applied to local table +-- merge_state - show phase of initial copy +-- custom_snapshot - remote snapshot of COPY transaction +-- table_attrs - urlencoded dict of table attributes +-- dropped_ddl - partition combining: temp place to put DDL +-- copy_role - partition combining: how to handle copy +-- copy_pos - position in parallel copy working order +-- +-- copy_role = lead: +-- on copy start, drop indexes and store in dropped_ddl +-- on copy finish change state to catching-up, then wait until copy_role turns to NULL +-- catching-up: if dropped_ddl not NULL, restore them +-- copy_role = wait-copy: +-- on copy start wait, until role changes (to wait-replay) +-- copy_role = wait-replay: +-- on copy finish, tag as 'catching-up' +-- wait until copy_role is NULL, then proceed +-- ---------------------------------------------------------------------- +begin + for table_name, local, merge_state, custom_snapshot, table_attrs, + dropped_ddl, dest_table + in + select t.table_name, t.local, t.merge_state, t.custom_snapshot, t.table_attrs, + t.dropped_ddl, t.dest_table + from londiste.table_info t + where t.queue_name = i_queue_name + order by t.nr, t.table_name + loop + copy_role := null; + copy_pos := 0; + + if merge_state in ('in-copy', 'catching-up') then + select f.copy_role, f.copy_pos + from londiste._coordinate_copy(i_queue_name, table_name) f + into copy_role, copy_pos; + end if; + + return next; + end loop; + return; +end; +$$; + + +-- +-- Name: get_table_pending_fkeys(text); Type: FUNCTION; Schema: londiste; Owner: - +-- + +CREATE FUNCTION get_table_pending_fkeys(i_table_name text) RETURNS SETOF pending_fkeys + LANGUAGE plpgsql STABLE STRICT + AS $$ +-- ---------------------------------------------------------------------- +-- Function: londiste.get_table_pending_fkeys(1) +-- +-- Return dropped fkeys for table. +-- +-- Parameters: +-- i_table_name - fqname +-- +-- Returns: +-- desc +-- ---------------------------------------------------------------------- +declare + fkeys record; +begin + for fkeys in + select * + from londiste.pending_fkeys + where from_table = i_table_name or to_table = i_table_name + order by 1,2,3 + loop + return next fkeys; + end loop; + return; +end; +$$; + + +-- +-- Name: get_valid_pending_fkeys(text); Type: FUNCTION; Schema: londiste; Owner: - +-- + +CREATE FUNCTION get_valid_pending_fkeys(i_queue_name text) RETURNS SETOF pending_fkeys + LANGUAGE plpgsql STABLE STRICT + AS $$ +-- ---------------------------------------------------------------------- +-- Function: londiste.get_valid_pending_fkeys(1) +-- +-- Returns dropped fkeys where both sides are in sync now. +-- +-- Parameters: +-- i_queue_name - cascaded queue name +-- +-- Returns: +-- desc +-- ---------------------------------------------------------------------- +declare + fkeys record; +begin + for fkeys in + select pf.* + from londiste.pending_fkeys pf + order by 1, 2, 3 + loop + perform 1 + from londiste.table_info st_from + where coalesce(st_from.dest_table, st_from.table_name) = fkeys.from_table + and st_from.merge_state = 'ok' + and st_from.custom_snapshot is null + and st_from.queue_name = i_queue_name; + if not found then + continue; + end if; + perform 1 + from londiste.table_info st_to + where coalesce(st_to.dest_table, st_to.table_name) = fkeys.to_table + and st_to.merge_state = 'ok' + and st_to.custom_snapshot is null + and st_to.queue_name = i_queue_name; + if not found then + continue; + end if; + return next fkeys; + end loop; + + return; +end; +$$; + + +-- +-- Name: global_add_table(text, text); Type: FUNCTION; Schema: londiste; Owner: - +-- + +CREATE FUNCTION global_add_table(i_queue_name text, i_table_name text, OUT ret_code integer, OUT ret_note text) RETURNS record + LANGUAGE plpgsql STRICT + AS $$ +-- ---------------------------------------------------------------------- +-- Function: londiste.global_add_table(2) +-- +-- Register table on Londiste set. +-- +-- This means its available from root, events for it appear +-- in queue and nodes can attach to it. +-- +-- Called by: +-- on root - londiste.local_add_table() +-- elsewhere - londiste consumer when receives new table event +-- +-- Returns: +-- 200 - Ok +-- 400 - No such set +-- ---------------------------------------------------------------------- +declare + fq_table_name text; + _cqueue text; +begin + fq_table_name := londiste.make_fqname(i_table_name); + + select combined_queue into _cqueue + from pgq_node.node_info + where queue_name = i_queue_name + for update; + if not found then + select 400, 'No such queue: ' || i_queue_name into ret_code, ret_note; + return; + end if; + + perform 1 from londiste.table_info where queue_name = i_queue_name and table_name = fq_table_name; + if found then + select 200, 'Table already added: ' || fq_table_name into ret_code, ret_note; + return; + end if; + + insert into londiste.table_info (queue_name, table_name) + values (i_queue_name, fq_table_name); + select 200, 'Table added: ' || i_table_name + into ret_code, ret_note; + + -- let the combined node know about it too + if _cqueue is not null then + perform londiste.global_add_table(_cqueue, i_table_name); + end if; + + return; +exception + -- seems the row was added from parallel connection (setup vs. replay) + when unique_violation then + select 200, 'Table already added: ' || i_table_name + into ret_code, ret_note; + return; +end; +$$; + + +-- +-- Name: global_remove_seq(text, text); Type: FUNCTION; Schema: londiste; Owner: - +-- + +CREATE FUNCTION global_remove_seq(i_queue_name text, i_seq_name text, OUT ret_code integer, OUT ret_note text) RETURNS record + LANGUAGE plpgsql STRICT + AS $$ +-- ---------------------------------------------------------------------- +-- Function: londiste.global_remove_seq(2) +-- +-- Removes sequence registration in set. +-- +-- Called by: +-- - On root by londiste.local_remove_seq() +-- - Elsewhere by consumer receiving seq remove event +-- +-- Returns: +-- 200 - OK +-- 400 - not found +-- ---------------------------------------------------------------------- +declare + fq_name text; +begin + fq_name := londiste.make_fqname(i_seq_name); + delete from londiste.seq_info + where queue_name = i_queue_name + and seq_name = fq_name; + if not found then + select 400, 'Sequence not found: '||fq_name into ret_code, ret_note; + return; + end if; + if pgq_node.is_root_node(i_queue_name) then + perform londiste.root_notify_change(i_queue_name, 'londiste.remove-seq', fq_name); + end if; + select 200, 'Sequence removed: '||fq_name into ret_code, ret_note; + return; +end; +$$; + + +-- +-- Name: global_remove_table(text, text); Type: FUNCTION; Schema: londiste; Owner: - +-- + +CREATE FUNCTION global_remove_table(i_queue_name text, i_table_name text, OUT ret_code integer, OUT ret_note text) RETURNS record + LANGUAGE plpgsql STRICT + AS $$ +-- ---------------------------------------------------------------------- +-- Function: londiste.global_remove_table(2) +-- +-- Removes tables registration in set. +-- +-- Means that nodes cannot attach to this table anymore. +-- +-- Called by: +-- - On root by londiste.local_remove_table() +-- - Elsewhere by consumer receiving table remove event +-- +-- Returns: +-- 200 - OK +-- 400 - not found +-- ---------------------------------------------------------------------- +declare + fq_table_name text; +begin + fq_table_name := londiste.make_fqname(i_table_name); + if not pgq_node.is_root_node(i_queue_name) then + perform londiste.local_remove_table(i_queue_name, fq_table_name); + end if; + delete from londiste.table_info + where queue_name = i_queue_name + and table_name = fq_table_name; + if not found then + select 400, 'Table not found: ' || fq_table_name + into ret_code, ret_note; + return; + end if; + select 200, 'Table removed: ' || i_table_name + into ret_code, ret_note; + return; +end; +$$; + + +-- +-- Name: global_update_seq(text, text, bigint); Type: FUNCTION; Schema: londiste; Owner: - +-- + +CREATE FUNCTION global_update_seq(i_queue_name text, i_seq_name text, i_value bigint, OUT ret_code integer, OUT ret_note text) RETURNS record + LANGUAGE plpgsql + AS $$ +-- ---------------------------------------------------------------------- +-- Function: londiste.global_update_seq(3) +-- +-- Update seq. +-- +-- Parameters: +-- i_queue_name - set name +-- i_seq_name - seq name +-- i_value - new published value +-- +-- Returns: +-- 200 - OK +-- ---------------------------------------------------------------------- +declare + n record; + fqname text; + seq record; +begin + select node_type, node_name into n + from pgq_node.node_info + where queue_name = i_queue_name; + if not found then + select 404, 'Set not found: ' || i_queue_name into ret_code, ret_note; + return; + end if; + if n.node_type = 'root' then + select 402, 'Must not run on root node' into ret_code, ret_note; + return; + end if; + + fqname := londiste.make_fqname(i_seq_name); + select last_value, local from londiste.seq_info + into seq + where queue_name = i_queue_name and seq_name = fqname + for update; + if not found then + insert into londiste.seq_info + (queue_name, seq_name, last_value) + values (i_queue_name, fqname, i_value); + else + update londiste.seq_info + set last_value = i_value + where queue_name = i_queue_name and seq_name = fqname; + if seq.local then + perform pgq.seq_setval(fqname, i_value); + end if; + end if; + select 200, 'Sequence updated' into ret_code, ret_note; + return; +end; +$$; + + +-- +-- Name: is_replica_func(oid); Type: FUNCTION; Schema: londiste; Owner: - +-- + +CREATE FUNCTION is_replica_func(func_oid oid) RETURNS boolean + LANGUAGE sql STABLE STRICT + AS $_$ +-- ---------------------------------------------------------------------- +-- Function: londiste.is_replica_func(1) +-- +-- Returns true if function is a PgQ-based replication functions. +-- This also means it takes queue name as first argument. +-- ---------------------------------------------------------------------- +select count(1) > 0 + from pg_proc f join pg_namespace n on (n.oid = f.pronamespace) + where f.oid = $1 and n.nspname = 'pgq' and f.proname in ('sqltriga', 'logutriga'); +$_$; + + +-- +-- Name: local_add_seq(text, text); Type: FUNCTION; Schema: londiste; Owner: - +-- + +CREATE FUNCTION local_add_seq(i_queue_name text, i_seq_name text, OUT ret_code integer, OUT ret_note text) RETURNS record + LANGUAGE plpgsql + AS $$ +-- ---------------------------------------------------------------------- +-- Function: londiste.local_add_seq(2) +-- +-- Register sequence. +-- +-- Parameters: +-- i_queue_name - cascaded queue name +-- i_seq_name - seq name +-- +-- Returns: +-- 200 - OK +-- 400 - Not found +-- ---------------------------------------------------------------------- +declare + fq_seq_name text; + lastval int8; + seq record; +begin + fq_seq_name := londiste.make_fqname(i_seq_name); + + perform 1 from pg_class + where oid = londiste.find_seq_oid(fq_seq_name); + if not found then + select 400, 'Sequence not found: ' || fq_seq_name into ret_code, ret_note; + return; + end if; + + if pgq_node.is_root_node(i_queue_name) then + select local, last_value into seq + from londiste.seq_info + where queue_name = i_queue_name + and seq_name = fq_seq_name + for update; + if found and seq.local then + select 201, 'Sequence already added: ' || fq_seq_name + into ret_code, ret_note; + return; + end if; + if not seq.local then + update londiste.seq_info set local = true + where queue_name = i_queue_name and seq_name = fq_seq_name; + else + insert into londiste.seq_info (queue_name, seq_name, local, last_value) + values (i_queue_name, fq_seq_name, true, 0); + end if; + perform * from londiste.root_check_seqs(i_queue_name); + else + select local, last_value into seq + from londiste.seq_info + where queue_name = i_queue_name + and seq_name = fq_seq_name + for update; + if not found then + select 404, 'Unknown sequence: ' || fq_seq_name + into ret_code, ret_note; + return; + end if; + if seq.local then + select 201, 'Sequence already added: ' || fq_seq_name + into ret_code, ret_note; + return; + end if; + update londiste.seq_info set local = true + where queue_name = i_queue_name and seq_name = fq_seq_name; + perform pgq.seq_setval(fq_seq_name, seq.last_value); + end if; + + select 200, 'Sequence added: ' || fq_seq_name into ret_code, ret_note; + return; +end; +$$; + + +-- +-- Name: local_add_table(text, text); Type: FUNCTION; Schema: londiste; Owner: - +-- + +CREATE FUNCTION local_add_table(i_queue_name text, i_table_name text, OUT ret_code integer, OUT ret_note text) RETURNS record + LANGUAGE plpgsql STRICT + AS $$ +-- ---------------------------------------------------------------------- +-- Function: londiste.local_add_table(2) +-- +-- Register table on Londiste node. +-- ---------------------------------------------------------------------- +begin + select f.ret_code, f.ret_note into ret_code, ret_note + from londiste.local_add_table(i_queue_name, i_table_name, null) f; + return; +end; +$$; + + +-- +-- Name: local_add_table(text, text, text[]); Type: FUNCTION; Schema: londiste; Owner: - +-- + +CREATE FUNCTION local_add_table(i_queue_name text, i_table_name text, i_trg_args text[], OUT ret_code integer, OUT ret_note text) RETURNS record + LANGUAGE plpgsql + AS $$ +-- ---------------------------------------------------------------------- +-- Function: londiste.local_add_table(3) +-- +-- Register table on Londiste node. +-- ---------------------------------------------------------------------- +begin + select f.ret_code, f.ret_note into ret_code, ret_note + from londiste.local_add_table(i_queue_name, i_table_name, i_trg_args, null) f; + return; +end; +$$; + + +-- +-- Name: local_add_table(text, text, text[], text); Type: FUNCTION; Schema: londiste; Owner: - +-- + +CREATE FUNCTION local_add_table(i_queue_name text, i_table_name text, i_trg_args text[], i_table_attrs text, OUT ret_code integer, OUT ret_note text) RETURNS record + LANGUAGE plpgsql + AS $$ +-- ---------------------------------------------------------------------- +-- Function: londiste.local_add_table(4) +-- +-- Register table on Londiste node. +-- ---------------------------------------------------------------------- +begin + select f.ret_code, f.ret_note into ret_code, ret_note + from londiste.local_add_table(i_queue_name, i_table_name, i_trg_args, i_table_attrs, null) f; + return; +end; +$$; + + +-- +-- Name: local_add_table(text, text, text[], text, text); Type: FUNCTION; Schema: londiste; Owner: - +-- + +CREATE FUNCTION local_add_table(i_queue_name text, i_table_name text, i_trg_args text[], i_table_attrs text, i_dest_table text, OUT ret_code integer, OUT ret_note text) RETURNS record + LANGUAGE plpgsql + AS $$ +-- ---------------------------------------------------------------------- +-- Function: londiste.local_add_table(5) +-- +-- Register table on Londiste node, with customizable trigger args. +-- +-- Parameters: +-- i_queue_name - queue name +-- i_table_name - table name +-- i_trg_args - args to trigger, or magic parameters. +-- i_table_attrs - args to python handler +-- i_dest_table - actual name of destination table (NULL if same) +-- +-- Trigger args: +-- See documentation for pgq triggers. +-- +-- Magic parameters: +-- no_triggers - skip trigger creation +-- skip_truncate - set 'skip_truncate' table attribute +-- expect_sync - set table state to 'ok' +-- tgflags=X - trigger creation flags +-- merge_all - merge table from all sources. required for +-- multi-source table +-- no_merge - do not merge tables from different sources +-- skip - create skip trigger. same as S flag +-- virtual_table - skips structure check and trigger creation +-- +-- Trigger creation flags (default: AIUDL): +-- I - ON INSERT +-- U - ON UPDATE +-- D - ON DELETE +-- Q - use pgq.sqltriga() as trigger function +-- L - use pgq.logutriga() as trigger function +-- B - BEFORE +-- A - AFTER +-- S - SKIP +-- +-- Example: +-- > londiste.local_add_table('q', 'tbl', array['tgflags=BI', 'SKIP', 'pkey=col1,col2']) +-- +-- Returns: +-- 200 - Ok +-- 301 - Warning, trigger exists that will fire before londiste one +-- 400 - No such set +------------------------------------------------------------------------ +declare + col_types text; + fq_table_name text; + new_state text; + trunctrg_name text; + pgversion int; + logtrg_previous text; + lg_name text; + lg_func text; + lg_pos text; + lg_event text; + lg_args text; + _extra_args text; + tbl record; + i integer; + j integer; + sql text; + arg text; + _node record; + _tbloid oid; + _combined_queue text; + _combined_table text; + -- skip trigger + _skip_prefix text := 'zzz_'; + _skip_trg_count integer; + _skip_trg_name text; + -- check local tables from all sources + _queue_name text; + _local boolean; + -- array with all tgflags values + _check_flags char[] := array['B','A','Q','L','I','U','D','S']; + -- given tgflags array + _tgflags char[]; + -- ordinary argument array + _args text[]; + -- argument flags + _expect_sync boolean := false; + _merge_all boolean := false; + _no_merge boolean := false; + _skip_truncate boolean := false; + _no_triggers boolean := false; + _skip boolean := false; + _virtual_table boolean := false; + _dest_table text; + _got_extra1 boolean := false; + _table_name2 text; + _desc text; +begin + + -------- i_trg_args ARGUMENTS PARSING + + if array_lower(i_trg_args, 1) is not null then + for i in array_lower(i_trg_args, 1) .. array_upper(i_trg_args, 1) loop + arg := i_trg_args[i]; + if arg like 'tgflags=%' then + -- special flag handling + arg := upper(substr(arg, 9)); + for j in array_lower(_check_flags, 1) .. array_upper(_check_flags, 1) loop + if position(_check_flags[j] in arg) > 0 then + _tgflags := array_append(_tgflags, _check_flags[j]); + end if; + end loop; + elsif arg = 'expect_sync' then + _expect_sync := true; + elsif arg = 'skip_truncate' then + _skip_truncate := true; + elsif arg = 'no_triggers' then + _no_triggers := true; + elsif arg = 'merge_all' then + _merge_all = true; + elsif arg = 'no_merge' then + _no_merge = true; + elsif lower(arg) = 'skip' then + _skip := true; + elsif arg = 'virtual_table' then + _virtual_table := true; + _expect_sync := true; -- do not copy + _no_triggers := true; -- do not create triggers + else + if arg like 'ev_extra1=%' then + _got_extra1 := true; + end if; + -- ordinary arg + _args = array_append(_args, quote_literal(arg)); + end if; + end loop; + end if; + + if _merge_all and _no_merge then + select 405, 'Cannot use merge-all and no-merge together' + into ret_code, ret_note; + return; + end if; + + fq_table_name := londiste.make_fqname(i_table_name); + _dest_table := londiste.make_fqname(coalesce(i_dest_table, i_table_name)); + + if _dest_table <> fq_table_name and not _got_extra1 then + -- if renamed table, enforce trigger to put + -- global table name into extra1 + arg := 'ev_extra1=' || quote_literal(fq_table_name); + _args := array_append(_args, quote_literal(arg)); + end if; + + if _dest_table = fq_table_name then + _desc := fq_table_name; + else + _desc := fq_table_name || '(' || _dest_table || ')'; + end if; + + -------- TABLE STRUCTURE CHECK + + if not _virtual_table then + _tbloid := londiste.find_table_oid(_dest_table); + if _tbloid is null then + select 404, 'Table does not exist: ' || _desc into ret_code, ret_note; + return; + end if; + col_types := londiste.find_column_types(_dest_table); + if position('k' in col_types) < 1 then + -- allow missing primary key in case of combined table where + -- pkey was removed by londiste + perform 1 from londiste.table_info t, + pgq_node.node_info n_this, + pgq_node.node_info n_other + where n_this.queue_name = i_queue_name + and n_other.combined_queue = n_this.combined_queue + and n_other.queue_name <> n_this.queue_name + and t.queue_name = n_other.queue_name + and coalesce(t.dest_table, t.table_name) = _dest_table + and t.dropped_ddl is not null; + if not found then + select 400, 'Primary key missing on table: ' || _desc into ret_code, ret_note; + return; + end if; + end if; + end if; + + -------- TABLE REGISTRATION LOGIC + + select * from pgq_node.get_node_info(i_queue_name) into _node; + if not found or _node.ret_code >= 400 then + select 400, 'No such set: ' || i_queue_name into ret_code, ret_note; + return; + end if; + + select merge_state, local into tbl + from londiste.table_info + where queue_name = i_queue_name and table_name = fq_table_name; + if not found then + -- add to set on root + if _node.node_type = 'root' then + select f.ret_code, f.ret_note into ret_code, ret_note + from londiste.global_add_table(i_queue_name, i_table_name) f; + if ret_code <> 200 then + return; + end if; + else + select 404, 'Table not available on queue: ' || _desc + into ret_code, ret_note; + return; + end if; + + -- reload info + select merge_state, local into tbl + from londiste.table_info + where queue_name = i_queue_name and table_name = fq_table_name; + end if; + + if tbl.local then + select 200, 'Table already added: ' || _desc into ret_code, ret_note; + return; + end if; + + if _node.node_type = 'root' then + new_state := 'ok'; + perform londiste.root_notify_change(i_queue_name, 'londiste.add-table', fq_table_name); + elsif _node.node_type = 'leaf' and _node.combined_type = 'branch' then + new_state := 'ok'; + elsif _expect_sync then + new_state := 'ok'; + else + new_state := NULL; + end if; + + update londiste.table_info + set local = true, + merge_state = new_state, + table_attrs = coalesce(i_table_attrs, table_attrs), + dest_table = nullif(_dest_table, fq_table_name) + where queue_name = i_queue_name and table_name = fq_table_name; + if not found then + raise exception 'lost table: %', fq_table_name; + end if; + + -- merge all table sources on leaf + if _node.node_type = 'leaf' and not _no_merge then + for _queue_name, _table_name2, _local in + select t2.queue_name, t2.table_name, t2.local + from londiste.table_info t + join pgq_node.node_info n on (n.queue_name = t.queue_name) + left join pgq_node.node_info n2 on (n2.combined_queue = n.combined_queue or + (n2.combined_queue is null and n.combined_queue is null)) + left join londiste.table_info t2 + on (t2.queue_name = n2.queue_name and + coalesce(t2.dest_table, t2.table_name) = coalesce(t.dest_table, t.table_name)) + where t.queue_name = i_queue_name + and t.table_name = fq_table_name + and t2.queue_name != i_queue_name -- skip self + loop + -- if table from some other source is already marked as local, + -- raise error + if _local and coalesce(new_state, 'x') <> 'ok' then + select 405, 'Found local table '|| _desc + || ' in queue ' || _queue_name + || ', use remove-table first to remove all previous ' + || 'table subscriptions' + into ret_code, ret_note; + return; + end if; + + -- when table comes from multiple sources, merge_all switch is + -- required + if not _merge_all and coalesce(new_state, 'x') <> 'ok' then + select 405, 'Found multiple sources for table '|| _desc + || ', use merge-all or no-merge to continue' + into ret_code, ret_note; + return; + end if; + + update londiste.table_info + set local = true, + merge_state = new_state, + table_attrs = coalesce(i_table_attrs, table_attrs) + where queue_name = _queue_name and table_name = _table_name2; + if not found then + raise exception 'lost table: % on queue %', _table_name2, _queue_name; + end if; + end loop; + + -- if this node has combined_queue, add table there too + -- note: we need to keep both table_name/dest_table values + select n2.queue_name, t.table_name + from pgq_node.node_info n1 + join pgq_node.node_info n2 + on (n2.queue_name = n1.combined_queue) + left join londiste.table_info t + on (t.queue_name = n2.queue_name and t.table_name = fq_table_name and t.local) + where n1.queue_name = i_queue_name and n2.node_type = 'root' + into _combined_queue, _combined_table; + if found and _combined_table is null then + select f.ret_code, f.ret_note + from londiste.local_add_table(_combined_queue, fq_table_name, i_trg_args, i_table_attrs, _dest_table) f + into ret_code, ret_note; + if ret_code >= 300 then + return; + end if; + end if; + end if; + + if _skip_truncate then + perform 1 + from londiste.local_set_table_attrs(i_queue_name, fq_table_name, + coalesce(i_table_attrs || '&skip_truncate=1', 'skip_truncate=1')); + end if; + + -------- TRIGGER LOGIC + + -- new trigger + _extra_args := ''; + lg_name := '_londiste_' || i_queue_name; + lg_func := 'pgq.logutriga'; + lg_event := ''; + lg_args := quote_literal(i_queue_name); + lg_pos := 'after'; + + if array_lower(_args, 1) is not null then + lg_args := lg_args || ', ' || array_to_string(_args, ', '); + end if; + + if 'B' = any(_tgflags) then + lg_pos := 'before'; + end if; + if 'A' = any(_tgflags) then + lg_pos := 'after'; + end if; + if 'Q' = any(_tgflags) then + lg_func := 'pgq.sqltriga'; + end if; + if 'L' = any(_tgflags) then + lg_func := 'pgq.logutriga'; + end if; + if 'I' = any(_tgflags) then + lg_event := lg_event || ' or insert'; + end if; + if 'U' = any(_tgflags) then + lg_event := lg_event || ' or update'; + end if; + if 'D' = any(_tgflags) then + lg_event := lg_event || ' or delete'; + end if; + if 'S' = any(_tgflags) then + _skip := true; + end if; + + if _node.node_type = 'leaf' then + -- on weird leafs the trigger funcs may not exist + perform 1 from pg_proc p join pg_namespace n on (n.oid = p.pronamespace) + where n.nspname = 'pgq' and p.proname in ('logutriga', 'sqltriga'); + if not found then + select 200, 'Table added with no triggers: ' || _desc into ret_code, ret_note; + return; + end if; + -- on regular leaf, install deny trigger + _extra_args := ', ' || quote_literal('deny'); + end if; + + -- if skip param given, rename previous skip triggers and prefix current + if _skip then + -- get count and name of existing skip triggers + select count(*), min(t.tgname) + into _skip_trg_count, _skip_trg_name + from pg_catalog.pg_trigger t + where t.tgrelid = londiste.find_table_oid(_dest_table) + and position(E'\\000skip\\000' in lower(tgargs::text)) > 0; + -- if no previous skip triggers, prefix name and add SKIP to args + if _skip_trg_count = 0 then + lg_name := _skip_prefix || lg_name; + lg_args := lg_args || ', ' || quote_literal('SKIP'); + -- if one previous skip trigger, check it's prefix and + -- do not use SKIP on current trigger + elsif _skip_trg_count = 1 then + -- if not prefixed then rename + if position(_skip_prefix in _skip_trg_name) != 1 then + sql := 'alter trigger ' || _skip_trg_name + || ' on ' || londiste.quote_fqname(_dest_table) + || ' rename to ' || _skip_prefix || _skip_trg_name; + execute sql; + end if; + else + select 405, 'Multiple SKIP triggers in table: ' || _desc + into ret_code, ret_note; + return; + end if; + end if; + + -- create Ins/Upd/Del trigger if it does not exists already + perform 1 from pg_catalog.pg_trigger + where tgrelid = londiste.find_table_oid(_dest_table) + and tgname = lg_name; + if not found then + + if _no_triggers then + select 200, 'Table added with no triggers: ' || _desc + into ret_code, ret_note; + return; + end if; + + -- finalize event + lg_event := substr(lg_event, 4); + if lg_event = '' then + lg_event := 'insert or update or delete'; + end if; + + -- create trigger + sql := 'create trigger ' || quote_ident(lg_name) + || ' ' || lg_pos || ' ' || lg_event + || ' on ' || londiste.quote_fqname(_dest_table) + || ' for each row execute procedure ' + || lg_func || '(' || lg_args || _extra_args || ')'; + execute sql; + end if; + + -- create truncate trigger if it does not exists already + show server_version_num into pgversion; + if pgversion >= 80400 then + trunctrg_name := '_londiste_' || i_queue_name || '_truncate'; + perform 1 from pg_catalog.pg_trigger + where tgrelid = londiste.find_table_oid(_dest_table) + and tgname = trunctrg_name; + if not found then + sql := 'create trigger ' || quote_ident(trunctrg_name) + || ' after truncate on ' || londiste.quote_fqname(_dest_table) + || ' for each statement execute procedure pgq.sqltriga(' || quote_literal(i_queue_name) + || _extra_args || ')'; + execute sql; + end if; + end if; + + -- Check that no trigger exists on the target table that will get fired + -- before londiste one (this could have londiste replicate data + -- out-of-order + -- + -- Don't report all the trigger names, 8.3 does not have array_accum + -- available + + if pgversion >= 90000 then + select tg.tgname into logtrg_previous + from pg_class r join pg_trigger tg on (tg.tgrelid = r.oid) + where r.oid = londiste.find_table_oid(_dest_table) + and not tg.tgisinternal + and tg.tgname < lg_name::name + -- per-row AFTER trigger + and (tg.tgtype & 3) = 1 -- bits: 0:ROW, 1:BEFORE + -- current londiste + and not londiste.is_replica_func(tg.tgfoid) + -- old londiste + and substring(tg.tgname from 1 for 10) != '_londiste_' + and substring(tg.tgname from char_length(tg.tgname) - 6) != '_logger' + order by 1 limit 1; + else + select tg.tgname into logtrg_previous + from pg_class r join pg_trigger tg on (tg.tgrelid = r.oid) + where r.oid = londiste.find_table_oid(_dest_table) + and not tg.tgisconstraint + and tg.tgname < lg_name::name + -- per-row AFTER trigger + and (tg.tgtype & 3) = 1 -- bits: 0:ROW, 1:BEFORE + -- current londiste + and not londiste.is_replica_func(tg.tgfoid) + -- old londiste + and substring(tg.tgname from 1 for 10) != '_londiste_' + and substring(tg.tgname from char_length(tg.tgname) - 6) != '_logger' + order by 1 limit 1; + end if; + + if logtrg_previous is not null then + select 301, + 'Table added: ' || _desc + || ', but londiste trigger is not first: ' + || logtrg_previous + into ret_code, ret_note; + return; + end if; + + select 200, 'Table added: ' || _desc into ret_code, ret_note; + return; +end; +$$; + + +-- +-- Name: local_remove_seq(text, text); Type: FUNCTION; Schema: londiste; Owner: - +-- + +CREATE FUNCTION local_remove_seq(i_queue_name text, i_seq_name text, OUT ret_code integer, OUT ret_note text) RETURNS record + LANGUAGE plpgsql STRICT + AS $$ +-- ---------------------------------------------------------------------- +-- Function: londiste.local_remove_seq(2) +-- +-- Remove sequence. +-- +-- Parameters: +-- i_queue_name - set name +-- i_seq_name - sequence name +-- +-- Returns: +-- 200 - OK +-- 404 - Sequence not found +-- ---------------------------------------------------------------------- +declare + fqname text; +begin + fqname := londiste.make_fqname(i_seq_name); + if pgq_node.is_root_node(i_queue_name) then + select f.ret_code, f.ret_note + into ret_code, ret_note + from londiste.global_remove_seq(i_queue_name, fqname) f; + return; + end if; + update londiste.seq_info + set local = false + where queue_name = i_queue_name + and seq_name = fqname + and local; + if not found then + select 404, 'Sequence not found: '||fqname into ret_code, ret_note; + return; + end if; + + select 200, 'Sequence removed: '||fqname into ret_code, ret_note; + return; +end; +$$; + + +-- +-- Name: local_remove_table(text, text); Type: FUNCTION; Schema: londiste; Owner: - +-- + +CREATE FUNCTION local_remove_table(i_queue_name text, i_table_name text, OUT ret_code integer, OUT ret_note text) RETURNS record + LANGUAGE plpgsql STRICT + AS $$ +-- ---------------------------------------------------------------------- +-- Function: londiste.local_remove_table(2) +-- +-- Remove table. +-- +-- Parameters: +-- i_queue_name - set name +-- i_table_name - table name +-- +-- Returns: +-- 200 - OK +-- 404 - Table not found +-- ---------------------------------------------------------------------- +declare + fq_table_name text; + tbl record; +begin + fq_table_name := londiste.make_fqname(i_table_name); + + select local into tbl + from londiste.table_info + where queue_name = i_queue_name + and table_name = fq_table_name; + if not found then + select 400, 'Table not found: ' || fq_table_name into ret_code, ret_note; + return; + end if; + + if tbl.local then + perform londiste.drop_table_triggers(i_queue_name, fq_table_name); + + -- reset data + update londiste.table_info + set local = false, + custom_snapshot = null, + table_attrs = null, + -- dropped_ddl = null, + merge_state = null, + dest_table = null + where queue_name = i_queue_name + and table_name = fq_table_name; + else + if not pgq_node.is_root_node(i_queue_name) then + select 400, 'Table not registered locally: ' || fq_table_name into ret_code, ret_note; + return; + end if; + end if; + + if pgq_node.is_root_node(i_queue_name) then + perform londiste.global_remove_table(i_queue_name, fq_table_name); + perform londiste.root_notify_change(i_queue_name, 'londiste.remove-table', fq_table_name); + end if; + + select 200, 'Table removed: ' || fq_table_name into ret_code, ret_note; + return; +end; +$$; + + +-- +-- Name: local_set_table_attrs(text, text, text); Type: FUNCTION; Schema: londiste; Owner: - +-- + +CREATE FUNCTION local_set_table_attrs(i_queue_name text, i_table_name text, i_table_attrs text, OUT ret_code integer, OUT ret_note text) RETURNS record + LANGUAGE plpgsql + AS $$ +-- ---------------------------------------------------------------------- +-- Function: londiste.local_set_table_attrs(3) +-- +-- Store urlencoded table attributes. +-- +-- Parameters: +-- i_queue_name - cascaded queue name +-- i_table - table name +-- i_table_attrs - urlencoded attributes +-- ---------------------------------------------------------------------- +begin + update londiste.table_info + set table_attrs = i_table_attrs + where queue_name = i_queue_name + and table_name = i_table_name + and local; + if found then + select 200, i_table_name || ': Table attributes stored' + into ret_code, ret_note; + else + select 404, 'no such local table: ' || i_table_name + into ret_code, ret_note; + end if; + return; +end; +$$; + + +-- +-- Name: local_set_table_state(text, text, text, text); Type: FUNCTION; Schema: londiste; Owner: - +-- + +CREATE FUNCTION local_set_table_state(i_queue_name text, i_table_name text, i_snapshot text, i_merge_state text, OUT ret_code integer, OUT ret_note text) RETURNS record + LANGUAGE plpgsql + AS $$ +-- ---------------------------------------------------------------------- +-- Function: londiste.local_set_table_state(4) +-- +-- Change table state. +-- +-- Parameters: +-- i_queue_name - cascaded queue name +-- i_table - table name +-- i_snapshot - optional remote snapshot info +-- i_merge_state - merge state +-- ---------------------------------------------------------------------- +declare + _tbl text; +begin + _tbl = londiste.make_fqname(i_table_name); + + update londiste.table_info + set custom_snapshot = i_snapshot, + merge_state = i_merge_state + where queue_name = i_queue_name + and table_name = _tbl + and local; + if not found then + select 404, 'No such table: ' || _tbl + into ret_code, ret_note; + return; + end if; + + select 200, 'Table ' || _tbl || ' state set to ' + || coalesce(quote_literal(i_merge_state), 'NULL') + into ret_code, ret_note; + return; +end; +$$; + + +-- +-- Name: local_set_table_struct(text, text, text); Type: FUNCTION; Schema: londiste; Owner: - +-- + +CREATE FUNCTION local_set_table_struct(i_queue_name text, i_table_name text, i_dropped_ddl text, OUT ret_code integer, OUT ret_note text) RETURNS record + LANGUAGE plpgsql + AS $$ +-- ---------------------------------------------------------------------- +-- Function: londiste.local_set_table_struct(3) +-- +-- Store dropped table struct temporarily. +-- +-- Parameters: +-- i_queue_name - cascaded queue name +-- i_table - table name +-- i_dropped_ddl - merge state +-- ---------------------------------------------------------------------- +begin + update londiste.table_info + set dropped_ddl = i_dropped_ddl + where queue_name = i_queue_name + and table_name = i_table_name + and local; + if found then + select 200, 'Table struct stored' + into ret_code, ret_note; + else + select 404, 'no such local table: '||i_table_name + into ret_code, ret_note; + + end if; + return; +end; +$$; + + +-- +-- Name: local_show_missing(text); Type: FUNCTION; Schema: londiste; Owner: - +-- + +CREATE FUNCTION local_show_missing(i_queue_name text, OUT obj_kind text, OUT obj_name text) RETURNS SETOF record + LANGUAGE plpgsql STABLE STRICT + AS $$ +-- ---------------------------------------------------------------------- +-- Function: londiste.local_show_missing(1) +-- +-- Return info about missing tables. On root show tables +-- not registered on set, on branch/leaf show tables +-- in set but not registered locally. +-- ---------------------------------------------------------------------- +begin + if pgq_node.is_root_node(i_queue_name) then + for obj_kind, obj_name in + select r.relkind, n.nspname || '.' || r.relname + from pg_catalog.pg_class r, pg_catalog.pg_namespace n + where n.oid = r.relnamespace + and r.relkind in ('r', 'S') + and n.nspname not in ('pgq', 'pgq_ext', 'pgq_node', 'londiste', 'pg_catalog', 'information_schema') + and n.nspname !~ '^pg_(toast|temp)' + and not exists (select 1 from londiste.table_info + where queue_name = i_queue_name and local + and coalesce(dest_table, table_name) = (n.nspname || '.' || r.relname)) + order by 1, 2 + loop + return next; + end loop; + else + for obj_kind, obj_name in + select 'S', s.seq_name from londiste.seq_info s + where s.queue_name = i_queue_name + and not s.local + union all + select 'r', t.table_name from londiste.table_info t + where t.queue_name = i_queue_name + and not t.local + order by 1, 2 + loop + return next; + end loop; + end if; + return; +end; +$$; + + +-- +-- Name: make_fqname(text); Type: FUNCTION; Schema: londiste; Owner: - +-- + +CREATE FUNCTION make_fqname(i_name text) RETURNS text + LANGUAGE plpgsql IMMUTABLE STRICT + AS $$ +-- ---------------------------------------------------------------------- +-- Function: londiste.make_fqname(1) +-- +-- Make name to schema-qualified one. +-- +-- First dot is taken as schema separator. +-- +-- If schema is missing, 'public' is assumed. +-- +-- Parameters: +-- i_name - object name. +-- +-- Returns: +-- Schema qualified name. +-- ---------------------------------------------------------------------- +begin + if position('.' in i_name) > 0 then + return i_name; + else + return 'public.' || i_name; + end if; +end; +$$; + + +-- +-- Name: quote_fqname(text); Type: FUNCTION; Schema: londiste; Owner: - +-- + +CREATE FUNCTION quote_fqname(i_name text) RETURNS text + LANGUAGE plpgsql IMMUTABLE STRICT + AS $$ +-- ---------------------------------------------------------------------- +-- Function: londiste.quote_fqname(1) +-- +-- Quete fully-qualified object name for SQL. +-- +-- First dot is taken as schema separator. +-- +-- If schema is missing, 'public' is assumed. +-- +-- Parameters: +-- i_name - fully qualified object name. +-- +-- Returns: +-- Quoted name. +-- ---------------------------------------------------------------------- +declare + res text; + pos integer; + s text; + n text; +begin + pos := position('.' in i_name); + if pos > 0 then + s := substring(i_name for pos - 1); + n := substring(i_name from pos + 1); + else + s := 'public'; + n := i_name; + end if; + return quote_ident(s) || '.' || quote_ident(n); +end; +$$; + + +-- +-- Name: restore_table_fkey(text, text); Type: FUNCTION; Schema: londiste; Owner: - +-- + +CREATE FUNCTION restore_table_fkey(i_from_table text, i_fkey_name text) RETURNS integer + LANGUAGE plpgsql STRICT + AS $$ +-- ---------------------------------------------------------------------- +-- Function: londiste.restore_table_fkey(2) +-- +-- Restore dropped fkey. +-- +-- Parameters: +-- i_from_table - source table +-- i_fkey_name - fkey name +-- +-- Returns: +-- nothing +-- ---------------------------------------------------------------------- +declare + fkey record; +begin + select * into fkey + from londiste.pending_fkeys + where fkey_name = i_fkey_name and from_table = i_from_table; + + if not found then + return 0; + end if; + + execute fkey.fkey_def; + + delete from londiste.pending_fkeys where fkey_name = fkey.fkey_name; + + return 1; +end; +$$; + + +-- +-- Name: root_check_seqs(text); Type: FUNCTION; Schema: londiste; Owner: - +-- + +CREATE FUNCTION root_check_seqs(i_queue_name text, OUT ret_code integer, OUT ret_note text) RETURNS record + LANGUAGE plpgsql + AS $$ +begin + select f.ret_code, f.ret_note + into ret_code, ret_note + from londiste.root_check_seqs(i_queue_name, 10000) f; + return; +end; +$$; + + +-- +-- Name: root_check_seqs(text, bigint); Type: FUNCTION; Schema: londiste; Owner: - +-- + +CREATE FUNCTION root_check_seqs(i_queue_name text, i_buffer bigint, OUT ret_code integer, OUT ret_note text) RETURNS record + LANGUAGE plpgsql + AS $$ +-- ---------------------------------------------------------------------- +-- Function: londiste.root_check_seqs(1) +-- +-- Check sequences, and publish values if needed. +-- +-- Parameters: +-- i_queue_name - set name +-- i_buffer - safety room +-- +-- Returns: +-- 200 - OK +-- 402 - Not a root node +-- 404 - Queue not found +-- ---------------------------------------------------------------------- +declare + n record; + seq record; + real_value int8; + pub_value int8; + real_buffer int8; +begin + if i_buffer is null or i_buffer < 10 then + real_buffer := 10000; + else + real_buffer := i_buffer; + end if; + + select node_type, node_name into n + from pgq_node.node_info + where queue_name = i_queue_name + for update; + if not found then + select 404, 'Queue not found: ' || i_queue_name into ret_code, ret_note; + return; + end if; + if n.node_type <> 'root' then + select 402, 'Not a root node' into ret_code, ret_note; + return; + end if; + + for seq in + select seq_name, last_value, + londiste.quote_fqname(seq_name) as fqname + from londiste.seq_info + where queue_name = i_queue_name + and local + order by nr + loop + execute 'select last_value from ' || seq.fqname into real_value; + if real_value + real_buffer >= seq.last_value then + pub_value := real_value + real_buffer * 3; + perform pgq.insert_event(i_queue_name, 'londiste.update-seq', + pub_value::text, seq.seq_name, null, null, null); + update londiste.seq_info set last_value = pub_value + where queue_name = i_queue_name + and seq_name = seq.seq_name; + end if; + end loop; + + select 100, 'Sequences updated' into ret_code, ret_note; + return; +end; +$$; + + +-- +-- Name: root_notify_change(text, text, text); Type: FUNCTION; Schema: londiste; Owner: - +-- + +CREATE FUNCTION root_notify_change(i_queue_name text, i_ev_type text, i_ev_data text) RETURNS integer + LANGUAGE plpgsql + AS $$ +-- ---------------------------------------------------------------------- +-- Function: londiste.root_notify_change(3) +-- +-- Send event about change in root downstream. +-- ---------------------------------------------------------------------- +declare + que text; + ntype text; +begin + + if not coalesce(pgq_node.is_root_node(i_queue_name), false) then + raise exception 'only root node can send events'; + end if; + perform pgq.insert_event(i_queue_name, i_ev_type, i_ev_data); + + return 1; +end; +$$; + + +-- +-- Name: split_fqname(text); Type: FUNCTION; Schema: londiste; Owner: - +-- + +CREATE FUNCTION split_fqname(i_fqname text, OUT schema_part text, OUT name_part text) RETURNS record + LANGUAGE plpgsql IMMUTABLE STRICT + AS $$ +-- ---------------------------------------------------------------------- +-- Function: londiste.split_fqname(1) +-- +-- Split fqname to schema and name parts. +-- +-- First dot is taken as schema separator. +-- +-- If schema is missing, 'public' is assumed. +-- +-- Parameters: +-- i_fqname - object name. +-- ---------------------------------------------------------------------- +declare + dot integer; +begin + dot = position('.' in i_fqname); + if dot > 0 then + schema_part = substring(i_fqname for dot - 1); + name_part = substring(i_fqname from dot + 1); + else + schema_part = 'public'; + name_part = i_fqname; + end if; + return; +end; +$$; + + +-- +-- Name: table_info_trigger(); Type: FUNCTION; Schema: londiste; Owner: - +-- + +CREATE FUNCTION table_info_trigger() RETURNS trigger + LANGUAGE plpgsql + AS $$ +-- ---------------------------------------------------------------------- +-- Function: londiste.table_info_trigger(0) +-- +-- Trigger on londiste.table_info. Cleans triggers from tables +-- when table is removed from londiste.table_info. +-- ---------------------------------------------------------------------- +begin + if TG_OP = 'DELETE' then + perform londiste.drop_table_triggers(OLD.queue_name, OLD.table_name); + end if; + return null; +end; +$$; + + +-- +-- Name: upgrade_schema(); Type: FUNCTION; Schema: londiste; Owner: - +-- + +CREATE FUNCTION upgrade_schema() RETURNS integer + LANGUAGE plpgsql + AS $$ +-- updates table structure if necessary +declare + cnt int4 = 0; +begin + + -- table_info: check (dropped_ddl is null or merge_state in ('in-copy', 'catching-up')) + perform 1 from information_schema.check_constraints + where constraint_schema = 'londiste' + and constraint_name = 'table_info_check' + and position('in-copy' in check_clause) > 0 + and position('catching' in check_clause) = 0; + if found then + alter table londiste.table_info drop constraint table_info_check; + alter table londiste.table_info add constraint table_info_check + check (dropped_ddl is null or merge_state in ('in-copy', 'catching-up')); + cnt := cnt + 1; + end if; + + -- table_info.dest_table + perform 1 from information_schema.columns + where table_schema = 'londiste' + and table_name = 'table_info' + and column_name = 'dest_table'; + if not found then + alter table londiste.table_info add column dest_table text; + end if; + + return cnt; +end; +$$; + + +-- +-- Name: version(); Type: FUNCTION; Schema: londiste; Owner: - +-- + +CREATE FUNCTION version() RETURNS text + LANGUAGE plpgsql + AS $$ +begin + return '3.0.0.13'; +end; +$$; + + +SET search_path = mail_delivery, pg_catalog; + +-- +-- Name: companies_data_sets_clear(integer); Type: FUNCTION; Schema: mail_delivery; Owner: - +-- + +CREATE FUNCTION companies_data_sets_clear(mail_set_id integer) RETURNS boolean + LANGUAGE plpgsql + AS $$ +DECLARE + mail_set RECORD; +BEGIN + SELECT m.* INTO mail_set + FROM mail_delivery.mail_sets m + WHERE m.id = mail_set_id; + IF NOT FOUND THEN + RETURN FALSE; + END IF; + + DELETE + FROM mail_delivery.companies_data_sets d + WHERE d.mail_set_id = mail_set_id; + RETURN TRUE; +END; +$$; + + +-- +-- Name: companies_data_sets_create(integer, integer, integer[]); Type: FUNCTION; Schema: mail_delivery; Owner: - +-- + +CREATE FUNCTION companies_data_sets_create(filter_id integer, mail_set_id integer, external_ids integer[]) RETURNS boolean + LANGUAGE plpgsql + AS $$ +DECLARE + filter RECORD; + mail_set RECORD; + filter_sql TEXT; +BEGIN + SELECT d.* INTO filter + FROM mail_delivery.companies_filters d + WHERE d.id = filter_id; + IF NOT FOUND THEN + RETURN FALSE; + END IF; + + SELECT g.* INTO mail_set + FROM mail_delivery.mail_sets g + WHERE g.id = mail_set_id; + IF NOT FOUND THEN + RETURN FALSE; + END IF; + + SELECT + mail_delivery.companies_data_sets_filter_sql( + filter_id, + external_ids + ) + INTO + filter_sql; + + IF filter_sql IS NULL THEN + RETURN FALSE; + END IF; + + --формируем список получателей (компании + привязанные пользователи) + EXECUTE ' + INSERT INTO mail_delivery.companies_data_sets + ("filter_id", "mail_set_id", "company_id", + "region_id", "email", "user_id", "created_at", "updated_at") + SELECT ' || filter_id || ', + E''' || mail_set_id || ''', + data_sets.company_id, + MIN(data_sets.region_id), + data_sets.email, + MIN(data_sets.user_id), + CURRENT_TIMESTAMP, + CURRENT_TIMESTAMP + FROM ( + WITH filtered_companies AS ( + ' || filter_sql || ' + ) + SELECT c.id AS company_id, c.region_id AS region_id, emails.email AS email, NULL AS user_id + FROM + filtered_companies c + LEFT JOIN + (SELECT c.id company_id, LOWER(cn.value) email + FROM companies c + INNER JOIN addresses a ON a.company_id = c.id + INNER JOIN contacts cn ON cn.address_id = a.id + INNER JOIN contact_types ct ON ct.id = cn.contact_type_id + AND ct.name = ''E-mail'' + WHERE c.state <> ''deleted'' + GROUP BY c.id, LOWER(cn.value) + ) emails + ON emails.company_id = c.id + UNION ALL + SELECT c.id AS company_id, c.region_id AS region_id, LOWER(u.email) AS email, u.id AS user_id + FROM + filtered_companies c + LEFT JOIN + company_users cu ON cu.company_id = c.id AND cu.role <> ''pcmanager'' + LEFT JOIN + users u ON u.id = cu.user_id + ) data_sets + GROUP BY + data_sets.company_id, + data_sets.email + '; + + --удаляем лишние строчки с email=NULL, + --если есть хотя бы один email у компании или её пользователей + DELETE + FROM mail_delivery.companies_data_sets WHERE id IN( + SELECT r1.id FROM mail_delivery.companies_data_sets r1 + INNER JOIN mail_delivery.companies_data_sets r2 + ON r1.company_id = r2.company_id + WHERE + r1.email IS NULL + AND r2.email IS NOT NULL + AND r1.filter_id = filter_id + AND r2.filter_id = filter_id + AND r1.mail_set_id = mail_set_id + AND r2.mail_set_id = mail_set_id + ); + + RETURN TRUE; +END; +$$; + + +-- +-- Name: companies_data_sets_filter_sql(integer, integer[]); Type: FUNCTION; Schema: mail_delivery; Owner: - +-- + +CREATE FUNCTION companies_data_sets_filter_sql(a_filter_id integer, external_ids integer[]) RETURNS text + LANGUAGE plpgsql + AS $$ +--- Формирует SQL запрос для заполнения companies_data_set (список получателей рассылки) +--- получает id фильтра (из companies_filter) +--- и дополнительный список идов компаний ( после бага PC4-7446 это просто список идов компаний companies.id) +DECLARE + + filter record; + + tables text[]; + join_conditions text[]; + join_types text[]; + linked_flags boolean[]; + wheres text[]; + sql text; + i integer; + s text; + fake text; + BEGIN + SELECT d.* INTO filter + FROM mail_delivery.companies_filters d + WHERE d.id = a_filter_id; + + IF NOT FOUND THEN + RETURN NULL; + END IF; + + --список таблиц и правила джойна + wheres[0] := 'c.state <> ''deleted'''; + tables[0] := 'company_settings cs'; + join_conditions[0] := 'cs.company_id = c.id'; + join_types[0] := 'LEFT JOIN'; + linked_flags[0] := FALSE; + + tables[1] := 'company_region_commercials commercial_regions'; + join_conditions[1] := 'commercial_regions.company_id = c.id'; + join_types[1] := 'INNER JOIN'; + linked_flags[1] := FALSE; + + tables[2] := '( + SELECT company_id + FROM products p + INNER JOIN companies c ON p.company_id = c.id + WHERE + c.state <> ''deleted'' AND + p.state <> ''deleted'' + GROUP BY company_id + ) p'; + join_conditions[2] := 'p.company_id = c.id'; + join_types[2] := 'INNER JOIN'; + linked_flags[2] := FALSE; + + tables[3] := '( + SELECT company_id + FROM products p + INNER JOIN companies c ON p.company_id = c.id + WHERE + c.state <> ''deleted'' AND + p.state <> ''deleted'' AND + p.is_public = true + GROUP BY company_id + ) pp'; + join_conditions[3] := 'pp.company_id = c.id'; + join_types[3] := 'INNER JOIN'; + linked_flags[3] := FALSE; + + tables[4] := E'( + SELECT DISTINCT p.company_id, + pr.region_id + FROM products p + INNER JOIN product_regions pr ON pr.product_id = p.id + ) prod_regions'; + join_conditions[4] := 'prod_regions.company_id = c.id'; + join_types[4] := 'INNER JOIN'; + linked_flags[4] := FALSE; + + tables[5] := '( + SELECT c.id AS company_id, + ( + SELECT prov.region_id + FROM + addresses ad + INNER JOIN cities cii ON ad.city_id = cii.id + INNER JOIN provinces prov ON cii.province_id = prov.id + WHERE + ad.company_id = c.id + ORDER BY + ad.position ASC + LIMIT 1 + ) AS region_id + FROM + companies c + WHERE + c.state <> ''deleted'' + ) main_regions'; + join_conditions[5] := 'main_regions.company_id = c.id'; + join_types[5] := 'LEFT JOIN'; + linked_flags[5] := FALSE; + + tables[6] := '( + SELECT + products.company_id, COUNT(products.id) AS products_count + FROM + products + WHERE + products.state IN (''accepted'', ''changed'', ''pending'') + GROUP BY + products.company_id + ) AS companies_products_count'; + join_conditions[6] := 'companies_products_count.company_id = c.id'; + join_types[6] := 'INNER JOIN'; + linked_flags[6] := FALSE; + + tables[7] := '( + SELECT + products.company_id, MIN(products.actualized_at) AS last_update_date + FROM + vw_products_with_properties products + WHERE + products.state IN (''accepted'', ''changed'', ''pending'') + GROUP BY + products.company_id + ) AS companies_last_updated_products'; + join_conditions[7] := 'companies_last_updated_products.company_id = c.id'; + join_types[7] := 'INNER JOIN'; + linked_flags[7] := FALSE; + + tables[8] := '( + SELECT company_users.company_id, MAX(online_users.last_seen) AS user_last_seen_date + FROM company_users + INNER JOIN online_users ON online_users.user_id = company_users.user_id AND company_users.role <> ''pcmanager'' + LEFT JOIN user_roles ON user_roles.user_id = company_users.user_id + WHERE user_roles.id IS NULL + GROUP BY company_users.company_id + ) AS companies_last_users'; + join_conditions[8] := 'companies_last_users.company_id = c.id'; + join_types[8] := 'INNER JOIN'; + linked_flags[8] := FALSE; + + tables[9] := 'test_packets'; + join_conditions[9] := 'test_packets.company_id = c.id' ; + join_types[9] := 'INNER JOIN'; + linked_flags[9] := FALSE; + + tables[10] := '( + SELECT company_users.company_id + FROM company_users + WHERE company_users.role NOT IN (''admin'', ''pcmanager'', ''site_editor'') + GROUP BY company_users.company_id + ) AS companies_has_user'; + join_conditions[10] := 'companies_has_user.company_id = c.id'; + join_types[10] := 'LEFT JOIN'; + linked_flags[10] := FALSE; + + --применяем параметры фильтра по компаниям + IF filter.id IS NOT NULL THEN + IF filter.is_only_imported = TRUE THEN + + --применяем фильтр по идентификаторам временных компаний + IF LENGTH(filter.imports) > 0 THEN + wheres := wheres || ('c.csv_id IN(' || filter.imports || ')'); + ELSE + wheres := wheres || 'c.tmp IN(1, 2, 3)'::text; + END IF; + + --wheres := wheres || 'c.csv_import = TRUE'::text; + --wheres := wheres || 'c.csv_id = 2'::text; + END IF; + + -- фильтр по кол-ву товаров + IF COALESCE(filter.products_count_min, filter.products_count_max) IS NOT NULL THEN + IF filter.products_count_min + filter.products_count_max IS NOT NULL THEN -- указан диапазон + wheres := wheres || ( + 'companies_products_count.products_count >= ' || filter.products_count_min::VARCHAR || ' AND ' || + 'companies_products_count.products_count <= ' || filter.products_count_max::VARCHAR + )::TEXT; + ELSIF filter.products_count_min IS NOT NULL THEN + wheres := wheres || ('companies_products_count.products_count >= ' || filter.products_count_min::VARCHAR)::TEXT; + ELSIF filter.products_count_max IS NOT NULL THEN + wheres := wheres || ('companies_products_count.products_count <= ' || filter.products_count_max::VARCHAR)::TEXT; + END IF; + linked_flags[6] := TRUE; + END IF; + + -- фильтр по диапазону даты обновления товаров + IF COALESCE(filter.products_update_date_min, filter.products_update_date_max) IS NOT NULL THEN + IF filter.products_update_date_min IS NOT NULL AND filter.products_update_date_max IS NOT NULL THEN + wheres := wheres || ( + 'companies_last_updated_products.last_update_date BETWEEN ''' || + filter.products_update_date_min::DATE || ''' AND ''' || + filter.products_update_date_max::DATE || '''' + )::TEXT; + ELSIF filter.products_update_date_min IS NOT NULL THEN + wheres := wheres || ( + 'companies_last_updated_products.last_update_date >= ''' || filter.products_update_date_min::DATE || '''' + )::TEXT; + ELSIF filter.products_update_date_max IS NOT NULL THEN + wheres := wheres || ( + 'companies_last_updated_products.last_update_date <= ''' || filter.products_update_date_max::DATE || '''' + )::TEXT; + END IF; + linked_flags[7] := TRUE; + END IF; + + -- фильтр по диапазону даты последнего входа привязанного юзера (не пцманагер и не суперюзер) + IF COALESCE(filter.last_seen_date_min, filter.last_seen_date_max) IS NOT NULL THEN + IF filter.last_seen_date_min IS NOT NULL AND filter.last_seen_date_max IS NOT NULL THEN + wheres := wheres || ( + 'companies_last_users.user_last_seen_date BETWEEN ''' || + filter.last_seen_date_min::DATE || ''' AND ''' || + filter.last_seen_date_max::DATE || '''' + )::TEXT; + ELSIF filter.last_seen_date_min IS NOT NULL THEN + wheres := wheres || ( + 'companies_last_users.user_last_seen_date >= ''' || filter.last_seen_date_min::DATE || '''' + )::TEXT; + ELSIF filter.last_seen_date_max IS NOT NULL THEN + wheres := wheres || ( + 'companies_last_users.user_last_seen_date <= ''' || filter.last_seen_date_max::DATE || '''' + )::TEXT; + END IF; + linked_flags[8] := TRUE; + END IF; + + IF LENGTH(filter.regions) > 0 THEN + wheres := wheres + || ('c.main_region_id IN(' + || filter.regions + || ')'); + END IF; + + IF LENGTH(filter.commercial_regions) > 0 THEN + linked_flags[1] := TRUE; + wheres := wheres + || ('commercial_regions.region_id IN(' + || filter.commercial_regions + || ')'); + END IF; + + IF filter.has_price IS NOT NULL THEN + IF LENGTH(filter.price_regions) > 0 THEN + wheres := wheres + || ('prod_regions.region_id IN(' + || filter.price_regions + || ')'); + END IF; + linked_flags[4] := TRUE; + IF filter.has_price THEN + join_types[4] := 'INNER JOIN'; + ELSE + join_types[4] := 'LEFT JOIN'; + wheres := wheres || 'prod_regions.company_id IS NULL'::text; + END IF; + END IF; + + IF filter.has_products IS NOT NULL THEN + linked_flags[2] := TRUE; + IF filter.has_products THEN + join_types[2] := 'INNER JOIN'; + ELSE + join_types[2] := 'LEFT JOIN'; + wheres := wheres || 'p.company_id IS NULL'::text; + END IF; + END IF; + + IF filter.has_public_products IS NOT NULL THEN + linked_flags[3] := TRUE; + IF filter.has_public_products THEN + join_types[3] := 'INNER JOIN'; + ELSE + join_types[3] := 'LEFT JOIN'; + wheres := wheres || 'pp.company_id IS NULL'::text; + END IF; + END IF; + + IF filter.has_user IS NOT NULL THEN + linked_flags[10] := TRUE; + IF filter.has_user THEN + join_types[10] := 'INNER JOIN'; + ELSE + join_types[10] := 'LEFT JOIN'; + wheres := wheres || '(companies_has_user.company_id IS NULL)'::text; + END IF; + END IF; + + IF filter.packets IS NOT NULL THEN + wheres := wheres || ('c.packet IN(' || filter.packets || ')'); + END IF; + + IF filter.from_created_at IS NOT NULL THEN + wheres := wheres + || ('c.created_at >= ''' + || to_char(filter.from_created_at, 'YYYY-MM-DD') + || ''''); + END IF; + + IF filter.to_created_at IS NOT NULL THEN + wheres := wheres + || ('c.created_at <= ''' + || to_char(filter.to_created_at, 'YYYY-MM-DD') + || ''''); + END IF; + + IF filter.from_updated_at IS NOT NULL THEN + linked_flags[0] := TRUE; + wheres := wheres + || ('LEAST(cs.updated_at, c.updated_at) >= ''' + || to_char(filter.from_updated_at, 'YYYY-MM-DD') + || ''''); + END IF; + + IF filter.to_updated_at IS NOT NULL THEN + linked_flags[0] := TRUE; + wheres := wheres + || ('GREATEST(cs.updated_at, c.updated_at) <= ''' + || to_char(filter.to_updated_at, 'YYYY-MM-DD') + || ''''); + END IF; + + -- фильтр по тестовым размещения + IF filter.test_packet_status IS NOT NULL THEN + linked_flags[9] := TRUE; + IF filter.test_packet_status = 'no' THEN + join_types[9] = 'LEFT JOIN'; + END IF; + + IF filter.test_packet_status = 'pending' THEN + wheres := wheres || 'test_packets.valid_till > timezone(''utc'', now())'::text; + ELSIF filter.test_packet_status = 'finished' THEN + wheres := wheres || 'date(test_packets.valid_till) <= timezone(''utc'', now())'::text; + ELSIF filter.test_packet_status = 'no' THEN + wheres := wheres || 'test_packets.id IS NULL'::text; + END IF; + END IF; + + -- фильтр по дню тестового размещения + IF filter.test_packet_day_remains IS NOT NULL THEN + linked_flags[9] := TRUE; + wheres := wheres || ( + 'test_packets.valid_till::date - timezone(''utc'', now())::date <= ' + || to_char(filter.test_packet_day_remains, '99999') + )::text; + END IF; + IF filter.test_packet_day_remains_min IS NOT NULL THEN + linked_flags[9] := TRUE; + wheres := wheres || ( + 'test_packets.valid_till::date - timezone(''utc'', now())::date >= ' + || to_char(filter.test_packet_day_remains_min, '99999') + )::text; + END IF; + + IF filter.test_packet_day_after IS NOT NULL THEN + linked_flags[9] := TRUE; + wheres := wheres || ( + 'timezone(''utc'', now())::date - test_packets.valid_till::date <= ' + || to_char(filter.test_packet_day_after, '99999') + )::text; + END IF; + IF filter.test_packet_day_after_min IS NOT NULL THEN + linked_flags[9] := TRUE; + wheres := wheres || ( + 'timezone(''utc'', now())::date - test_packets.valid_till::date >= ' + || to_char(filter.test_packet_day_after_min, '99999') + )::text; + END IF; + + IF filter.days_after_created_max IS NOT NULL THEN + wheres := wheres || ( + 'timezone(''utc'', now())::date - c.created_at::date <= ' + || to_char(filter.days_after_created_max, '99999') + )::text; + END IF; + IF filter.days_after_created_min IS NOT NULL THEN + wheres := wheres || ( + 'timezone(''utc'', now())::date - c.created_at::date >= ' + || to_char(filter.days_after_created_min, '99999') + )::text; + END IF; + + -- фильтр по типу интернет-магазина (тип YML) + IF filter.online_store_types IS NOT NULL THEN + s := '('::text; + IF position('no_online_store' in filter.online_store_types) > 0 THEN + s := s || '(c.online_store_type is null)'::text; + END IF; + + IF filter.online_store_types <> 'no_online_store' THEN + IF s <> '(' THEN + s := s || ' OR '::text; + END IF; + s := s || 'c.online_store_type IN ('''::text || replace(trim(replace(replace(filter.online_store_types, 'no_online_store', ''), ',,', ''), ','), ',', ''',''') || ''')'::text; + END IF; + + s := s || ')'::text; + wheres = wheres || s; + END IF; + + -- проверим поле company_status из фильтра + SELECT mail_delivery.parse_filter_company_status(filter.company_status ) INTO s; + IF LENGTH(s) > 0 THEN + wheres = wheres || s; + END IF; + + END IF; + + --- + -- Добавляем ограничение список идов компаний + --- + IF external_ids IS NOT NULL THEN + wheres := wheres || ('c.id IN('|| array_to_string(external_ids, ', ')|| ')'); + END IF; + + --собираем запрос + sql := 'SELECT c.id AS id, MIN(c.main_region_id) AS region_id FROM companies c'; + FOR i IN 0..10 LOOP + IF linked_flags[i] = TRUE THEN + sql := sql || ' ' || join_types[i] || ' '; + sql := sql || tables[i]; + IF join_conditions[i].length > 0 THEN + sql := sql || ' ON ' || join_conditions[i]; + END IF; + END IF; + END LOOP; + sql := sql || ' WHERE ' || array_to_string(wheres, ' AND '); + sql := sql || ' GROUP BY c.id'; + + RETURN sql; + END; +$$; + + +-- +-- Name: companies_data_sets_prepare(integer, integer, integer[]); Type: FUNCTION; Schema: mail_delivery; Owner: - +-- + +CREATE FUNCTION companies_data_sets_prepare(filter_id integer, mail_set_id integer, external_ids integer[]) RETURNS integer + LANGUAGE plpgsql + AS $$ +DECLARE + result INTEGER; + filter RECORD; + mail_set RECORD; +BEGIN + SELECT f.* INTO filter + FROM mail_delivery.companies_filters f + WHERE f.id = filter_id; + IF NOT FOUND THEN + RETURN 0; + END IF; + + SELECT m.* INTO mail_set + FROM mail_delivery.mail_sets m + WHERE m.id = mail_set_id; + IF NOT FOUND THEN + RETURN 0; + END IF; + + IF NOT EXISTS( + SELECT id + FROM mail_delivery.companies_data_sets d + WHERE d.filter_id = filter_id + AND d.mail_set_id = mail_set_id + LIMIT 1) + THEN + SET CONSTRAINTS ALL DEFERRED; + PERFORM mail_delivery.companies_data_sets_clear(mail_set_id); + PERFORM mail_delivery.companies_data_sets_create( + filter_id, + mail_set_id, + external_ids + ); + SET CONSTRAINTS ALL IMMEDIATE; + END IF; + + SELECT COUNT(*) + INTO result + FROM mail_delivery.companies_data_sets d + WHERE d.filter_id = filter_id + AND d.mail_set_id = mail_set_id; + + RETURN result; +END; +$$; + + +-- +-- Name: mail_set_clear(integer); Type: FUNCTION; Schema: mail_delivery; Owner: - +-- + +CREATE FUNCTION mail_set_clear(mail_set_id integer) RETURNS boolean + LANGUAGE plpgsql + AS $$ +DECLARE + mail_set RECORD; +BEGIN + SELECT m.* INTO mail_set + FROM mail_delivery.mail_sets m + WHERE m.id = mail_set_id; + IF NOT FOUND THEN + RETURN FALSE; + END IF; + + DELETE FROM mail_delivery.mails m WHERE m.mail_set_id = mail_set_id; + RETURN TRUE; +END; +$$; + + +-- +-- Name: optimized_companies_data_sets_create(integer, integer, integer[]); Type: FUNCTION; Schema: mail_delivery; Owner: - +-- + +CREATE FUNCTION optimized_companies_data_sets_create(filter_id integer, mail_set_id integer, external_ids integer[]) RETURNS boolean + LANGUAGE plpgsql + AS $$ +DECLARE + filter RECORD; + mail_set RECORD; + filter_sql TEXT; +BEGIN + SELECT d.* INTO filter + FROM mail_delivery.companies_filters d + WHERE d.id = filter_id; + IF NOT FOUND THEN + RETURN FALSE; + END IF; + + SELECT g.* INTO mail_set + FROM mail_delivery.mail_sets g + WHERE g.id = mail_set_id; + IF NOT FOUND THEN + RETURN FALSE; + END IF; + + SELECT + mail_delivery.companies_data_sets_filter_sql( + filter_id, + external_ids + ) + INTO + filter_sql; + + IF filter_sql IS NULL THEN + RETURN FALSE; + END IF; + + --формируем список получателей (компании + привязанные пользователи) + EXECUTE ' + INSERT INTO mail_delivery.companies_data_sets ( + "filter_id", "mail_set_id", "company_id", "region_id", "email", "user_id", "created_at", "updated_at" + ) + SELECT ' || filter_id || ', + E''' || mail_set_id || ''', + data_sets.company_id, + MIN(data_sets.region_id), + data_sets.email, + MIN(data_sets.user_id), + CURRENT_TIMESTAMP, + CURRENT_TIMESTAMP + FROM ( + WITH filtered_companies AS ( + ' || filter_sql || ' + ) + + SELECT c.id AS company_id, MIN(c.region_id) AS region_id, LOWER(cn.value) email, NULL AS user_id + FROM filtered_companies c + INNER JOIN addresses a ON a.company_id = c.id + INNER JOIN contacts cn ON cn.address_id = a.id + INNER JOIN contact_types ct + ON ct.id = cn.contact_type_id + AND ct.name = ''E-mail'' + GROUP BY c.id, LOWER(cn.value) + + UNION ALL + + SELECT c.id AS company_id, c.region_id AS region_id, LOWER(u.email) AS email, u.id AS user_id + FROM filtered_companies c + INNER JOIN company_users cu + ON cu.company_id = c.id + AND cu.role <> ''pcmanager'' + INNER JOIN users u ON u.id = cu.user_id + ) data_sets + GROUP BY + data_sets.company_id, + data_sets.email'; + + RETURN TRUE; +END; +$$; + + +-- +-- Name: optimized_companies_data_sets_filter_sql(text, integer[]); Type: FUNCTION; Schema: mail_delivery; Owner: - +-- + +CREATE FUNCTION optimized_companies_data_sets_filter_sql(filter_id text, external_ids integer[]) RETURNS text + LANGUAGE plpgsql + AS $$ +DECLARE + filter mail_delivery.companies_filters%ROWTYPE; + + tables text[]; + join_conditions text[]; + join_types text[]; + linked_flags boolean[]; + wheres text[]; + sql text; + i integer; + BEGIN + IF filter_id IS NULL THEN + RETURN NULL; + END IF; + + EXECUTE 'SELECT ' || filter_id INTO filter; + + --список таблиц и правила джойна + wheres[0] := 'c.state <> ''deleted'''; + tables[0] := 'company_settings cs'; + join_conditions[0] := 'cs.company_id = c.id'; + join_types[0] := 'LEFT JOIN'; + linked_flags[0] := FALSE; + + tables[1] := 'company_region_commercials commercial_regions'; + join_conditions[1] := 'commercial_regions.company_id = c.id'; + join_types[1] := 'INNER JOIN'; + linked_flags[1] := FALSE; + + tables[2] := '( + SELECT company_id + FROM products p + INNER JOIN companies c ON p.company_id = c.id + WHERE + c.state <> ''deleted'' AND + p.state <> ''deleted'' + GROUP BY company_id + ) p'; + join_conditions[2] := 'p.company_id = c.id'; + join_types[2] := 'INNER JOIN'; + linked_flags[2] := FALSE; + + tables[3] := '( + SELECT company_id + FROM products p + INNER JOIN companies c ON p.company_id = c.id + WHERE + c.state <> ''deleted'' AND + p.state <> ''deleted'' AND + p.is_public = true + GROUP BY company_id + ) pp'; + join_conditions[3] := 'pp.company_id = c.id'; + join_types[3] := 'INNER JOIN'; + linked_flags[3] := FALSE; + + tables[4] := E'( + SELECT DISTINCT p.company_id, + pr.region_id + FROM products p + INNER JOIN product_regions pr ON pr.product_id = p.id + ) prod_regions'; + join_conditions[4] := 'prod_regions.company_id = c.id'; + join_types[4] := 'INNER JOIN'; + linked_flags[4] := FALSE; + + -- Этот злобный изврат отключен. +-- tables[5] := '( +-- SELECT c.id AS company_id, +-- ( +-- SELECT prov.region_id +-- FROM +-- addresses ad +-- INNER JOIN cities cii ON ad.city_id = cii.id +-- INNER JOIN provinces prov ON cii.province_id = prov.id +-- WHERE +-- ad.company_id = c.id +-- ORDER BY +-- ad.position ASC +-- LIMIT 1 +-- ) AS region_id +-- FROM +-- companies c +-- WHERE +-- c.state <> ''deleted'' +-- ) main_regions'; +-- join_conditions[5] := 'main_regions.company_id = c.id'; +-- join_types[5] := 'LEFT JOIN'; + linked_flags[5] := FALSE; + + tables[6] := '( + SELECT + products.company_id, COUNT(products.id) AS products_count + FROM + products + WHERE + products.state IN (''accepted'', ''changed'', ''pending'') + GROUP BY + products.company_id + ) AS companies_products_count'; + join_conditions[6] := 'companies_products_count.company_id = c.id'; + join_types[6] := 'INNER JOIN'; + linked_flags[6] := FALSE; + + tables[7] := '( + SELECT + products.company_id, MAX(products.actualized_at) AS last_update_date + FROM + products + WHERE + products.state IN (''accepted'', ''changed'', ''pending'') + GROUP BY + products.company_id + ) AS companies_last_updated_products'; + join_conditions[7] := 'companies_last_updated_products.company_id = c.id'; + join_types[7] := 'INNER JOIN'; + linked_flags[7] := FALSE; + + tables[8] := '( + SELECT company_users.company_id, MAX(online_users.last_seen) AS user_last_seen_date + FROM company_users + INNER JOIN online_users ON online_users.user_id = company_users.user_id AND company_users.role <> ''pcmanager'' + LEFT JOIN user_roles ON user_roles.user_id = company_users.user_id + WHERE user_roles.id IS NULL + GROUP BY company_users.company_id + ) AS companies_last_users'; + join_conditions[8] := 'companies_last_users.company_id = c.id'; + join_types[8] := 'INNER JOIN'; + linked_flags[8] := FALSE; + + tables[9] := 'test_packets'; + join_conditions[9] := 'test_packets.company_id = c.id' ; + join_types[9] := 'INNER JOIN'; + linked_flags[9] := FALSE; + + --применяем параметры фильтра по компаниям + -- уберём пока фильт, т.к тут сплошные траблы с проверкой, он всё равно придёт + --IF filter IS NOT NULL THEN + IF filter.is_only_imported = TRUE THEN + RAISE NOTICE '%', 'Ohoho'; + + wheres := wheres || 'c.tmp = TRUE'::text; + + --применяем фильтр по идентификаторам временных компаний + IF LENGTH(filter.imports) > 0 THEN + wheres := wheres || ('c.csv_id IN(' || filter.imports || ')'); + ELSE + wheres := wheres || 'c.tmp IN(1, 2, 3)'::text; + END IF; + + --wheres := wheres || 'c.csv_import = TRUE'::text; + --wheres := wheres || 'c.csv_id = 2'::text; + END IF; + + -- фильтр по кол-ву товаров + IF COALESCE(filter.products_count_min, filter.products_count_max) IS NOT NULL THEN + IF filter.products_count_min + filter.products_count_max IS NOT NULL THEN -- указан диапазон + wheres := wheres || ( + 'companies_products_count.products_count >= ' || filter.products_count_min::VARCHAR || ' AND ' || + 'companies_products_count.products_count <= ' || filter.products_count_max::VARCHAR + )::TEXT; + ELSIF filter.products_count_min IS NOT NULL THEN + wheres := wheres || ('companies_products_count.products_count >= ' || filter.products_count_min::VARCHAR)::TEXT; + ELSIF filter.products_count_max IS NOT NULL THEN + wheres := wheres || ('companies_products_count.products_count <= ' || filter.products_count_max::VARCHAR)::TEXT; + END IF; + linked_flags[6] := TRUE; + END IF; + + -- фильтр по диапазону даты обновления товаров + IF COALESCE(filter.products_update_date_min, filter.products_update_date_max) IS NOT NULL THEN + IF filter.products_update_date_min IS NOT NULL AND filter.products_update_date_max IS NOT NULL THEN + wheres := wheres || ( + 'companies_last_updated_products.last_update_date BETWEEN ''' || + filter.products_update_date_min::DATE || ''' AND ''' || + filter.products_update_date_max::DATE || '''' + )::TEXT; + ELSIF filter.products_update_date_min IS NOT NULL THEN + wheres := wheres || ( + 'companies_last_updated_products.last_update_date >= ''' || filter.products_update_date_min::DATE || '''' + )::TEXT; + ELSIF filter.products_update_date_max IS NOT NULL THEN + wheres := wheres || ( + 'companies_last_updated_products.last_update_date <= ''' || filter.products_update_date_max::DATE || '''' + )::TEXT; + END IF; + linked_flags[7] := TRUE; + END IF; + + -- фильтр по диапазону даты последнего входа привязанного юзера (не пцманагер и не суперюзер) + IF COALESCE(filter.last_seen_date_min, filter.last_seen_date_max) IS NOT NULL THEN + IF filter.last_seen_date_min IS NOT NULL AND filter.last_seen_date_max IS NOT NULL THEN + wheres := wheres || ( + 'companies_last_users.user_last_seen_date BETWEEN ''' || + filter.last_seen_date_min::DATE || ''' AND ''' || + filter.last_seen_date_max::DATE || '''' + )::TEXT; + ELSIF filter.last_seen_date_min IS NOT NULL THEN + wheres := wheres || ( + 'companies_last_users.user_last_seen_date >= ''' || filter.last_seen_date_min::DATE || '''' + )::TEXT; + ELSIF filter.last_seen_date_max IS NOT NULL THEN + wheres := wheres || ( + 'companies_last_users.user_last_seen_date <= ''' || filter.last_seen_date_max::DATE || '''' + )::TEXT; + END IF; + linked_flags[8] := TRUE; + END IF; + + IF LENGTH(filter.regions) > 0 THEN + --linked_flags[5] := TRUE; + wheres := wheres + || ('c.main_region_id IN(' + || filter.regions + || ')'); + END IF; + + IF LENGTH(filter.commercial_regions) > 0 THEN + linked_flags[1] := TRUE; + wheres := wheres + || ('commercial_regions.region_id IN(' + || filter.commercial_regions + || ')'); + END IF; + + IF filter.has_price IS NOT NULL THEN + IF LENGTH(filter.price_regions) > 0 THEN + wheres := wheres + || ('prod_regions.region_id IN(' + || filter.price_regions + || ')'); + END IF; + linked_flags[4] := TRUE; + IF filter.has_price THEN + join_types[4] := 'INNER JOIN'; + ELSE + join_types[4] := 'LEFT JOIN'; + wheres := wheres || 'prod_regions.company_id IS NULL'::text; + END IF; + END IF; + + IF filter.has_products IS NOT NULL THEN + linked_flags[2] := TRUE; + IF filter.has_products THEN + join_types[2] := 'INNER JOIN'; + ELSE + join_types[2] := 'LEFT JOIN'; + wheres := wheres || 'p.company_id IS NULL'::text; + END IF; + END IF; + + IF filter.has_public_products IS NOT NULL THEN + linked_flags[3] := TRUE; + IF filter.has_public_products THEN + join_types[3] := 'INNER JOIN'; + ELSE + join_types[3] := 'LEFT JOIN'; + wheres := wheres || 'pp.company_id IS NULL'::text; + END IF; + END IF; + + IF LENGTH(filter.packets) > 0 THEN + wheres := wheres || ('c.packet IN(' || filter.packets || ')'); + END IF; + + IF filter.from_created_at IS NOT NULL THEN + wheres := wheres + || ('c.created_at >= ''' + || to_char(filter.from_created_at, 'YYYY-MM-DD') + || ''''); + END IF; + + IF filter.to_created_at IS NOT NULL THEN + wheres := wheres + || ('c.created_at <= ''' + || to_char(filter.to_created_at, 'YYYY-MM-DD') + || ''''); + END IF; + + IF filter.from_updated_at IS NOT NULL THEN + linked_flags[0] := TRUE; + wheres := wheres + || ('LEAST(cs.updated_at, c.updated_at) >= ''' + || to_char(filter.from_updated_at, 'YYYY-MM-DD') + || ''''); + END IF; + + IF filter.to_updated_at IS NOT NULL THEN + linked_flags[0] := TRUE; + wheres := wheres + || ('GREATEST(cs.updated_at, c.updated_at) <= ''' + || to_char(filter.to_updated_at, 'YYYY-MM-DD') + || ''''); + END IF; + + IF filter.is_pricelist_online IS NOT NULL THEN + wheres := wheres || ('c.is_pricelist_online = ' || CASE filter.is_pricelist_online WHEN TRUE THEN 'true' ELSE 'false' END ); + END IF; + + -- фильтр по тестовым размещения + IF filter.test_packet_status IS NOT NULL THEN + linked_flags[9] := TRUE; + IF filter.test_packet_status = 'no' THEN + join_types[9] = 'LEFT JOIN'; + END IF; + + IF filter.test_packet_status = 'pending' THEN + wheres := wheres || 'test_packets.valid_till > timezone(''utc'', now())'::text; + ELSIF filter.test_packet_status = 'finished' THEN + wheres := wheres || 'date(test_packets.valid_till) <= timezone(''utc'', now())'::text; + ELSIF filter.test_packet_status = 'no' THEN + wheres := wheres || 'test_packets.id IS NULL'::text; + END IF; + END IF; + + -- фильтр по дню тестового размещения + IF filter.test_packet_day_remains IS NOT NULL THEN + linked_flags[9] := TRUE; + wheres := wheres || ( + 'test_packets.valid_till::date - timezone(''utc'', now())::date <= ' + || to_char(filter.test_packet_day_remains, '99999') + )::text; + END IF; + IF filter.test_packet_day_remains_min IS NOT NULL THEN + linked_flags[9] := TRUE; + wheres := wheres || ( + 'test_packets.valid_till::date - timezone(''utc'', now())::date >= ' + || to_char(filter.test_packet_day_remains_min, '99999') + )::text; + END IF; + + + --END IF; + + IF external_ids IS NOT NULL THEN + wheres := wheres + || ('c.oferta_sync_id IN(' + || array_to_string(external_ids, ', ') + || ')'); + END IF; + + --собираем запрос + sql := 'SELECT c.id AS id, MIN(c.main_region_id) AS region_id FROM companies c'; + FOR i IN 0..10 LOOP + IF linked_flags[i] = TRUE THEN + sql := sql || ' ' || join_types[i] || ' '; + sql := sql || tables[i]; + IF join_conditions[i].length > 0 THEN + sql := sql || ' ON ' || join_conditions[i]; + END IF; + END IF; + END LOOP; + sql := sql || ' WHERE ' || array_to_string(wheres, ' AND '); + sql := sql || ' GROUP BY c.id'; + + RETURN sql; + END; +$$; + + +-- +-- Name: optimized_companies_data_sets_filter_sql(integer, integer[]); Type: FUNCTION; Schema: mail_delivery; Owner: - +-- + +CREATE FUNCTION optimized_companies_data_sets_filter_sql(filter_id integer, external_ids integer[]) RETURNS text + LANGUAGE plpgsql + AS $$ +DECLARE + filter record; + + tables text[]; + join_conditions text[]; + join_types text[]; + linked_flags boolean[]; + wheres text[]; + sql text; + i integer; + BEGIN + SELECT d.* INTO filter + FROM mail_delivery.companies_filters d + WHERE d.id = filter_id; + + IF NOT FOUND THEN + RETURN NULL; + END IF; + + --список таблиц и правила джойна + wheres[0] := 'c.state <> ''deleted'''; + tables[0] := 'company_settings cs'; + join_conditions[0] := 'cs.company_id = c.id'; + join_types[0] := 'LEFT JOIN'; + linked_flags[0] := FALSE; + + tables[1] := 'company_region_commercials commercial_regions'; + join_conditions[1] := 'commercial_regions.company_id = c.id'; + join_types[1] := 'INNER JOIN'; + linked_flags[1] := FALSE; + + tables[2] := '( + SELECT company_id + FROM products p + INNER JOIN companies c ON p.company_id = c.id + WHERE + c.state <> ''deleted'' AND + p.state <> ''deleted'' + GROUP BY company_id + ) p'; + join_conditions[2] := 'p.company_id = c.id'; + join_types[2] := 'INNER JOIN'; + linked_flags[2] := FALSE; + + tables[3] := '( + SELECT company_id + FROM products p + INNER JOIN companies c ON p.company_id = c.id + WHERE + c.state <> ''deleted'' AND + p.state <> ''deleted'' AND + p.is_public = true + GROUP BY company_id + ) pp'; + join_conditions[3] := 'pp.company_id = c.id'; + join_types[3] := 'INNER JOIN'; + linked_flags[3] := FALSE; + + tables[4] := E'( + SELECT DISTINCT p.company_id, + pr.region_id + FROM products p + INNER JOIN product_regions pr ON pr.product_id = p.id + ) prod_regions'; + join_conditions[4] := 'prod_regions.company_id = c.id'; + join_types[4] := 'INNER JOIN'; + linked_flags[4] := FALSE; + + -- Этот злобный изврат отключен. +-- tables[5] := '( +-- SELECT c.id AS company_id, +-- ( +-- SELECT prov.region_id +-- FROM +-- addresses ad +-- INNER JOIN cities cii ON ad.city_id = cii.id +-- INNER JOIN provinces prov ON cii.province_id = prov.id +-- WHERE +-- ad.company_id = c.id +-- ORDER BY +-- ad.position ASC +-- LIMIT 1 +-- ) AS region_id +-- FROM +-- companies c +-- WHERE +-- c.state <> ''deleted'' +-- ) main_regions'; +-- join_conditions[5] := 'main_regions.company_id = c.id'; +-- join_types[5] := 'LEFT JOIN'; + linked_flags[5] := FALSE; + + tables[6] := '( + SELECT + products.company_id, COUNT(products.id) AS products_count + FROM + products + WHERE + products.state IN (''accepted'', ''changed'', ''pending'') + GROUP BY + products.company_id + ) AS companies_products_count'; + join_conditions[6] := 'companies_products_count.company_id = c.id'; + join_types[6] := 'INNER JOIN'; + linked_flags[6] := FALSE; + + tables[7] := '( + SELECT + products.company_id, MAX(products.actualized_at) AS last_update_date + FROM + products + WHERE + products.state IN (''accepted'', ''changed'', ''pending'') + GROUP BY + products.company_id + ) AS companies_last_updated_products'; + join_conditions[7] := 'companies_last_updated_products.company_id = c.id'; + join_types[7] := 'INNER JOIN'; + linked_flags[7] := FALSE; + + tables[8] := '( + SELECT company_users.company_id, MAX(online_users.last_seen) AS user_last_seen_date + FROM company_users + INNER JOIN online_users ON online_users.user_id = company_users.user_id AND company_users.role <> ''pcmanager'' + LEFT JOIN user_roles ON user_roles.user_id = company_users.user_id + WHERE user_roles.id IS NULL + GROUP BY company_users.company_id + ) AS companies_last_users'; + join_conditions[8] := 'companies_last_users.company_id = c.id'; + join_types[8] := 'INNER JOIN'; + linked_flags[8] := FALSE; + + tables[9] := 'test_packets'; + join_conditions[9] := 'test_packets.company_id = c.id' ; + join_types[9] := 'INNER JOIN'; + linked_flags[9] := FALSE; + + --применяем параметры фильтра по компаниям + IF filter.id IS NOT NULL THEN + IF filter.is_only_imported = TRUE THEN + wheres := wheres || 'c.tmp = TRUE'::text; + + --применяем фильтр по идентификаторам временных компаний + IF LENGTH(filter.imports) > 0 THEN + wheres := wheres || ('c.csv_id IN(' || filter.imports || ')'); + ELSE + wheres := wheres || 'c.tmp IN(1, 2, 3)'::text; + END IF; + + --wheres := wheres || 'c.csv_import = TRUE'::text; + --wheres := wheres || 'c.csv_id = 2'::text; + END IF; + + -- фильтр по кол-ву товаров + IF COALESCE(filter.products_count_min, filter.products_count_max) IS NOT NULL THEN + IF filter.products_count_min + filter.products_count_max IS NOT NULL THEN -- указан диапазон + wheres := wheres || ( + 'companies_products_count.products_count >= ' || filter.products_count_min::VARCHAR || ' AND ' || + 'companies_products_count.products_count <= ' || filter.products_count_max::VARCHAR + )::TEXT; + ELSIF filter.products_count_min IS NOT NULL THEN + wheres := wheres || ('companies_products_count.products_count >= ' || filter.products_count_min::VARCHAR)::TEXT; + ELSIF filter.products_count_max IS NOT NULL THEN + wheres := wheres || ('companies_products_count.products_count <= ' || filter.products_count_max::VARCHAR)::TEXT; + END IF; + linked_flags[6] := TRUE; + END IF; + + -- фильтр по диапазону даты обновления товаров + IF COALESCE(filter.products_update_date_min, filter.products_update_date_max) IS NOT NULL THEN + IF filter.products_update_date_min IS NOT NULL AND filter.products_update_date_max IS NOT NULL THEN + wheres := wheres || ( + 'companies_last_updated_products.last_update_date BETWEEN ''' || + filter.products_update_date_min::DATE || ''' AND ''' || + filter.products_update_date_max::DATE || '''' + )::TEXT; + ELSIF filter.products_update_date_min IS NOT NULL THEN + wheres := wheres || ( + 'companies_last_updated_products.last_update_date >= ''' || filter.products_update_date_min::DATE || '''' + )::TEXT; + ELSIF filter.products_update_date_max IS NOT NULL THEN + wheres := wheres || ( + 'companies_last_updated_products.last_update_date <= ''' || filter.products_update_date_max::DATE || '''' + )::TEXT; + END IF; + linked_flags[7] := TRUE; + END IF; + + -- фильтр по диапазону даты последнего входа привязанного юзера (не пцманагер и не суперюзер) + IF COALESCE(filter.last_seen_date_min, filter.last_seen_date_max) IS NOT NULL THEN + IF filter.last_seen_date_min IS NOT NULL AND filter.last_seen_date_max IS NOT NULL THEN + wheres := wheres || ( + 'companies_last_users.user_last_seen_date BETWEEN ''' || + filter.last_seen_date_min::DATE || ''' AND ''' || + filter.last_seen_date_max::DATE || '''' + )::TEXT; + ELSIF filter.last_seen_date_min IS NOT NULL THEN + wheres := wheres || ( + 'companies_last_users.user_last_seen_date >= ''' || filter.last_seen_date_min::DATE || '''' + )::TEXT; + ELSIF filter.last_seen_date_max IS NOT NULL THEN + wheres := wheres || ( + 'companies_last_users.user_last_seen_date <= ''' || filter.last_seen_date_max::DATE || '''' + )::TEXT; + END IF; + linked_flags[8] := TRUE; + END IF; + + IF LENGTH(filter.regions) > 0 THEN + --linked_flags[5] := TRUE; + wheres := wheres + || ('c.main_region_id IN(' + || filter.regions + || ')'); + END IF; + + IF LENGTH(filter.commercial_regions) > 0 THEN + linked_flags[1] := TRUE; + wheres := wheres + || ('commercial_regions.region_id IN(' + || filter.commercial_regions + || ')'); + END IF; + + IF filter.has_price IS NOT NULL THEN + IF LENGTH(filter.price_regions) > 0 THEN + wheres := wheres + || ('prod_regions.region_id IN(' + || filter.price_regions + || ')'); + END IF; + linked_flags[4] := TRUE; + IF filter.has_price THEN + join_types[4] := 'INNER JOIN'; + ELSE + join_types[4] := 'LEFT JOIN'; + wheres := wheres || 'prod_regions.company_id IS NULL'::text; + END IF; + END IF; + + IF filter.has_products IS NOT NULL THEN + linked_flags[2] := TRUE; + IF filter.has_products THEN + join_types[2] := 'INNER JOIN'; + ELSE + join_types[2] := 'LEFT JOIN'; + wheres := wheres || 'p.company_id IS NULL'::text; + END IF; + END IF; + + IF filter.has_public_products IS NOT NULL THEN + linked_flags[3] := TRUE; + IF filter.has_public_products THEN + join_types[3] := 'INNER JOIN'; + ELSE + join_types[3] := 'LEFT JOIN'; + wheres := wheres || 'pp.company_id IS NULL'::text; + END IF; + END IF; + + IF LENGTH(filter.packets) > 0 THEN + wheres := wheres || ('c.packet IN(' || filter.packets || ')'); + END IF; + + IF filter.from_created_at IS NOT NULL THEN + wheres := wheres + || ('c.created_at >= ''' + || to_char(filter.from_created_at, 'YYYY-MM-DD') + || ''''); + END IF; + + IF filter.to_created_at IS NOT NULL THEN + wheres := wheres + || ('c.created_at <= ''' + || to_char(filter.to_created_at, 'YYYY-MM-DD') + || ''''); + END IF; + + IF filter.from_updated_at IS NOT NULL THEN + linked_flags[0] := TRUE; + wheres := wheres + || ('LEAST(cs.updated_at, c.updated_at) >= ''' + || to_char(filter.from_updated_at, 'YYYY-MM-DD') + || ''''); + END IF; + + IF filter.to_updated_at IS NOT NULL THEN + linked_flags[0] := TRUE; + wheres := wheres + || ('GREATEST(cs.updated_at, c.updated_at) <= ''' + || to_char(filter.to_updated_at, 'YYYY-MM-DD') + || ''''); + END IF; + + IF filter.is_pricelist_online IS NOT NULL THEN + wheres := wheres || ('c.is_pricelist_online = ' || CASE filter.is_pricelist_online WHEN TRUE THEN 'true' ELSE 'false' END ); + END IF; + + -- фильтр по тестовым размещения + IF filter.test_packet_status IS NOT NULL THEN + linked_flags[9] := TRUE; + IF filter.test_packet_status = 'no' THEN + join_types[9] = 'LEFT JOIN'; + END IF; + + IF filter.test_packet_status = 'pending' THEN + wheres := wheres || 'test_packets.valid_till > timezone(''utc'', now())'::text; + ELSIF filter.test_packet_status = 'finished' THEN + wheres := wheres || 'date(test_packets.valid_till) <= timezone(''utc'', now())'::text; + ELSIF filter.test_packet_status = 'no' THEN + wheres := wheres || 'test_packets.id IS NULL'::text; + END IF; + END IF; + + -- фильтр по дню тестового размещения + IF filter.test_packet_day_remains IS NOT NULL THEN + linked_flags[9] := TRUE; + wheres := wheres || ( + 'test_packets.valid_till::date - timezone(''utc'', now())::date <= ' + || to_char(filter.test_packet_day_remains, '99999') + )::text; + END IF; + IF filter.test_packet_day_remains_min IS NOT NULL THEN + linked_flags[9] := TRUE; + wheres := wheres || ( + 'test_packets.valid_till::date - timezone(''utc'', now())::date >= ' + || to_char(filter.test_packet_day_remains_min, '99999') + )::text; + END IF; + + + END IF; + + IF external_ids IS NOT NULL THEN + wheres := wheres + || ('c.oferta_sync_id IN(' + || array_to_string(external_ids, ', ') + || ')'); + END IF; + + --собираем запрос + sql := 'SELECT c.id AS id, MIN(c.main_region_id) AS region_id FROM companies c'; + FOR i IN 0..10 LOOP + IF linked_flags[i] = TRUE THEN + sql := sql || ' ' || join_types[i] || ' '; + sql := sql || tables[i]; + IF join_conditions[i].length > 0 THEN + sql := sql || ' ON ' || join_conditions[i]; + END IF; + END IF; + END LOOP; + sql := sql || ' WHERE ' || array_to_string(wheres, ' AND '); + sql := sql || ' GROUP BY c.id'; + + RETURN sql; + END; +$$; + + +-- +-- Name: parse_filter_company_status(text); Type: FUNCTION; Schema: mail_delivery; Owner: - +-- + +CREATE FUNCTION parse_filter_company_status(company_status text) RETURNS text + LANGUAGE plpgsql + AS $$ +-- разбирает значение поля company_status из фильтра +-- и по нему формирует условия для формирования запроса в companies_data_sets_filter_sql +-- возвращает строку с условием для where +DECLARE + cond text; + BEGIN + -- перебираем статусы из MailDelivery::CompaniesFilter + -- формируем условие на companies.state + IF company_status = 'all' or company_status IS NULL THEN + cond := 'c.state <> ''deleted'' '; + ELSIF company_status = 'published' THEN + cond := 'c.state IN ( ''pending'', ''changed'', ''accepted'' )'; + ELSIF company_status = 'rejected' THEN + cond := 'c.state = ''rejected'' '; + END if; + + RETURN cond; + + END; +$$; + + +-- +-- Name: personal_subscription_data_sets_clear(integer); Type: FUNCTION; Schema: mail_delivery; Owner: - +-- + +CREATE FUNCTION personal_subscription_data_sets_clear(mail_set_id integer) RETURNS boolean + LANGUAGE plpgsql + AS $$ +DECLARE + mail_set RECORD; +BEGIN + SELECT m.* INTO mail_set + FROM mail_delivery.mail_sets m + WHERE m.id = mail_set_id; + IF NOT FOUND THEN + RETURN FALSE; + END IF; + + DELETE + FROM mail_delivery.personal_subscription_data_sets d + WHERE d.mail_set_id = mail_set_id; + RETURN TRUE; +END; +$$; + + +-- +-- Name: personal_subscription_data_sets_create(integer); Type: FUNCTION; Schema: mail_delivery; Owner: - +-- + +CREATE FUNCTION personal_subscription_data_sets_create(mail_set_id integer) RETURNS boolean + LANGUAGE plpgsql + AS $$ +DECLARE + mail_set RECORD; + delivery RECORD; +BEGIN + SELECT g.* INTO mail_set + FROM mail_delivery.mail_sets g + WHERE g.id = mail_set_id; + IF NOT FOUND THEN + RETURN FALSE; + END IF; + + SELECT * INTO delivery + FROM mail_delivery.personal_subscription_deliveries + WHERE id = mail_set.subject_id; + IF NOT FOUND THEN + RETURN FALSE; + END IF; + + EXECUTE ' + insert into mail_delivery.personal_subscription_data_sets ("mail_set_id", "user_id", "email", "created_at", "updated_at") + (select ' || mail_set_id || ', user_id, email, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP + from mail_delivery.personal_subscriptions + where delivery_id = ' || delivery.id || '); + '; + + RETURN TRUE; +END; +$$; + + +-- +-- Name: personal_subscription_data_sets_prepare(integer); Type: FUNCTION; Schema: mail_delivery; Owner: - +-- + +CREATE FUNCTION personal_subscription_data_sets_prepare(mail_set_id integer) RETURNS integer + LANGUAGE plpgsql + AS $$ +DECLARE + result INTEGER; + mail_set RECORD; +BEGIN + SELECT m.* INTO mail_set + FROM mail_delivery.mail_sets m + WHERE m.id = mail_set_id; + IF NOT FOUND THEN + RETURN 0; + END IF; + + IF NOT EXISTS( + SELECT id + FROM mail_delivery.personal_subscription_data_sets d + WHERE d.mail_set_id = mail_set_id + LIMIT 1) + THEN + -- Здес можно сделать, чтобы personal_subscription_data_sets_create возвращала число вставленных строк + SET CONSTRAINTS ALL DEFERRED; + PERFORM mail_delivery.personal_subscription_data_sets_clear(mail_set_id); + PERFORM mail_delivery.personal_subscription_data_sets_create(mail_set_id); + SET CONSTRAINTS ALL IMMEDIATE; + END IF; + + SELECT COUNT(*) + INTO result + FROM mail_delivery.personal_subscription_data_sets d + WHERE d.mail_set_id = mail_set_id; + + RETURN result; +END; +$$; + + +-- +-- Name: personal_subscription_new_companies(integer, text, text, text); Type: FUNCTION; Schema: mail_delivery; Owner: - +-- + +CREATE FUNCTION personal_subscription_new_companies(delivery_id integer, region_ids text, from_date text, to_interval text) RETURNS integer + LANGUAGE plpgsql + AS $$ +DECLARE + i INTEGER; +BEGIN + i := -1; + EXECUTE ' + INSERT INTO mail_delivery.personal_subscription_data_prepared(delivery_id, region_id, rubric_id, prepared_ids) + SELECT '|| delivery_id ||' AS delivery_id, cr.region_id as region_id, null AS rubric_id, array_agg(c.id) AS ids + FROM companies c + + INNER JOIN company_regions cr + ON cr.company_id = c.id + + WHERE + c.tmp = false + AND c.state = ''accepted'' + + AND c.created_at >= date(date ''' || from_date || ''' - interval '''|| to_interval ||''') -- до + AND c.created_at <= date ''' || from_date || ''' -- от + AND cr.region_id in (' || region_ids || ') -- регион + GROUP by cr.region_id + '; + GET DIAGNOSTICS i = ROW_COUNT; + + RETURN i; +END; +$$; + + +-- +-- Name: personal_subscription_new_demands(integer, text, text, text); Type: FUNCTION; Schema: mail_delivery; Owner: - +-- + +CREATE FUNCTION personal_subscription_new_demands(delivery_id integer, region_ids text, from_date text, to_interval text) RETURNS integer + LANGUAGE plpgsql + AS $$ +DECLARE + i INTEGER; +BEGIN + i := -1; + EXECUTE ' + INSERT INTO mail_delivery.personal_subscription_data_prepared(delivery_id, region_id, rubric_id, prepared_ids) + SELECT '|| delivery_id ||' AS delivery_id, d.region_id as region_id, null AS rubric_id, array_agg(d.id) AS ids + FROM demands d + WHERE + d.is_published = true + AND d.state = ''accepted'' + + AND d.created_at >= date(date ''' || from_date || ''' - interval '''|| to_interval ||''') -- до + AND d.created_at <= date ''' || from_date || ''' -- от + AND d.region_id in (' || region_ids || ') -- регион + GROUP by d.region_id + '; + GET DIAGNOSTICS i = ROW_COUNT; + + RETURN i; +END; +$$; + + +-- +-- Name: personal_subscription_new_demands_notclient(integer, text, text, text, text); Type: FUNCTION; Schema: mail_delivery; Owner: - +-- + +CREATE FUNCTION personal_subscription_new_demands_notclient(delivery_id integer, region_ids text, from_date text, from_interval text, to_interval text) RETURNS integer + LANGUAGE plpgsql + AS $$ +DECLARE + i INTEGER; +BEGIN + i := -1; + EXECUTE ' + INSERT INTO mail_delivery.personal_subscription_data_prepared(delivery_id, region_id, rubric_id, prepared_ids) + SELECT '|| delivery_id ||' AS delivery_id, d.region_id as region_id, null AS rubric_id, array_agg(d.id) AS ids + FROM demands d + WHERE + d.is_published = true + AND d.state = ''accepted'' + + AND d.created_at >= date(date ''' || from_date || ''' - interval '''|| to_interval ||''') -- до + AND d.created_at <= date(date ''' || from_date || ''' - interval '''|| from_interval ||''') -- от + AND d.region_id in (' || region_ids || ') -- регион + GROUP by d.region_id + '; + GET DIAGNOSTICS i = ROW_COUNT; + + RETURN i; +END; +$$; + + +-- +-- Name: personal_subscription_new_leads(integer, text, text, text, text); Type: FUNCTION; Schema: mail_delivery; Owner: - +-- + +CREATE FUNCTION personal_subscription_new_leads(delivery_id integer, region_ids text, rubric_ids text, from_date text, to_interval text) RETURNS integer + LANGUAGE plpgsql + AS $$ + DECLARE + i INTEGER; + BEGIN + + i := -1; + EXECUTE ' + INSERT INTO mail_delivery.personal_subscription_data_prepared(delivery_id, region_id, rubric_id, prepared_ids) + SELECT '|| delivery_id ||' AS delivery_id, sub.region_id as region_id, sub.rubric_id AS rubric_id, array_agg(sub.id) AS ids + FROM ( + SELECT cr.region_id as region_id, crr.rubric_id AS rubric_id, c.id AS id + FROM companies c + + INNER JOIN company_regions cr + ON cr.company_id = c.id + INNER JOIN company_rubrics crr + ON c.id = crr.company_id + INNER JOIN statistics.company_statistic_total_by_months st + ON st.company_id = c.id + + WHERE + c.tmp = false + AND c.state = ''accepted'' + + AND st.date = date(date ''' || from_date || ''' - interval '''|| to_interval ||''') -- в + AND cr.region_id in (' || region_ids || ') -- регион + + AND crr.rubric_id in (' || rubric_ids || ') + ORDER BY st.visits DESC + ) AS sub + GROUP by sub.region_id, sub.rubric_id + '; + GET DIAGNOSTICS i = ROW_COUNT; + + RETURN i; + END; + $$; + + +-- +-- Name: personal_subscription_new_products(integer, text, text, text, text); Type: FUNCTION; Schema: mail_delivery; Owner: - +-- + +CREATE FUNCTION personal_subscription_new_products(delivery_id integer, region_ids text, rubric_ids text, from_date text, to_interval text) RETURNS integer + LANGUAGE plpgsql + AS $$ +DECLARE + i INTEGER; +BEGIN + i := -1; + EXECUTE ' + INSERT INTO mail_delivery.personal_subscription_data_prepared(delivery_id, region_id, rubric_id, prepared_ids) + SELECT '|| delivery_id ||' AS delivery_id, pr.region_id as region_id, rdt.rubric_l4_id AS rubric_id, array_agg(p.id) AS ids + FROM products p + + INNER JOIN product_regions pr + ON pr.product_id = p.id + INNER JOIN rubrics_denormalization_tree rdt + ON rdt.rubric_id = p.rubric_id + + WHERE + p.is_public = true + AND p.state = ''accepted'' + + AND p.created_at >= date(date ''' || from_date || ''' - interval '''|| to_interval ||''') -- до + AND p.created_at <= date ''' || from_date || ''' -- от + AND pr.region_id in (' || region_ids || ') -- регион + + AND (rdt.rubric_l4_id in (' || rubric_ids || ') OR rdt.rubric_l2_id in (' || rubric_ids || ')) + GROUP by pr.region_id, rdt.rubric_l4_id + '; + GET DIAGNOSTICS i = ROW_COUNT; + + RETURN i; +END; +$$; + + +-- +-- Name: subscribe_users_by_personal_delivery_filter(integer, text, integer[]); Type: FUNCTION; Schema: mail_delivery; Owner: - +-- + +CREATE FUNCTION subscribe_users_by_personal_delivery_filter(delivery_id integer, filter_id text, external_ids integer[]) RETURNS integer + LANGUAGE plpgsql + AS $$ +DECLARE + filter RECORD; + mail_set RECORD; + filter_sql TEXT; + i integer; +BEGIN + SELECT filter_id INTO filter; + + SELECT + mail_delivery.optimized_companies_data_sets_filter_sql( + filter_id, + external_ids + ) + INTO + filter_sql; + + IF filter_sql IS NULL THEN + --RETURN ''; + END IF; + + --формируем список получателей (компании + привязанные пользователи) + i := -1; + EXECUTE ' + INSERT INTO mail_delivery.personal_subscriptions (delivery_id, user_id, email, option_region, option_rubrics, token, created_at, updated_at) + SELECT *, md5(''--'' || sub.delivery_id || sub.user_id || sub.email::TEXT || ''--'') AS token, + import.to_utc(now()) AS created_at, import.to_utc(now()) AS updated_at + FROM ( + SELECT + ' || delivery_id || ' AS delivery_id, + MIN(data_sets.user_id) AS user_id, + data_sets.email::CHARACTER VARYING AS email, + c.main_region_id AS option_region, + cmr.rubric_id::TEXT AS option_rubrics + + FROM ( + WITH filtered_companies AS ( + ' || filter_sql || ' + ) + SELECT c.id AS company_id, LOWER(u.email) AS email, u.id AS user_id + FROM filtered_companies c + INNER JOIN company_users cu + ON cu.company_id = c.id + AND cu.role <> ''pcmanager'' + INNER JOIN users u ON u.id = cu.user_id + WHERE u.state <> ''deleted'' + ) data_sets + + INNER JOIN companies c + ON c.id = data_sets.company_id + INNER JOIN companies_main_rubrics cmr + ON cmr.company_id = c.id + + WHERE trim(lower(email)) NOT IN ( + SELECT trim(lower(email)) + FROM mail_delivery.personal_subscriptions + WHERE delivery_id = ' || delivery_id || ' + ) + + GROUP BY + data_sets.company_id, + data_sets.email, + option_region, + option_rubrics + ) AS sub + '; + GET DIAGNOSTICS i = ROW_COUNT; + + RETURN i; +END; +$$; + + +SET search_path = pgq, pg_catalog; + +-- +-- Name: batch_event_sql(bigint); Type: FUNCTION; Schema: pgq; Owner: - +-- + +CREATE FUNCTION batch_event_sql(x_batch_id bigint) RETURNS text + LANGUAGE plpgsql + AS $$ +-- ---------------------------------------------------------------------- +-- Function: pgq.batch_event_sql(1) +-- Creates SELECT statement that fetches events for this batch. +-- +-- Parameters: +-- x_batch_id - ID of a active batch. +-- +-- Returns: +-- SQL statement. +-- ---------------------------------------------------------------------- + +-- ---------------------------------------------------------------------- +-- Algorithm description: +-- Given 2 snapshots, sn1 and sn2 with sn1 having xmin1, xmax1 +-- and sn2 having xmin2, xmax2 create expression that filters +-- right txid's from event table. +-- +-- Simplest solution would be +-- > WHERE ev_txid >= xmin1 AND ev_txid <= xmax2 +-- > AND NOT txid_visible_in_snapshot(ev_txid, sn1) +-- > AND txid_visible_in_snapshot(ev_txid, sn2) +-- +-- The simple solution has a problem with long transactions (xmin1 very low). +-- All the batches that happen when the long tx is active will need +-- to scan all events in that range. Here is 2 optimizations used: +-- +-- 1) Use [xmax1..xmax2] for range scan. That limits the range to +-- txids that actually happened between two snapshots. For txids +-- in the range [xmin1..xmax1] look which ones were actually +-- committed between snapshots and search for them using exact +-- values using IN (..) list. +-- +-- 2) As most TX are short, there could be lot of them that were +-- just below xmax1, but were committed before xmax2. So look +-- if there are ID's near xmax1 and lower the range to include +-- them, thus decresing size of IN (..) list. +-- ---------------------------------------------------------------------- +declare + rec record; + sql text; + tbl text; + arr text; + part text; + select_fields text; + retry_expr text; + batch record; +begin + select s.sub_last_tick, s.sub_next_tick, s.sub_id, s.sub_queue, + txid_snapshot_xmax(last.tick_snapshot) as tx_start, + txid_snapshot_xmax(cur.tick_snapshot) as tx_end, + last.tick_snapshot as last_snapshot, + cur.tick_snapshot as cur_snapshot + into batch + from pgq.subscription s, pgq.tick last, pgq.tick cur + where s.sub_batch = x_batch_id + and last.tick_queue = s.sub_queue + and last.tick_id = s.sub_last_tick + and cur.tick_queue = s.sub_queue + and cur.tick_id = s.sub_next_tick; + if not found then + raise exception 'batch not found'; + end if; + + -- load older transactions + arr := ''; + for rec in + -- active tx-es in prev_snapshot that were committed in cur_snapshot + select id1 from + txid_snapshot_xip(batch.last_snapshot) id1 left join + txid_snapshot_xip(batch.cur_snapshot) id2 on (id1 = id2) + where id2 is null + order by 1 desc + loop + -- try to avoid big IN expression, so try to include nearby + -- tx'es into range + if batch.tx_start - 100 <= rec.id1 then + batch.tx_start := rec.id1; + else + if arr = '' then + arr := rec.id1::text; + else + arr := arr || ',' || rec.id1::text; + end if; + end if; + end loop; + + -- must match pgq.event_template + select_fields := 'select ev_id, ev_time, ev_txid, ev_retry, ev_type,' + || ' ev_data, ev_extra1, ev_extra2, ev_extra3, ev_extra4'; + retry_expr := ' and (ev_owner is null or ev_owner = ' + || batch.sub_id::text || ')'; + + -- now generate query that goes over all potential tables + sql := ''; + for rec in + select xtbl from pgq.batch_event_tables(x_batch_id) xtbl + loop + tbl := rec.xtbl; + -- this gets newer queries that definitely are not in prev_snapshot + part := select_fields + || ' from pgq.tick cur, pgq.tick last, ' || tbl || ' ev ' + || ' where cur.tick_id = ' || batch.sub_next_tick::text + || ' and cur.tick_queue = ' || batch.sub_queue::text + || ' and last.tick_id = ' || batch.sub_last_tick::text + || ' and last.tick_queue = ' || batch.sub_queue::text + || ' and ev.ev_txid >= ' || batch.tx_start::text + || ' and ev.ev_txid <= ' || batch.tx_end::text + || ' and txid_visible_in_snapshot(ev.ev_txid, cur.tick_snapshot)' + || ' and not txid_visible_in_snapshot(ev.ev_txid, last.tick_snapshot)' + || retry_expr; + -- now include older tx-es, that were ongoing + -- at the time of prev_snapshot + if arr <> '' then + part := part || ' union all ' + || select_fields || ' from ' || tbl || ' ev ' + || ' where ev.ev_txid in (' || arr || ')' + || retry_expr; + end if; + if sql = '' then + sql := part; + else + sql := sql || ' union all ' || part; + end if; + end loop; + if sql = '' then + raise exception 'could not construct sql for batch %', x_batch_id; + end if; + return sql || ' order by 1'; +end; +$$; + + +-- +-- Name: batch_event_tables(bigint); Type: FUNCTION; Schema: pgq; Owner: - +-- + +CREATE FUNCTION batch_event_tables(x_batch_id bigint) RETURNS SETOF text + LANGUAGE plpgsql + AS $$ +-- ---------------------------------------------------------------------- +-- Function: pgq.batch_event_tables(1) +-- +-- Returns set of table names where this batch events may reside. +-- +-- Parameters: +-- x_batch_id - ID of a active batch. +-- ---------------------------------------------------------------------- +declare + nr integer; + tbl text; + use_prev integer; + use_next integer; + batch record; +begin + select + txid_snapshot_xmin(last.tick_snapshot) as tx_min, -- absolute minimum + txid_snapshot_xmax(cur.tick_snapshot) as tx_max, -- absolute maximum + q.queue_data_pfx, q.queue_ntables, + q.queue_cur_table, q.queue_switch_step1, q.queue_switch_step2 + into batch + from pgq.tick last, pgq.tick cur, pgq.subscription s, pgq.queue q + where cur.tick_id = s.sub_next_tick + and cur.tick_queue = s.sub_queue + and last.tick_id = s.sub_last_tick + and last.tick_queue = s.sub_queue + and s.sub_batch = x_batch_id + and q.queue_id = s.sub_queue; + if not found then + raise exception 'Cannot find data for batch %', x_batch_id; + end if; + + -- if its definitely not in one or other, look into both + if batch.tx_max < batch.queue_switch_step1 then + use_prev := 1; + use_next := 0; + elsif batch.queue_switch_step2 is not null + and (batch.tx_min > batch.queue_switch_step2) + then + use_prev := 0; + use_next := 1; + else + use_prev := 1; + use_next := 1; + end if; + + if use_prev then + nr := batch.queue_cur_table - 1; + if nr < 0 then + nr := batch.queue_ntables - 1; + end if; + tbl := batch.queue_data_pfx || '_' || nr::text; + return next tbl; + end if; + + if use_next then + tbl := batch.queue_data_pfx || '_' || batch.queue_cur_table::text; + return next tbl; + end if; + + return; +end; +$$; + + +-- +-- Name: batch_retry(bigint, integer); Type: FUNCTION; Schema: pgq; Owner: - +-- + +CREATE FUNCTION batch_retry(i_batch_id bigint, i_retry_seconds integer) RETURNS integer + LANGUAGE plpgsql SECURITY DEFINER + AS $$ +-- ---------------------------------------------------------------------- +-- Function: pgq.batch_retry(2) +-- +-- Put whole batch into retry queue, to be processed again later. +-- +-- Parameters: +-- i_batch_id - ID of active batch. +-- i_retry_time - Time when the event should be put back into queue +-- +-- Returns: +-- number of events inserted +-- Calls: +-- None +-- Tables directly manipulated: +-- pgq.retry_queue +-- ---------------------------------------------------------------------- +declare + _retry timestamptz; + _cnt integer; + _s record; +begin + _retry := current_timestamp + ((i_retry_seconds::text || ' seconds')::interval); + + select * into _s from pgq.subscription where sub_batch = i_batch_id; + if not found then + raise exception 'batch_retry: batch % not found', i_batch_id; + end if; + + insert into pgq.retry_queue (ev_retry_after, ev_queue, + ev_id, ev_time, ev_txid, ev_owner, ev_retry, + ev_type, ev_data, ev_extra1, ev_extra2, + ev_extra3, ev_extra4) + select distinct _retry, _s.sub_queue, + b.ev_id, b.ev_time, NULL::int8, _s.sub_id, coalesce(b.ev_retry, 0) + 1, + b.ev_type, b.ev_data, b.ev_extra1, b.ev_extra2, + b.ev_extra3, b.ev_extra4 + from pgq.get_batch_events(i_batch_id) b + left join pgq.retry_queue rq + on (rq.ev_id = b.ev_id + and rq.ev_owner = _s.sub_id + and rq.ev_queue = _s.sub_queue) + where rq.ev_id is null; + + GET DIAGNOSTICS _cnt = ROW_COUNT; + return _cnt; +end; +$$; + + +-- +-- Name: create_queue(text); Type: FUNCTION; Schema: pgq; Owner: - +-- + +CREATE FUNCTION create_queue(i_queue_name text) RETURNS integer + LANGUAGE plpgsql SECURITY DEFINER + AS $$ +-- ---------------------------------------------------------------------- +-- Function: pgq.create_queue(1) +-- +-- Creates new queue with given name. +-- +-- Returns: +-- 0 - queue already exists +-- 1 - queue created +-- Calls: +-- pgq.grant_perms(i_queue_name); +-- pgq.ticker(i_queue_name); +-- pgq.tune_storage(i_queue_name); +-- Tables directly manipulated: +-- insert - pgq.queue +-- create - pgq.event_N () inherits (pgq.event_template) +-- create - pgq.event_N_0 .. pgq.event_N_M () inherits (pgq.event_N) +-- ---------------------------------------------------------------------- +declare + tblpfx text; + tblname text; + idxpfx text; + idxname text; + sql text; + id integer; + tick_seq text; + ev_seq text; + n_tables integer; +begin + if i_queue_name is null then + raise exception 'Invalid NULL value'; + end if; + + -- check if exists + perform 1 from pgq.queue where queue_name = i_queue_name; + if found then + return 0; + end if; + + -- insert event + id := nextval('pgq.queue_queue_id_seq'); + tblpfx := 'pgq.event_' || id::text; + idxpfx := 'event_' || id::text; + tick_seq := 'pgq.event_' || id::text || '_tick_seq'; + ev_seq := 'pgq.event_' || id::text || '_id_seq'; + insert into pgq.queue (queue_id, queue_name, + queue_data_pfx, queue_event_seq, queue_tick_seq) + values (id, i_queue_name, tblpfx, ev_seq, tick_seq); + + select queue_ntables into n_tables from pgq.queue + where queue_id = id; + + -- create seqs + execute 'CREATE SEQUENCE ' || tick_seq; + execute 'CREATE SEQUENCE ' || ev_seq; + + -- create data tables + execute 'CREATE TABLE ' || tblpfx || ' () ' + || ' INHERITS (pgq.event_template)'; + for i in 0 .. (n_tables - 1) loop + tblname := tblpfx || '_' || i::text; + idxname := idxpfx || '_' || i::text; + execute 'CREATE TABLE ' || tblname || ' () ' + || ' INHERITS (' || tblpfx || ')'; + execute 'ALTER TABLE ' || tblname || ' ALTER COLUMN ev_id ' + || ' SET DEFAULT nextval(' || quote_literal(ev_seq) || ')'; + execute 'create index ' || idxname || '_txid_idx on ' + || tblname || ' (ev_txid)'; + end loop; + + perform pgq.grant_perms(i_queue_name); + + perform pgq.ticker(i_queue_name); + + perform pgq.tune_storage(i_queue_name); + + return 1; +end; +$$; + + +-- +-- Name: current_event_table(text); Type: FUNCTION; Schema: pgq; Owner: - +-- + +CREATE FUNCTION current_event_table(x_queue_name text) RETURNS text + LANGUAGE plpgsql + AS $$ +-- ---------------------------------------------------------------------- +-- Function: pgq.current_event_table(1) +-- +-- Return active event table for particular queue. +-- Event can be added to it without going via functions, +-- e.g. by COPY. +-- +-- If queue is disabled and GUC session_replication_role <> 'replica' +-- then raises exception. +-- +-- or expressed in a different way - an even table of a disabled queue +-- is returned only on replica +-- +-- Note: +-- The result is valid only during current transaction. +-- +-- Permissions: +-- Actual insertion requires superuser access. +-- +-- Parameters: +-- x_queue_name - Queue name. +-- ---------------------------------------------------------------------- +declare + res text; + disabled boolean; +begin + select queue_data_pfx || '_' || queue_cur_table::text, + queue_disable_insert + into res, disabled + from pgq.queue where queue_name = x_queue_name; + if not found then + raise exception 'Event queue not found'; + end if; + if disabled then + if current_setting('session_replication_role') <> 'replica' then + raise exception 'Writing to queue disabled'; + end if; + end if; + return res; +end; +$$; + + +-- +-- Name: drop_queue(text); Type: FUNCTION; Schema: pgq; Owner: - +-- + +CREATE FUNCTION drop_queue(x_queue_name text) RETURNS integer + LANGUAGE plpgsql STRICT + AS $$ +-- ---------------------------------------------------------------------- +-- Function: pgq.drop_queue(1) +-- +-- Drop queue and all associated tables. +-- No consumers must be listening on the queue. +-- +-- ---------------------------------------------------------------------- +begin + return pgq.drop_queue(x_queue_name, false); +end; +$$; + + +-- +-- Name: drop_queue(text, boolean); Type: FUNCTION; Schema: pgq; Owner: - +-- + +CREATE FUNCTION drop_queue(x_queue_name text, x_force boolean) RETURNS integer + LANGUAGE plpgsql SECURITY DEFINER + AS $$ +-- ---------------------------------------------------------------------- +-- Function: pgq.drop_queue(2) +-- +-- Drop queue and all associated tables. +-- +-- Parameters: +-- x_queue_name - queue name +-- x_force - ignore (drop) existing consumers +-- Returns: +-- 1 - success +-- Calls: +-- pgq.unregister_consumer(queue_name, consumer_name) +-- perform pgq.ticker(i_queue_name); +-- perform pgq.tune_storage(i_queue_name); +-- Tables directly manipulated: +-- delete - pgq.queue +-- drop - pgq.event_N (), pgq.event_N_0 .. pgq.event_N_M +-- ---------------------------------------------------------------------- +declare + tblname text; + q record; + num integer; +begin + -- check if exists + select * into q from pgq.queue + where queue_name = x_queue_name + for update; + if not found then + raise exception 'No such event queue'; + end if; + + if x_force then + perform pgq.unregister_consumer(queue_name, consumer_name) + from pgq.get_consumer_info(x_queue_name); + else + -- check if no consumers + select count(*) into num from pgq.subscription + where sub_queue = q.queue_id; + if num > 0 then + raise exception 'cannot drop queue, consumers still attached'; + end if; + end if; + + -- drop data tables + for i in 0 .. (q.queue_ntables - 1) loop + tblname := q.queue_data_pfx || '_' || i::text; + execute 'DROP TABLE ' || tblname; + end loop; + execute 'DROP TABLE ' || q.queue_data_pfx; + + -- delete ticks + delete from pgq.tick where tick_queue = q.queue_id; + + -- drop seqs + -- FIXME: any checks needed here? + execute 'DROP SEQUENCE ' || q.queue_tick_seq; + execute 'DROP SEQUENCE ' || q.queue_event_seq; + + -- delete event + delete from pgq.queue + where queue_name = x_queue_name; + + return 1; +end; +$$; + + +-- +-- Name: event_retry(bigint, bigint, timestamp with time zone); Type: FUNCTION; Schema: pgq; Owner: - +-- + +CREATE FUNCTION event_retry(x_batch_id bigint, x_event_id bigint, x_retry_time timestamp with time zone) RETURNS integer + LANGUAGE plpgsql SECURITY DEFINER + AS $$ +-- ---------------------------------------------------------------------- +-- Function: pgq.event_retry(3a) +-- +-- Put the event into retry queue, to be processed again later. +-- +-- Parameters: +-- x_batch_id - ID of active batch. +-- x_event_id - event id +-- x_retry_time - Time when the event should be put back into queue +-- +-- Returns: +-- 1 - success +-- 0 - event already in retry queue +-- Calls: +-- None +-- Tables directly manipulated: +-- insert - pgq.retry_queue +-- ---------------------------------------------------------------------- +begin + insert into pgq.retry_queue (ev_retry_after, ev_queue, + ev_id, ev_time, ev_txid, ev_owner, ev_retry, ev_type, ev_data, + ev_extra1, ev_extra2, ev_extra3, ev_extra4) + select x_retry_time, sub_queue, + ev_id, ev_time, NULL, sub_id, coalesce(ev_retry, 0) + 1, + ev_type, ev_data, ev_extra1, ev_extra2, ev_extra3, ev_extra4 + from pgq.get_batch_events(x_batch_id), + pgq.subscription + where sub_batch = x_batch_id + and ev_id = x_event_id; + if not found then + raise exception 'event not found'; + end if; + return 1; + +-- dont worry if the event is already in queue +exception + when unique_violation then + return 0; +end; +$$; + + +-- +-- Name: event_retry(bigint, bigint, integer); Type: FUNCTION; Schema: pgq; Owner: - +-- + +CREATE FUNCTION event_retry(x_batch_id bigint, x_event_id bigint, x_retry_seconds integer) RETURNS integer + LANGUAGE plpgsql SECURITY DEFINER + AS $$ +-- ---------------------------------------------------------------------- +-- Function: pgq.event_retry(3b) +-- +-- Put the event into retry queue, to be processed later again. +-- +-- Parameters: +-- x_batch_id - ID of active batch. +-- x_event_id - event id +-- x_retry_seconds - Time when the event should be put back into queue +-- +-- Returns: +-- 1 - success +-- 0 - event already in retry queue +-- Calls: +-- pgq.event_retry(3a) +-- Tables directly manipulated: +-- None +-- ---------------------------------------------------------------------- +declare + new_retry timestamptz; +begin + new_retry := current_timestamp + ((x_retry_seconds::text || ' seconds')::interval); + return pgq.event_retry(x_batch_id, x_event_id, new_retry); +end; +$$; + + +-- +-- Name: event_retry_raw(text, text, timestamp with time zone, bigint, timestamp with time zone, integer, text, text, text, text, text, text); Type: FUNCTION; Schema: pgq; Owner: - +-- + +CREATE FUNCTION event_retry_raw(x_queue text, x_consumer text, x_retry_after timestamp with time zone, x_ev_id bigint, x_ev_time timestamp with time zone, x_ev_retry integer, x_ev_type text, x_ev_data text, x_ev_extra1 text, x_ev_extra2 text, x_ev_extra3 text, x_ev_extra4 text) RETURNS bigint + LANGUAGE plpgsql SECURITY DEFINER + AS $$ +-- ---------------------------------------------------------------------- +-- Function: pgq.event_retry_raw(12) +-- +-- Allows full control over what goes to retry queue. +-- +-- Parameters: +-- x_queue - name of the queue +-- x_consumer - name of the consumer +-- x_retry_after - when the event should be processed again +-- x_ev_id - event id +-- x_ev_time - creation time +-- x_ev_retry - retry count +-- x_ev_type - user data +-- x_ev_data - user data +-- x_ev_extra1 - user data +-- x_ev_extra2 - user data +-- x_ev_extra3 - user data +-- x_ev_extra4 - user data +-- +-- Returns: +-- Event ID. +-- ---------------------------------------------------------------------- +declare + q record; + id bigint; +begin + select sub_id, queue_event_seq, sub_queue into q + from pgq.consumer, pgq.queue, pgq.subscription + where queue_name = x_queue + and co_name = x_consumer + and sub_consumer = co_id + and sub_queue = queue_id; + if not found then + raise exception 'consumer not registered'; + end if; + + id := x_ev_id; + if id is null then + id := nextval(q.queue_event_seq); + end if; + + insert into pgq.retry_queue (ev_retry_after, ev_queue, + ev_id, ev_time, ev_owner, ev_retry, + ev_type, ev_data, ev_extra1, ev_extra2, ev_extra3, ev_extra4) + values (x_retry_after, q.sub_queue, + id, x_ev_time, q.sub_id, x_ev_retry, + x_ev_type, x_ev_data, x_ev_extra1, x_ev_extra2, + x_ev_extra3, x_ev_extra4); + + return id; +end; +$$; + + +-- +-- Name: find_tick_helper(integer, bigint, timestamp with time zone, bigint, bigint, interval); Type: FUNCTION; Schema: pgq; Owner: - +-- + +CREATE FUNCTION find_tick_helper(i_queue_id integer, i_prev_tick_id bigint, i_prev_tick_time timestamp with time zone, i_prev_tick_seq bigint, i_min_count bigint, i_min_interval interval, OUT next_tick_id bigint, OUT next_tick_time timestamp with time zone, OUT next_tick_seq bigint) RETURNS record + LANGUAGE plpgsql STABLE + AS $$ +-- ---------------------------------------------------------------------- +-- Function: pgq.find_tick_helper(6) +-- +-- Helper function for pgq.next_batch_custom() to do extended tick search. +-- ---------------------------------------------------------------------- +declare + sure boolean; + can_set boolean; + t record; + cnt int8; + ival interval; +begin + -- first, fetch last tick of the queue + select tick_id, tick_time, tick_event_seq into t + from pgq.tick + where tick_queue = i_queue_id + and tick_id > i_prev_tick_id + order by tick_queue desc, tick_id desc + limit 1; + if not found then + return; + end if; + + -- check whether batch would end up within reasonable limits + sure := true; + can_set := false; + if i_min_count is not null then + cnt = t.tick_event_seq - i_prev_tick_seq; + if cnt >= i_min_count then + can_set := true; + end if; + if cnt > i_min_count * 2 then + sure := false; + end if; + end if; + if i_min_interval is not null then + ival = t.tick_time - i_prev_tick_time; + if ival >= i_min_interval then + can_set := true; + end if; + if ival > i_min_interval * 2 then + sure := false; + end if; + end if; + + -- if last tick too far away, do large scan + if not sure then + select tick_id, tick_time, tick_event_seq into t + from pgq.tick + where tick_queue = i_queue_id + and tick_id > i_prev_tick_id + and ((i_min_count is not null and (tick_event_seq - i_prev_tick_seq) >= i_min_count) + or + (i_min_interval is not null and (tick_time - i_prev_tick_time) >= i_min_interval)) + order by tick_queue asc, tick_id asc + limit 1; + can_set := true; + end if; + if can_set then + next_tick_id := t.tick_id; + next_tick_time := t.tick_time; + next_tick_seq := t.tick_event_seq; + end if; + return; +end; +$$; + + +-- +-- Name: finish_batch(bigint); Type: FUNCTION; Schema: pgq; Owner: - +-- + +CREATE FUNCTION finish_batch(x_batch_id bigint) RETURNS integer + LANGUAGE plpgsql SECURITY DEFINER + AS $$ +-- ---------------------------------------------------------------------- +-- Function: pgq.finish_batch(1) +-- +-- Closes a batch. No more operations can be done with events +-- of this batch. +-- +-- Parameters: +-- x_batch_id - id of batch. +-- +-- Returns: +-- 1 if batch was found, 0 otherwise. +-- Calls: +-- None +-- Tables directly manipulated: +-- update - pgq.subscription +-- ---------------------------------------------------------------------- +begin + update pgq.subscription + set sub_active = now(), + sub_last_tick = sub_next_tick, + sub_next_tick = null, + sub_batch = null + where sub_batch = x_batch_id; + if not found then + raise warning 'finish_batch: batch % not found', x_batch_id; + return 0; + end if; + + return 1; +end; +$$; + + +-- +-- Name: force_tick(text); Type: FUNCTION; Schema: pgq; Owner: - +-- + +CREATE FUNCTION force_tick(i_queue_name text) RETURNS bigint + LANGUAGE plpgsql SECURITY DEFINER + AS $$ +-- ---------------------------------------------------------------------- +-- Function: pgq.force_tick(2) +-- +-- Simulate lots of events happening to force ticker to tick. +-- +-- Should be called in loop, with some delay until last tick +-- changes or too much time is passed. +-- +-- Such function is needed because paraller calls of pgq.ticker() are +-- dangerous, and cannot be protected with locks as snapshot +-- is taken before locking. +-- +-- Parameters: +-- i_queue_name - Name of the queue +-- +-- Returns: +-- Currently last tick id. +-- ---------------------------------------------------------------------- +declare + q record; + t record; +begin + -- bump seq and get queue id + select queue_id, + setval(queue_event_seq, nextval(queue_event_seq) + + queue_ticker_max_count * 2 + 1000) as tmp + into q from pgq.queue + where queue_name = i_queue_name + and not queue_external_ticker + and not queue_ticker_paused; + + --if not found then + -- raise notice 'queue not found or ticks not allowed'; + --end if; + + -- return last tick id + select tick_id into t + from pgq.tick, pgq.queue + where tick_queue = queue_id and queue_name = i_queue_name + order by tick_queue desc, tick_id desc limit 1; + + return t.tick_id; +end; +$$; + + +-- +-- Name: get_batch_cursor(bigint, text, integer); Type: FUNCTION; Schema: pgq; Owner: - +-- + +CREATE FUNCTION get_batch_cursor(i_batch_id bigint, i_cursor_name text, i_quick_limit integer, OUT ev_id bigint, OUT ev_time timestamp with time zone, OUT ev_txid bigint, OUT ev_retry integer, OUT ev_type text, OUT ev_data text, OUT ev_extra1 text, OUT ev_extra2 text, OUT ev_extra3 text, OUT ev_extra4 text) RETURNS SETOF record + LANGUAGE plpgsql STRICT + AS $$ +-- ---------------------------------------------------------------------- +-- Function: pgq.get_batch_cursor(3) +-- +-- Get events in batch using a cursor. +-- +-- Parameters: +-- i_batch_id - ID of active batch. +-- i_cursor_name - Name for new cursor +-- i_quick_limit - Number of events to return immediately +-- +-- Returns: +-- List of events. +-- Calls: +-- pgq.get_batch_cursor(4) +-- ---------------------------------------------------------------------- +begin + for ev_id, ev_time, ev_txid, ev_retry, ev_type, ev_data, + ev_extra1, ev_extra2, ev_extra3, ev_extra4 + in + select * from pgq.get_batch_cursor(i_batch_id, + i_cursor_name, i_quick_limit, null) + loop + return next; + end loop; + return; +end; +$$; + + +-- +-- Name: get_batch_cursor(bigint, text, integer, text); Type: FUNCTION; Schema: pgq; Owner: - +-- + +CREATE FUNCTION get_batch_cursor(i_batch_id bigint, i_cursor_name text, i_quick_limit integer, i_extra_where text, OUT ev_id bigint, OUT ev_time timestamp with time zone, OUT ev_txid bigint, OUT ev_retry integer, OUT ev_type text, OUT ev_data text, OUT ev_extra1 text, OUT ev_extra2 text, OUT ev_extra3 text, OUT ev_extra4 text) RETURNS SETOF record + LANGUAGE plpgsql + AS $$ +-- ---------------------------------------------------------------------- +-- Function: pgq.get_batch_cursor(4) +-- +-- Get events in batch using a cursor. +-- +-- Parameters: +-- i_batch_id - ID of active batch. +-- i_cursor_name - Name for new cursor +-- i_quick_limit - Number of events to return immediately +-- i_extra_where - optional where clause to filter events +-- +-- Returns: +-- List of events. +-- Calls: +-- pgq.batch_event_sql(i_batch_id) - internal function which generates SQL optimised specially for getting events in this batch +-- ---------------------------------------------------------------------- +declare + _cname text; + _sql text; +begin + if i_batch_id is null or i_cursor_name is null or i_quick_limit is null then + return; + end if; + + _cname := quote_ident(i_cursor_name); + _sql := pgq.batch_event_sql(i_batch_id); + + -- apply extra where + if i_extra_where is not null then + _sql := replace(_sql, ' order by 1', ''); + _sql := 'select * from (' || _sql + || ') _evs where ' || i_extra_where + || ' order by 1'; + end if; + + -- create cursor + execute 'declare ' || _cname || ' no scroll cursor for ' || _sql; + + -- if no events wanted, don't bother with execute + if i_quick_limit <= 0 then + return; + end if; + + -- return first block of events + for ev_id, ev_time, ev_txid, ev_retry, ev_type, ev_data, + ev_extra1, ev_extra2, ev_extra3, ev_extra4 + in execute 'fetch ' || i_quick_limit::text || ' from ' || _cname + loop + return next; + end loop; + + return; +end; +$$; + + +-- +-- Name: get_batch_events(bigint); Type: FUNCTION; Schema: pgq; Owner: - +-- + +CREATE FUNCTION get_batch_events(x_batch_id bigint, OUT ev_id bigint, OUT ev_time timestamp with time zone, OUT ev_txid bigint, OUT ev_retry integer, OUT ev_type text, OUT ev_data text, OUT ev_extra1 text, OUT ev_extra2 text, OUT ev_extra3 text, OUT ev_extra4 text) RETURNS SETOF record + LANGUAGE plpgsql + AS $$ +-- ---------------------------------------------------------------------- +-- Function: pgq.get_batch_events(1) +-- +-- Get all events in batch. +-- +-- Parameters: +-- x_batch_id - ID of active batch. +-- +-- Returns: +-- List of events. +-- ---------------------------------------------------------------------- +declare + sql text; +begin + sql := pgq.batch_event_sql(x_batch_id); + for ev_id, ev_time, ev_txid, ev_retry, ev_type, ev_data, + ev_extra1, ev_extra2, ev_extra3, ev_extra4 + in execute sql + loop + return next; + end loop; + return; +end; +$$; + + +-- +-- Name: get_batch_info(bigint); Type: FUNCTION; Schema: pgq; Owner: - +-- + +CREATE FUNCTION get_batch_info(x_batch_id bigint, OUT queue_name text, OUT consumer_name text, OUT batch_start timestamp with time zone, OUT batch_end timestamp with time zone, OUT prev_tick_id bigint, OUT tick_id bigint, OUT lag interval, OUT seq_start bigint, OUT seq_end bigint) RETURNS record + LANGUAGE plpgsql SECURITY DEFINER + AS $$ +-- ---------------------------------------------------------------------- +-- Function: pgq.get_batch_info(1) +-- +-- Returns detailed info about a batch. +-- +-- Parameters: +-- x_batch_id - id of a active batch. +-- +-- Returns: ??? pls check +-- queue_name - which queue this batch came from +-- consumer_name - batch processed by +-- batch_start - start time of batch +-- batch_end - end time of batch +-- prev_tick_id - start tick for this batch +-- tick_id - end tick for this batch +-- lag - now() - tick_id.time +-- seq_start - start event id for batch +-- seq_end - end event id for batch +-- ---------------------------------------------------------------------- +begin + select q.queue_name, c.co_name, + prev.tick_time, cur.tick_time, + s.sub_last_tick, s.sub_next_tick, + current_timestamp - cur.tick_time, + prev.tick_event_seq, cur.tick_event_seq + into queue_name, consumer_name, batch_start, batch_end, + prev_tick_id, tick_id, lag, seq_start, seq_end + from pgq.subscription s, pgq.tick cur, pgq.tick prev, + pgq.queue q, pgq.consumer c + where s.sub_batch = x_batch_id + and prev.tick_id = s.sub_last_tick + and prev.tick_queue = s.sub_queue + and cur.tick_id = s.sub_next_tick + and cur.tick_queue = s.sub_queue + and q.queue_id = s.sub_queue + and c.co_id = s.sub_consumer; + return; +end; +$$; + + +-- +-- Name: get_consumer_info(); Type: FUNCTION; Schema: pgq; Owner: - +-- + +CREATE FUNCTION get_consumer_info(OUT queue_name text, OUT consumer_name text, OUT lag interval, OUT last_seen interval, OUT last_tick bigint, OUT current_batch bigint, OUT next_tick bigint, OUT pending_events bigint) RETURNS SETOF record + LANGUAGE plpgsql SECURITY DEFINER + AS $$ +-- ---------------------------------------------------------------------- +-- Function: pgq.get_consumer_info(0) +-- +-- Returns info about all consumers on all queues. +-- +-- Returns: +-- See pgq.get_consumer_info(2) +-- ---------------------------------------------------------------------- +begin + for queue_name, consumer_name, lag, last_seen, + last_tick, current_batch, next_tick, pending_events + in + select f.queue_name, f.consumer_name, f.lag, f.last_seen, + f.last_tick, f.current_batch, f.next_tick, f.pending_events + from pgq.get_consumer_info(null, null) f + loop + return next; + end loop; + return; +end; +$$; + + +-- +-- Name: get_consumer_info(text); Type: FUNCTION; Schema: pgq; Owner: - +-- + +CREATE FUNCTION get_consumer_info(i_queue_name text, OUT queue_name text, OUT consumer_name text, OUT lag interval, OUT last_seen interval, OUT last_tick bigint, OUT current_batch bigint, OUT next_tick bigint, OUT pending_events bigint) RETURNS SETOF record + LANGUAGE plpgsql SECURITY DEFINER + AS $$ +-- ---------------------------------------------------------------------- +-- Function: pgq.get_consumer_info(1) +-- +-- Returns info about all consumers on single queue. +-- +-- Returns: +-- See pgq.get_consumer_info(2) +-- ---------------------------------------------------------------------- +begin + for queue_name, consumer_name, lag, last_seen, + last_tick, current_batch, next_tick, pending_events + in + select f.queue_name, f.consumer_name, f.lag, f.last_seen, + f.last_tick, f.current_batch, f.next_tick, f.pending_events + from pgq.get_consumer_info(i_queue_name, null) f + loop + return next; + end loop; + return; +end; +$$; + + +-- +-- Name: get_consumer_info(text, text); Type: FUNCTION; Schema: pgq; Owner: - +-- + +CREATE FUNCTION get_consumer_info(i_queue_name text, i_consumer_name text, OUT queue_name text, OUT consumer_name text, OUT lag interval, OUT last_seen interval, OUT last_tick bigint, OUT current_batch bigint, OUT next_tick bigint, OUT pending_events bigint) RETURNS SETOF record + LANGUAGE plpgsql SECURITY DEFINER + AS $$ +-- ---------------------------------------------------------------------- +-- Function: pgq.get_consumer_info(2) +-- +-- Get info about particular consumer on particular queue. +-- +-- Parameters: +-- i_queue_name - name of a queue. (null = all) +-- i_consumer_name - name of a consumer (null = all) +-- +-- Returns: +-- queue_name - Queue name +-- consumer_name - Consumer name +-- lag - How old are events the consumer is processing +-- last_seen - When the consumer seen by pgq +-- last_tick - Tick ID of last processed tick +-- current_batch - Current batch ID, if one is active or NULL +-- next_tick - If batch is active, then its final tick. +-- ---------------------------------------------------------------------- +declare + _pending_events bigint; + _queue_id bigint; +begin + for queue_name, consumer_name, lag, last_seen, + last_tick, current_batch, next_tick, _pending_events, _queue_id + in + select q.queue_name, c.co_name, + current_timestamp - t.tick_time, + current_timestamp - s.sub_active, + s.sub_last_tick, s.sub_batch, s.sub_next_tick, + t.tick_event_seq, q.queue_id + from pgq.queue q, + pgq.consumer c, + pgq.subscription s + left join pgq.tick t + on (t.tick_queue = s.sub_queue and t.tick_id = s.sub_last_tick) + where q.queue_id = s.sub_queue + and c.co_id = s.sub_consumer + and (i_queue_name is null or q.queue_name = i_queue_name) + and (i_consumer_name is null or c.co_name = i_consumer_name) + order by 1,2 + loop + select t.tick_event_seq - _pending_events + into pending_events + from pgq.tick t + where t.tick_queue = _queue_id + order by t.tick_queue desc, t.tick_id desc + limit 1; + return next; + end loop; + return; +end; +$$; + + +-- +-- Name: get_queue_info(); Type: FUNCTION; Schema: pgq; Owner: - +-- + +CREATE FUNCTION get_queue_info(OUT queue_name text, OUT queue_ntables integer, OUT queue_cur_table integer, OUT queue_rotation_period interval, OUT queue_switch_time timestamp with time zone, OUT queue_external_ticker boolean, OUT queue_ticker_paused boolean, OUT queue_ticker_max_count integer, OUT queue_ticker_max_lag interval, OUT queue_ticker_idle_period interval, OUT ticker_lag interval, OUT ev_per_sec double precision, OUT ev_new bigint, OUT last_tick_id bigint) RETURNS SETOF record + LANGUAGE plpgsql + AS $$ +-- ---------------------------------------------------------------------- +-- Function: pgq.get_queue_info(0) +-- +-- Get info about all queues. +-- +-- Returns: +-- List of pgq.ret_queue_info records. +-- queue_name - queue name +-- queue_ntables - number of tables in this queue +-- queue_cur_table - ??? +-- queue_rotation_period - how often the event_N_M tables in this queue are rotated +-- queue_switch_time - ??? when was this queue last rotated +-- queue_external_ticker - ??? +-- queue_ticker_paused - ??? is ticker paused in this queue +-- queue_ticker_max_count - max number of events before a tick is issued +-- queue_ticker_max_lag - maks time without a tick +-- queue_ticker_idle_period - how often the ticker should check this queue +-- ticker_lag - time from last tick +-- ev_per_sec - how many events per second this queue serves +-- ev_new - ??? +-- last_tick_id - last tick id for this queue +-- +-- ---------------------------------------------------------------------- +begin + for queue_name, queue_ntables, queue_cur_table, queue_rotation_period, + queue_switch_time, queue_external_ticker, queue_ticker_paused, + queue_ticker_max_count, queue_ticker_max_lag, queue_ticker_idle_period, + ticker_lag, ev_per_sec, ev_new, last_tick_id + in select + f.queue_name, f.queue_ntables, f.queue_cur_table, f.queue_rotation_period, + f.queue_switch_time, f.queue_external_ticker, f.queue_ticker_paused, + f.queue_ticker_max_count, f.queue_ticker_max_lag, f.queue_ticker_idle_period, + f.ticker_lag, f.ev_per_sec, f.ev_new, f.last_tick_id + from pgq.get_queue_info(null) f + loop + return next; + end loop; + return; +end; +$$; + + +-- +-- Name: get_queue_info(text); Type: FUNCTION; Schema: pgq; Owner: - +-- + +CREATE FUNCTION get_queue_info(i_queue_name text, OUT queue_name text, OUT queue_ntables integer, OUT queue_cur_table integer, OUT queue_rotation_period interval, OUT queue_switch_time timestamp with time zone, OUT queue_external_ticker boolean, OUT queue_ticker_paused boolean, OUT queue_ticker_max_count integer, OUT queue_ticker_max_lag interval, OUT queue_ticker_idle_period interval, OUT ticker_lag interval, OUT ev_per_sec double precision, OUT ev_new bigint, OUT last_tick_id bigint) RETURNS SETOF record + LANGUAGE plpgsql + AS $$ +-- ---------------------------------------------------------------------- +-- Function: pgq.get_queue_info(1) +-- +-- Get info about particular queue. +-- +-- Returns: +-- One pgq.ret_queue_info record. +-- contente same as forpgq.get_queue_info() +-- ---------------------------------------------------------------------- +declare + _ticker_lag interval; + _top_tick_id bigint; + _ht_tick_id bigint; + _top_tick_time timestamptz; + _top_tick_event_seq bigint; + _ht_tick_time timestamptz; + _ht_tick_event_seq bigint; + _queue_id integer; + _queue_event_seq text; +begin + for queue_name, queue_ntables, queue_cur_table, queue_rotation_period, + queue_switch_time, queue_external_ticker, queue_ticker_paused, + queue_ticker_max_count, queue_ticker_max_lag, queue_ticker_idle_period, + _queue_id, _queue_event_seq + in select + q.queue_name, q.queue_ntables, q.queue_cur_table, + q.queue_rotation_period, q.queue_switch_time, + q.queue_external_ticker, q.queue_ticker_paused, + q.queue_ticker_max_count, q.queue_ticker_max_lag, + q.queue_ticker_idle_period, + q.queue_id, q.queue_event_seq + from pgq.queue q + where (i_queue_name is null or q.queue_name = i_queue_name) + order by q.queue_name + loop + -- most recent tick + select (current_timestamp - t.tick_time), + tick_id, t.tick_time, t.tick_event_seq + into ticker_lag, _top_tick_id, _top_tick_time, _top_tick_event_seq + from pgq.tick t + where t.tick_queue = _queue_id + order by t.tick_queue desc, t.tick_id desc + limit 1; + -- slightly older tick + select ht.tick_id, ht.tick_time, ht.tick_event_seq + into _ht_tick_id, _ht_tick_time, _ht_tick_event_seq + from pgq.tick ht + where ht.tick_queue = _queue_id + and ht.tick_id >= _top_tick_id - 20 + order by ht.tick_queue asc, ht.tick_id asc + limit 1; + if _ht_tick_time < _top_tick_time then + ev_per_sec = (_top_tick_event_seq - _ht_tick_event_seq) / extract(epoch from (_top_tick_time - _ht_tick_time)); + else + ev_per_sec = null; + end if; + ev_new = pgq.seq_getval(_queue_event_seq) - _top_tick_event_seq; + last_tick_id = _top_tick_id; + return next; + end loop; + return; +end; +$$; + + +-- +-- Name: grant_perms(text); Type: FUNCTION; Schema: pgq; Owner: - +-- + +CREATE FUNCTION grant_perms(x_queue_name text) RETURNS integer + LANGUAGE plpgsql SECURITY DEFINER + AS $$ +-- ---------------------------------------------------------------------- +-- Function: pgq.grant_perms(1) +-- +-- Make event tables readable by public. +-- +-- Parameters: +-- x_queue_name - Name of the queue. +-- +-- Returns: +-- nothing +-- ---------------------------------------------------------------------- +declare + q record; + i integer; + tbl_perms text; + seq_perms text; +begin + select * from pgq.queue into q + where queue_name = x_queue_name; + if not found then + raise exception 'Queue not found'; + end if; + + if true then + -- safe, all access must go via functions + seq_perms := 'select'; + tbl_perms := 'select'; + else + -- allow ordinery users to directly insert + -- to event tables. dangerous. + seq_perms := 'select, update'; + tbl_perms := 'select, insert'; + end if; + + -- tick seq, normal users don't need to modify it + execute 'grant ' || seq_perms + || ' on ' || q.queue_tick_seq || ' to public'; + + -- event seq + execute 'grant ' || seq_perms + || ' on ' || q.queue_event_seq || ' to public'; + + -- parent table for events + execute 'grant select on ' || q.queue_data_pfx || ' to public'; + + -- real event tables + for i in 0 .. q.queue_ntables - 1 loop + execute 'grant ' || tbl_perms + || ' on ' || q.queue_data_pfx || '_' || i::text + || ' to public'; + end loop; + + return 1; +end; +$$; + + +-- +-- Name: insert_event(text, text, text); Type: FUNCTION; Schema: pgq; Owner: - +-- + +CREATE FUNCTION insert_event(queue_name text, ev_type text, ev_data text) RETURNS bigint + LANGUAGE plpgsql SECURITY DEFINER + AS $$ +-- ---------------------------------------------------------------------- +-- Function: pgq.insert_event(3) +-- +-- Insert a event into queue. +-- +-- Parameters: +-- queue_name - Name of the queue +-- ev_type - User-specified type for the event +-- ev_data - User data for the event +-- +-- Returns: +-- Event ID +-- Calls: +-- pgq.insert_event(7) +-- ---------------------------------------------------------------------- +begin + return pgq.insert_event(queue_name, ev_type, ev_data, null, null, null, null); +end; +$$; + + +-- +-- Name: insert_event(text, text, text, text, text, text, text); Type: FUNCTION; Schema: pgq; Owner: - +-- + +CREATE FUNCTION insert_event(queue_name text, ev_type text, ev_data text, ev_extra1 text, ev_extra2 text, ev_extra3 text, ev_extra4 text) RETURNS bigint + LANGUAGE plpgsql SECURITY DEFINER + AS $$ +-- ---------------------------------------------------------------------- +-- Function: pgq.insert_event(7) +-- +-- Insert a event into queue with all the extra fields. +-- +-- Parameters: +-- queue_name - Name of the queue +-- ev_type - User-specified type for the event +-- ev_data - User data for the event +-- ev_extra1 - Extra data field for the event +-- ev_extra2 - Extra data field for the event +-- ev_extra3 - Extra data field for the event +-- ev_extra4 - Extra data field for the event +-- +-- Returns: +-- Event ID +-- Calls: +-- pgq.insert_event_raw(11) +-- Tables directly manipulated: +-- insert - pgq.insert_event_raw(11), a C function, inserts into current event_N_M table +-- ---------------------------------------------------------------------- +begin + return pgq.insert_event_raw(queue_name, null, now(), null, null, + ev_type, ev_data, ev_extra1, ev_extra2, ev_extra3, ev_extra4); +end; +$$; + + +-- +-- Name: insert_event_raw(text, bigint, timestamp with time zone, integer, integer, text, text, text, text, text, text); Type: FUNCTION; Schema: pgq; Owner: - +-- + +CREATE FUNCTION insert_event_raw(queue_name text, ev_id bigint, ev_time timestamp with time zone, ev_owner integer, ev_retry integer, ev_type text, ev_data text, ev_extra1 text, ev_extra2 text, ev_extra3 text, ev_extra4 text) RETURNS bigint + LANGUAGE c + AS '$libdir/pgq_lowlevel', 'pgq_insert_event_raw'; + + +-- +-- Name: logutriga(); Type: FUNCTION; Schema: pgq; Owner: - +-- + +CREATE FUNCTION logutriga() RETURNS trigger + LANGUAGE c + AS '$libdir/pgq_triggers', 'pgq_logutriga'; + + +-- +-- Name: maint_operations(); Type: FUNCTION; Schema: pgq; Owner: - +-- + +CREATE FUNCTION maint_operations(OUT func_name text, OUT func_arg text) RETURNS SETOF record + LANGUAGE plpgsql + AS $$ +-- ---------------------------------------------------------------------- +-- Function: pgq.maint_operations(0) +-- +-- Returns list of functions to call for maintenance. +-- +-- The goal is to avoid hardcoding them into maintenance process. +-- +-- Function signature: +-- Function should take either 1 or 0 arguments and return 1 if it wants +-- to be called immediately again, 0 if not. +-- +-- Returns: +-- func_name - Function to call +-- func_arg - Optional argument to function (queue name) +-- ---------------------------------------------------------------------- +declare + ops text[]; + nrot int4; +begin + -- rotate step 1 + nrot := 0; + func_name := 'pgq.maint_rotate_tables_step1'; + for func_arg in + select queue_name from pgq.queue + where queue_rotation_period is not null + and queue_switch_step2 is not null + and queue_switch_time + queue_rotation_period < current_timestamp + order by 1 + loop + nrot := nrot + 1; + return next; + end loop; + + -- rotate step 2 + if nrot = 0 then + select count(1) from pgq.queue + where queue_rotation_period is not null + and queue_switch_step2 is null + into nrot; + end if; + if nrot > 0 then + func_name := 'pgq.maint_rotate_tables_step2'; + func_arg := NULL; + return next; + end if; + + -- check if extra field exists + perform 1 from pg_attribute + where attrelid = 'pgq.queue'::regclass + and attname = 'queue_extra_maint'; + if found then + -- add extra ops + for func_arg, ops in + select q.queue_name, queue_extra_maint from pgq.queue q + where queue_extra_maint is not null + order by 1 + loop + for i in array_lower(ops, 1) .. array_upper(ops, 1) + loop + func_name = ops[i]; + return next; + end loop; + end loop; + end if; + + -- vacuum tables + func_name := 'vacuum'; + for func_arg in + select * from pgq.maint_tables_to_vacuum() + loop + return next; + end loop; + + -- + -- pgq_node & londiste + -- + -- although they belong to queue_extra_maint, they are + -- common enough so its more effective to handle them here. + -- + + perform 1 from pg_proc p, pg_namespace n + where p.pronamespace = n.oid + and n.nspname = 'pgq_node' + and p.proname = 'maint_watermark'; + if found then + func_name := 'pgq_node.maint_watermark'; + for func_arg in + select n.queue_name + from pgq_node.node_info n + where n.node_type = 'root' + loop + return next; + end loop; + + end if; + + perform 1 from pg_proc p, pg_namespace n + where p.pronamespace = n.oid + and n.nspname = 'londiste' + and p.proname = 'root_check_seqs'; + if found then + func_name := 'londiste.root_check_seqs'; + for func_arg in + select distinct s.queue_name + from londiste.seq_info s, pgq_node.node_info n + where s.local + and n.node_type = 'root' + and n.queue_name = s.queue_name + loop + return next; + end loop; + end if; + + return; +end; +$$; + + +-- +-- Name: maint_retry_events(); Type: FUNCTION; Schema: pgq; Owner: - +-- + +CREATE FUNCTION maint_retry_events() RETURNS integer + LANGUAGE plpgsql + AS $$ +-- ---------------------------------------------------------------------- +-- Function: pgq.maint_retry_events(0) +-- +-- Moves retry events back to main queue. +-- +-- It moves small amount at a time. It should be called +-- until it returns 0 +-- +-- Returns: +-- Number of events processed. +-- ---------------------------------------------------------------------- +declare + cnt integer; + rec record; +begin + cnt := 0; + + -- allow only single event mover at a time, without affecting inserts + lock table pgq.retry_queue in share update exclusive mode; + + for rec in + select queue_name, + ev_id, ev_time, ev_owner, ev_retry, ev_type, ev_data, + ev_extra1, ev_extra2, ev_extra3, ev_extra4 + from pgq.retry_queue, pgq.queue + where ev_retry_after <= current_timestamp + and queue_id = ev_queue + order by ev_retry_after + limit 10 + loop + cnt := cnt + 1; + perform pgq.insert_event_raw(rec.queue_name, + rec.ev_id, rec.ev_time, rec.ev_owner, rec.ev_retry, + rec.ev_type, rec.ev_data, rec.ev_extra1, rec.ev_extra2, + rec.ev_extra3, rec.ev_extra4); + delete from pgq.retry_queue + where ev_owner = rec.ev_owner + and ev_id = rec.ev_id; + end loop; + return cnt; +end; +$$; + + +-- +-- Name: maint_rotate_tables_step1(text); Type: FUNCTION; Schema: pgq; Owner: - +-- + +CREATE FUNCTION maint_rotate_tables_step1(i_queue_name text) RETURNS integer + LANGUAGE plpgsql + AS $$ +-- ---------------------------------------------------------------------- +-- Function: pgq.maint_rotate_tables_step1(1) +-- +-- Rotate tables for one queue. +-- +-- Parameters: +-- i_queue_name - Name of the queue +-- +-- Returns: +-- 0 +-- ---------------------------------------------------------------------- +declare + badcnt integer; + cf record; + nr integer; + tbl text; + lowest_tick_id int8; + lowest_xmin int8; +begin + -- check if needed and load record + select * from pgq.queue into cf + where queue_name = i_queue_name + and queue_rotation_period is not null + and queue_switch_step2 is not null + and queue_switch_time + queue_rotation_period < current_timestamp + for update; + if not found then + return 0; + end if; + + -- find lowest tick for that queue + select min(sub_last_tick) into lowest_tick_id + from pgq.subscription + where sub_queue = cf.queue_id; + + -- if some consumer exists + if lowest_tick_id is not null then + -- is the slowest one still on previous table? + select txid_snapshot_xmin(tick_snapshot) into lowest_xmin + from pgq.tick + where tick_queue = cf.queue_id + and tick_id = lowest_tick_id; + if not found then + raise exception 'queue % maint failure: tick % not found', i_queue_name, lowest_tick_id; + end if; + if lowest_xmin <= cf.queue_switch_step2 then + return 0; -- skip rotation then + end if; + end if; + + -- nobody on previous table, we can rotate + + -- calc next table number and name + nr := cf.queue_cur_table + 1; + if nr = cf.queue_ntables then + nr := 0; + end if; + tbl := cf.queue_data_pfx || '_' || nr::text; + + -- there may be long lock on the table from pg_dump, + -- detect it and skip rotate then + begin + execute 'lock table ' || tbl || ' nowait'; + execute 'truncate ' || tbl; + exception + when lock_not_available then + -- cannot truncate, skipping rotate + return 0; + end; + + -- remember the moment + update pgq.queue + set queue_cur_table = nr, + queue_switch_time = current_timestamp, + queue_switch_step1 = txid_current(), + queue_switch_step2 = NULL + where queue_id = cf.queue_id; + + -- Clean ticks by using step2 txid from previous rotation. + -- That should keep all ticks for all batches that are completely + -- in old table. This keeps them for longer than needed, but: + -- 1. we want the pgq.tick table to be big, to avoid Postgres + -- accitentally switching to seqscans on that. + -- 2. that way we guarantee to consumers that they an be moved + -- back on the queue at least for one rotation_period. + -- (may help in disaster recovery) + delete from pgq.tick + where tick_queue = cf.queue_id + and txid_snapshot_xmin(tick_snapshot) < cf.queue_switch_step2; + + return 0; +end; +$$; + + +-- +-- Name: maint_rotate_tables_step2(); Type: FUNCTION; Schema: pgq; Owner: - +-- + +CREATE FUNCTION maint_rotate_tables_step2() RETURNS integer + LANGUAGE plpgsql + AS $$ +-- ---------------------------------------------------------------------- +-- Function: pgq.maint_rotate_tables_step2(0) +-- +-- Stores the txid when the rotation was visible. It should be +-- called in separate transaction than pgq.maint_rotate_tables_step1() +-- ---------------------------------------------------------------------- +begin + update pgq.queue + set queue_switch_step2 = txid_current() + where queue_switch_step2 is null; + return 0; +end; +$$; + + +-- +-- Name: maint_tables_to_vacuum(); Type: FUNCTION; Schema: pgq; Owner: - +-- + +CREATE FUNCTION maint_tables_to_vacuum() RETURNS SETOF text + LANGUAGE plpgsql + AS $$ +-- ---------------------------------------------------------------------- +-- Function: pgq.maint_tables_to_vacuum(0) +-- +-- Returns list of tablenames that need frequent vacuuming. +-- +-- The goal is to avoid hardcoding them into maintenance process. +-- +-- Returns: +-- List of table names. +-- ---------------------------------------------------------------------- +declare + scm text; + tbl text; + fqname text; +begin + -- assume autovacuum handles them fine + if current_setting('autovacuum') = 'on' then + return; + end if; + + for scm, tbl in values + ('pgq', 'subscription'), + ('pgq', 'consumer'), + ('pgq', 'queue'), + ('pgq', 'tick'), + ('pgq', 'retry_queue'), + ('pgq_ext', 'completed_tick'), + ('pgq_ext', 'completed_batch'), + ('pgq_ext', 'completed_event'), + ('pgq_ext', 'partial_batch'), + --('pgq_node', 'node_location'), + --('pgq_node', 'node_info'), + ('pgq_node', 'local_state'), + --('pgq_node', 'subscriber_info'), + --('londiste', 'table_info'), + ('londiste', 'seq_info'), + --('londiste', 'applied_execute'), + --('londiste', 'pending_fkeys'), + ('txid', 'epoch'), + ('londiste', 'completed') + loop + select n.nspname || '.' || t.relname into fqname + from pg_class t, pg_namespace n + where n.oid = t.relnamespace + and n.nspname = scm + and t.relname = tbl; + if found then + return next fqname; + end if; + end loop; + return; +end; +$$; + + +-- +-- Name: next_batch(text, text); Type: FUNCTION; Schema: pgq; Owner: - +-- + +CREATE FUNCTION next_batch(i_queue_name text, i_consumer_name text) RETURNS bigint + LANGUAGE plpgsql + AS $$ +-- ---------------------------------------------------------------------- +-- Function: pgq.next_batch(2) +-- +-- Old function that returns just batch_id. +-- +-- Parameters: +-- i_queue_name - Name of the queue +-- i_consumer_name - Name of the consumer +-- +-- Returns: +-- Batch ID or NULL if there are no more events available. +-- ---------------------------------------------------------------------- +declare + res int8; +begin + select batch_id into res + from pgq.next_batch_info(i_queue_name, i_consumer_name); + return res; +end; +$$; + + +-- +-- Name: next_batch_custom(text, text, interval, integer, interval); Type: FUNCTION; Schema: pgq; Owner: - +-- + +CREATE FUNCTION next_batch_custom(i_queue_name text, i_consumer_name text, i_min_lag interval, i_min_count integer, i_min_interval interval, OUT batch_id bigint, OUT cur_tick_id bigint, OUT prev_tick_id bigint, OUT cur_tick_time timestamp with time zone, OUT prev_tick_time timestamp with time zone, OUT cur_tick_event_seq bigint, OUT prev_tick_event_seq bigint) RETURNS record + LANGUAGE plpgsql SECURITY DEFINER + AS $$ +-- ---------------------------------------------------------------------- +-- Function: pgq.next_batch_custom(5) +-- +-- Makes next block of events active. Block size can be tuned +-- with i_min_count, i_min_interval parameters. Events age can +-- be tuned with i_min_lag. +-- +-- If it returns NULL, there is no events available in queue. +-- Consumer should sleep then. +-- +-- The values from event_id sequence may give hint how big the +-- batch may be. But they are inexact, they do not give exact size. +-- Client *MUST NOT* use them to detect whether the batch contains any +-- events at all - the values are unfit for that purpose. +-- +-- Note: +-- i_min_lag together with i_min_interval/i_min_count is inefficient. +-- +-- Parameters: +-- i_queue_name - Name of the queue +-- i_consumer_name - Name of the consumer +-- i_min_lag - Consumer wants events older than that +-- i_min_count - Consumer wants batch to contain at least this many events +-- i_min_interval - Consumer wants batch to cover at least this much time +-- +-- Returns: +-- batch_id - Batch ID or NULL if there are no more events available. +-- cur_tick_id - End tick id. +-- cur_tick_time - End tick time. +-- cur_tick_event_seq - Value from event id sequence at the time tick was issued. +-- prev_tick_id - Start tick id. +-- prev_tick_time - Start tick time. +-- prev_tick_event_seq - value from event id sequence at the time tick was issued. +-- Calls: +-- pgq.insert_event_raw(11) +-- Tables directly manipulated: +-- update - pgq.subscription +-- ---------------------------------------------------------------------- +declare + errmsg text; + queue_id integer; + sub_id integer; + cons_id integer; +begin + select s.sub_queue, s.sub_consumer, s.sub_id, s.sub_batch, + t1.tick_id, t1.tick_time, t1.tick_event_seq, + t2.tick_id, t2.tick_time, t2.tick_event_seq + into queue_id, cons_id, sub_id, batch_id, + prev_tick_id, prev_tick_time, prev_tick_event_seq, + cur_tick_id, cur_tick_time, cur_tick_event_seq + from pgq.consumer c, + pgq.queue q, + pgq.subscription s + left join pgq.tick t1 + on (t1.tick_queue = s.sub_queue + and t1.tick_id = s.sub_last_tick) + left join pgq.tick t2 + on (t2.tick_queue = s.sub_queue + and t2.tick_id = s.sub_next_tick) + where q.queue_name = i_queue_name + and c.co_name = i_consumer_name + and s.sub_queue = q.queue_id + and s.sub_consumer = c.co_id; + if not found then + errmsg := 'Not subscriber to queue: ' + || coalesce(i_queue_name, 'NULL') + || '/' + || coalesce(i_consumer_name, 'NULL'); + raise exception '%', errmsg; + end if; + + -- sanity check + if prev_tick_id is null then + raise exception 'PgQ corruption: Consumer % on queue % does not see tick %', i_consumer_name, i_queue_name, prev_tick_id; + end if; + + -- has already active batch + if batch_id is not null then + return; + end if; + + if i_min_interval is null and i_min_count is null then + -- find next tick + select tick_id, tick_time, tick_event_seq + into cur_tick_id, cur_tick_time, cur_tick_event_seq + from pgq.tick + where tick_id > prev_tick_id + and tick_queue = queue_id + order by tick_queue asc, tick_id asc + limit 1; + else + -- find custom tick + select next_tick_id, next_tick_time, next_tick_seq + into cur_tick_id, cur_tick_time, cur_tick_event_seq + from pgq.find_tick_helper(queue_id, prev_tick_id, + prev_tick_time, prev_tick_event_seq, + i_min_count, i_min_interval); + end if; + + if i_min_lag is not null then + -- enforce min lag + if now() - cur_tick_time < i_min_lag then + cur_tick_id := NULL; + cur_tick_time := NULL; + cur_tick_event_seq := NULL; + end if; + end if; + + if cur_tick_id is null then + -- nothing to do + prev_tick_id := null; + prev_tick_time := null; + prev_tick_event_seq := null; + return; + end if; + + -- get next batch + batch_id := nextval('pgq.batch_id_seq'); + update pgq.subscription + set sub_batch = batch_id, + sub_next_tick = cur_tick_id, + sub_active = now() + where sub_queue = queue_id + and sub_consumer = cons_id; + return; +end; +$$; + + +-- +-- Name: next_batch_info(text, text); Type: FUNCTION; Schema: pgq; Owner: - +-- + +CREATE FUNCTION next_batch_info(i_queue_name text, i_consumer_name text, OUT batch_id bigint, OUT cur_tick_id bigint, OUT prev_tick_id bigint, OUT cur_tick_time timestamp with time zone, OUT prev_tick_time timestamp with time zone, OUT cur_tick_event_seq bigint, OUT prev_tick_event_seq bigint) RETURNS record + LANGUAGE plpgsql + AS $$ +-- ---------------------------------------------------------------------- +-- Function: pgq.next_batch_info(2) +-- +-- Makes next block of events active. +-- +-- If it returns NULL, there is no events available in queue. +-- Consumer should sleep then. +-- +-- The values from event_id sequence may give hint how big the +-- batch may be. But they are inexact, they do not give exact size. +-- Client *MUST NOT* use them to detect whether the batch contains any +-- events at all - the values are unfit for that purpose. +-- +-- Parameters: +-- i_queue_name - Name of the queue +-- i_consumer_name - Name of the consumer +-- +-- Returns: +-- batch_id - Batch ID or NULL if there are no more events available. +-- cur_tick_id - End tick id. +-- cur_tick_time - End tick time. +-- cur_tick_event_seq - Value from event id sequence at the time tick was issued. +-- prev_tick_id - Start tick id. +-- prev_tick_time - Start tick time. +-- prev_tick_event_seq - value from event id sequence at the time tick was issued. +-- Calls: +-- pgq.next_batch_custom(5) +-- Tables directly manipulated: +-- None +-- ---------------------------------------------------------------------- +begin + select f.batch_id, f.cur_tick_id, f.prev_tick_id, + f.cur_tick_time, f.prev_tick_time, + f.cur_tick_event_seq, f.prev_tick_event_seq + into batch_id, cur_tick_id, prev_tick_id, cur_tick_time, prev_tick_time, + cur_tick_event_seq, prev_tick_event_seq + from pgq.next_batch_custom(i_queue_name, i_consumer_name, NULL, NULL, NULL) f; + return; +end; +$$; + + +-- +-- Name: register_consumer(text, text); Type: FUNCTION; Schema: pgq; Owner: - +-- + +CREATE FUNCTION register_consumer(x_queue_name text, x_consumer_id text) RETURNS integer + LANGUAGE plpgsql SECURITY DEFINER + AS $$ +-- ---------------------------------------------------------------------- +-- Function: pgq.register_consumer(2) +-- +-- Subscribe consumer on a queue. +-- +-- From this moment forward, consumer will see all events in the queue. +-- +-- Parameters: +-- x_queue_name - Name of queue +-- x_consumer_name - Name of consumer +-- +-- Returns: +-- 0 - if already registered +-- 1 - if new registration +-- Calls: +-- pgq.register_consumer_at(3) +-- Tables directly manipulated: +-- None +-- ---------------------------------------------------------------------- +begin + return pgq.register_consumer_at(x_queue_name, x_consumer_id, NULL); +end; +$$; + + +-- +-- Name: register_consumer_at(text, text, bigint); Type: FUNCTION; Schema: pgq; Owner: - +-- + +CREATE FUNCTION register_consumer_at(x_queue_name text, x_consumer_name text, x_tick_pos bigint) RETURNS integer + LANGUAGE plpgsql SECURITY DEFINER + AS $$ +-- ---------------------------------------------------------------------- +-- Function: pgq.register_consumer_at(3) +-- +-- Extended registration, allows to specify tick_id. +-- +-- Note: +-- For usage in special situations. +-- +-- Parameters: +-- x_queue_name - Name of a queue +-- x_consumer_name - Name of consumer +-- x_tick_pos - Tick ID +-- +-- Returns: +-- 0/1 whether consumer has already registered. +-- Calls: +-- None +-- Tables directly manipulated: +-- update/insert - pgq.subscription +-- ---------------------------------------------------------------------- +declare + tmp text; + last_tick bigint; + x_queue_id integer; + x_consumer_id integer; + queue integer; + sub record; +begin + select queue_id into x_queue_id from pgq.queue + where queue_name = x_queue_name; + if not found then + raise exception 'Event queue not created yet'; + end if; + + -- get consumer and create if new + select co_id into x_consumer_id from pgq.consumer + where co_name = x_consumer_name; + if not found then + insert into pgq.consumer (co_name) values (x_consumer_name); + x_consumer_id := currval('pgq.consumer_co_id_seq'); + end if; + + -- if particular tick was requested, check if it exists + if x_tick_pos is not null then + perform 1 from pgq.tick + where tick_queue = x_queue_id + and tick_id = x_tick_pos; + if not found then + raise exception 'cannot reposition, tick not found: %', x_tick_pos; + end if; + end if; + + -- check if already registered + select sub_last_tick, sub_batch into sub + from pgq.subscription + where sub_consumer = x_consumer_id + and sub_queue = x_queue_id; + if found then + if x_tick_pos is not null then + -- if requested, update tick pos and drop partial batch + update pgq.subscription + set sub_last_tick = x_tick_pos, + sub_batch = null, + sub_next_tick = null, + sub_active = now() + where sub_consumer = x_consumer_id + and sub_queue = x_queue_id; + end if; + -- already registered + return 0; + end if; + + -- new registration + if x_tick_pos is null then + -- start from current tick + select tick_id into last_tick from pgq.tick + where tick_queue = x_queue_id + order by tick_queue desc, tick_id desc + limit 1; + if not found then + raise exception 'No ticks for this queue. Please run ticker on database.'; + end if; + else + last_tick := x_tick_pos; + end if; + + -- register + insert into pgq.subscription (sub_queue, sub_consumer, sub_last_tick) + values (x_queue_id, x_consumer_id, last_tick); + return 1; +end; +$$; + + +-- +-- Name: seq_getval(text); Type: FUNCTION; Schema: pgq; Owner: - +-- + +CREATE FUNCTION seq_getval(i_seq_name text) RETURNS bigint + LANGUAGE plpgsql + AS $$ +-- ---------------------------------------------------------------------- +-- Function: pgq.seq_getval(1) +-- +-- Read current last_val from seq, without affecting it. +-- +-- Parameters: +-- i_seq_name - Name of the sequence +-- +-- Returns: +-- last value. +-- ---------------------------------------------------------------------- +declare + res int8; + fqname text; + pos integer; + s text; + n text; +begin + pos := position('.' in i_seq_name); + if pos > 0 then + s := substring(i_seq_name for pos - 1); + n := substring(i_seq_name from pos + 1); + else + s := 'public'; + n := i_seq_name; + end if; + fqname := quote_ident(s) || '.' || quote_ident(n); + + execute 'select last_value from ' || fqname into res; + return res; +end; +$$; + + +-- +-- Name: seq_setval(text, bigint); Type: FUNCTION; Schema: pgq; Owner: - +-- + +CREATE FUNCTION seq_setval(i_seq_name text, i_new_value bigint) RETURNS bigint + LANGUAGE plpgsql + AS $$ +-- ---------------------------------------------------------------------- +-- Function: pgq.seq_setval(2) +-- +-- Like setval() but does not allow going back. +-- +-- Parameters: +-- i_seq_name - Name of the sequence +-- i_new_value - new value +-- +-- Returns: +-- current last value. +-- ---------------------------------------------------------------------- +declare + res int8; + fqname text; + pos integer; + s text; + n text; +begin + pos := position('.' in i_seq_name); + if pos > 0 then + s := substring(i_seq_name for pos - 1); + n := substring(i_seq_name from pos + 1); + else + s := 'public'; + n := i_seq_name; + end if; + fqname := quote_ident(s) || '.' || quote_ident(n); + + res := pgq.seq_getval(i_seq_name); + if res < i_new_value then + perform setval(fqname, i_new_value); + return i_new_value; + end if; + return res; +end; +$$; + + +-- +-- Name: set_queue_config(text, text, text); Type: FUNCTION; Schema: pgq; Owner: - +-- + +CREATE FUNCTION set_queue_config(x_queue_name text, x_param_name text, x_param_value text) RETURNS integer + LANGUAGE plpgsql SECURITY DEFINER + AS $$ +-- ---------------------------------------------------------------------- +-- Function: pgq.set_queue_config(3) +-- +-- +-- Set configuration for specified queue. +-- +-- Parameters: +-- x_queue_name - Name of the queue to configure. +-- x_param_name - Configuration parameter name. +-- x_param_value - Configuration parameter value. +-- +-- Returns: +-- 0 if event was already in queue, 1 otherwise. +-- Calls: +-- None +-- Tables directly manipulated: +-- update - pgq.queue +-- ---------------------------------------------------------------------- +declare + v_param_name text; +begin + -- discard NULL input + if x_queue_name is null or x_param_name is null then + raise exception 'Invalid NULL value'; + end if; + + -- check if queue exists + perform 1 from pgq.queue where queue_name = x_queue_name; + if not found then + raise exception 'No such event queue'; + end if; + + -- check if valid parameter name + v_param_name := 'queue_' || x_param_name; + if v_param_name not in ( + 'queue_ticker_max_count', + 'queue_ticker_max_lag', + 'queue_ticker_idle_period', + 'queue_ticker_paused', + 'queue_rotation_period', + 'queue_external_ticker') + then + raise exception 'cannot change parameter "%s"', x_param_name; + end if; + + execute 'update pgq.queue set ' + || v_param_name || ' = ' || quote_literal(x_param_value) + || ' where queue_name = ' || quote_literal(x_queue_name); + + return 1; +end; +$$; + + +-- +-- Name: sqltriga(); Type: FUNCTION; Schema: pgq; Owner: - +-- + +CREATE FUNCTION sqltriga() RETURNS trigger + LANGUAGE c + AS '$libdir/pgq_triggers', 'pgq_sqltriga'; + + +-- +-- Name: ticker(); Type: FUNCTION; Schema: pgq; Owner: - +-- + +CREATE FUNCTION ticker() RETURNS bigint + LANGUAGE plpgsql SECURITY DEFINER + AS $$ +-- ---------------------------------------------------------------------- +-- Function: pgq.ticker(0) +-- +-- Creates ticks for all unpaused queues which dont have external ticker. +-- +-- Returns: +-- Number of queues that were processed. +-- ---------------------------------------------------------------------- +declare + res bigint; + q record; +begin + res := 0; + for q in + select queue_name from pgq.queue + where not queue_external_ticker + and not queue_ticker_paused + order by queue_name + loop + if pgq.ticker(q.queue_name) > 0 then + res := res + 1; + end if; + end loop; + return res; +end; +$$; + + +-- +-- Name: ticker(text); Type: FUNCTION; Schema: pgq; Owner: - +-- + +CREATE FUNCTION ticker(i_queue_name text) RETURNS bigint + LANGUAGE plpgsql SECURITY DEFINER + AS $$ +-- ---------------------------------------------------------------------- +-- Function: pgq.ticker(1) +-- +-- Check if tick is needed for the queue and insert it. +-- +-- For pgqadm usage. +-- +-- Parameters: +-- i_queue_name - Name of the queue +-- +-- Returns: +-- Tick id or NULL if no tick was done. +-- ---------------------------------------------------------------------- +declare + res bigint; + q record; + state record; + last2 record; +begin + select queue_id, queue_tick_seq, queue_external_ticker, + queue_ticker_max_count, queue_ticker_max_lag, + queue_ticker_idle_period, queue_event_seq, + pgq.seq_getval(queue_event_seq) as event_seq, + queue_ticker_paused + into q + from pgq.queue where queue_name = i_queue_name; + if not found then + raise exception 'no such queue'; + end if; + + if q.queue_external_ticker then + raise exception 'This queue has external tick source.'; + end if; + + if q.queue_ticker_paused then + raise exception 'Ticker has been paused for this queue'; + end if; + + -- load state from last tick + select now() - tick_time as lag, + q.event_seq - tick_event_seq as new_events, + tick_id, tick_time, tick_event_seq, + txid_snapshot_xmax(tick_snapshot) as sxmax, + txid_snapshot_xmin(tick_snapshot) as sxmin + into state + from pgq.tick + where tick_queue = q.queue_id + order by tick_queue desc, tick_id desc + limit 1; + + if found then + if state.sxmin > txid_current() then + raise exception 'Invalid PgQ state: old xmin=%, old xmax=%, cur txid=%', + state.sxmin, state.sxmax, txid_current(); + end if; + if state.new_events < 0 then + raise warning 'Negative new_events? old=% cur=%', state.tick_event_seq, q.event_seq; + end if; + if state.sxmax > txid_current() then + raise warning 'Dubious PgQ state: old xmax=%, cur txid=%', state.sxmax, txid_current(); + end if; + + if state.new_events > 0 then + -- there are new events, should we wait a bit? + if state.new_events < q.queue_ticker_max_count + and state.lag < q.queue_ticker_max_lag + then + return NULL; + end if; + else + -- no new events, should we apply idle period? + -- check previous event from the last one. + select state.tick_time - tick_time as lag + into last2 + from pgq.tick + where tick_queue = q.queue_id + and tick_id < state.tick_id + order by tick_queue desc, tick_id desc + limit 1; + if found then + -- gradually decrease the tick frequency + if (state.lag < q.queue_ticker_max_lag / 2) + or + (state.lag < last2.lag * 2 + and state.lag < q.queue_ticker_idle_period) + then + return NULL; + end if; + end if; + end if; + end if; + + insert into pgq.tick (tick_queue, tick_id, tick_event_seq) + values (q.queue_id, nextval(q.queue_tick_seq), q.event_seq); + + return currval(q.queue_tick_seq); +end; +$$; + + +-- +-- Name: ticker(text, bigint, timestamp with time zone, bigint); Type: FUNCTION; Schema: pgq; Owner: - +-- + +CREATE FUNCTION ticker(i_queue_name text, i_tick_id bigint, i_orig_timestamp timestamp with time zone, i_event_seq bigint) RETURNS bigint + LANGUAGE plpgsql SECURITY DEFINER + AS $$ +-- ---------------------------------------------------------------------- +-- Function: pgq.ticker(3) +-- +-- External ticker: Insert a tick with a particular tick_id and timestamp. +-- +-- Parameters: +-- i_queue_name - Name of the queue +-- i_tick_id - Id of new tick. +-- +-- Returns: +-- Tick id. +-- ---------------------------------------------------------------------- +begin + insert into pgq.tick (tick_queue, tick_id, tick_time, tick_event_seq) + select queue_id, i_tick_id, i_orig_timestamp, i_event_seq + from pgq.queue + where queue_name = i_queue_name + and queue_external_ticker + and not queue_ticker_paused; + if not found then + raise exception 'queue not found or ticker disabled: %', i_queue_name; + end if; + + -- make sure seqs stay current + perform pgq.seq_setval(queue_tick_seq, i_tick_id), + pgq.seq_setval(queue_event_seq, i_event_seq) + from pgq.queue + where queue_name = i_queue_name; + + return i_tick_id; +end; +$$; + + +-- +-- Name: tune_storage(text); Type: FUNCTION; Schema: pgq; Owner: - +-- + +CREATE FUNCTION tune_storage(i_queue_name text) RETURNS integer + LANGUAGE plpgsql STRICT + AS $$ +-- ---------------------------------------------------------------------- +-- Function: pgq.tune_storage(1) +-- +-- Tunes storage settings for queue data tables +-- ---------------------------------------------------------------------- +declare + tbl text; + tbloid oid; + q record; + i int4; + sql text; + pgver int4; +begin + pgver := current_setting('server_version_num'); + + select * into q + from pgq.queue where queue_name = i_queue_name; + if not found then + return 0; + end if; + + for i in 0 .. (q.queue_ntables - 1) loop + tbl := q.queue_data_pfx || '_' || i::text; + + -- set fillfactor + sql := 'alter table ' || tbl || ' set (fillfactor = 100'; + + -- autovacuum for 8.4+ + if pgver >= 80400 then + sql := sql || ', autovacuum_enabled=off, toast.autovacuum_enabled =off'; + end if; + sql := sql || ')'; + execute sql; + + -- autovacuum for 8.3 + if pgver < 80400 then + tbloid := tbl::regclass::oid; + delete from pg_catalog.pg_autovacuum where vacrelid = tbloid; + insert into pg_catalog.pg_autovacuum values (tbloid, false, -1,-1,-1,-1,-1,-1,-1,-1); + end if; + end loop; + + return 1; +end; +$$; + + +-- +-- Name: unregister_consumer(text, text); Type: FUNCTION; Schema: pgq; Owner: - +-- + +CREATE FUNCTION unregister_consumer(x_queue_name text, x_consumer_name text) RETURNS integer + LANGUAGE plpgsql SECURITY DEFINER + AS $$ +-- ---------------------------------------------------------------------- +-- Function: pgq.unregister_consumer(2) +-- +-- Unsubscriber consumer from the queue. Also consumer's +-- retry events are deleted. +-- +-- Parameters: +-- x_queue_name - Name of the queue +-- x_consumer_name - Name of the consumer +-- +-- Returns: +-- number of (sub)consumers unregistered +-- Calls: +-- None +-- Tables directly manipulated: +-- delete - pgq.retry_queue +-- delete - pgq.subscription +-- ---------------------------------------------------------------------- +declare + x_sub_id integer; + _sub_id_cnt integer; +begin + select s.sub_id into x_sub_id + from pgq.subscription s, pgq.consumer c, pgq.queue q + where s.sub_queue = q.queue_id + and s.sub_consumer = c.co_id + and q.queue_name = x_queue_name + and c.co_name = x_consumer_name + for update of s; + if not found then + return 0; + end if; + + -- consumer + subconsumer count + select count(*) into _sub_id_cnt + from pgq.subscription + where sub_id = x_sub_id; + + -- retry events + delete from pgq.retry_queue + where ev_owner = x_sub_id; + + -- this will drop subconsumers too + delete from pgq.subscription + where sub_id = x_sub_id; + + return _sub_id_cnt; +end; +$$; + + +-- +-- Name: upgrade_schema(); Type: FUNCTION; Schema: pgq; Owner: - +-- + +CREATE FUNCTION upgrade_schema() RETURNS integer + LANGUAGE plpgsql + AS $$ +-- updates table structure if necessary +declare + cnt int4 = 0; +begin + + -- pgq.subscription.sub_last_tick: NOT NULL -> NULL + perform 1 from information_schema.columns + where table_schema = 'pgq' + and table_name = 'subscription' + and column_name ='sub_last_tick' + and is_nullable = 'NO'; + if found then + alter table pgq.subscription + alter column sub_last_tick + drop not null; + cnt := cnt + 1; + end if; + + return cnt; +end; +$$; + + +-- +-- Name: version(); Type: FUNCTION; Schema: pgq; Owner: - +-- + +CREATE FUNCTION version() RETURNS text + LANGUAGE plpgsql + AS $$ +-- ---------------------------------------------------------------------- +-- Function: pgq.version(0) +-- +-- Returns verison string for pgq. ATM its SkyTools version +-- that is only bumped when PGQ database code changes. +-- ---------------------------------------------------------------------- +begin + return '3.0.0.13'; +end; +$$; + + +SET search_path = pgq_ext, pg_catalog; + +-- +-- Name: get_last_tick(text); Type: FUNCTION; Schema: pgq_ext; Owner: - +-- + +CREATE FUNCTION get_last_tick(a_consumer text) RETURNS bigint + LANGUAGE plpgsql + AS $$ +-- ---------------------------------------------------------------------- +-- Function: pgq_ext.get_last_tick(1) +-- +-- Gets last completed tick for this consumer +-- +-- Parameters: +-- a_consumer - consumer name +-- +-- Returns: +-- tick_id - last completed tick +-- Calls: +-- pgq_ext.get_last_tick(2) +-- Tables directly manipulated: +-- None +-- ---------------------------------------------------------------------- +begin + return pgq_ext.get_last_tick(a_consumer, ''); +end; +$$; + + +-- +-- Name: get_last_tick(text, text); Type: FUNCTION; Schema: pgq_ext; Owner: - +-- + +CREATE FUNCTION get_last_tick(a_consumer text, a_subconsumer text) RETURNS bigint + LANGUAGE plpgsql SECURITY DEFINER + AS $$ +-- ---------------------------------------------------------------------- +-- Function: pgq_ext.get_last_tick(2) +-- +-- Gets last completed tick for this consumer +-- +-- Parameters: +-- a_consumer - consumer name +-- a_subconsumer - subconsumer name +-- +-- Returns: +-- tick_id - last completed tick +-- Calls: +-- None +-- Tables directly manipulated: +-- None +-- ---------------------------------------------------------------------- +declare + res int8; +begin + select last_tick_id into res + from pgq_ext.completed_tick + where consumer_id = a_consumer + and subconsumer_id = a_subconsumer; + return res; +end; +$$; + + +-- +-- Name: is_batch_done(text, bigint); Type: FUNCTION; Schema: pgq_ext; Owner: - +-- + +CREATE FUNCTION is_batch_done(a_consumer text, a_batch_id bigint) RETURNS boolean + LANGUAGE plpgsql + AS $$ +-- ---------------------------------------------------------------------- +-- Function: pgq_ext.is_batch_done(2) +-- +-- Checks if a certain consumer has completed the batch +-- +-- Parameters: +-- a_consumer - consumer name +-- a_batch_id - a batch id +-- +-- Returns: +-- true if batch is done, else false +-- Calls: +-- pgq_ext.is_batch_done(3) +-- Tables directly manipulated: +-- None +-- ---------------------------------------------------------------------- +begin + return pgq_ext.is_batch_done(a_consumer, '', a_batch_id); +end; +$$; + + +-- +-- Name: is_batch_done(text, text, bigint); Type: FUNCTION; Schema: pgq_ext; Owner: - +-- + +CREATE FUNCTION is_batch_done(a_consumer text, a_subconsumer text, a_batch_id bigint) RETURNS boolean + LANGUAGE plpgsql SECURITY DEFINER + AS $$ +-- ---------------------------------------------------------------------- +-- Function: pgq_ext.is_batch_done(3) +-- +-- Checks if a certain consumer and subconsumer have completed the batch +-- +-- Parameters: +-- a_consumer - consumer name +-- a_subconsumer - subconsumer name +-- a_batch_id - a batch id +-- +-- Returns: +-- true if batch is done, else false +-- Calls: +-- None +-- Tables directly manipulated: +-- None +-- ---------------------------------------------------------------------- +declare + res boolean; +begin + select last_batch_id = a_batch_id + into res from pgq_ext.completed_batch + where consumer_id = a_consumer + and subconsumer_id = a_subconsumer; + if not found then + return false; + end if; + return res; +end; +$$; + + +-- +-- Name: is_event_done(text, bigint, bigint); Type: FUNCTION; Schema: pgq_ext; Owner: - +-- + +CREATE FUNCTION is_event_done(a_consumer text, a_batch_id bigint, a_event_id bigint) RETURNS boolean + LANGUAGE plpgsql + AS $$ +-- ---------------------------------------------------------------------- +-- Function: pgq_ext.is_event_done(3) +-- +-- Checks if a certain consumer has "done" and event +-- in a batch +-- +-- Parameters: +-- a_consumer - consumer name +-- a_batch_id - a batch id +-- a_event_id - an event id +-- +-- Returns: +-- true if event is done, else false +-- Calls: +-- Nonpgq_ext.is_event_done(4) +-- Tables directly manipulated: +-- None +-- ---------------------------------------------------------------------- +begin + return pgq_ext.is_event_done(a_consumer, '', a_batch_id, a_event_id); +end; +$$; + + +-- +-- Name: is_event_done(text, text, bigint, bigint); Type: FUNCTION; Schema: pgq_ext; Owner: - +-- + +CREATE FUNCTION is_event_done(a_consumer text, a_subconsumer text, a_batch_id bigint, a_event_id bigint) RETURNS boolean + LANGUAGE plpgsql SECURITY DEFINER + AS $$ +-- ---------------------------------------------------------------------- +-- Function: pgq_ext.is_event_done(4) +-- +-- Checks if a certain consumer and subconsumer have "done" and event +-- in a batch +-- +-- Parameters: +-- a_consumer - consumer name +-- a_subconsumer - subconsumer name +-- a_batch_id - a batch id +-- a_event_id - an event id +-- +-- Returns: +-- true if event is done, else false +-- Calls: +-- None +-- Tables directly manipulated: +-- None +-- ---------------------------------------------------------------------- +declare + res bigint; +begin + perform 1 from pgq_ext.completed_event + where consumer_id = a_consumer + and subconsumer_id = a_subconsumer + and batch_id = a_batch_id + and event_id = a_event_id; + return found; +end; +$$; + + +-- +-- Name: set_batch_done(text, bigint); Type: FUNCTION; Schema: pgq_ext; Owner: - +-- + +CREATE FUNCTION set_batch_done(a_consumer text, a_batch_id bigint) RETURNS boolean + LANGUAGE plpgsql + AS $$ +-- ---------------------------------------------------------------------- +-- Function: pgq_ext.set_batch_done(3) +-- +-- Marks a batch as "done" for certain consumer +-- +-- Parameters: +-- a_consumer - consumer name +-- a_batch_id - a batch id +-- +-- Returns: +-- false if it already was done +-- true for successfully marking it as done +-- Calls: +-- pgq_ext.set_batch_done(3) +-- Tables directly manipulated: +-- None +-- ---------------------------------------------------------------------- +begin + return pgq_ext.set_batch_done(a_consumer, '', a_batch_id); +end; +$$; + + +-- +-- Name: set_batch_done(text, text, bigint); Type: FUNCTION; Schema: pgq_ext; Owner: - +-- + +CREATE FUNCTION set_batch_done(a_consumer text, a_subconsumer text, a_batch_id bigint) RETURNS boolean + LANGUAGE plpgsql SECURITY DEFINER + AS $$ +-- ---------------------------------------------------------------------- +-- Function: pgq_ext.set_batch_done(3) +-- +-- Marks a batch as "done" for certain consumer and subconsumer +-- +-- Parameters: +-- a_consumer - consumer name +-- a_subconsumer - subconsumer name +-- a_batch_id - a batch id +-- +-- Returns: +-- false if it already was done +-- true for successfully marking it as done +-- Calls: +-- None +-- Tables directly manipulated: +-- update - pgq_ext.completed_batch +-- ---------------------------------------------------------------------- +begin + if pgq_ext.is_batch_done(a_consumer, a_subconsumer, a_batch_id) then + return false; + end if; + + if a_batch_id > 0 then + update pgq_ext.completed_batch + set last_batch_id = a_batch_id + where consumer_id = a_consumer + and subconsumer_id = a_subconsumer; + if not found then + insert into pgq_ext.completed_batch (consumer_id, subconsumer_id, last_batch_id) + values (a_consumer, a_subconsumer, a_batch_id); + end if; + end if; + + return true; +end; +$$; + + +-- +-- Name: set_event_done(text, bigint, bigint); Type: FUNCTION; Schema: pgq_ext; Owner: - +-- + +CREATE FUNCTION set_event_done(a_consumer text, a_batch_id bigint, a_event_id bigint) RETURNS boolean + LANGUAGE plpgsql + AS $$ +-- ---------------------------------------------------------------------- +-- Function: pgq_ext.set_event_done(3) +-- +-- Marks and event done in a batch for a certain consumer and subconsumer +-- +-- Parameters: +-- a_consumer - consumer name +-- a_batch_id - a batch id +-- a_event_id - an event id +-- +-- Returns: +-- false if already done +-- true on success +-- Calls: +-- pgq_ext.set_event_done(4) +-- Tables directly manipulated: +-- None +-- ---------------------------------------------------------------------- +begin + return pgq_ext.set_event_done(a_consumer, '', a_batch_id, a_event_id); +end; +$$; + + +-- +-- Name: set_event_done(text, text, bigint, bigint); Type: FUNCTION; Schema: pgq_ext; Owner: - +-- + +CREATE FUNCTION set_event_done(a_consumer text, a_subconsumer text, a_batch_id bigint, a_event_id bigint) RETURNS boolean + LANGUAGE plpgsql SECURITY DEFINER + AS $$ +-- ---------------------------------------------------------------------- +-- Function: pgq_ext.set_event_done(4) +-- +-- Marks and event done in a batch for a certain consumer and subconsumer +-- +-- Parameters: +-- a_consumer - consumer name +-- a_subconsumer - subconsumer name +-- a_batch_id - a batch id +-- a_event_id - an event id +-- +-- Returns: +-- false if already done +-- true on success +-- Calls: +-- None +-- Tables directly manipulated: +-- insert - pgq_ext.partial_batch +-- delete - pgq_ext.completed_event +-- update - pgq_ext.partial_batch +-- insert - pgq_ext.completed_event +-- ---------------------------------------------------------------------- +declare + old_batch bigint; +begin + -- check if done + perform 1 from pgq_ext.completed_event + where consumer_id = a_consumer + and subconsumer_id = a_subconsumer + and batch_id = a_batch_id + and event_id = a_event_id; + if found then + return false; + end if; + + -- if batch changed, do cleanup + select cur_batch_id into old_batch + from pgq_ext.partial_batch + where consumer_id = a_consumer + and subconsumer_id = a_subconsumer; + if not found then + -- first time here + insert into pgq_ext.partial_batch + (consumer_id, subconsumer_id, cur_batch_id) + values (a_consumer, a_subconsumer, a_batch_id); + elsif old_batch <> a_batch_id then + -- batch changed, that means old is finished on queue db + -- thus the tagged events are not needed anymore + delete from pgq_ext.completed_event + where consumer_id = a_consumer + and subconsumer_id = a_subconsumer + and batch_id = old_batch; + -- remember current one + update pgq_ext.partial_batch + set cur_batch_id = a_batch_id + where consumer_id = a_consumer + and subconsumer_id = a_subconsumer; + end if; + + -- tag as done + insert into pgq_ext.completed_event + (consumer_id, subconsumer_id, batch_id, event_id) + values (a_consumer, a_subconsumer, a_batch_id, a_event_id); + + return true; +end; +$$; + + +-- +-- Name: set_last_tick(text, bigint); Type: FUNCTION; Schema: pgq_ext; Owner: - +-- + +CREATE FUNCTION set_last_tick(a_consumer text, a_tick_id bigint) RETURNS integer + LANGUAGE plpgsql + AS $$ +-- ---------------------------------------------------------------------- +-- Function: pgq_ext.set_last_tick(2) +-- +-- records last completed tick for consumer, +-- removes row if a_tick_id is NULL +-- +-- Parameters: +-- a_consumer - consumer name +-- a_tick_id - a tick id +-- +-- Returns: +-- 1 +-- Calls: +-- pgq_ext.set_last_tick(2) +-- Tables directly manipulated: +-- None +-- ---------------------------------------------------------------------- +begin + return pgq_ext.set_last_tick(a_consumer, '', a_tick_id); +end; +$$; + + +-- +-- Name: set_last_tick(text, text, bigint); Type: FUNCTION; Schema: pgq_ext; Owner: - +-- + +CREATE FUNCTION set_last_tick(a_consumer text, a_subconsumer text, a_tick_id bigint) RETURNS integer + LANGUAGE plpgsql SECURITY DEFINER + AS $$ +-- ---------------------------------------------------------------------- +-- Function: pgq_ext.set_last_tick(3) +-- +-- records last completed tick for consumer, +-- removes row if a_tick_id is NULL +-- +-- Parameters: +-- a_consumer - consumer name +-- a_subconsumer - subconsumer name +-- a_tick_id - a tick id +-- +-- Returns: +-- 1 +-- Calls: +-- None +-- Tables directly manipulated: +-- delete - pgq_ext.completed_tick +-- update - pgq_ext.completed_tick +-- insert - pgq_ext.completed_tick +-- ---------------------------------------------------------------------- +begin + if a_tick_id is null then + delete from pgq_ext.completed_tick + where consumer_id = a_consumer + and subconsumer_id = a_subconsumer; + else + update pgq_ext.completed_tick + set last_tick_id = a_tick_id + where consumer_id = a_consumer + and subconsumer_id = a_subconsumer; + if not found then + insert into pgq_ext.completed_tick + (consumer_id, subconsumer_id, last_tick_id) + values (a_consumer, a_subconsumer, a_tick_id); + end if; + end if; + + return 1; +end; +$$; + + +-- +-- Name: upgrade_schema(); Type: FUNCTION; Schema: pgq_ext; Owner: - +-- + +CREATE FUNCTION upgrade_schema() RETURNS integer + LANGUAGE plpgsql + AS $$ +-- updates table structure if necessary +-- ---------------------------------------------------------------------- +-- Function: pgq_ext.upgrade_schema() +-- +-- Upgrades tables to have column subconsumer_id +-- +-- Parameters: +-- None +-- +-- Returns: +-- number of tables updated +-- Calls: +-- None +-- Tables directly manipulated: +-- alter - pgq_ext.completed_batch +-- alter - pgq_ext.completed_tick +-- alter - pgq_ext.partial_batch +-- alter - pgq_ext.completed_event +-- ---------------------------------------------------------------------- +declare + cnt int4 = 0; + tbl text; + sql text; +begin + -- pgq_ext.completed_batch: subconsumer_id + perform 1 from information_schema.columns + where table_schema = 'pgq_ext' + and table_name = 'completed_batch' + and column_name = 'subconsumer_id'; + if not found then + alter table pgq_ext.completed_batch + add column subconsumer_id text; + update pgq_ext.completed_batch + set subconsumer_id = ''; + alter table pgq_ext.completed_batch + alter column subconsumer_id set not null; + alter table pgq_ext.completed_batch + drop constraint completed_batch_pkey; + alter table pgq_ext.completed_batch + add constraint completed_batch_pkey + primary key (consumer_id, subconsumer_id); + cnt := cnt + 1; + end if; + + -- pgq_ext.completed_tick: subconsumer_id + perform 1 from information_schema.columns + where table_schema = 'pgq_ext' + and table_name = 'completed_tick' + and column_name = 'subconsumer_id'; + if not found then + alter table pgq_ext.completed_tick + add column subconsumer_id text; + update pgq_ext.completed_tick + set subconsumer_id = ''; + alter table pgq_ext.completed_tick + alter column subconsumer_id set not null; + alter table pgq_ext.completed_tick + drop constraint completed_tick_pkey; + alter table pgq_ext.completed_tick + add constraint completed_tick_pkey + primary key (consumer_id, subconsumer_id); + cnt := cnt + 1; + end if; + + -- pgq_ext.partial_batch: subconsumer_id + perform 1 from information_schema.columns + where table_schema = 'pgq_ext' + and table_name = 'partial_batch' + and column_name = 'subconsumer_id'; + if not found then + alter table pgq_ext.partial_batch + add column subconsumer_id text; + update pgq_ext.partial_batch + set subconsumer_id = ''; + alter table pgq_ext.partial_batch + alter column subconsumer_id set not null; + alter table pgq_ext.partial_batch + drop constraint partial_batch_pkey; + alter table pgq_ext.partial_batch + add constraint partial_batch_pkey + primary key (consumer_id, subconsumer_id); + cnt := cnt + 1; + end if; + + -- pgq_ext.completed_event: subconsumer_id + perform 1 from information_schema.columns + where table_schema = 'pgq_ext' + and table_name = 'completed_event' + and column_name = 'subconsumer_id'; + if not found then + alter table pgq_ext.completed_event + add column subconsumer_id text; + update pgq_ext.completed_event + set subconsumer_id = ''; + alter table pgq_ext.completed_event + alter column subconsumer_id set not null; + alter table pgq_ext.completed_event + drop constraint completed_event_pkey; + alter table pgq_ext.completed_event + add constraint completed_event_pkey + primary key (consumer_id, subconsumer_id, batch_id, event_id); + cnt := cnt + 1; + end if; + + -- add default value to subconsumer_id column + for tbl in + select table_name + from information_schema.columns + where table_schema = 'pgq_ext' + and table_name in ('completed_tick', 'completed_event', 'partial_batch', 'completed_batch') + and column_name = 'subconsumer_id' + and column_default is null + loop + sql := 'alter table pgq_ext.' || tbl + || ' alter column subconsumer_id set default ' || quote_literal(''); + execute sql; + cnt := cnt + 1; + end loop; + + return cnt; +end; +$$; + + +-- +-- Name: version(); Type: FUNCTION; Schema: pgq_ext; Owner: - +-- + +CREATE FUNCTION version() RETURNS text + LANGUAGE plpgsql + AS $$ +-- ---------------------------------------------------------------------- +-- Function: pgq_ext.version(0) +-- +-- Returns version string for pgq_ext. ATM its SkyTools version +-- with suffix that is only bumped when pgq_ext database code changes. +-- ---------------------------------------------------------------------- +begin + return '3.0.0.3'; +end; +$$; + + +SET search_path = pgq_node, pg_catalog; + +-- +-- Name: change_consumer_provider(text, text, text); Type: FUNCTION; Schema: pgq_node; Owner: - +-- + +CREATE FUNCTION change_consumer_provider(i_queue_name text, i_consumer_name text, i_new_provider text, OUT ret_code integer, OUT ret_note text) RETURNS record + LANGUAGE plpgsql SECURITY DEFINER + AS $$ +-- ---------------------------------------------------------------------- +-- Function: pgq_node.change_consumer_provider(3) +-- +-- Change provider for this consumer. +-- +-- Parameters: +-- i_queue_name - queue name +-- i_consumer_name - consumer name +-- i_new_provider - node name for new provider +-- Returns: +-- ret_code - error code +-- 200 - ok +-- 404 - no such consumer or new node +-- ret_note - description +-- ---------------------------------------------------------------------- +begin + perform 1 from pgq_node.node_location + where queue_name = i_queue_name + and node_name = i_new_provider; + if not found then + select 404, 'New node not found: ' || i_new_provider + into ret_code, ret_note; + return; + end if; + + update pgq_node.local_state + set provider_node = i_new_provider, + uptodate = false + where queue_name = i_queue_name + and consumer_name = i_consumer_name; + if not found then + select 404, 'Unknown consumer: ' || i_queue_name || '/' || i_consumer_name + into ret_code, ret_note; + return; + end if; + select 200, 'Consumer provider node set to : ' || i_new_provider + into ret_code, ret_note; + return; +end; +$$; + + +-- +-- Name: create_node(text, text, text, text, text, bigint, text); Type: FUNCTION; Schema: pgq_node; Owner: - +-- + +CREATE FUNCTION create_node(i_queue_name text, i_node_type text, i_node_name text, i_worker_name text, i_provider_name text, i_global_watermark bigint, i_combined_queue text, OUT ret_code integer, OUT ret_note text) RETURNS record + LANGUAGE plpgsql SECURITY DEFINER + AS $$ +-- ---------------------------------------------------------------------- +-- Function: pgq_node.create_node(7) +-- +-- Initialize node. +-- +-- Parameters: +-- i_node_name - cascaded queue name +-- i_node_type - node type +-- i_node_name - node name +-- i_worker_name - worker consumer name +-- i_provider_name - provider node name for non-root nodes +-- i_global_watermark - global lowest tick_id +-- i_combined_queue - merge-leaf: target queue +-- +-- Returns: +-- 200 - Ok +-- 401 - node already initialized +-- ???? - maybe we coud use more error codes ? +-- +-- Node Types: +-- root - master node +-- branch - subscriber node that can be provider to others +-- leaf - subscriber node that cannot be provider to others +-- Calls: +-- None +-- Tables directly manipulated: +-- None +-- ---------------------------------------------------------------------- +declare + _wm_consumer text; + _global_wm bigint; +begin + perform 1 from pgq_node.node_info where queue_name = i_queue_name; + if found then + select 401, 'Node already initialized' into ret_code, ret_note; + return; + end if; + + _wm_consumer := '.global_watermark'; + + if i_node_type = 'root' then + if coalesce(i_provider_name, i_global_watermark::text, + i_combined_queue) is not null then + select 401, 'unexpected args for '||i_node_type into ret_code, ret_note; + return; + end if; + + perform pgq.create_queue(i_queue_name); + perform pgq.register_consumer(i_queue_name, _wm_consumer); + _global_wm := (select last_tick from pgq.get_consumer_info(i_queue_name, _wm_consumer)); + elsif i_node_type = 'branch' then + if i_provider_name is null then + select 401, 'provider not set for '||i_node_type into ret_code, ret_note; + return; + end if; + if i_global_watermark is null then + select 401, 'global watermark not set for '||i_node_type into ret_code, ret_note; + return; + end if; + perform pgq.create_queue(i_queue_name); + update pgq.queue set queue_external_ticker = true where queue_name = i_queue_name; + if i_global_watermark > 1 then + perform pgq.ticker(i_queue_name, i_global_watermark, now(), 1); + end if; + perform pgq.register_consumer_at(i_queue_name, _wm_consumer, i_global_watermark); + _global_wm := i_global_watermark; + elsif i_node_type = 'leaf' then + _global_wm := i_global_watermark; + if i_combined_queue is not null then + perform 1 from pgq.get_queue_info(i_combined_queue); + if not found then + select 401, 'non-existing queue on leaf side: '||i_combined_queue + into ret_code, ret_note; + return; + end if; + end if; + else + select 401, 'bad node type: '||i_node_type + into ret_code, ret_note; + end if; + + insert into pgq_node.node_info + (queue_name, node_type, node_name, + worker_name, combined_queue) + values (i_queue_name, i_node_type, i_node_name, + i_worker_name, i_combined_queue); + + if i_node_type <> 'root' then + select f.ret_code, f.ret_note into ret_code, ret_note + from pgq_node.register_consumer(i_queue_name, i_worker_name, + i_provider_name, _global_wm) f; + else + select f.ret_code, f.ret_note into ret_code, ret_note + from pgq_node.register_consumer(i_queue_name, i_worker_name, + i_node_name, _global_wm) f; + end if; + if ret_code <> 200 then + return; + end if; + + select 200, 'Node "' || i_node_name || '" initialized for queue "' + || i_queue_name || '" with type "' || i_node_type || '"' + into ret_code, ret_note; + return; +end; +$$; + + +-- +-- Name: demote_root(text, integer, text); Type: FUNCTION; Schema: pgq_node; Owner: - +-- + +CREATE FUNCTION demote_root(i_queue_name text, i_step integer, i_new_provider text, OUT ret_code integer, OUT ret_note text, OUT last_tick bigint) RETURNS record + LANGUAGE plpgsql SECURITY DEFINER + AS $$ +-- ---------------------------------------------------------------------- +-- Function: pgq_node.demote_root(3) +-- +-- Multi-step root demotion to branch. +-- +-- Must be be called for each step in sequence: +-- +-- Step 1 - disable writing to queue. +-- Step 2 - wait until writers go away, do tick. +-- Step 3 - change type, register. +-- +-- Parameters: +-- i_queue_name - queue name +-- i_step - step number +-- i_new_provider - new provider node +-- Returns: +-- 200 - success +-- 404 - node not initialized for queue +-- 301 - node is not root +-- ---------------------------------------------------------------------- +declare + n_type text; + w_name text; + sql text; + ev_id int8; +begin + select node_type, worker_name into n_type, w_name + from pgq_node.node_info + where queue_name = i_queue_name; + if not found then + select 404, 'Node not initialized for queue: ' || i_queue_name + into ret_code, ret_note; + return; + end if; + + if n_type != 'root' then + select 301, 'Node not root' + into ret_code, ret_note; + return; + end if; + if i_step > 1 then + perform 1 from pgq.queue + where queue_name = i_queue_name + and queue_disable_insert + and queue_external_ticker; + if not found then + raise exception 'steps in wrong order'; + end if; + end if; + + if i_step = 1 then + update pgq.queue + set queue_disable_insert = true, + queue_external_ticker = true + where queue_name = i_queue_name; + if not found then + select 404, 'Huh, no queue?: ' || i_queue_name + into ret_code, ret_note; + return; + end if; + select 200, 'Step 1: Writing disabled for: ' || i_queue_name + into ret_code, ret_note; + elsif i_step = 2 then + set local session_replication_role = 'replica'; + sql := 'lock table ' || pgq.current_event_table(i_queue_name); + execute sql; + + + select nextval(queue_tick_seq), nextval(queue_event_seq) + into last_tick, ev_id + from pgq.queue + where queue_name = i_queue_name; + + perform pgq.ticker(i_queue_name, last_tick, now(), ev_id); + + select 200, 'Step 2: Inserted last tick: ' || i_queue_name + into ret_code, ret_note; + elsif i_step = 3 then + -- change type, point worker to new provider + select t.tick_id into last_tick + from pgq.tick t, pgq.queue q + where q.queue_name = i_queue_name + and t.tick_queue = q.queue_id + order by t.tick_queue desc, t.tick_id desc + limit 1; + update pgq_node.node_info + set node_type = 'branch' + where queue_name = i_queue_name; + update pgq_node.local_state + set provider_node = i_new_provider, + last_tick_id = last_tick, + uptodate = false + where queue_name = i_queue_name + and consumer_name = w_name; + select 200, 'Step 3: Demoted root to branch: ' || i_queue_name + into ret_code, ret_note; + else + raise exception 'incorrect step number'; + end if; + return; +end; +$$; + + +-- +-- Name: drop_node(text, text); Type: FUNCTION; Schema: pgq_node; Owner: - +-- + +CREATE FUNCTION drop_node(i_queue_name text, i_node_name text, OUT ret_code integer, OUT ret_note text) RETURNS record + LANGUAGE plpgsql SECURITY DEFINER + AS $$ +-- ---------------------------------------------------------------------- +-- Function: pgq_node.drop_node(2) +-- +-- Drop node. This needs to be run on all the members of a set +-- to properly get rid of the node. +-- +-- Parameters: +-- i_queue_name - queue name +-- i_node_name - node_name +-- +-- Returns: +-- ret_code - error code +-- ret_note - error description +-- +-- Return Codes: +-- 200 - Ok +-- 304 - No such queue +-- 406 - That is a provider +-- Calls: +-- None +-- Tables directly manipulated: +-- None +------------------------------------------------------------------------ +declare + _is_local boolean; + _is_prov boolean; +begin + select (n.node_name = i_node_name), + (select s.provider_node = i_node_name + from pgq_node.local_state s + where s.queue_name = i_queue_name + and s.consumer_name = n.worker_name) + into _is_local, _is_prov + from pgq_node.node_info n + where n.queue_name = i_queue_name; + + if not found then + select 304, 'No such queue: ' || i_queue_name into ret_code, ret_note; + return; + end if; + + -- drop local state + if _is_local then + delete from pgq_node.subscriber_info + where queue_name = i_queue_name; + + delete from pgq_node.local_state + where queue_name = i_queue_name; + + delete from pgq_node.node_info + where queue_name = i_queue_name + and node_name = i_node_name; + + perform pgq.drop_queue(queue_name, true) + from pgq.queue where queue_name = i_queue_name; + + delete from pgq_node.node_location + where queue_name = i_queue_name + and node_name <> i_node_name; + elsif _is_prov then + select 405, 'Cannot drop provider node: ' || i_node_name into ret_code, ret_note; + return; + else + perform pgq_node.unregister_subscriber(i_queue_name, i_node_name); + end if; + + -- let the unregister_location send event if needed + select f.ret_code, f.ret_note + from pgq_node.unregister_location(i_queue_name, i_node_name) f + into ret_code, ret_note; + + select 200, 'Node dropped' into ret_code, ret_note; + return; +end; +$$; + + +-- +-- Name: get_consumer_info(text); Type: FUNCTION; Schema: pgq_node; Owner: - +-- + +CREATE FUNCTION get_consumer_info(i_queue_name text, OUT consumer_name text, OUT provider_node text, OUT last_tick_id bigint, OUT paused boolean, OUT uptodate boolean, OUT cur_error text) RETURNS SETOF record + LANGUAGE plpgsql SECURITY DEFINER + AS $$ +-- ---------------------------------------------------------------------- +-- Function: pgq_node.get_consumer_info(1) +-- +-- Get consumer list that work on the local node. +-- +-- Parameters: +-- i_queue_name - cascaded queue name +-- +-- Returns: +-- consumer_name - cascaded consumer name +-- provider_node - node from where the consumer reads from +-- last_tick_id - last committed tick +-- paused - if consumer is paused +-- uptodate - if consumer is uptodate +-- cur_error - failure reason +-- ---------------------------------------------------------------------- +begin + for consumer_name, provider_node, last_tick_id, paused, uptodate, cur_error in + select s.consumer_name, s.provider_node, s.last_tick_id, + s.paused, s.uptodate, s.cur_error + from pgq_node.local_state s + where s.queue_name = i_queue_name + order by 1 + loop + return next; + end loop; + return; +end; +$$; + + +-- +-- Name: get_consumer_state(text, text); Type: FUNCTION; Schema: pgq_node; Owner: - +-- + +CREATE FUNCTION get_consumer_state(i_queue_name text, i_consumer_name text, OUT ret_code integer, OUT ret_note text, OUT node_type text, OUT node_name text, OUT completed_tick bigint, OUT provider_node text, OUT provider_location text, OUT paused boolean, OUT uptodate boolean, OUT cur_error text) RETURNS record + LANGUAGE plpgsql SECURITY DEFINER + AS $$ +-- ---------------------------------------------------------------------- +-- Function: pgq_node.get_consumer_state(2) +-- +-- Get info for cascaded consumer that targets local node. +-- +-- Parameters: +-- i_node_name - cascaded queue name +-- i_consumer_name - cascaded consumer name +-- +-- Returns: +-- node_type - local node type +-- node_name - local node name +-- completed_tick - last committed tick +-- provider_node - provider node name +-- provider_location - connect string to provider node +-- paused - this node should not do any work +-- uptodate - if consumer has loaded last changes +-- cur_error - failure reason +-- ---------------------------------------------------------------------- +begin + select n.node_type, n.node_name + into node_type, node_name + from pgq_node.node_info n + where n.queue_name = i_queue_name; + if not found then + select 404, 'Unknown queue: ' || i_queue_name + into ret_code, ret_note; + return; + end if; + select s.last_tick_id, s.provider_node, s.paused, s.uptodate, s.cur_error + into completed_tick, provider_node, paused, uptodate, cur_error + from pgq_node.local_state s + where s.queue_name = i_queue_name + and s.consumer_name = i_consumer_name; + if not found then + select 404, 'Unknown consumer: ' || i_queue_name || '/' || i_consumer_name + into ret_code, ret_note; + return; + end if; + select 100, 'Ok', p.node_location + into ret_code, ret_note, provider_location + from pgq_node.node_location p + where p.queue_name = i_queue_name + and p.node_name = provider_node; + if not found then + select 404, 'Unknown provider node: ' || i_queue_name || '/' || provider_node + into ret_code, ret_note; + return; + end if; + return; +end; +$$; + + +-- +-- Name: get_node_info(text); Type: FUNCTION; Schema: pgq_node; Owner: - +-- + +CREATE FUNCTION get_node_info(i_queue_name text, OUT ret_code integer, OUT ret_note text, OUT node_type text, OUT node_name text, OUT global_watermark bigint, OUT local_watermark bigint, OUT provider_node text, OUT provider_location text, OUT combined_queue text, OUT combined_type text, OUT worker_name text, OUT worker_paused boolean, OUT worker_uptodate boolean, OUT worker_last_tick bigint, OUT node_attrs text) RETURNS record + LANGUAGE plpgsql SECURITY DEFINER + AS $$ +-- ---------------------------------------------------------------------- +-- Function: pgq_node.get_node_info(1) +-- +-- Get local node info for cascaded queue. +-- +-- Parameters: +-- i_queue_name - cascaded queue name +-- +-- Returns: +-- node_type - local node type +-- node_name - local node name +-- global_watermark - queue's global watermark +-- local_watermark - queue's local watermark, for this and below nodes +-- provider_node - provider node name +-- provider_location - provider connect string +-- combined_queue - queue name for target set +-- combined_type - node type of target setA +-- worker_name - consumer name that maintains this node +-- worker_paused - is worker paused +-- worker_uptodate - is worker seen the changes +-- worker_last_tick - last committed tick_id by worker +-- ---------------------------------------------------------------------- +declare + sql text; +begin + select 100, 'Ok', n.node_type, n.node_name, + c.node_type, c.queue_name, w.provider_node, l.node_location, + n.worker_name, w.paused, w.uptodate, w.last_tick_id, + n.node_attrs + into ret_code, ret_note, node_type, node_name, + combined_type, combined_queue, provider_node, provider_location, + worker_name, worker_paused, worker_uptodate, worker_last_tick, + node_attrs + from pgq_node.node_info n + left join pgq_node.node_info c on (c.queue_name = n.combined_queue) + left join pgq_node.local_state w on (w.queue_name = n.queue_name and w.consumer_name = n.worker_name) + left join pgq_node.node_location l on (l.queue_name = w.queue_name and l.node_name = w.provider_node) + where n.queue_name = i_queue_name; + if not found then + select 404, 'Unknown queue: ' || i_queue_name into ret_code, ret_note; + return; + end if; + + if node_type in ('root', 'branch') then + select min(case when consumer_name = '.global_watermark' then null else last_tick end), + min(case when consumer_name = '.global_watermark' then last_tick else null end) + into local_watermark, global_watermark + from pgq.get_consumer_info(i_queue_name); + if local_watermark is null then + select t.tick_id into local_watermark + from pgq.tick t, pgq.queue q + where t.tick_queue = q.queue_id + and q.queue_name = i_queue_name + order by 1 desc + limit 1; + end if; + else + local_watermark := worker_last_tick; + end if; + + if node_type = 'root' then + select tick_id from pgq.tick t, pgq.queue q + where q.queue_name = i_queue_name + and t.tick_queue = q.queue_id + order by t.tick_queue desc, t.tick_id desc + limit 1 + into worker_last_tick; + end if; + + return; +end; +$$; + + +-- +-- Name: get_queue_locations(text); Type: FUNCTION; Schema: pgq_node; Owner: - +-- + +CREATE FUNCTION get_queue_locations(i_queue_name text, OUT node_name text, OUT node_location text, OUT dead boolean) RETURNS SETOF record + LANGUAGE plpgsql SECURITY DEFINER + AS $$ +-- ---------------------------------------------------------------------- +-- Function: pgq_node.get_queue_locations(1) +-- +-- Get node list for the queue. +-- +-- Parameters: +-- i_queue_name - queue name +-- +-- Returns: +-- node_name - node name +-- node_location - libpq connect string for the node +-- dead - whether the node should be considered dead +-- ---------------------------------------------------------------------- +begin + for node_name, node_location, dead in + select l.node_name, l.node_location, l.dead + from pgq_node.node_location l + where l.queue_name = i_queue_name + loop + return next; + end loop; + return; +end; +$$; + + +-- +-- Name: get_subscriber_info(text); Type: FUNCTION; Schema: pgq_node; Owner: - +-- + +CREATE FUNCTION get_subscriber_info(i_queue_name text, OUT node_name text, OUT worker_name text, OUT node_watermark bigint) RETURNS SETOF record + LANGUAGE plpgsql SECURITY DEFINER + AS $$ +-- ---------------------------------------------------------------------- +-- Function: pgq_node.get_subscriber_info(1) +-- +-- Get subscriber list for the local node. +-- +-- It may be out-of-date, due to in-progress +-- administrative change. +-- Node's local provider info ( pgq_node.get_node_info() or pgq_node.get_worker_state(1) ) +-- is the authoritative source. +-- +-- Parameters: +-- i_queue_name - cascaded queue name +-- +-- Returns: +-- node_name - node name that uses current node as provider +-- worker_name - consumer that maintains remote node +-- local_watermark - lowest tick_id on subscriber +-- ---------------------------------------------------------------------- +declare + _watermark_name text; +begin + for node_name, worker_name, _watermark_name in + select s.subscriber_node, s.worker_name, s.watermark_name + from pgq_node.subscriber_info s + where s.queue_name = i_queue_name + order by 1 + loop + select last_tick into node_watermark + from pgq.get_consumer_info(i_queue_name, _watermark_name); + return next; + end loop; + return; +end; +$$; + + +-- +-- Name: get_worker_state(text); Type: FUNCTION; Schema: pgq_node; Owner: - +-- + +CREATE FUNCTION get_worker_state(i_queue_name text, OUT ret_code integer, OUT ret_note text, OUT node_type text, OUT node_name text, OUT completed_tick bigint, OUT provider_node text, OUT provider_location text, OUT paused boolean, OUT uptodate boolean, OUT cur_error text, OUT worker_name text, OUT global_watermark bigint, OUT local_watermark bigint, OUT local_queue_top bigint, OUT combined_queue text, OUT combined_type text) RETURNS record + LANGUAGE plpgsql SECURITY DEFINER + AS $$ +-- ---------------------------------------------------------------------- +-- Function: pgq_node.get_worker_state(1) +-- +-- Get info for consumer that maintains local node. +-- +-- Parameters: +-- i_queue_name - cascaded queue name +-- +-- Returns: +-- node_type - local node type +-- node_name - local node name +-- completed_tick - last committed tick +-- provider_node - provider node name +-- provider_location - connect string to provider node +-- paused - this node should not do any work +-- uptodate - if consumer has loaded last changes +-- cur_error - failure reason + +-- worker_name - consumer name that maintains this node +-- global_watermark - queue's global watermark +-- local_watermark - queue's local watermark, for this and below nodes +-- local_queue_top - last tick in local queue +-- combined_queue - queue name for target set +-- combined_type - node type of target setA +-- ---------------------------------------------------------------------- +begin + select n.node_type, n.node_name, n.worker_name, n.combined_queue + into node_type, node_name, worker_name, combined_queue + from pgq_node.node_info n + where n.queue_name = i_queue_name; + if not found then + select 404, 'Unknown queue: ' || i_queue_name + into ret_code, ret_note; + return; + end if; + select s.last_tick_id, s.provider_node, s.paused, s.uptodate, s.cur_error + into completed_tick, provider_node, paused, uptodate, cur_error + from pgq_node.local_state s + where s.queue_name = i_queue_name + and s.consumer_name = worker_name; + if not found then + select 404, 'Unknown consumer: ' || i_queue_name || '/' || worker_name + into ret_code, ret_note; + return; + end if; + select 100, 'Ok', p.node_location + into ret_code, ret_note, provider_location + from pgq_node.node_location p + where p.queue_name = i_queue_name + and p.node_name = provider_node; + if not found then + select 404, 'Unknown provider node: ' || i_queue_name || '/' || provider_node + into ret_code, ret_note; + return; + end if; + + if combined_queue is not null then + select n.node_type into combined_type + from pgq_node.node_info n + where n.queue_name = get_worker_state.combined_queue; + if not found then + select 404, 'Combinde queue node not found: ' || combined_queue + into ret_code, ret_note; + return; + end if; + end if; + + if node_type in ('root', 'branch') then + select min(case when consumer_name = '.global_watermark' then null else last_tick end), + min(case when consumer_name = '.global_watermark' then last_tick else null end) + into local_watermark, global_watermark + from pgq.get_consumer_info(i_queue_name); + if local_watermark is null then + select t.tick_id into local_watermark + from pgq.tick t, pgq.queue q + where t.tick_queue = q.queue_id + and q.queue_name = i_queue_name + order by 1 desc + limit 1; + end if; + + select tick_id from pgq.tick t, pgq.queue q + where q.queue_name = i_queue_name + and t.tick_queue = q.queue_id + order by t.tick_queue desc, t.tick_id desc + limit 1 into local_queue_top; + else + local_watermark := completed_tick; + end if; + + return; +end; +$$; + + +-- +-- Name: is_leaf_node(text); Type: FUNCTION; Schema: pgq_node; Owner: - +-- + +CREATE FUNCTION is_leaf_node(i_queue_name text) RETURNS boolean + LANGUAGE plpgsql + AS $$ +-- ---------------------------------------------------------------------- +-- Function: pgq_node.is_leaf_node(1) +-- +-- Checs if node is leaf. +-- +-- Parameters: +-- i_queue_name - queue name +-- Returns: +-- true - if this this the leaf node for queue +-- ---------------------------------------------------------------------- +declare + res bool; +begin + select n.node_type = 'leaf' into res + from pgq_node.node_info n + where n.queue_name = i_queue_name; + if not found then + raise exception 'queue does not exist: %', i_queue_name; + end if; + return res; +end; +$$; + + +-- +-- Name: is_root_node(text); Type: FUNCTION; Schema: pgq_node; Owner: - +-- + +CREATE FUNCTION is_root_node(i_queue_name text) RETURNS boolean + LANGUAGE plpgsql + AS $$ +-- ---------------------------------------------------------------------- +-- Function: pgq_node.is_root_node(1) +-- +-- Checs if node is root. +-- +-- Parameters: +-- i_queue_name - queue name +-- Returns: +-- true - if this this the root node for queue +-- ---------------------------------------------------------------------- +declare + res bool; +begin + select n.node_type = 'root' into res + from pgq_node.node_info n + where n.queue_name = i_queue_name; + if not found then + raise exception 'queue does not exist: %', i_queue_name; + end if; + return res; +end; +$$; + + +-- +-- Name: maint_watermark(text); Type: FUNCTION; Schema: pgq_node; Owner: - +-- + +CREATE FUNCTION maint_watermark(i_queue_name text) RETURNS integer + LANGUAGE plpgsql + AS $$ +-- ---------------------------------------------------------------------- +-- Function: pgq_node.maint_watermark(1) +-- +-- Move global watermark on root node. +-- +-- Returns: +-- 0 - tells pgqd to call just once +-- ---------------------------------------------------------------------- +declare + _lag interval; +begin + perform 1 from pgq_node.node_info + where queue_name = i_queue_name + and node_type = 'root' + for update; + if not found then + return 0; + end if; + + select lag into _lag from pgq.get_consumer_info(i_queue_name, '.global_watermark'); + if _lag >= '5 minutes'::interval then + perform pgq_node.set_global_watermark(i_queue_name, NULL); + end if; + + return 0; +end; +$$; + + +-- +-- Name: promote_branch(text); Type: FUNCTION; Schema: pgq_node; Owner: - +-- + +CREATE FUNCTION promote_branch(i_queue_name text, OUT ret_code integer, OUT ret_note text) RETURNS record + LANGUAGE plpgsql SECURITY DEFINER + AS $$ +-- ---------------------------------------------------------------------- +-- Function: pgq_node.promote_branch(1) +-- +-- Promote branch node to root. +-- +-- Parameters: +-- i_queue_name - queue name +-- +-- Returns: +-- 200 - success +-- 404 - node not initialized for queue +-- 301 - node is not branch +-- ---------------------------------------------------------------------- +declare + n_name text; + n_type text; + w_name text; + last_tick bigint; + sql text; +begin + select node_name, node_type, worker_name into n_name, n_type, w_name + from pgq_node.node_info + where queue_name = i_queue_name; + if not found then + select 404, 'Node not initialized for queue: ' || i_queue_name + into ret_code, ret_note; + return; + end if; + + if n_type != 'branch' then + select 301, 'Node not branch' + into ret_code, ret_note; + return; + end if; + + update pgq.queue + set queue_disable_insert = false, + queue_external_ticker = false + where queue_name = i_queue_name; + + -- change type, point worker to itself + select t.tick_id into last_tick + from pgq.tick t, pgq.queue q + where q.queue_name = i_queue_name + and t.tick_queue = q.queue_id + order by t.tick_queue desc, t.tick_id desc + limit 1; + + -- make tick seq larger than last tick + perform pgq.seq_setval(queue_tick_seq, last_tick) + from pgq.queue where queue_name = i_queue_name; + + update pgq_node.node_info + set node_type = 'root' + where queue_name = i_queue_name; + + update pgq_node.local_state + set provider_node = n_name, + last_tick_id = last_tick, + uptodate = false + where queue_name = i_queue_name + and consumer_name = w_name; + + select 200, 'Branch node promoted to root' + into ret_code, ret_note; + + return; +end; +$$; + + +-- +-- Name: register_consumer(text, text, text, bigint); Type: FUNCTION; Schema: pgq_node; Owner: - +-- + +CREATE FUNCTION register_consumer(i_queue_name text, i_consumer_name text, i_provider_node text, i_custom_tick_id bigint, OUT ret_code integer, OUT ret_note text) RETURNS record + LANGUAGE plpgsql SECURITY DEFINER + AS $$ +-- ---------------------------------------------------------------------- +-- Function: pgq_node.register_consumer(4) +-- +-- Subscribe plain cascaded consumer to a target node. +-- That means it's planning to read from remote node +-- and write to local node. +-- +-- Parameters: +-- i_queue_name - set name +-- i_consumer_name - cascaded consumer name +-- i_provider_node - node name +-- i_custom_tick_id - tick id +-- +-- Returns: +-- ret_code - error code +-- 200 - ok +-- 201 - already registered +-- 401 - no such queue +-- ret_note - description +-- ---------------------------------------------------------------------- +declare + n record; + node_wm_name text; + node_pos bigint; +begin + select node_type into n + from pgq_node.node_info where queue_name = i_queue_name + for update; + if not found then + select 404, 'Unknown queue: ' || i_queue_name into ret_code, ret_note; + return; + end if; + perform 1 from pgq_node.local_state + where queue_name = i_queue_name + and consumer_name = i_consumer_name; + if found then + update pgq_node.local_state + set provider_node = i_provider_node, + last_tick_id = i_custom_tick_id + where queue_name = i_queue_name + and consumer_name = i_consumer_name; + select 201, 'Consumer already registered: ' || i_queue_name + || '/' || i_consumer_name into ret_code, ret_note; + return; + end if; + + insert into pgq_node.local_state (queue_name, consumer_name, provider_node, last_tick_id) + values (i_queue_name, i_consumer_name, i_provider_node, i_custom_tick_id); + + select 200, 'Consumer '||i_consumer_name||' registered on queue '||i_queue_name + into ret_code, ret_note; + return; +end; +$$; + + +-- +-- Name: register_location(text, text, text, boolean); Type: FUNCTION; Schema: pgq_node; Owner: - +-- + +CREATE FUNCTION register_location(i_queue_name text, i_node_name text, i_node_location text, i_dead boolean, OUT ret_code integer, OUT ret_note text) RETURNS record + LANGUAGE plpgsql SECURITY DEFINER + AS $$ +-- ---------------------------------------------------------------------- +-- Function: pgq_node.register_location(4) +-- +-- Add new node location. +-- +-- Parameters: +-- i_queue_name - queue name +-- i_node_name - node name +-- i_node_location - node connect string +-- i_dead - dead flag for node +-- +-- Returns: +-- ret_code - error code +-- ret_note - error description +-- +-- Return Codes: +-- 200 - Ok +-- ---------------------------------------------------------------------- +declare + node record; +begin + select node_type = 'root' as is_root into node + from pgq_node.node_info where queue_name = i_queue_name + for update; + -- may return 0 rows + + perform 1 from pgq_node.node_location + where queue_name = i_queue_name + and node_name = i_node_name; + if found then + update pgq_node.node_location + set node_location = coalesce(i_node_location, node_location), + dead = i_dead + where queue_name = i_queue_name + and node_name = i_node_name; + elsif i_node_location is not null then + insert into pgq_node.node_location (queue_name, node_name, node_location, dead) + values (i_queue_name, i_node_name, i_node_location, i_dead); + end if; + + if node.is_root then + perform pgq.insert_event(i_queue_name, 'pgq.location-info', + i_node_name, i_queue_name, i_node_location, i_dead::text, null) + from pgq_node.node_info n + where n.queue_name = i_queue_name; + end if; + + select 200, 'Location registered' into ret_code, ret_note; + return; +end; +$$; + + +-- +-- Name: register_subscriber(text, text, text, bigint); Type: FUNCTION; Schema: pgq_node; Owner: - +-- + +CREATE FUNCTION register_subscriber(i_queue_name text, i_remote_node_name text, i_remote_worker_name text, i_custom_tick_id bigint, OUT ret_code integer, OUT ret_note text, OUT global_watermark bigint) RETURNS record + LANGUAGE plpgsql SECURITY DEFINER + AS $$ +-- ---------------------------------------------------------------------- +-- Function: pgq_node.register_subscriber(4) +-- +-- Subscribe remote node to local node at custom position. +-- Should be used when changing provider for existing node. +-- +-- Parameters: +-- i_node_name - set name +-- i_remote_node_name - node name +-- i_remote_worker_name - consumer name +-- i_custom_tick_id - tick id [optional] +-- +-- Returns: +-- ret_code - error code +-- ret_note - description +-- global_watermark - minimal watermark +-- ---------------------------------------------------------------------- +declare + n record; + node_wm_name text; + node_pos bigint; +begin + select node_type into n + from pgq_node.node_info where queue_name = i_queue_name + for update; + if not found then + select 404, 'Unknown queue: ' || i_queue_name into ret_code, ret_note; + return; + end if; + select last_tick into global_watermark + from pgq.get_consumer_info(i_queue_name, '.global_watermark'); + + if n.node_type not in ('root', 'branch') then + select 401, 'Cannot subscribe to ' || n.node_type || ' node' + into ret_code, ret_note; + return; + end if; + + node_wm_name := '.' || i_remote_node_name || '.watermark'; + node_pos := coalesce(i_custom_tick_id, global_watermark); + + perform pgq.register_consumer_at(i_queue_name, node_wm_name, global_watermark); + + perform pgq.register_consumer_at(i_queue_name, i_remote_worker_name, node_pos); + + insert into pgq_node.subscriber_info (queue_name, subscriber_node, worker_name, watermark_name) + values (i_queue_name, i_remote_node_name, i_remote_worker_name, node_wm_name); + + select 200, 'Subscriber registered: '||i_remote_node_name into ret_code, ret_note; + return; +end; +$$; + + +-- +-- Name: set_consumer_completed(text, text, bigint); Type: FUNCTION; Schema: pgq_node; Owner: - +-- + +CREATE FUNCTION set_consumer_completed(i_queue_name text, i_consumer_name text, i_tick_id bigint, OUT ret_code integer, OUT ret_note text) RETURNS record + LANGUAGE plpgsql SECURITY DEFINER + AS $$ +-- ---------------------------------------------------------------------- +-- Function: pgq_node.set_consumer_completed(3) +-- +-- Set last completed tick id for the cascaded consumer +-- that it has committed to local node. +-- +-- Parameters: +-- i_queue_name - cascaded queue name +-- i_consumer_name - cascaded consumer name +-- i_tick_id - tick id +-- Returns: +-- 200 - ok +-- 404 - consumer not known +-- ---------------------------------------------------------------------- +begin + update pgq_node.local_state + set last_tick_id = i_tick_id, + cur_error = NULL + where queue_name = i_queue_name + and consumer_name = i_consumer_name; + if found then + select 100, 'Consumer ' || i_consumer_name || ' compleded tick = ' || i_tick_id::text + into ret_code, ret_note; + else + select 404, 'Consumer not known: ' + || i_queue_name || '/' || i_consumer_name + into ret_code, ret_note; + end if; + return; +end; +$$; + + +-- +-- Name: set_consumer_error(text, text, text); Type: FUNCTION; Schema: pgq_node; Owner: - +-- + +CREATE FUNCTION set_consumer_error(i_queue_name text, i_consumer_name text, i_error_msg text, OUT ret_code integer, OUT ret_note text) RETURNS record + LANGUAGE plpgsql SECURITY DEFINER + AS $$ +-- ---------------------------------------------------------------------- +-- Function: pgq_node.set_consumer_error(3) +-- +-- If batch processing fails, consumer can store it's last error in db. +-- Returns: +-- 100 - ok +-- 101 - consumer not known +-- ---------------------------------------------------------------------- +begin + update pgq_node.local_state + set cur_error = i_error_msg + where queue_name = i_queue_name + and consumer_name = i_consumer_name; + if found then + select 100, 'Consumer ' || i_consumer_name || ' error = ' || i_error_msg + into ret_code, ret_note; + else + select 101, 'Consumer not known, ignoring: ' + || i_queue_name || '/' || i_consumer_name + into ret_code, ret_note; + end if; + return; +end; +$$; + + +-- +-- Name: set_consumer_paused(text, text, boolean); Type: FUNCTION; Schema: pgq_node; Owner: - +-- + +CREATE FUNCTION set_consumer_paused(i_queue_name text, i_consumer_name text, i_paused boolean, OUT ret_code integer, OUT ret_note text) RETURNS record + LANGUAGE plpgsql SECURITY DEFINER + AS $$ +-- ---------------------------------------------------------------------- +-- Function: pgq_node.set_consumer_paused(3) +-- +-- Set consumer paused flag. +-- +-- Parameters: +-- i_queue_name - cascaded queue name +-- i_consumer_name - cascaded consumer name +-- i_paused - new flag state +-- Returns: +-- 200 - ok +-- 201 - already paused +-- 404 - consumer not found +-- ---------------------------------------------------------------------- +declare + old_flag boolean; + word text; +begin + if i_paused then + word := 'paused'; + else + word := 'resumed'; + end if; + + select paused into old_flag + from pgq_node.local_state + where queue_name = i_queue_name + and consumer_name = i_consumer_name + for update; + if not found then + select 404, 'Unknown consumer: ' || i_consumer_name + into ret_code, ret_note; + elsif old_flag = i_paused then + select 201, 'Consumer ' || i_consumer_name || ' already ' || word + into ret_code, ret_note; + else + update pgq_node.local_state + set paused = i_paused, + uptodate = false + where queue_name = i_queue_name + and consumer_name = i_consumer_name; + + select 200, 'Consumer '||i_consumer_name||' tagged as '||word into ret_code, ret_note; + end if; + return; + +end; +$$; + + +-- +-- Name: set_consumer_uptodate(text, text, boolean); Type: FUNCTION; Schema: pgq_node; Owner: - +-- + +CREATE FUNCTION set_consumer_uptodate(i_queue_name text, i_consumer_name text, i_uptodate boolean, OUT ret_code integer, OUT ret_note text) RETURNS record + LANGUAGE plpgsql SECURITY DEFINER + AS $$ +-- ---------------------------------------------------------------------- +-- Function: pgq_node.set_consumer_uptodate(3) +-- +-- Set consumer uptodate flag..... +-- +-- Parameters: +-- i_queue_name - queue name +-- i_consumer_name - consumer name +-- i_uptodate - new flag state +-- +-- Returns: +-- 200 - ok +-- 404 - consumer not known +-- ---------------------------------------------------------------------- +begin + update pgq_node.local_state + set uptodate = i_uptodate + where queue_name = i_queue_name + and consumer_name = i_consumer_name; + if found then + select 200, 'Consumer uptodate = ' || i_uptodate::int4::text + into ret_code, ret_note; + else + select 404, 'Consumer not known: ' + || i_queue_name || '/' || i_consumer_name + into ret_code, ret_note; + end if; + return; +end; +$$; + + +-- +-- Name: set_global_watermark(text, bigint); Type: FUNCTION; Schema: pgq_node; Owner: - +-- + +CREATE FUNCTION set_global_watermark(i_queue_name text, i_watermark bigint, OUT ret_code integer, OUT ret_note text) RETURNS record + LANGUAGE plpgsql SECURITY DEFINER + AS $$ +-- ---------------------------------------------------------------------- +-- Function: pgq_node.set_global_watermark(2) +-- +-- Move global watermark on branch/leaf, publish on root. +-- +-- Parameters: +-- i_queue_name - queue name +-- i_watermark - global tick_id that is processed everywhere. +-- NULL on root, then local wm is published. +-- ---------------------------------------------------------------------- +declare + this record; + _wm bigint; + wm_consumer text; +begin + wm_consumer = '.global_watermark'; + + select node_type, queue_name, worker_name into this + from pgq_node.node_info + where queue_name = i_queue_name + for update; + if not found then + select 404, 'Queue' || i_queue_name || ' not found' + into ret_code, ret_note; + return; + end if; + + _wm = i_watermark; + if this.node_type = 'root' then + if i_watermark is null then + select f.ret_code, f.ret_note, f.local_watermark + into ret_code, ret_note, _wm + from pgq_node.get_node_info(i_queue_name) f; + if ret_code >= 300 then + return; + end if; + if _wm is null then + raise exception 'local_watermark=NULL from get_node_info()?'; + end if; + end if; + + -- move watermark + perform pgq.register_consumer_at(i_queue_name, wm_consumer, _wm); + + -- send event downstream + perform pgq.insert_event(i_queue_name, 'pgq.global-watermark', _wm::text, + i_queue_name, null, null, null); + -- update root workers pos to avoid it getting stale + update pgq_node.local_state + set last_tick_id = _wm + where queue_name = i_queue_name + and consumer_name = this.worker_name; + elsif this.node_type = 'branch' then + if i_watermark is null then + select 500, 'bad usage: wm=null on branch node' + into ret_code, ret_note; + return; + end if; + + -- tick can be missing if we are processing + -- old batches that set watermark outside + -- current range + perform 1 from pgq.tick t, pgq.queue q + where q.queue_name = i_queue_name + and t.tick_queue = q.queue_id + and t.tick_id = _wm; + if not found then + select 200, 'Skipping global watermark update to ' || _wm::text + into ret_code, ret_note; + return; + end if; + + -- move watermark + perform pgq.register_consumer_at(i_queue_name, wm_consumer, _wm); + else + select 100, 'Ignoring global watermark in leaf' + into ret_code, ret_note; + return; + end if; + + select 200, 'Global watermark set to ' || _wm::text + into ret_code, ret_note; + return; +end; +$$; + + +-- +-- Name: set_node_attrs(text, text); Type: FUNCTION; Schema: pgq_node; Owner: - +-- + +CREATE FUNCTION set_node_attrs(i_queue_name text, i_node_attrs text, OUT ret_code integer, OUT ret_note text) RETURNS record + LANGUAGE plpgsql SECURITY DEFINER + AS $$ +-- ---------------------------------------------------------------------- +-- Function: pgq_node.create_attrs(2) +-- +-- Set node attributes. +-- +-- Parameters: +-- i_node_name - cascaded queue name +-- i_node_attrs - urlencoded node attrs +-- +-- Returns: +-- 200 - ok +-- 404 - node not found +-- ---------------------------------------------------------------------- +begin + update pgq_node.node_info + set node_attrs = i_node_attrs + where queue_name = i_queue_name; + if not found then + select 404, 'Node not found' into ret_code, ret_note; + return; + end if; + + select 200, 'Node attributes updated' + into ret_code, ret_note; + return; +end; +$$; + + +-- +-- Name: set_partition_watermark(text, text, bigint); Type: FUNCTION; Schema: pgq_node; Owner: - +-- + +CREATE FUNCTION set_partition_watermark(i_combined_queue_name text, i_part_queue_name text, i_watermark bigint, OUT ret_code integer, OUT ret_note text) RETURNS record + LANGUAGE plpgsql SECURITY DEFINER + AS $$ +-- ---------------------------------------------------------------------- +-- Function: pgq_node.set_partition_watermark(3) +-- +-- Move merge-leaf position on combined-branch. +-- +-- Parameters: +-- i_combined_queue_name - local combined queue name +-- i_part_queue_name - local part queue name (merge-leaf) +-- i_watermark - partition tick_id that came inside combined-root batch +-- +-- Returns: +-- 200 - success +-- 201 - no partition queue +-- 401 - worker registration not found +-- ---------------------------------------------------------------------- +declare + n record; +begin + -- check if combined-branch exists + select c.node_type, p.worker_name into n + from pgq_node.node_info c, pgq_node.node_info p + where p.queue_name = i_part_queue_name + and c.queue_name = i_combined_queue_name + and p.combined_queue = c.queue_name + and p.node_type = 'leaf' + and c.node_type = 'branch'; + if not found then + select 201, 'Part-queue does not exist' into ret_code, ret_note; + return; + end if; + + update pgq_node.local_state + set last_tick_id = i_watermark + where queue_name = i_part_queue_name + and consumer_name = n.worker_name; + if not found then + select 401, 'Worker registration not found' into ret_code, ret_note; + return; + end if; + + select 200, 'Ok' into ret_code, ret_note; + return; +end; +$$; + + +-- +-- Name: set_subscriber_watermark(text, text, bigint); Type: FUNCTION; Schema: pgq_node; Owner: - +-- + +CREATE FUNCTION set_subscriber_watermark(i_queue_name text, i_node_name text, i_watermark bigint, OUT ret_code integer, OUT ret_note text) RETURNS record + LANGUAGE plpgsql SECURITY DEFINER + AS $$ +-- ---------------------------------------------------------------------- +-- Function: pgq_node.set_subscriber_watermark(3) +-- +-- Notify provider about subscribers lowest watermark. +-- +-- Called on provider at interval by each worker +-- +-- Parameters: +-- i_queue_name - cascaded queue name +-- i_node_name - subscriber node name +-- i_watermark - tick_id +-- +-- Returns: +-- ret_code - error code +-- ret_note - description +-- ---------------------------------------------------------------------- +declare + n record; + wm_name text; +begin + wm_name := '.' || i_node_name || '.watermark'; + select * into n from pgq.get_consumer_info(i_queue_name, wm_name); + if not found then + select 404, 'node '||i_node_name||' not subscribed to queue ', i_queue_name + into ret_code, ret_note; + return; + end if; + + -- todo: check if wm sane? + if i_watermark < n.last_tick then + select 405, 'watermark must not be moved backwards' + into ret_code, ret_note; + return; + elsif i_watermark = n.last_tick then + select 100, 'watermark already set' + into ret_code, ret_note; + return; + end if; + + perform pgq.register_consumer_at(i_queue_name, wm_name, i_watermark); + + select 200, wm_name || ' set to ' || i_watermark::text + into ret_code, ret_note; + return; +end; +$$; + + +-- +-- Name: unregister_consumer(text, text); Type: FUNCTION; Schema: pgq_node; Owner: - +-- + +CREATE FUNCTION unregister_consumer(i_queue_name text, i_consumer_name text, OUT ret_code integer, OUT ret_note text) RETURNS record + LANGUAGE plpgsql SECURITY DEFINER + AS $$ +-- ---------------------------------------------------------------------- +-- Function: pgq_node.unregister_consumer(2) +-- +-- Unregister cascaded consumer from local node. +-- +-- Parameters: +-- i_queue_name - cascaded queue name +-- i_consumer_name - cascaded consumer name +-- +-- Returns: +-- ret_code - error code +-- 200 - ok +-- 404 - no such queue +-- ret_note - description +-- ---------------------------------------------------------------------- +begin + perform 1 from pgq_node.node_info where queue_name = i_queue_name + for update; + if not found then + select 404, 'Unknown queue: ' || i_queue_name into ret_code, ret_note; + return; + end if; + + delete from pgq_node.local_state + where queue_name = i_queue_name + and consumer_name = i_consumer_name; + + select 200, 'Consumer '||i_consumer_name||' unregistered from '||i_queue_name + into ret_code, ret_note; + return; +end; +$$; + + +-- +-- Name: unregister_location(text, text); Type: FUNCTION; Schema: pgq_node; Owner: - +-- + +CREATE FUNCTION unregister_location(i_queue_name text, i_node_name text, OUT ret_code integer, OUT ret_note text) RETURNS record + LANGUAGE plpgsql SECURITY DEFINER + AS $$ +-- ---------------------------------------------------------------------- +-- Function: pgq_node.unregister_location(2) +-- +-- Drop unreferenced node. +-- +-- Parameters: +-- i_queue_name - queue name +-- i_node_name - node to drop +-- +-- Returns: +-- ret_code - error code +-- ret_note - error description +-- +-- Return Codes: +-- 200 - Ok +-- 301 - Location not found +-- 403 - Cannot drop nodes own or parent location +-- ---------------------------------------------------------------------- +declare + _queue_name text; + _wm_consumer text; + _global_wm bigint; + sub record; + node record; +begin + select n.node_name, n.node_type, s.provider_node + into node + from pgq_node.node_info n + left join pgq_node.local_state s + on (s.consumer_name = n.worker_name + and s.queue_name = n.queue_name) + where n.queue_name = i_queue_name; + if found then + if node.node_name = i_node_name then + select 403, 'Cannot drop nodes own location' into ret_code, ret_note; + return; + end if; + if node.provider_node = i_node_name then + select 403, 'Cannot drop location of nodes parent' into ret_code, ret_note; + return; + end if; + end if; + + delete from pgq_node.node_location + where queue_name = i_queue_name + and node_name = i_node_name; + + if found then + select 200, 'Ok' into ret_code, ret_note; + else + select 301, 'Location not found: ' || i_queue_name || '/' || i_node_name + into ret_code, ret_note; + end if; + + if node.node_type = 'root' then + perform pgq.insert_event(i_queue_name, 'pgq.unregister-location', + i_node_name, i_queue_name, null, null, null) + from pgq_node.node_info n + where n.queue_name = i_queue_name; + end if; + + return; +end; +$$; + + +-- +-- Name: unregister_subscriber(text, text); Type: FUNCTION; Schema: pgq_node; Owner: - +-- + +CREATE FUNCTION unregister_subscriber(i_queue_name text, i_remote_node_name text, OUT ret_code integer, OUT ret_note text) RETURNS record + LANGUAGE plpgsql SECURITY DEFINER + AS $$ +-- ---------------------------------------------------------------------- +-- Function: pgq_node.unregister_subscriber(2) +-- +-- Unsubscribe remote node from local node. +-- +-- Parameters: +-- i_queue_name - set name +-- i_remote_node_name - node name +-- +-- Returns: +-- ret_code - error code +-- ret_note - description +-- ---------------------------------------------------------------------- +declare + n_wm_name text; + worker_name text; +begin + n_wm_name := '.' || i_remote_node_name || '.watermark'; + select s.worker_name into worker_name from pgq_node.subscriber_info s + where queue_name = i_queue_name and subscriber_node = i_remote_node_name; + if not found then + select 304, 'Subscriber not found' into ret_code, ret_note; + return; + end if; + + perform pgq.unregister_consumer(i_queue_name, n_wm_name); + perform pgq.unregister_consumer(i_queue_name, worker_name); + + delete from pgq_node.subscriber_info + where queue_name = i_queue_name + and subscriber_node = i_remote_node_name; + + select 200, 'Subscriber unregistered: '||i_remote_node_name + into ret_code, ret_note; + return; +end; +$$; + + +-- +-- Name: upgrade_schema(); Type: FUNCTION; Schema: pgq_node; Owner: - +-- + +CREATE FUNCTION upgrade_schema() RETURNS integer + LANGUAGE plpgsql + AS $$ +-- updates table structure if necessary +declare + cnt int4 = 0; +begin + -- node_info.node_attrs + perform 1 from information_schema.columns + where table_schema = 'pgq_node' + and table_name = 'node_info' + and column_name = 'node_attrs'; + if not found then + alter table pgq_node.node_info add column node_attrs text; + cnt := cnt + 1; + end if; + + return cnt; +end; +$$; + + +-- +-- Name: version(); Type: FUNCTION; Schema: pgq_node; Owner: - +-- + +CREATE FUNCTION version() RETURNS text + LANGUAGE plpgsql + AS $$ +begin + return '3.0.0.13'; +end; +$$; + + +SET search_path = public, pg_catalog; + +-- +-- Name: add_to_queue_changed_synonyms(); Type: FUNCTION; Schema: public; Owner: - +-- + +CREATE FUNCTION add_to_queue_changed_synonyms() RETURNS integer + LANGUAGE plpgsql + AS $$ +DECLARE + last_date TIMESTAMP; +BEGIN + +-- определим дату последней индексации +SELECT updated_at INTO last_date +FROM public.glossary_log +WHERE operation = 'index_rows' +ORDER BY updated_at DESC +LIMIT 1; + +IF last_date IS NULL THEN + RETURN 0; +END IF; + +-- у которых есть рубрика, но нет базового слова +INSERT INTO search_index_queue (class_name, obj_id, created_at, updated_at) +SELECT * FROM ( + WITH _synonyms AS ( + SELECT s.id, s.rubric_id, r.lft, r.rgt + FROM synonyms s + INNER JOIN ( + SELECT s.id + FROM synonyms s + INNER JOIN base_words bs ON bs.id = s.synonym_id + LEFT JOIN search_wordforms wf_s ON wf_s.word = bs.name + WHERE + s.base_id IS NULL AND s.rubric_id IS NOT NULL + AND (s.updated_at > last_date + OR bs.updated_at > last_date + OR wf_s.updated_at > last_date) + GROUP BY s.id + ) sub ON sub.id = s.id + INNER JOIN rubrics r ON r.id = s.rubric_id + ) + + SELECT 'PriceListRow', p.id, import.to_utc(clock_timestamp()), import.to_utc(clock_timestamp()) + FROM price_list_rows p + INNER JOIN rubrics r ON r.id = p.rubric_id + INNER JOIN _synonyms s ON r.lft >= s.lft AND r.rgt <= s.rgt +) a; + +-- у которых есть рубрика и базовое слово +INSERT INTO search_index_queue (class_name, obj_id, created_at, updated_at) +SELECT * FROM ( + WITH _synonyms AS ( + SELECT s.id, s.rubric_id, r.lft, r.rgt, bw.name base_name + FROM synonyms s + INNER JOIN ( + SELECT s.id + FROM synonyms s + INNER JOIN base_words bs ON bs.id = s.synonym_id + LEFT JOIN search_wordforms wf_s ON wf_s.word = bs.name + INNER JOIN base_words bw ON bw.id = s.base_id + LEFT JOIN search_wordforms wf_b ON wf_b.word = bw.name + WHERE + s.base_id IS NOT NULL AND s.rubric_id IS NOT NULL + AND (s.updated_at > last_date + OR bs.updated_at > last_date + OR wf_s.updated_at > last_date + OR bw.updated_at > last_date + OR wf_b.updated_at > last_date) + GROUP BY s.id + ) sub ON sub.id = s.id + INNER JOIN rubrics r ON r.id = s.rubric_id + INNER JOIN base_words bw ON bw.id = s.base_id + ) + + SELECT 'PriceListRow', p.id, import.to_utc(clock_timestamp()), import.to_utc(clock_timestamp()) + FROM search_index_price_list_rows si + INNER JOIN price_list_rows p ON p.id = si.price_list_row_id + INNER JOIN rubrics r ON r.id = p.rubric_id + INNER JOIN _synonyms s ON r.lft >= s.lft AND r.rgt <= s.rgt AND si.terms_index @@ to_tsquery('simple', s.base_name) +) a; + +-- у которых нет рубрики, но есть базовое слово +INSERT INTO search_index_queue (class_name, obj_id, created_at, updated_at) +SELECT * FROM ( + WITH _synonyms AS ( + SELECT s.id, bw.name base_name + FROM synonyms s + INNER JOIN ( + SELECT s.id + FROM synonyms s + INNER JOIN base_words bs ON bs.id = s.synonym_id + LEFT JOIN search_wordforms wf_s ON wf_s.word = bs.name + INNER JOIN base_words bw ON bw.id = s.base_id + LEFT JOIN search_wordforms wf_b ON wf_b.word = bw.name + WHERE + s.base_id IS NOT NULL AND s.rubric_id IS NULL + AND (s.updated_at > last_date + OR bs.updated_at > last_date + OR wf_s.updated_at > last_date + OR bw.updated_at > last_date + OR wf_b.updated_at > last_date) + GROUP BY s.id + ) sub ON sub.id = s.id + INNER JOIN base_words bw ON bw.id = s.base_id + ) + + SELECT 'PriceListRow', p.id, import.to_utc(clock_timestamp()), import.to_utc(clock_timestamp()) + FROM search_index_price_list_rows si + INNER JOIN price_list_rows p ON p.id = si.price_list_row_id + INNER JOIN _synonyms s ON si.terms_index @@ to_tsquery('simple', s.base_name) +) a; + +RETURN 1; +END; +$$; + + +-- +-- Name: brutmerge_ip_infos(); Type: FUNCTION; Schema: public; Owner: - +-- + +CREATE FUNCTION brutmerge_ip_infos() RETURNS integer + LANGUAGE plpgsql + AS $$ + DECLARE + curs refcursor; + _curs refcursor; + rec RECORD; + _rec RECORD; + counter integer; + last_start bigint; + last_end bigint; + last_city integer; + BEGIN + + counter := 0; + + DROP TABLE IF EXISTS _ip_infos; + CREATE TABLE _ip_infos ( + id serial NOT NULL, + ip_start bigint NOT NULL, + ip_end bigint NOT NULL, + city_id INTEGER NOT NULL + ); + + CREATE INDEX index_t_ip_infos_ip_start ON _ip_infos USING btree (ip_start); + CREATE INDEX index_t_ip_infos_ip_end ON _ip_infos USING btree (ip_end); + + OPEN curs FOR SELECT * FROM ip_infos ORDER BY ip_end - ip_start; + LOOP + FETCH curs INTO rec; + EXIT WHEN NOT FOUND; + + last_end := rec.ip_start - 1; + OPEN _curs FOR SELECT * FROM _ip_infos WHERE (ip_start BETWEEN rec.ip_start AND rec.ip_end) OR (ip_end BETWEEN rec.ip_start AND rec.ip_end) ORDER BY ip_start; + LOOP + FETCH _curs INTO _rec; + EXIT WHEN NOT FOUND; + IF last_end + 1 <= _rec.ip_start - 1 THEN + INSERT INTO _ip_infos (ip_start, ip_end, city_id) VALUES (last_end + 1, _rec.ip_start - 1, rec.city_id); + END IF; + last_end = _rec.ip_end; + END LOOP; + CLOSE _curs; + IF last_end + 1 <= rec.ip_end THEN + INSERT INTO _ip_infos (ip_start, ip_end, city_id) VALUES (last_end + 1, rec.ip_end, rec.city_id); + END IF; + + counter := counter + 1; + IF counter % 100 = 0 THEN + RAISE NOTICE 'Пройдено % строк', counter; + END IF; + END LOOP; + CLOSE curs; + + DELETE FROM ip_infos; + + OPEN curs FOR SELECT ip_start, ip_end, city_id FROM _ip_infos ORDER BY ip_start OFFSET 1; + SELECT ip_start, ip_end, city_id INTO last_start, last_end, last_city FROM _ip_infos ORDER BY ip_start LIMIT 1; + LOOP + FETCH curs INTO rec; + EXIT WHEN NOT FOUND; + + IF rec.ip_start > last_end + 1 OR rec.city_id != last_city THEN + INSERT INTO ip_infos(ip_start, ip_end, city_id) VALUES (last_start, last_end, last_city); + last_start = rec.ip_start; + END IF; + + last_end = rec.ip_end; + last_city = rec.city_id; + + END LOOP; + INSERT INTO ip_infos(ip_start, ip_end, city_id) VALUES (last_start, last_end, last_city); + CLOSE curs; + + DROP TABLE _ip_infos; + RETURN 0; + END; + $$; + + +-- +-- Name: build_company_yandex_rubrics(); Type: FUNCTION; Schema: public; Owner: - +-- + +CREATE FUNCTION build_company_yandex_rubrics() RETURNS integer + LANGUAGE plpgsql + AS $$ + BEGIN + TRUNCATE company_yandex_rubrics; + + INSERT INTO company_yandex_rubrics (company_id, yandex_rubric_id) + SELECT cpr.company_id, yr.yandex_rubric_id + FROM company_price_product_rubrics cpr + INNER JOIN yandex_rubrics_pc_rubrics yr ON yr.rubric_id = cpr.rubric_id; + + RETURN 1; + END; + $$; + + +-- +-- Name: cancel_backend(integer); Type: FUNCTION; Schema: public; Owner: - +-- + +CREATE FUNCTION cancel_backend(pid integer) RETURNS void + LANGUAGE plpgsql SECURITY DEFINER + AS $$ + begin + execute 'select pg_cancel_backend(' || pid || ')'; + end; +$$; + + +-- +-- Name: cast_product_state_into_integer(product_state); Type: FUNCTION; Schema: public; Owner: - +-- + +CREATE FUNCTION cast_product_state_into_integer(product_state) RETURNS integer + LANGUAGE sql IMMUTABLE + AS $_$ +SELECT CASE + WHEN ($1 = 'pending'::product_state) THEN 1 + WHEN ($1 = 'accepted'::product_state) THEN 2 + WHEN ($1 = 'changed'::product_state) THEN 3 + WHEN ($1 = 'declined'::product_state) THEN 4 + WHEN ($1 = 'deleted'::product_state) THEN 5 + ELSE NULL::integer + END; +$_$; + + +-- +-- Name: company_price_products_to_rubrics(); Type: FUNCTION; Schema: public; Owner: - +-- + +CREATE FUNCTION company_price_products_to_rubrics() RETURNS SETOF company_rubric + LANGUAGE plpgsql IMMUTABLE COST 300000 ROWS 1000000 + AS $$ + BEGIN + RETURN QUERY + + SELECT cg.company_id::BIGINT, cg.rubric_id::BIGINT + FROM ( + SELECT ca.company_id, ca.r_ids[s] rubric_id + FROM ( + SELECT cr.company_id, ARRAY[r1.id, r2.id, r3.id, r4.id, r5.id] r_ids, + generate_subscripts(ARRAY[r1.id, r2.id, r3.id, r4.id, r5.id], 1) s + FROM ( + SELECT company_id, rubric_id + FROM ( + SELECT p.company_id, p.rubric_id + FROM price_list_rows p + WHERE p.is_deleted = false + GROUP BY p.company_id, p.rubric_id + + UNION + + SELECT pd.company_id, pd.rubric_id + FROM products pd + WHERE pd.state IN ('accepted', 'pending') + GROUP BY pd.company_id, pd.rubric_id + ) sub + GROUP BY company_id, rubric_id + ) cr + INNER JOIN rubrics r1 ON r1.id = cr.rubric_id + LEFT JOIN rubrics r2 ON r2.id = r1.parent_id + LEFT JOIN rubrics r3 ON r3.id = r2.parent_id + LEFT JOIN rubrics r4 ON r4.id = r3.parent_id + LEFT JOIN rubrics r5 ON r5.id = r4.parent_id + LEFT JOIN rubrics r6 ON r6.id = r5.parent_id + ) ca + ) cg + GROUP BY cg.company_id, cg.rubric_id; + + END; + $$; + + +-- +-- Name: compute_companies_traffic_direction(date); Type: FUNCTION; Schema: public; Owner: - +-- + +CREATE FUNCTION compute_companies_traffic_direction(_first_week_day date) RETURNS integer + LANGUAGE plpgsql + AS $$ + BEGIN + + DROP TABLE IF EXISTS "_companies"; + CREATE TEMPORARY TABLE "_companies"( + "company_id" INTEGER, + "rubric_id" INTEGER, + "region_id" INTEGER, + "visits_limit" INTEGER, + "visits_current" INTEGER + ); + + INSERT INTO _companies + SELECT * + FROM ( + WITH _companies AS ( + SELECT c.id, c.packet + FROM companies c + INNER JOIN company_domains cd ON cd.company_id = c.id AND cd.state != 'rejected' + WHERE c.packet > 1 AND c.state != 'deleted' + ), + _rubrics_l2_top AS ( + SELECT z.company_id, z.rubric_id + FROM ( + SELECT s.company_id, s.rubric_id, row_number() OVER (PARTITION BY s.company_id ORDER BY s.cnt DESC) top + FROM ( + SELECT p.company_id, rdt.rubric_l2_id rubric_id, count(p.id) cnt + FROM _companies c + INNER JOIN products p ON p.company_id = c.id AND p.state NOT IN ('deleted', 'declined') AND p.is_public = TRUE + INNER JOIN rubrics_denormalization_tree rdt ON rdt.rubric_id = p.rubric_id + GROUP BY p.company_id, rdt.rubric_l2_id + ) s + ) z + INNER JOIN rubrics r ON r.id = z.rubric_id + WHERE z.top = 1 + ), + _rubrics AS ( + SELECT rr.company_id, rr.rubric_id + FROM rubrics r + INNER JOIN ( + SELECT p.company_id, rdt.rubric_l4_id rubric_id + FROM _companies c + INNER JOIN products p ON p.company_id = c.id AND p.state NOT IN ('deleted', 'declined') AND p.is_public = TRUE + INNER JOIN rubrics_denormalization_tree rdt ON rdt.rubric_id = p.rubric_id + GROUP BY p.company_id, rdt.rubric_l4_id + ) rr ON rr.rubric_id = r.id + + UNION ALL + + SELECT rr.company_id, rr.rubric_id + FROM rubrics r + INNER JOIN ( + SELECT p.company_id, p.rubric_id + FROM _companies c + INNER JOIN products p ON p.company_id = c.id AND p.state NOT IN ('deleted', 'declined') AND p.rubric_id IS NOT NULL AND p.is_public = TRUE + GROUP BY p.company_id, p.rubric_id + ) rr ON rr.rubric_id = r.id + INNER JOIN wordstat_rubrics wr ON wr.rubric_id = r.id AND wr.state = 'accepted' + ), + _regions AS ( + SELECT rc.company_id, rc.region_id, + CASE + WHEN stat_regions.region_id IS NULL THEN 0 + ELSE stat_regions.region_id + END AS stat_region_id + FROM _companies c + INNER JOIN company_region_commercials rc ON rc.company_id = c.id + INNER JOIN regions r ON r.id = rc.region_id AND r.rgt - r.lft = 1 + LEFT JOIN ( + SELECT region_id + FROM rubric_normal_stats + GROUP BY region_id + ) stat_regions ON stat_regions.region_id = r.id + ), + _stats AS ( + SELECT c.id company_id, COALESCE(sw.visits, 0) current_stat + FROM _companies c + LEFT JOIN "statistics"."company_statistic_total_by_weeks" sw ON sw.company_id = c.id AND sw.first_week_day = _first_week_day + ), + _limits AS ( + SELECT s.company_id, round(s.week_stat + (s.week_stat - cs.current_stat) * 0.1) limit_stat + FROM _companies c + INNER JOIN ( + SELECT r.company_id, ns.week_stat, row_number() OVER (PARTITION BY r.company_id ORDER BY ns.week_stat DESC) n + FROM _companies c + INNER JOIN _rubrics_l2_top rb ON rb.company_id = c.id + INNER JOIN _regions r ON r.company_id = c.id + INNER JOIN rubric_normal_stats ns ON ns.region_id = r.stat_region_id AND ns.packet = c.packet AND ns.rubric_id = rb.rubric_id + ) s ON s.company_id = c.id AND s.n = 1 + INNER JOIN _stats cs ON cs.company_id = c.id + ) + + SELECT c.id, rb.rubric_id, rg.region_id, l.limit_stat, s.current_stat + FROM _companies c + INNER JOIN _rubrics rb ON rb.company_id = c.id + INNER JOIN _regions rg ON rg.company_id = c.id + INNER JOIN _stats s ON s.company_id = c.id + INNER JOIN _limits l ON l.company_id = c.id + WHERE l.limit_stat - s.current_stat > 0 + ) a; + + DELETE FROM company_traffic_limits; + DELETE FROM company_rubric_regions; + + INSERT INTO company_traffic_limits (company_id, visits_limits, visits_current, created_at, updated_at) + SELECT company_id, visits_limit, visits_current, import.to_utc(clock_timestamp()), import.to_utc(clock_timestamp()) + FROM _companies + GROUP BY company_id, visits_limit, visits_current; + + INSERT INTO company_rubric_regions (company_id, rubric_id, region_id, created_at, updated_at) + SELECT c.company_id, c.rubric_id, c.region_id, import.to_utc(clock_timestamp()), import.to_utc(clock_timestamp()) + FROM _companies c + INNER JOIN rubrics r ON r.id = c.rubric_id AND char_length(r.title) <= 33 AND position('.' in r.title) = 0 AND position('/' in r.title) = 0; + + DROP TABLE IF EXISTS "_companies"; + + -- рубрики с одинаковыми названиями + DROP TABLE IF EXISTS _similar_rubrics; + CREATE TEMPORARY TABLE _similar_rubrics (id INTEGER, rubric_id INTEGER[]); + INSERT INTO _similar_rubrics + SELECT unnest(rubric_id) id, rubric_id + FROM ( + SELECT array_agg(DISTINCT id) rubric_id + FROM rubrics + WHERE cached_level >=4 AND slug != 'another' + GROUP BY COALESCE(prefix_normativka || ' ', '') || title + ) q; + CREATE INDEX _similar_rubrics_id_idx ON _similar_rubrics USING btree(id); + + -- найдём все баннеры у которых разные наборы рубрик + DROP TABLE IF EXISTS _banners_with_bad_rubrics; + CREATE TEMPORARY TABLE _banners_with_bad_rubrics (id INTEGER, rubric_id INTEGER); + INSERT INTO _banners_with_bad_rubrics + SELECT br.yandex_direct_banner_id, b.rubric_id + FROM ( + SELECT array_agg(DISTINCT br.rubric_id) rubric_id, yandex_direct_banner_id + FROM yandex_direct_banner_rubrics br + GROUP BY br.yandex_direct_banner_id + ) br + INNER JOIN yandex_direct_banners b ON b.id = br.yandex_direct_banner_id + LEFT JOIN _similar_rubrics sr ON br.rubric_id = sr.rubric_id + WHERE sr.rubric_id IS NULL; + + -- удалим у них рубрики + DELETE FROM yandex_direct_banner_rubrics + WHERE yandex_direct_banner_id IN ( SELECT id FROM _banners_with_bad_rubrics br ); + + -- и потом добавим нужные рубрики + INSERT INTO yandex_direct_banner_rubrics (yandex_direct_banner_id, rubric_id) + SELECT bbr.id, unnest(sr.rubric_id) rubric_id + FROM _banners_with_bad_rubrics bbr + INNER JOIN _similar_rubrics sr on bbr.rubric_id = sr.id; + + -- нужно установить основную рубрику с самым наименьшим id + UPDATE yandex_direct_banners b + SET rubric_id = q.min_rubric_id + FROM ( + SELECT br.yandex_direct_banner_id, MIN(br.rubric_id) min_rubric_id + FROM yandex_direct_banner_rubrics br + GROUP BY br.yandex_direct_banner_id + ) q + WHERE b.id = q.yandex_direct_banner_id AND b.rubric_id != q.min_rubric_id; + + DROP TABLE IF EXISTS _similar_rubrics; + DROP TABLE IF EXISTS _banners_with_bad_rubrics; + + + RETURN 1; + END; +$$; + + +-- +-- Name: crc32(text); Type: FUNCTION; Schema: public; Owner: - +-- + +CREATE FUNCTION crc32(word text) RETURNS bigint + LANGUAGE plpgsql IMMUTABLE + AS $$ + DECLARE tmp bigint; + DECLARE i int; + DECLARE j int; + DECLARE byte_length int; + DECLARE word_array bytea; + BEGIN + IF COALESCE(word, '') = '' THEN + return 0; + END IF; + + i = 0; + tmp = 4294967295; + byte_length = bit_length(word) / 8; + word_array = decode(replace(word, E'\\', E'\\\\'), 'escape'); + LOOP + tmp = (tmp # get_byte(word_array, i))::bigint; + i = i + 1; + j = 0; + LOOP + tmp = ((tmp >> 1) # (3988292384 * (tmp & 1)))::bigint; + j = j + 1; + IF j >= 8 THEN + EXIT; + END IF; + END LOOP; + IF i >= byte_length THEN + EXIT; + END IF; + END LOOP; + return (tmp # 4294967295); + END + $$; + + +-- +-- Name: crc32_int4(text); Type: FUNCTION; Schema: public; Owner: - +-- + +CREATE FUNCTION crc32_int4(word text) RETURNS integer + LANGUAGE plpgsql IMMUTABLE STRICT + AS $$ + DECLARE tmp int; + DECLARE i int; + DECLARE j int; + DECLARE word_array bytea; + BEGIN + i = 0; + tmp = 2147483647; + word_array = decode(replace(word, E'\\', E'\\\\'), 'escape'); + LOOP + tmp = (tmp # get_byte(word_array, i))::int4; + i = i + 1; + j = 0; + LOOP + tmp = ((tmp >> 1) # (1994146192 * (tmp & 1)))::int4; + j = j + 1; + IF j >= 8 THEN + EXIT; + END IF; + END LOOP; + IF i >= char_length(word) THEN + EXIT; + END IF; + END LOOP; + return (tmp # 2147483647); + END +$$; + + +-- +-- Name: destroy_address(integer); Type: FUNCTION; Schema: public; Owner: - +-- + +CREATE FUNCTION destroy_address(_address_id integer) RETURNS void + LANGUAGE plpgsql + AS $_$ +DECLARE + address public.addresses%ROWTYPE; + + company_region public.company_regions%ROWTYPE; + company_regions_curs CURSOR(company INTEGER, department INTEGER) IS + SELECT * + FROM company_regions + WHERE company_id = company AND + department_id = department + FOR UPDATE; + + company_region_comm public.company_region_commercials%ROWTYPE; + company_regions_comm_curs CURSOR(company INTEGER, department INTEGER) IS + SELECT * + FROM company_region_commercials + WHERE company_id = company AND + department_id = department + FOR UPDATE; + + replacement_address_id INTEGER; +BEGIN + -- load address + SELECT * INTO address FROM addresses WHERE id = $1; + + IF NOT FOUND THEN + RAISE EXCEPTION 'Адрес #% не найден', $1; + END IF; + + IF address.position = 1 AND + (SELECT COUNT(*) FROM addresses WHERE company_id = address.company_id) = 1 THEN + RAISE EXCEPTION 'Нельзя удалять первый адрес'; + END IF; + + -- company_regions + FOR company_region IN company_regions_curs(address.company_id, address.id) + LOOP + -- найти среди адресов еще один в этом же регионе и заменить department_id + -- в противном случае грохнуть привязку + replacement_address_id := NULL; + + SELECT + addresses.id INTO replacement_address_id + FROM + addresses INNER JOIN + cities ON addresses.city_id = cities.id INNER JOIN + provinces ON cities.province_id = provinces.id INNER JOIN + regions ON provinces.region_id = regions.id + WHERE + regions.id IN ( + SELECT id + FROM regions + WHERE lft >= (SELECT lft FROM regions WHERE id = company_region.region_id) AND + rgt <= (SELECT rgt FROM regions WHERE id = company_region.region_id) + ORDER BY lft + ) AND + addresses.company_id = address.company_id AND + addresses.id <> address.id + ORDER BY + position ASC + LIMIT 1; + + IF replacement_address_id IS NULL THEN + DELETE FROM company_regions + WHERE CURRENT OF company_regions_curs; + ELSE + UPDATE company_regions SET department_id = replacement_address_id + WHERE CURRENT OF company_regions_curs; + END IF; + END LOOP; + + -- аналогично - company_region_commercials + FOR company_region_comm IN company_regions_comm_curs(address.company_id, address.id) + LOOP + replacement_address_id := NULL; + + SELECT + addresses.id INTO replacement_address_id + FROM + addresses INNER JOIN + cities ON addresses.city_id = cities.id INNER JOIN + provinces ON cities.province_id = provinces.id INNER JOIN + regions ON provinces.region_id = regions.id + WHERE + regions.id IN ( + SELECT id + FROM regions + WHERE lft >= (SELECT lft FROM regions WHERE id = company_region_comm.region_id) AND + rgt <= (SELECT rgt FROM regions WHERE id = company_region_comm.region_id) + ORDER BY lft + ) AND + addresses.company_id = address.company_id AND + addresses.id <> address.id + ORDER BY + position ASC + LIMIT 1; + + IF replacement_address_id IS NULL THEN + DELETE FROM company_region_commercials + WHERE CURRENT OF company_regions_comm_curs; + ELSE + UPDATE company_region_commercials SET department_id = replacement_address_id + WHERE CURRENT OF company_regions_comm_curs; + END IF; + END LOOP; + + DELETE FROM contacts WHERE address_id = address.id; + + DELETE FROM phones WHERE address_id = address.id; + + DELETE FROM yandex_map_coordinates WHERE address_id = address.id; + + -- поставить в экспорт + PERFORM export.queue_company_for_update(address.company_id); + + DELETE FROM addresses WHERE id = address.id; + + UPDATE addresses a SET position = t.real_position + FROM + ( + SELECT + id, + ROW_NUMBER() OVER (PARTITION BY company_id ORDER BY position NULLS LAST, created_at, id) AS real_position + FROM + addresses + WHERE + company_id = address.company_id + ) t + WHERE + a.id = t.id; +END; +$_$; + + +-- +-- Name: dirty_rubrics_nested_set_snapshot(); Type: FUNCTION; Schema: public; Owner: - +-- + +CREATE FUNCTION dirty_rubrics_nested_set_snapshot() RETURNS integer + LANGUAGE plpgsql + AS $$ +DECLARE + _n INTEGER; + _id INTEGER; +BEGIN + -- http://social.msdn.microsoft.com/Forums/zh/transactsql/thread/83eaa7a4-f2d6-4d69-b47a-f74b1b29598e + DELETE FROM dirty_rubrics_nested_set; + INSERT INTO dirty_rubrics_nested_set (id, parent_id, position, lft, rgt) + VALUES (-1, NULL, 1, NULL, NULL); + INSERT INTO dirty_rubrics_nested_set (id, parent_id, position, lft, rgt) + SELECT id, parent_id, position, NULL, NULL + FROM dirty_rubrics; + UPDATE dirty_rubrics_nested_set SET parent_id = -1 WHERE parent_id IS NULL AND id != - 1; + --UPDATE dirty_rubrics_nested_set SET lft = NULL, rgt = NULL; + _n := 0; _id := -1; + + WHILE EXISTS(SELECT 1 FROM dirty_rubrics_nested_set WHERE rgt IS NULL) LOOP + UPDATE dirty_rubrics_nested_set SET lft = _n WHERE id = _id AND lft IS NULL; + IF NOT EXISTS (SELECT 1 FROM dirty_rubrics_nested_set WHERE parent_id = _id AND rgt IS NULL) THEN + _n := _n + 1; + UPDATE dirty_rubrics_nested_set SET rgt = _n WHERE id = _id; + SELECT parent_id INTO _id FROM dirty_rubrics_nested_set WHERE id = _id; + ELSE + _n := _n + 1; + SELECT id INTO _id FROM dirty_rubrics_nested_set WHERE parent_id = _id AND lft IS NULL ORDER BY position LIMIT 1; + END IF; + IF _n % 1000 = 0 THEN + RAISE NOTICE 'passed % node(s)', _n; + END IF; + END LOOP; + DELETE FROM dirty_rubrics_nested_set WHERE id = -1; + UPDATE dirty_rubrics_nested_set SET parent_id = NULL WHERE parent_id = -1; + RETURN _n; +END; +$$; + + +-- +-- Name: get_catalogue_products(integer[], integer); Type: FUNCTION; Schema: public; Owner: - +-- + +CREATE FUNCTION get_catalogue_products(products_ids integer[], _region_id integer) RETURNS SETOF classes.catalogue_product + LANGUAGE sql ROWS 50 + AS $_$ + SELECT * FROM ( + WITH product_ids AS ( + SELECT $1 + ), + natural_order AS ( + SELECT DISTINCT product_id, rn AS row_number + FROM + ( + SELECT + product_id, + first_value(row_number) OVER (PARTITION BY product_id ORDER BY row_number) AS rn + FROM + ( + SELECT + a AS product_id, + ROW_NUMBER() OVER () AS row_number + FROM + unnest((TABLE product_ids)) AS a + ) AS ordered + ) AS distnct + ), + selected_products AS ( + SELECT + products.id, + products.rubric_id, + products.company_id, + products.name, + products.url_name, + products.announce, + products.announce_valid, + CASE + WHEN companies.has_regional_product_properties IS TRUE THEN COALESCE(product_regions.price, product_properties.price) + ELSE product_properties.price + END AS price, + CASE + WHEN companies.has_regional_product_properties IS TRUE THEN COALESCE(product_regions.price_max, product_properties.price_max) + ELSE product_properties.price_max + END AS price_max, + CASE + WHEN companies.has_regional_product_properties IS TRUE THEN COALESCE(product_regions.is_exact_price, product_properties.is_exact_price) + ELSE product_properties.is_exact_price + END AS is_exact_price, + CASE + WHEN companies.has_regional_product_properties IS TRUE THEN COALESCE(product_regions.currency, product_properties.currency) + ELSE product_properties.currency + END AS currency, + products.created_at, + product_properties.actualized_at, + product_properties.exists, + product_properties.updated_at, + company_region_commercials.is_bold AS bold, + companies.name AS company_name, + companies.packet AS company_packet, + companies.has_email AS company_has_email, + companies.products_count AS company_products_count, + companies.online_store_type AS company_online_store_type, + regions.name_lat AS company_products_region + FROM products + INNER JOIN companies ON products.company_id = companies.id + INNER JOIN regions ON companies.products_region_id = regions.id + INNER JOIN product_properties ON products.id = product_properties.product_id + LEFT JOIN product_regions ON product_regions.product_id = products.id AND product_regions.region_id = $2 AND product_regions.is_deleted = FALSE + LEFT JOIN company_region_commercials ON ( + companies.id = company_region_commercials.company_id AND + company_region_commercials.region_id = $2 + ) + WHERE + products.id = ANY((TABLE product_ids)::int4[]) + ), + companies_ids AS ( + SELECT array_agg(company_id) AS ids FROM selected_products + ), + products_images AS ( + SELECT product_id, + fname || '_thumb' || ext AS interpolated, + fname || '_small' || ext AS interpolated_small, + fname || '_medium' || ext AS interpolated_medium + FROM ( + SELECT DISTINCT ON (product_id) + product_id, + + substring(lpad(id::varchar, 9, '0') from 1 for 3) || '/' || + substring(lpad(id::varchar, 9, '0') from 4 for 3) || '/' || + substring(lpad(id::varchar, 9, '0') from 7 for 3) AS fname, + + '.' || substring(img_file_name from E'[A-Za-z0-9]+$') AS ext + + FROM product_images + WHERE product_id = ANY((TABLE product_ids)::int4[]) + ORDER BY product_id, position + ) image_info + ), + selected_companies AS ( + SELECT id, name, packet, has_email + FROM companies + WHERE id = ANY((TABLE companies_ids)::int4[]) + ), + first_addresses AS ( + SELECT company_id, city_id, addresses.id + FROM addresses + WHERE company_id = ANY((TABLE companies_ids)::int4[]) AND + position = 1 + ), + region_addresses AS ( + SELECT DISTINCT ON (addresses.company_id) + addresses.company_id, city_id, addresses.id + FROM addresses INNER JOIN + cities ON addresses.city_id = cities.id + WHERE addresses.company_id = ANY((TABLE companies_ids)::int4[]) AND + cities.region_id = $2 + ORDER BY addresses.company_id, addresses.position + ), + company_cities AS ( + SELECT addresses.company_id, + cities.name AS city_name, + cities.region_id AS city_region_id, + '+' || countries.phone_code || ' (' || phones.code || ')' AS phone_code, + phones.number as phone_number + FROM ( + SELECT first_addresses.company_id, + COALESCE(region_addresses.city_id, first_addresses.city_id) AS city_id, + COALESCE(region_addresses.id, first_addresses.id) AS address_id + FROM first_addresses LEFT JOIN + region_addresses ON first_addresses.company_id = region_addresses.company_id + ) AS addresses INNER JOIN + cities ON addresses.city_id = cities.id INNER JOIN + phones ON phones.address_id = addresses.address_id AND phones.position = 1 INNER JOIN + provinces ON provinces.id = cities.province_id INNER JOIN + countries ON countries.id = provinces.country_id + ), + _company_business_types AS ( + SELECT company_business_types.company_id, array_accum(company_business_types.business_type_id) AS business_types + FROM company_business_types + INNER JOIN selected_companies ON selected_companies.id = company_business_types.company_id + GROUP BY company_business_types.company_id + ), + prepared_users AS ( + SELECT + company_users.company_id, + company_users.user_id + FROM + company_users INNER JOIN + users ON company_users.user_id = users.id + WHERE + company_users.company_id = ANY((TABLE companies_ids)::int4[]) AND + company_users.is_representative = TRUE + ) + SELECT + selected_products.id, + selected_products.rubric_id, + selected_products.name, + selected_products.url_name, + selected_products.announce, + selected_products.announce_valid, + selected_products.is_exact_price, + selected_products.price::DOUBLE PRECISION, + selected_products.price_max::DOUBLE PRECISION, + selected_products.currency AS currency, + selected_products.exists, + selected_products.actualized_at, + selected_products.created_at, + selected_products.bold, + products_images.interpolated AS img_file_name, + products_images.interpolated_small AS img_file_name_small, + products_images.interpolated_medium AS img_file_name_medium, + selected_products.company_id, + selected_products.company_name, + company_cities.city_name AS company_city, + company_cities.city_region_id AS company_city_region_id, + company_cities.phone_code, + company_cities.phone_number, + selected_products.company_packet, + selected_products.company_products_region, + selected_products.company_has_email, + selected_products.company_products_count, + selected_products.company_online_store_type, + prepared_users.user_id, + _company_business_types.business_types, + CASE + WHEN _company_business_types.business_types @> '{3,6}' THEN 'опт, розница' + WHEN _company_business_types.business_types @> '{3}' THEN 'опт' + WHEN _company_business_types.business_types @> '{6}' THEN 'розница' + ELSE NULL + END AS btype, + selected_products.updated_at + FROM + selected_products INNER JOIN + company_cities ON selected_products.company_id = company_cities.company_id INNER JOIN + natural_order ON selected_products.id = natural_order.product_id LEFT JOIN + products_images ON products_images.product_id = selected_products.id LEFT JOIN + prepared_users ON selected_products.company_id = prepared_users.company_id LEFT JOIN + _company_business_types ON _company_business_types.company_id = selected_products.company_id + ORDER BY + natural_order.row_number + ) a; +$_$; + + +SET search_path = classes, pg_catalog; + +-- +-- Name: catalogue_rubric; Type: TABLE; Schema: classes; Owner: -; Tablespace: +-- + +CREATE TABLE catalogue_rubric ( + id integer NOT NULL, + parent_id integer, + lft integer, + rgt integer, + title character varying(255) NOT NULL, + joined_path character varying(255) NOT NULL, + is_normativka boolean, + next_level_normativka boolean, + cached_level smallint, + current_region_stats integer, + default_region_stats integer, + is_symlink boolean, + symlink_target_id integer, + children_count integer, + is_plural boolean, + short_title character varying(255) NOT NULL +); + + +SET search_path = public, pg_catalog; + +-- +-- Name: get_catalogue_rubricator(integer, integer); Type: FUNCTION; Schema: public; Owner: - +-- + +CREATE FUNCTION get_catalogue_rubricator(from_rubric_id integer, current_region_id integer) RETURNS SETOF classes.catalogue_rubric + LANGUAGE sql IMMUTABLE STRICT + AS $_$ +SELECT * FROM unnest(( + SELECT prerendered + FROM + prerendered_rubricators + WHERE + rubric_id = $1 AND + region_id = $2 + LIMIT 1 +)); +$_$; + + +-- +-- Name: get_company_main_rubric_4lvl(integer); Type: FUNCTION; Schema: public; Owner: - +-- + +CREATE FUNCTION get_company_main_rubric_4lvl(p_company_id integer) RETURNS integer + LANGUAGE plpgsql STABLE + AS $$ + DECLARE + result integer; + BEGIN + select t.rubric_id + into result + from ( + select + row_number( ) over ( order by t.cnt desc ) rn, + t.rubric_id + from ( + select rdt.rubric_l4_id rubric_id, count(*) cnt + from products p + inner join rubrics_denormalization_tree rdt ON rdt.rubric_id = p.rubric_id + where ( p.company_id = p_company_id ) + and ( p.state not in ('declined', 'deleted') ) + and ( p.is_public = true ) + group by rdt.rubric_l4_id + ) t + ) t + where t.rn = 1; + + return result; + END; + $$; + + +-- +-- Name: get_next_account_num(); Type: FUNCTION; Schema: public; Owner: - +-- + +CREATE FUNCTION get_next_account_num() RETURNS character varying + LANGUAGE plpgsql + AS $$ + DECLARE + l_now date; + l_year character varying; + l_sequence character varying; + l_relname character varying; + result character varying; + BEGIN + l_now = current_date; + l_year = to_char( l_now, 'YYYY' ); + l_sequence = 'accounts_num_seq_' || l_year; + + select relname into l_relname + from pg_catalog.pg_class + where relname = l_sequence + and relkind = 'S' + LIMIT 1; + + if not found then + EXECUTE 'CREATE SEQUENCE ' || l_sequence || ' MAXVALUE 9999 START 1'; + END IF; + + EXECUTE 'select nextval(''' || l_sequence || ''')' into result; + return 'ОПЦРУ-' || result || '/' || to_char( l_now, 'YY' ); + END + $$; + + +-- +-- Name: get_timestamp_diff(character varying, timestamp without time zone, timestamp without time zone); Type: FUNCTION; Schema: public; Owner: - +-- + +CREATE FUNCTION get_timestamp_diff(character varying, timestamp without time zone, timestamp without time zone) RETURNS integer + LANGUAGE plpgsql + AS $_$ + DECLARE + result integer; + BEGIN + SELECT date_part($1, (extract(epoch from $2 - $3) * interval '1 second'))::integer INTO result; + RETURN result; + END +$_$; + + +-- +-- Name: inet_aton(text); Type: FUNCTION; Schema: public; Owner: - +-- + +CREATE FUNCTION inet_aton(text) RETURNS bigint + LANGUAGE sql + AS $_$ +SELECT +split_part($1,'.',1)::int8*(256*256*256)+ +split_part($1,'.',2)::int8*(256*256)+ +split_part($1,'.',3)::int8*256+ +split_part($1,'.',4)::int8; +$_$; + + +-- +-- Name: inet_ntoa(bigint); Type: FUNCTION; Schema: public; Owner: - +-- + +CREATE FUNCTION inet_ntoa(bigint) RETURNS text + LANGUAGE sql + AS $_$ +SELECT (($1>>24) & 255::int8) || '.' || +(($1>>16) & 255::int8) || '.' || +(($1>>8) & 255::int8) || '.' || +($1 & 255::int8) as result +$_$; + + +-- +-- Name: kill_backend(integer); Type: FUNCTION; Schema: public; Owner: - +-- + +CREATE FUNCTION kill_backend(pid integer) RETURNS void + LANGUAGE plpgsql SECURITY DEFINER + AS $$ + begin + execute 'select pg_terminate_backend(' || pid || ')'; + end; +$$; + + +-- +-- Name: product_url_name(integer); Type: FUNCTION; Schema: public; Owner: - +-- + +CREATE FUNCTION product_url_name(product_id integer) RETURNS character varying + LANGUAGE plpgsql IMMUTABLE STRICT + AS $$ +DECLARE + product RECORD; +BEGIN + SELECT * INTO product FROM public.products WHERE id = product_id; + IF NOT FOUND THEN + RETURN NULL; + END IF; + + RETURN product_url_name(product.name); +END; +$$; + + +-- +-- Name: product_url_name(character varying); Type: FUNCTION; Schema: public; Owner: - +-- + +CREATE FUNCTION product_url_name(name character varying) RETURNS character varying + LANGUAGE plperl STRICT + AS $_X$ +# разбиваем входную строку по регулярному выражению и собираем результат через '_' +my $result = lc($_[0]); +$result =~ s/\W+/_/g; +# +# правила транслитерации взяты из статьи на wikipedia +# http://ru.wikipedia.org/wiki/%D0%A2%D1%80%D0%B0%D0%BD%D1%81%D0%BB%D0%B8%D1%82%D0%B5%D1%80%D0%B0%D1%86%D0%B8%D1%8F_%D1%80%D1%83%D1%81%D1%81%D0%BA%D0%BE%D0%B3%D0%BE_%D0%B0%D0%BB%D1%84%D0%B0%D0%B2%D0%B8%D1%82%D0%B0_%D0%BB%D0%B0%D1%82%D0%B8%D0%BD%D0%B8%D1%86%D0%B5%D0%B9#.D0.98.D0.BD.D0.BE.D1.8F.D0.B7.D1.8B.D1.87.D0.BD.D1.8B.D0.B5_.D1.81.D0.B8.D1.81.D1.82.D0.B5.D0.BC.D1.8B_.D1.82.D1.80.D0.B0.D0.BD.D1.81.D0.BB.D0.B8.D1.82.D0.B5.D1.80.D0.B0.D1.86.D0.B8.D0.B8_.D1.80.D1.83.D1.81.D1.81.D0.BA.D0.BE.D0.B3.D0.BE_.D1.8F.D0.B7.D1.8B.D0.BA.D0.B0 +# + +# заменяем Е и Ё на YE и YO в начале слов и после гласных +$result =~ s/(^|_|[ауоыиэяюёе])е/$1ye/g; +$result =~ s/(^|_|[ауоыиэяюёе])ё/$1yo/g; + +# пропускаем Й в окончаниях -ий, -ый +$result =~ s/([иы])й($|_)/$1$2/g; + +# пропускаем Ъ и Ь +$result =~ s/[ъь]//g; + +# многосимвольные замены +$result =~ s/ж/zh/g; +$result =~ s/кс/x/g; +$result =~ s/х/kh/g; +$result =~ s/ц/ts/g; +$result =~ s/ч/ch/g; +$result =~ s/ш/sh/g; +$result =~ s/щ/shch/g; +$result =~ s/ю/yu/g; +$result =~ s/я/ya/g; + +# простые замены +# $result =~ tr/абвгдеёзийклмнопрстуфыэ/abvgdeeziyklmnoprstufye/; +my %map = ('а'=>'a', 'б'=>'b', 'в'=>'v', 'г'=>'g', 'д'=>'d', + 'е'=>'e', 'ё'=>'e', 'з'=>'z', 'и'=>'i', 'й'=>'y', + 'к'=>'k', 'л'=>'l', 'м'=>'m', 'н'=>'n', 'о'=>'o', + 'п'=>'p', 'р'=>'r', 'с'=>'s', 'т'=>'t', 'у'=>'u', + 'ф'=>'f', 'ы'=>'y', 'э'=>'e'); +my $pos = -1; +for my $k (keys %map) { + while ( ($pos = index( $result, $k, $pos + 1)) > -1 ) { + substr( $result, $pos, 1, $map{$k} ); + } +} + +# удаляем из результата весь оставшийся мусор +$result =~ s/[^a-z0-9_]//g; +$result =~ s/(^_+)|(_+$)//g; + +return $result; + +$_X$; + + +-- +-- Name: recalculate_industries_joined_path(numeric, boolean); Type: FUNCTION; Schema: public; Owner: - +-- + +CREATE FUNCTION recalculate_industries_joined_path(i_industry_id numeric, i_visible boolean) RETURNS numeric + LANGUAGE plpgsql + AS $_$ +/* +Пересчитать вложенные отраслевые рубрики для указанной рубрики. +*/ + +DECLARE + + tmp_cur record; + tmp_lft INTEGER; + tmp_rgt INTEGER; + +BEGIN + + SELECT lft, rgt INTO tmp_lft, tmp_rgt FROM public.industries WHERE id = $1; + + FOR tmp_cur IN + WITH RECURSIVE temp1 (id, parent_id, lft, rgt) AS + ( + SELECT + t1.id, + t1.parent_id, + t1.lft, + t1.rgt + FROM + industries t1 + WHERE t1.id = $1 + + UNION + + SELECT + t2.id, + t2.parent_id, + t2.lft, + t2.rgt + FROM + industries t2 + INNER JOIN temp1 ON temp1.id = t2.parent_id + ) + SELECT + * + FROM temp1 + WHERE + lft > tmp_lft + AND rgt < tmp_rgt + ORDER BY + lft + Loop + + UPDATE public.industries + SET + joined_path = (SELECT joined_path FROM public.industries + WHERE id = tmp_cur.parent_id) || '/' || slug, + is_visible = COALESCE(i_visible, is_visible) + WHERE id = tmp_cur.id; + + END Loop; + + return 1; +end; +$_$; + + +-- +-- Name: recalculate_thematic_rubrics_joined_path(numeric, boolean); Type: FUNCTION; Schema: public; Owner: - +-- + +CREATE FUNCTION recalculate_thematic_rubrics_joined_path(i_thematic_rubric_id numeric, i_visible boolean) RETURNS numeric + LANGUAGE plpgsql + AS $_$ +/* +Пересчитать вложенные тематические рубрики для указанной рубрики. +*/ + +DECLARE + + tmp_cur record; + tmp_lft INTEGER; + tmp_rgt INTEGER; + +BEGIN + + SELECT lft, rgt INTO tmp_lft, tmp_rgt FROM public.thematic_rubrics WHERE id = $1; + + FOR tmp_cur IN + WITH RECURSIVE temp1 (id, parent_id, lft, rgt) AS + ( + SELECT + t1.id, + t1.parent_id, + t1.lft, + t1.rgt + FROM + public.thematic_rubrics t1 + WHERE t1.id = $1 + + UNION + + SELECT + t2.id, + t2.parent_id, + t2.lft, + t2.rgt + FROM + public.thematic_rubrics t2 + INNER JOIN temp1 ON temp1.id = t2.parent_id + ) + SELECT + * + FROM temp1 + WHERE + lft > tmp_lft + AND rgt < tmp_rgt + ORDER BY + lft + Loop + + UPDATE public.thematic_rubrics + SET + joined_path = (SELECT joined_path FROM public.thematic_rubrics + WHERE id = tmp_cur.parent_id) || '/' || slug, + is_visible = COALESCE($2, is_visible) + WHERE id = tmp_cur.id; + + END Loop; + + return 1; +end; +$_$; + + +-- +-- Name: render_catalogue_root_rubricator(integer, integer); Type: FUNCTION; Schema: public; Owner: - +-- + +CREATE FUNCTION render_catalogue_root_rubricator(current_region_id integer, max_level integer) RETURNS SETOF classes.catalogue_rubric + LANGUAGE plpgsql IMMUTABLE STRICT + AS $$ +BEGIN + RETURN QUERY + WITH r AS ( + SELECT + r.id, r.parent_id, r.lft, r.rgt, r.title, + r.joined_path, r.is_normativka, r.next_level_normativka, + r.cached_level::SMALLINT, + r.is_symlink, r.symlink_target_id, 0 as children_count, r.is_plural, r.short_title + FROM + rubrics r + WHERE + parent_id IS NOT NULL AND + cached_level > 0 AND + cached_level <= max_level + ), + curr AS ( + SELECT id, rubric_id, products_stat FROM rubric_statistics WHERE region_id = current_region_id + ) + SELECT + r.id, r.parent_id, r.lft, r.rgt, r.title, + r.joined_path, r.is_normativka, r.next_level_normativka, + r.cached_level::SMALLINT, + COALESCE(curr.products_stat, 0) AS current_region_stats, + COALESCE(curr.products_stat, 0) AS default_region_stats, + r.is_symlink, r.symlink_target_id, 0 as children_count, r.is_plural, r.short_title + FROM + r LEFT JOIN curr ON r.id = curr.rubric_id + ORDER BY r.lft; +END; +$$; + + +-- +-- Name: FUNCTION render_catalogue_root_rubricator(current_region_id integer, max_level integer); Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON FUNCTION render_catalogue_root_rubricator(current_region_id integer, max_level integer) IS 'Вычисляет корневой рубрикатор для региона'; + + +-- +-- Name: render_catalogue_rubricator(integer, integer); Type: FUNCTION; Schema: public; Owner: - +-- + +CREATE FUNCTION render_catalogue_rubricator(from_rubric_id integer, current_region_id integer) RETURNS SETOF classes.catalogue_rubric + LANGUAGE plpgsql IMMUTABLE STRICT + AS $$ +DECLARE + rubric RECORD; +BEGIN + -- load rubric + SELECT + id, parent_id, lft, rgt, cached_level AS "level", next_level_normativka, is_normativka + INTO rubric + FROM rubrics + WHERE id = from_rubric_id AND is_published = TRUE; + + IF NOT FOUND THEN + RETURN QUERY SELECT * FROM classes.catalogue_rubric LIMIT 1; + ELSIF rubric.is_normativka = TRUE OR (rubric.rgt - rubric.lft = 1) THEN + -- empty output + RETURN QUERY SELECT * FROM classes.catalogue_rubric LIMIT 1; + ELSE + RETURN QUERY + SELECT + * + FROM ( + WITH tree_l1 AS ( + SELECT + rubrics.id, + rubrics.parent_id, + COALESCE(rubrics.prefix_normativka || ' ' || rubrics.title, rubrics.title)::varchar AS title, + rubrics.lft, + rubrics.rgt, + rubrics.joined_path, + rubrics.is_normativka, + rubrics.next_level_normativka, + rubrics.cached_level AS level, + rubrics.is_symlink, + rubrics.symlink_target_id, + COALESCE(rubrics.is_plural, false) AS is_plural, + rubrics.short_title, + COALESCE(rubric_statistics.region_id, rs_sym.region_id) AS region_id, + COALESCE(rubric_statistics.products_stat, rs_sym.products_stat) AS current_region_stats, + -- сортировка для нормативок - по статистике + -- для остальных по порядку + CASE + WHEN rubrics.is_normativka = TRUE THEN 0 - COALESCE(rubric_statistics.products_stat, rs_sym.products_stat) + ELSE rubrics.lft + END AS first_order_field, + 0 AS second_order_field + FROM + rubrics + LEFT JOIN rubric_statistics ON (rubrics.id = rubric_statistics.rubric_id AND rubric_statistics.region_id = current_region_id) + LEFT JOIN rubric_statistics AS rs_sym ON + (rubrics.is_symlink = TRUE AND rubrics.symlink_target_id = rs_sym.rubric_id AND rs_sym.region_id = current_region_id) + WHERE + rubrics.parent_id = from_rubric_id AND + rubrics.is_published = TRUE + ), + tree_l2 AS ( + SELECT + *, + row_number() OVER (PARTITION BY first_order_field ORDER BY is_symlink::int4 ASC, current_region_stats DESC) AS second_order_field + FROM + ( + SELECT + rubrics.id, + rubrics.parent_id, + COALESCE(rubrics.prefix_normativka || ' ' || rubrics.title, rubrics.title)::varchar AS title, + rubrics.lft, + rubrics.rgt, + rubrics.joined_path, + rubrics.is_normativka, + rubrics.next_level_normativka, + rubrics.cached_level AS level, + rubrics.is_symlink, + rubrics.symlink_target_id, + COALESCE(rubrics.is_plural, false) AS is_plural, + rubrics.short_title, + COALESCE(rubric_statistics.region_id, rs_sym.region_id) AS region_id, + COALESCE(rubric_statistics.products_stat, rs_sym.products_stat) AS current_region_stats, + tree_l1.first_order_field + FROM + ( + SELECT * + FROM rubrics + WHERE parent_id IN (SELECT id FROM tree_l1) AND is_published = TRUE + ) AS rubrics + INNER JOIN tree_l1 ON rubrics.parent_id = tree_l1.id + LEFT JOIN rubric_statistics ON (rubrics.id = rubric_statistics.rubric_id AND rubric_statistics.region_id = current_region_id) + LEFT JOIN rubric_statistics AS rs_sym ON + (rubrics.is_symlink = TRUE AND rubrics.symlink_target_id = rs_sym.rubric_id AND rs_sym.region_id = current_region_id) + ) a + ), + tree AS ( + SELECT + *, (SELECT COUNT(*) FROM tree_l2 WHERE tree_l2.parent_id = tree_l1.id) children_count + FROM + tree_l1 + + UNION ALL + + SELECT + *, 0 AS children_count + FROM + tree_l2 + WHERE + second_order_field <= 7 + ) + SELECT + tree.id, + tree.parent_id, + tree.lft, + tree.rgt, + tree.title::varchar(255), + tree.joined_path, + tree.is_normativka, + tree.next_level_normativka, + tree.level::smallint AS cached_level, + COALESCE(tree.current_region_stats, 0) AS current_region_stats, + COALESCE(rubric_statistics.default_region_stats, 0) AS default_region_stats, + tree.is_symlink, + tree.symlink_target_id, + tree.children_count::int4 AS children_count, + tree.is_plural, + tree.short_title + FROM tree + LEFT JOIN + ( + SELECT + rubric_id, + products_stat AS default_region_stats + FROM + rubric_statistics + WHERE + rubric_id IN ( + SELECT COALESCE(symlink_target_id, id) FROM tree + ) AND + region_id = 0 + ) AS rubric_statistics ON COALESCE(tree.symlink_target_id, tree.id) = rubric_statistics.rubric_id + ORDER BY first_order_field ASC, second_order_field ASC + ) a; + END IF; +END; +$$; + + +-- +-- Name: FUNCTION render_catalogue_rubricator(from_rubric_id integer, current_region_id integer); Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON FUNCTION render_catalogue_rubricator(from_rubric_id integer, current_region_id integer) IS 'Вычисляет дерево подрубрик для рубрики'; + + +-- +-- Name: replace_dkvartal_with_dk(text); Type: FUNCTION; Schema: public; Owner: - +-- + +CREATE FUNCTION replace_dkvartal_with_dk(content text) RETURNS text + LANGUAGE plpgsql + AS $$ +DECLARE + new_content text; +BEGIN + -- Замена домена у ссылок и email + new_content = regexp_replace(content, '(http://(?:[\w]+\.)?|@)dkvartal(\.ru)', E'\\1dk\\2', 'g'); + -- Замена слов Dkvartal и DKVARTAL на DK, отсекаем ситуации, когда Dkvartal похож на часть slug + new_content = regexp_replace(new_content, '([^/_-]\m|^)Dkvartal|DKVARTAL', E'\\1DK', 'g'); + -- Замена слов dkvartal на dk в тексте, отсекаем ситуации, когда dkvartal похож на часть slug + new_content = regexp_replace(new_content, '([^/_-]\m|^)dkvartal', E'\\1dk', 'g'); + + RETURN new_content; +END; +$$; + + +-- +-- Name: rubric_url_name(character varying); Type: FUNCTION; Schema: public; Owner: - +-- + +CREATE FUNCTION rubric_url_name(name character varying) RETURNS character varying + LANGUAGE plperl STRICT + AS $_X$ +# разбиваем входную строку по регулярному выражению и собираем результат через '_' +my $result = join('_', (split( + # регулярному выражению соответствуют конструкции, + # которые не могут находиться в url-совместимом названии, - + # всякий мусор, не подпадающий под маску (a-z, A-Z, 0-9, _) + +/(\W+)/x, +lc($_[0]) +))); + +# заменяем Е и Ё на YE и YO в начале слов и после гласных +$result =~ s/(^|_|[ауоыиэяюёе])е/$1ye/g; +$result =~ s/(^|_|[ауоыиэяюёе])ё/$1yo/g; + +# пропускаем Й в окончаниях -ий, -ый +$result =~ s/([иы])й($|_)/$1$2/g; + +# пропускаем Ъ и Ь +$result =~ s/[ъь]//g; + +# многосимвольные замены +$result =~ s/ж/zh/g; +$result =~ s/кс/x/g; +$result =~ s/х/kh/g; +$result =~ s/ц/ts/g; +$result =~ s/ч/ch/g; +$result =~ s/ш/sh/g; +$result =~ s/щ/shch/g; +$result =~ s/ю/yu/g; +$result =~ s/я/ya/g; + +# простые замены +# $result =~ tr/абвгдеёзийклмнопрстуфыэ/abvgdeeziyklmnoprstufye/; +my %map = ('а'=>'a', 'б'=>'b', 'в'=>'v', 'г'=>'g', 'д'=>'d', + 'е'=>'e', 'ё'=>'e', 'з'=>'z', 'и'=>'i', 'й'=>'y', + 'к'=>'k', 'л'=>'l', 'м'=>'m', 'н'=>'n', 'о'=>'o', + 'п'=>'p', 'р'=>'r', 'с'=>'s', 'т'=>'t', 'у'=>'u', + 'ф'=>'f', 'ы'=>'y', 'э'=>'e'); +my $pos = -1; +for my $k (keys %map) { + while ( ($pos = index( $result, $k, $pos + 1)) > -1 ) { + substr( $result, $pos, 1, $map{$k} ); + } +} + +# удаляем из результата весь оставшийся мусор +$result =~ s/[^a-z0-9_]//g; +$result =~ s/(^_+)|(_+$)//g; +$result =~ s/[_]{2,}/_/g; + +return $result; + +$_X$; + + +-- +-- Name: update_ip_infos(); Type: FUNCTION; Schema: public; Owner: - +-- + +CREATE FUNCTION update_ip_infos() RETURNS integer + LANGUAGE plpgsql + AS $$ +DECLARE + ycurs refcursor; + icurs refcursor; + yrec RECORD; + irec RECORD; + p_city_id INTEGER; + sip BIGINT; + pip BIGINT; + max_d BIGINT; + d_length BIGINT; + done INTEGER; +BEGIN + done := 0; + max_d := 0; + OPEN ycurs FOR + SELECT ip, city_id FROM yandex_regions r + INNER JOIN ( + SELECT ip, lr, row_number() OVER (PARTITION BY ip ORDER BY visits_count DESC) FROM yandex_ips + ) i ON i.lr = r.region_id AND i.row_number = 1 + WHERE city_id IS NOT NULL; + + FETCH ycurs INTO yrec; + IF NOT FOUND THEN + RETURN 0; + END IF; + + p_city_id := yrec.city_id; + sip := yrec.ip; + pip := sip; + LOOP + FETCH ycurs INTO yrec; + + IF yrec.city_id != p_city_id OR NOT FOUND THEN + d_length = pip - sip; + IF d_length >= 64 AND max_d <= 10 THEN + OPEN icurs FOR + SELECT i.id, i.ip_start, i.ip_end, i.city_id + FROM ip_infos i + WHERE i.ip_start BETWEEN sip AND pip + OR i.ip_end BETWEEN sip AND pip + OR sip BETWEEN i.ip_start AND i.ip_end AND pip BETWEEN i.ip_start AND i.ip_end + ORDER BY i.ip_start; + LOOP + FETCH icurs INTO irec; + EXIT WHEN NOT FOUND; + IF irec.ip_start >= sip AND irec.ip_end <= pip THEN -- полностью входит в новый диапазон + DELETE FROM ip_infos WHERE id = irec.id; + + ELSIF irec.ip_start < sip AND irec.ip_end > pip THEN -- полностью покрывает новый диапазон + IF irec.city_id = p_city_id THEN + sip := irec.ip_start; + pip := irec.ip_end; + DELETE FROM ip_infos WHERE id = irec.id; + ELSE + UPDATE ip_infos SET ip_end = sip - 1 WHERE id = irec.id; + INSERT INTO ip_infos (ip_start, ip_end, city_id) VALUES (pip + 1, irec.ip_end, irec.city_id); + END IF; + + ELSIF irec.ip_start < sip THEN -- переcекает спереди + IF irec.city_id = p_city_id THEN + sip := irec.ip_start; + DELETE FROM ip_infos WHERE id = irec.id; + ELSE + UPDATE ip_infos SET ip_end = sip - 1 WHERE id = irec.id; + END IF; + + ELSIF irec.ip_end > pip THEN -- пересекает сзади + IF irec.city_id = p_city_id THEN + pip := irec.ip_end; + DELETE FROM ip_infos WHERE id = irec.id; + ELSE + UPDATE ip_infos SET ip_start = pip + 1 WHERE id = irec.id; + END IF; + + ELSE + RAISE EXCEPTION 'Ошибка'; + END IF; + END LOOP; + CLOSE icurs; + -- Вставить новый + INSERT INTO ip_infos (ip_start, ip_end, city_id) VALUES (sip, pip, p_city_id); + END IF; + p_city_id := yrec.city_id; + sip := yrec.ip; + max_d := 0; + ELSE + IF yrec.ip - pip > max_d THEN + max_d = yrec.ip - pip; + END IF; + END IF; + EXIT WHEN NOT FOUND; + pip := yrec.ip; + + done := done + 1; + IF done % 1000 = 0 THEN + RAISE NOTICE 'Пройдено % строк', done; + END IF; + END LOOP; + CLOSE ycurs; + RETURN 1; +END; +$$; + + +SET search_path = search, pg_catalog; + +-- +-- Name: add_to_queue_changed_synonyms(); Type: FUNCTION; Schema: search; Owner: - +-- + +CREATE FUNCTION add_to_queue_changed_synonyms() RETURNS integer + LANGUAGE plpgsql + AS $$ +DECLARE + last_date TIMESTAMP; +BEGIN + +-- определим дату последней индексации +SELECT updated_at INTO last_date +FROM public.glossary_log +WHERE operation = 'index_rows' +ORDER BY updated_at DESC +LIMIT 1; + +IF last_date IS NULL THEN + RETURN 0; +END IF; + +-- у которых есть рубрика, но нет базового слова +INSERT INTO search_index_queue (class_name, obj_id, created_at, updated_at) +SELECT * FROM ( + WITH _synonyms AS ( + SELECT s.id, s.rubric_id, r.lft, r.rgt + FROM synonyms s + INNER JOIN ( + SELECT s.id + FROM synonyms s + INNER JOIN base_words bs ON bs.id = s.synonym_id + LEFT JOIN search_wordforms wf_s ON wf_s.word = bs.name + WHERE + s.base_id IS NULL AND s.rubric_id IS NOT NULL + AND (s.updated_at > last_date + OR bs.updated_at > last_date + OR wf_s.updated_at > last_date) + GROUP BY s.id + ) sub ON sub.id = s.id + INNER JOIN rubrics r ON r.id = s.rubric_id + ) + + SELECT 'PriceListRow', p.id, import.to_utc(clock_timestamp()), import.to_utc(clock_timestamp()) + FROM price_list_rows p + INNER JOIN rubrics r ON r.id = p.rubric_id + INNER JOIN _synonyms s ON r.lft >= s.lft AND r.rgt <= s.rgt +) a; + +-- у которых есть рубрика и базовое слово +INSERT INTO search_index_queue (class_name, obj_id, created_at, updated_at) +SELECT * FROM ( + WITH _synonyms AS ( + SELECT s.id, s.rubric_id, r.lft, r.rgt, bw.name base_name + FROM synonyms s + INNER JOIN ( + SELECT s.id + FROM synonyms s + INNER JOIN base_words bs ON bs.id = s.synonym_id + LEFT JOIN search_wordforms wf_s ON wf_s.word = bs.name + INNER JOIN base_words bw ON bw.id = s.base_id + LEFT JOIN search_wordforms wf_b ON wf_b.word = bw.name + WHERE + s.base_id IS NOT NULL AND s.rubric_id IS NOT NULL + AND (s.updated_at > last_date + OR bs.updated_at > last_date + OR wf_s.updated_at > last_date + OR bw.updated_at > last_date + OR wf_b.updated_at > last_date) + GROUP BY s.id + ) sub ON sub.id = s.id + INNER JOIN rubrics r ON r.id = s.rubric_id + INNER JOIN base_words bw ON bw.id = s.base_id + ) + + SELECT 'PriceListRow', p.id, import.to_utc(clock_timestamp()), import.to_utc(clock_timestamp()) + FROM search_index_price_list_rows si + INNER JOIN price_list_rows p ON p.id = si.price_list_row_id + INNER JOIN rubrics r ON r.id = p.rubric_id + INNER JOIN _synonyms s ON r.lft >= s.lft AND r.rgt <= s.rgt AND si.terms_index @@ to_tsquery('simple', s.base_name) +) a; + +-- у которых нет рубрики, но есть базовое слово +INSERT INTO search_index_queue (class_name, obj_id, created_at, updated_at) +SELECT * FROM ( + WITH _synonyms AS ( + SELECT s.id, bw.name base_name + FROM synonyms s + INNER JOIN ( + SELECT s.id + FROM synonyms s + INNER JOIN base_words bs ON bs.id = s.synonym_id + LEFT JOIN search_wordforms wf_s ON wf_s.word = bs.name + INNER JOIN base_words bw ON bw.id = s.base_id + LEFT JOIN search_wordforms wf_b ON wf_b.word = bw.name + WHERE + s.base_id IS NOT NULL AND s.rubric_id IS NULL + AND (s.updated_at > last_date + OR bs.updated_at > last_date + OR wf_s.updated_at > last_date + OR bw.updated_at > last_date + OR wf_b.updated_at > last_date) + GROUP BY s.id + ) sub ON sub.id = s.id + INNER JOIN base_words bw ON bw.id = s.base_id + ) + + SELECT 'PriceListRow', p.id, import.to_utc(clock_timestamp()), import.to_utc(clock_timestamp()) + FROM search_index_price_list_rows si + INNER JOIN price_list_rows p ON p.id = si.price_list_row_id + INNER JOIN _synonyms s ON si.terms_index @@ to_tsquery('simple', s.base_name) +) a; + +RETURN 1; +END; +$$; + + +-- +-- Name: add_to_queue_changed_synonyms_product(); Type: FUNCTION; Schema: search; Owner: - +-- + +CREATE FUNCTION add_to_queue_changed_synonyms_product() RETURNS integer + LANGUAGE plpgsql + AS $$ +DECLARE + last_date TIMESTAMP; +BEGIN + +-- определим дату последней индексации +SELECT updated_at INTO last_date +FROM public.glossary_log +WHERE operation = 'index_products' +ORDER BY updated_at DESC +LIMIT 1; + +IF last_date IS NULL THEN + RETURN 0; +END IF; + +-- у которых есть рубрика и базовое слово +INSERT INTO search_index_queue (class_name, obj_id, created_at, updated_at) +SELECT * FROM ( + WITH _synonyms AS ( + SELECT s.id, s.rubric_id, r.lft, r.rgt, bw.name base_name + FROM synonyms s + INNER JOIN ( + SELECT s.id + FROM synonyms s + INNER JOIN base_words bs ON bs.id = s.synonym_id + LEFT JOIN search_wordforms wf_s ON wf_s.word = bs.name + INNER JOIN base_words bw ON bw.id = s.base_id + LEFT JOIN search_wordforms wf_b ON wf_b.word = bw.name + WHERE + s.base_id IS NOT NULL AND s.rubric_id IS NOT NULL + AND (s.updated_at > last_date + OR bs.updated_at > last_date + OR wf_s.updated_at > last_date + OR bw.updated_at > last_date + OR wf_b.updated_at > last_date) + GROUP BY s.id + ) sub ON sub.id = s.id + INNER JOIN rubrics r ON r.id = s.rubric_id + INNER JOIN base_words bw ON bw.id = s.base_id + ) + + SELECT 'Product', p.id, import.to_utc(clock_timestamp()), import.to_utc(clock_timestamp()) + FROM search_index_products si + INNER JOIN products p ON p.id = si.product_id + INNER JOIN rubrics r ON r.id = p.rubric_id + INNER JOIN _synonyms s ON r.lft >= s.lft AND r.rgt <= s.rgt AND si.terms_index @@ to_tsquery('simple', s.base_name) +) a; + +-- у которых нет рубрики, но есть базовое слово +INSERT INTO search_index_queue (class_name, obj_id, created_at, updated_at) +SELECT * FROM ( + WITH _synonyms AS ( + SELECT s.id, bw.name base_name + FROM synonyms s + INNER JOIN ( + SELECT s.id + FROM synonyms s + INNER JOIN base_words bs ON bs.id = s.synonym_id + LEFT JOIN search_wordforms wf_s ON wf_s.word = bs.name + INNER JOIN base_words bw ON bw.id = s.base_id + LEFT JOIN search_wordforms wf_b ON wf_b.word = bw.name + WHERE + s.base_id IS NOT NULL AND s.rubric_id IS NULL + AND (s.updated_at > last_date + OR bs.updated_at > last_date + OR wf_s.updated_at > last_date + OR bw.updated_at > last_date + OR wf_b.updated_at > last_date) + GROUP BY s.id + ) sub ON sub.id = s.id + INNER JOIN base_words bw ON bw.id = s.base_id + ) + + SELECT 'Product', p.id, import.to_utc(clock_timestamp()), import.to_utc(clock_timestamp()) + FROM search_index_products si + INNER JOIN products p ON p.id = si.product_id + INNER JOIN _synonyms s ON si.terms_index @@ to_tsquery('simple', s.base_name) +) a; + +RETURN 1; +END; +$$; + + +-- +-- Name: base_words_update_name_terms(); Type: FUNCTION; Schema: search; Owner: - +-- + +CREATE FUNCTION base_words_update_name_terms() RETURNS trigger + LANGUAGE plpgsql + AS $$ +begin + select array_agg(terms.word) into new.name_terms from search.extract_terms(new.name) as terms; + + return new; +end +$$; + + +-- +-- Name: companies_index_fields(integer[]); Type: FUNCTION; Schema: search; Owner: - +-- + +CREATE FUNCTION companies_index_fields(_ids integer[]) RETURNS SETOF companies_index_fieldset + LANGUAGE plpgsql IMMUTABLE + AS $$ + BEGIN + RETURN QUERY + -- 1. получаем сами компании + WITH _companies AS ( + SELECT + c.id, + c.name, + c.synonym, + c.name_rest, + ca.announce + FROM + companies c + LEFT JOIN + company_abouts ca ON ca.company_id = c.id AND ca.state NOT IN ('declined', 'deleted') + WHERE + c.id IN (SELECT * FROM unnest(_ids)) + ), + -- 2. адреса + _addresses AS ( + SELECT + a.company_id, + a.id AS address_id, + a.estate, + a.building, + a.comments, + a.street_id, + a.city_id + FROM + _companies c INNER JOIN + addresses a ON c.id = a.company_id + ), + -- 3. телефоны + _phones AS ( + SELECT + a.company_id, + p.number, + (p.code || p.number) AS full_number + FROM + _addresses a INNER JOIN + phones p ON a.address_id = p.address_id + ), + -- 4. сайты + _sites AS ( + SELECT + c.id AS company_id, + regexp_replace(regexp_replace(url, '^http(s)?://', ''), E'^www.', '') AS url + FROM + _companies c INNER JOIN + company_sites s ON c.id = s.company_id + ), + -- 5. адреса в человеческом виде + -- 5.1 временная таблица с улицами + _streets AS ( + SELECT + id, + type_id, + name, + city_id + FROM + streets + WHERE + id IN (SELECT street_id FROM _addresses) + ), + -- 5.2 временная таблица с городами + _cities AS ( + SELECT + id, province_id, name + FROM + cities + WHERE + id IN (SELECT city_id FROM _streets) + ), + _address_cities AS ( + SELECT + id, province_id, name + FROM + cities + WHERE + id IN (SELECT city_id FROM _addresses) + ), + _addresses_strings AS ( + SELECT + a.company_id, + regexp_replace( + COALESCE(p.name,'') || ' ' || COALESCE(c.name,COALESCE(ac.name, '')) || ' ' || COALESCE(st.name,'') || ' ' || COALESCE(s.name,'') || ' ' + || COALESCE(a.estate, '') || ' ' + || COALESCE(a.building, '') || ' ' + || COALESCE(a.comments, ''), + '[^0-9A-Za-zА-Яа-яёЁ.-]', ' ', 'gi') AS addr + FROM + _addresses a LEFT JOIN + _streets s ON a.street_id = s.id LEFT JOIN + street_types st ON s.type_id = st.id LEFT JOIN + _cities c ON s.city_id = c.id LEFT JOIN + _address_cities ac ON a.city_id = ac.id LEFT JOIN + provinces p ON c.province_id = p.id + ), + -- 6. рубрики + -- 6.1 временная таблица для ускорения выборки + _company_rubrics AS ( + SELECT + company_id, rubric_id + FROM + company_rubrics + WHERE + company_id IN (SELECT id FROM _companies) AND + rubric_level = 3 -- берем только листовые рубрики + ), + -- 6.2 сами рубрики + _rubrics AS ( + SELECT + _company_rubrics.company_id AS company_id, + rubrics.title AS title + FROM + _company_rubrics INNER JOIN + rubrics ON _company_rubrics.rubric_id = rubrics.id + ), + -- 7. раскидываем сырые данные по четырем полям + _fields AS ( + -- 1-4 поля = название + ОПФ + SELECT + company_id, + word, + field, + position + FROM ( + WITH _name_terms AS ( + SELECT + id AS company_id, + search.extract_not_stemmed_terms_custom( + COALESCE(name, '') || ' ' || + COALESCE(name_rest, '') + ) AS term + FROM + _companies + ) + SELECT + company_id, + (term).word AS word, + 1 AS field, + 1 AS position + FROM + _name_terms + WHERE + (term).position = 1 + UNION + SELECT + company_id, + (term).word AS word, + 2 AS field, + 2 AS position + FROM + _name_terms + WHERE + (term).position = 2 + UNION + SELECT + company_id, + (term).word AS word, + 3 AS field, + 3 AS position + FROM + _name_terms + WHERE + (term).position = 3 + UNION + SELECT + company_id, + (term).word AS word, + 4 AS field, + (term).position AS position + FROM + _name_terms + WHERE + (term).position > 3 + ) _name_fields + + -- 5 поле альт. название + UNION ALL + SELECT + company_id, + word, + field, + position + FROM ( + WITH _synonym_terms AS ( + SELECT + id AS company_id, + search.extract_not_stemmed_terms_custom(COALESCE(synonym, '')) AS term + FROM + _companies + ) + SELECT + company_id, + (term).word AS word, + 5 AS field, + (term).position AS position + FROM + _synonym_terms + ) _synonym_fields + + -- 6 поле = телефоны + сайты + UNION ALL + SELECT + company_id, + number AS word, + 6 AS field, + 1 AS position + FROM + _phones + UNION ALL + SELECT + company_id, + full_number AS word, + 6 AS field, + 1 AS position + FROM + _phones + UNION ALL + SELECT + company_id, + word, + field, + position + FROM ( + WITH _sites_terms AS ( + SELECT + company_id, + search.extract_not_stemmed_terms_custom(url) AS term + FROM + _sites + ) + SELECT + company_id, + (term).word AS word, + 6 AS field, + (term).position AS position + FROM + _sites_terms + ) _sites_fields + + -- 7 поле = адреса + UNION ALL + SELECT + company_id, + word, + field, + position + FROM ( + WITH _addresses_terms AS ( + SELECT + company_id, + search.extract_not_stemmed_terms_custom(addr) AS term + FROM + _addresses_strings + ) + SELECT + company_id, + (term).word AS word, + 7 AS field, + (term).position AS position + FROM + _addresses_terms + ) _addresses_fields + + -- 8 поле = рубрики + UNION ALL + SELECT + company_id, + word, + field, + position + FROM ( + WITH _rubrics_terms AS ( + SELECT + company_id, + search.extract_not_stemmed_terms_custom(title) AS term + FROM + _rubrics + ) + SELECT + company_id, + (term).word AS word, + 8 AS field, + (term).position AS position + FROM + _rubrics_terms + ) _rubrics_fields + + -- 9 поле = abouts + UNION ALL + SELECT + company_id, + word, + field, + position + FROM ( + WITH _abouts_terms AS ( + SELECT + id AS company_id, + search.extract_not_stemmed_terms_custom(COALESCE(announce, '')) AS term + FROM + _companies + ) + SELECT + company_id, + (term).word AS word, + 9 AS field, + (term).position AS position + FROM + _abouts_terms + ) _abouts_fields + ), + -- 8. загружаем словарь + _dict AS ( + SELECT + word, + form + FROM + search_wordforms + WHERE + "form" IN ( + SELECT + DISTINCT word + FROM + _fields + WHERE + word ~* '^[а-я]{3,}' + ) AND is_deleted != TRUE + ), + -- 9. приводим слова к базовой форме и выбрасываем дублирующиеся термы + _fields_morphological AS ( + (SELECT + company_id, + word, + field, + position + FROM + _fields) + UNION ALL + (SELECT + f.company_id, + COALESCE(d.word, f.word) AS word, + f.field, + f.position + 5000 + FROM + _fields f LEFT JOIN + _dict d ON f.word = d."form") + ORDER BY + position ASC + ), + -- 10. считаем поля для индекса + -- w1 + _index_w1 AS ( + SELECT + company_id, + array_to_string(array_agg(word), ' ') f + FROM _fields_morphological + WHERE field = 1 + GROUP BY company_id + ), + -- w2 + _index_w2 AS ( + SELECT + company_id, + array_to_string(array_agg(word), ' ') f + FROM _fields_morphological + WHERE field = 2 + GROUP BY company_id + ), + -- w3 + _index_w3 AS ( + SELECT + company_id, + array_to_string(array_agg(word), ' ') f + FROM _fields_morphological + WHERE field = 3 + GROUP BY company_id + ), + -- w4 + _index_w4 AS ( + SELECT + company_id, + array_to_string(array_agg(word), ' ') f + FROM _fields_morphological + WHERE field = 4 + GROUP BY company_id + ), + -- w5 + _index_w5 AS ( + SELECT + company_id, + array_to_string(array_agg(word), ' ') f + FROM _fields_morphological + WHERE field = 5 + GROUP BY company_id + ), + -- w6 + _index_w6 AS ( + SELECT + company_id, + array_to_string(array_agg(word), ' ') f + FROM _fields_morphological + WHERE field = 6 + GROUP BY company_id + ), + -- w7 + _index_w7 AS ( + SELECT + company_id, + array_to_string(array_agg(word), ' ') f + FROM _fields_morphological + WHERE field = 7 + GROUP BY company_id + ), + -- w8 + _index_w8 AS ( + SELECT + company_id, + array_to_string(array_agg(word), ' ') f + FROM _fields_morphological + WHERE field = 8 + GROUP BY company_id + ), + -- w9 + _index_w9 AS ( + SELECT + company_id, + array_to_string(array_agg(word), ' ') f + FROM _fields_morphological + WHERE field = 9 + GROUP BY company_id + ) + -- объединяем всё вместе + SELECT + i1.company_id AS company_id, + SUBSTRING(COALESCE(i1.f, '') FROM 1 FOR 255)::VARCHAR(255) AS w1, + SUBSTRING(COALESCE(i2.f, '') FROM 1 FOR 255)::VARCHAR(255) AS w2, + SUBSTRING(COALESCE(i3.f, '') FROM 1 FOR 255)::VARCHAR(255) AS w3, + SUBSTRING(COALESCE(i4.f, '') FROM 1 FOR 255)::VARCHAR(255) AS w4, + SUBSTRING(COALESCE(i5.f, '') FROM 1 FOR 255)::VARCHAR(255) AS w5, + SUBSTRING(COALESCE(i6.f, '') FROM 1 FOR 255)::VARCHAR(255) AS w6, + SUBSTRING(COALESCE(i7.f, '') FROM 1 FOR 255)::VARCHAR(255) AS w7, + SUBSTRING(COALESCE(i8.f, '') FROM 1 FOR 255)::VARCHAR(255) AS w8, + SUBSTRING(COALESCE(i9.f, '') FROM 1 FOR 255)::VARCHAR(255) AS w9 + FROM + _index_w1 i1 LEFT JOIN + _index_w2 i2 ON i1.company_id = i2.company_id LEFT JOIN + _index_w3 i3 ON i1.company_id = i3.company_id LEFT JOIN + _index_w4 i4 ON i1.company_id = i4.company_id LEFT JOIN + _index_w5 i5 ON i1.company_id = i5.company_id LEFT JOIN + _index_w6 i6 ON i1.company_id = i6.company_id LEFT JOIN + _index_w7 i7 ON i1.company_id = i7.company_id LEFT JOIN + _index_w8 i8 ON i1.company_id = i8.company_id LEFT JOIN + _index_w9 i9 ON i1.company_id = i9.company_id; + END; + $$; + + +SET search_path = classes, pg_catalog; + +-- +-- Name: search_term; Type: TABLE; Schema: classes; Owner: -; Tablespace: +-- + +CREATE TABLE search_term ( + word character varying(255) NOT NULL, + "position" smallint DEFAULT 1 NOT NULL +); + + +SET search_path = search, pg_catalog; + +-- +-- Name: extract_all_terms(text); Type: FUNCTION; Schema: search; Owner: - +-- + +CREATE FUNCTION extract_all_terms(str text) RETURNS SETOF classes.search_term + LANGUAGE plpgsql IMMUTABLE + AS $$ +BEGIN + RETURN QUERY + WITH + _not_stemmed_terms AS ( + SELECT * + FROM search.extract_not_stemmed_terms_custom(str) + ), + _stemmed_terms AS ( + WITH dict AS ( + SELECT * + FROM search_wordforms + WHERE "form" IN (SELECT word FROM _not_stemmed_terms WHERE word ~* '^[а-я]{3,}') AND + is_deleted = FALSE + ) + SELECT + COALESCE(dict.word, t.word) AS word, t.position + FROM + _not_stemmed_terms t LEFT JOIN + dict ON t.word = dict."form" + ) + SELECT * + FROM _not_stemmed_terms + UNION ALL + SELECT * + FROM _stemmed_terms; +END; +$$; + + +-- +-- Name: extract_full_terms(text); Type: FUNCTION; Schema: search; Owner: - +-- + +CREATE FUNCTION extract_full_terms(str text) RETURNS SETOF classes.search_term + LANGUAGE plpgsql IMMUTABLE + AS $$ + BEGIN + RETURN QUERY + SELECT word, position FROM ( + WITH not_stemmed AS ( + SELECT * FROM search.extract_not_stemmed_full_terms(str) + ), + dict AS ( + SELECT * + FROM search_wordforms + WHERE "form" IN (SELECT word FROM not_stemmed WHERE word ~* '^[а-я]{3,}') AND + is_deleted = FALSE + ) + SELECT + COALESCE(dict.word, t.word) AS word, t.position + FROM + not_stemmed t LEFT JOIN + dict ON t.word = dict."form" + ) a + GROUP BY word, position + ORDER BY position ASC; + END; + $$; + + +-- +-- Name: extract_not_stemmed_full_terms(text); Type: FUNCTION; Schema: search; Owner: - +-- + +CREATE FUNCTION extract_not_stemmed_full_terms(text) RETURNS SETOF classes.search_term + LANGUAGE plperl IMMUTABLE COST 1 ROWS 10 + AS $_X$ +# разбить строку на термы и вернуть их +# если строка пустая, ничего не вычислять +my $str = $_[0]; +chomp($str); # убрать \n из строки + +# убрать лишние пробелы и табуляции +$str =~ s/^\s+//; +$str =~ s/\s+$//; + +# прочитать в память имена единиц измерений (сформировать рег.выр.) +#my $unit_names_q = spi_exec_query('SELECT search.read_unit_names() AS un', 1); +#my $unit_names_preg = $unit_names_q->{rows}[0]->{un}; +my $unit_names_preg = "А|атм|В|Вт|Гб|ГГц|Гц|Кб|кВ|кВт|кг|кПа|л|м/с|м2|м3|мА|Мб|МГц|мин|мм|об/мин|п.м|п/м|Па|см|см3|ч|шт"; + +# 1. форматирование чисел +# сначала меняем в отдельно стоящих числах "," на "." +$str =~ s/\b(\d+)[,.]{1}(\d+)\b/$1.$2/gi; +# тоже самое, только если рядом ещё прилеплена единица измерения +$str =~ s/\b(\d+)[,.]{1}(\d+)($unit_names_preg)\b/$1.$2$3/gi; +# отделим еденицу измерения от числа +$str =~ s/\b(\d+)($unit_names_preg)\b/$1 $2/gi; +$str =~ s/\b(\d+)[.]{1}(\d+)($unit_names_preg)\b/$1.$2 $3/gi; + +# вырезания ноликов спереди и сзади чисел для отдельно стоящих чисел +$str =~ s/(\d+\.\d*[123456789]+)[0]+\b/$1$2/gi; +$str =~ s/(\d+)\.[0]+\b/$1$2/gi; +$str =~ s/( |^)(?:(? $word, position => $position}); + + $position++; +} + +return undef; +$_X$; + + +-- +-- Name: extract_not_stemmed_terms(text); Type: FUNCTION; Schema: search; Owner: - +-- + +CREATE FUNCTION extract_not_stemmed_terms(text) RETURNS SETOF classes.search_term + LANGUAGE plperl IMMUTABLE COST 1 ROWS 10 + AS $_X$ +# разбить строку на термы и вернуть их +# если строка пустая, ничего не вычислять +my $str = $_[0]; +chomp($str); # убрать \n из строки + +# убрать лишние пробелы и табуляции +$str =~ s/^\s+//; +$str =~ s/\s+$//; + +# прочитать в память имена единиц измерений (сформировать рег.выр.) +#my $unit_names_q = spi_exec_query('SELECT search.read_unit_names() AS un', 1); +#my $unit_names_preg = $unit_names_q->{rows}[0]->{un}; +my $unit_names_preg = "А|атм|В|Вт|Гб|ГГц|Гц|Кб|кВ|кВт|кг|кПа|л|м/с|м2|м3|мА|Мб|МГц|мин|мм|об/мин|п.м|п/м|Па|см|см3|ч|шт"; + +# 1. форматирование чисел +# сначала меняем в отдельно стоящих числах "," на "." +$str =~ s/\b(\d+)[,.]{1}(\d+)\b/$1.$2/gi; +# тоже самое, только если рядом ещё прилеплена единица измерения +$str =~ s/\b(\d+)[,.]{1}(\d+)($unit_names_preg)\b/$1.$2$3/gi; + +# вырезания ноликов спереди и сзади чисел для отдельно стоящих чисел +# [^\-\B] граница слова, но не дефис, раньше было \b +$str =~ s/(\d+\.\d*[123456789]+)[0]+(\b|$unit_names_preg)+/$1$2$3/gi; +$str =~ s/(\d+)\.[0]+(\b|$unit_names_preg)+/$1$2$3/gi; +$str =~ s/(\b|^)(?:(?{rows}[0]->{sw}; +my @stop_words_array = split(/\|/g, $stop_words_preg); + +my @words_without_stop_words = (); +# сначала поменяем ё на е и всё сделаем нижним регистром +foreach $word (@words) { + $word =~ s/[ёЁ]/е/g; + $word = lc($word); # lowercase + push(@words_without_stop_words, $word) if (!grep $_ eq $word, @stop_words_array); +} + +# 4. второе разбиение +#my $spec_words_q = spi_exec_query('SELECT search.read_spec_words() AS sw', 1); +#my $spec_words_preg = $spec_words_q->{rows}[0]->{sw}; +my $spec_words_preg = "б\/у|б\/ш|г\/д|г\/к|ж\/б|ж\/д|м\/д|н\/д|н\/у|п\/ш|п\/э|с\/т|с\/х|т\/о|х\/д|х\/к|ч\/б|ч\/м|э\/св"; +my @spec_words_array = split(/\|/g, $spec_words_preg); +my @terms = (); +my $position = 1; +my $parts_position = 10000; + +foreach $word (@words_without_stop_words) { + # если слово является спец-словом, то не разбиваем его + @wrds = (); + push(@wrds, $word); + $to_check_for_num = ''; + if (grep $_ eq $word, @spec_words_array) { + # skip + push(@wrds, $word); + } else { + @word_parts = (); + push(@word_parts, $word); + # дефисы + if ($word =~ m/((?:[^' \/\-]{1}|(? 1) { + $parts_position++; + } + + $sub_position++; + } + + $position++; +} + +my %used_terms; +$i = 0; +foreach $term (@terms) { + if ($i % 2 == 0) { + $word = $term; + } else { + if (!$used_terms{$word} || $used_terms{$word} < $term) { + $used_terms{$word} = $term; + return_next({word => $word, position => $term}); + } + } + $i++; +} + +return undef; +$_X$; + + +-- +-- Name: extract_not_stemmed_terms_custom(text); Type: FUNCTION; Schema: search; Owner: - +-- + +CREATE FUNCTION extract_not_stemmed_terms_custom(str text) RETURNS SETOF classes.search_term + LANGUAGE plpgsql IMMUTABLE + AS $$ +BEGIN + RETURN QUERY + SELECT word, MIN(position) AS position FROM ( + SELECT word, (ROW_NUMBER() OVER ())::smallint AS position + FROM search.extract_not_stemmed_terms(str) + ) _t + GROUP BY word + ORDER BY position; +END; +$$; + + +-- +-- Name: extract_not_stemmed_terms_fefelov(text); Type: FUNCTION; Schema: search; Owner: - +-- + +CREATE FUNCTION extract_not_stemmed_terms_fefelov(text) RETURNS SETOF classes.search_term + LANGUAGE plperl IMMUTABLE ROWS 10000 + AS $_X$ +# разбить строку на термы и вернуть их +# если строка пустая, ничего не вычислять +my $str = $_[0]; +chomp($str); # убрать \n из строки + +# убрать лишние пробелы и табуляции +$str =~ s/^\s+//; +$str =~ s/\s+$//; + +# прочитать в память имена единиц измерений (сформировать рег.выр.) +#my $unit_names_q = spi_exec_query('SELECT search.read_unit_names() AS un', 1); +#my $unit_names_preg = $unit_names_q->{rows}[0]->{un}; +my $unit_names_preg = "А|атм|В|Вт|Гб|ГГц|Гц|Кб|кВ|кВт|кг|кПа|л|м/с|м2|м3|мА|Мб|МГц|мин|мм|об/мин|п.м|п/м|Па|см|см3|ч|шт"; + +# 1. форматирование чисел +# сначала меняем в отдельно стоящих числах "," на "." +$str =~ s/\b(\d+)[,.]{1}(\d+)\b/$1.$2/gi; +# теперь еще что-то делаем +$str =~ s/\b(\d+)[,.]{1}(\d+)($unit_names_preg)\b/$1.$2$3/gi; + +# вырезания ноликов спереди и сзади чисел для отдельно стоящих чисел +# [^\-\B] граница слова, но не дефис, раньше было \b +$str =~ s/(\d+\.\d*[123456789]+)[0]+(\b|$unit_names_preg)+/$1$2$3/gi; +$str =~ s/(\d+)\.[0]+(\b|$unit_names_preg)+/$1$2$3/gi; +$str =~ s/(\b|^)(?:(?{rows}[0]->{sw}; +#my $stop_words_preg = "5м|5мм|com..."; +my @stop_words_array = split(/\|/g, $stop_words_preg); + +my @words_without_stop_words = (); +# сначала поменяем ё на е и всё сделаем нижним регистром +foreach $word (@words) { + $word =~ s/[ёЁ]/е/g; + $word = lc($word); # lowercase + push(@words_without_stop_words, $word) if (!grep $_ eq $word, @stop_words_array); +} + +# 4. второе разбиение +#my $spec_words_q = spi_exec_query('SELECT search.read_spec_words() AS sw', 1); +#my $spec_words_preg = $spec_words_q->{rows}[0]->{sw}; +my $spec_words_preg = "б\/у|б\/ш|г\/д|г\/к|ж\/б|ж\/д|м\/д|н\/д|н\/у|п\/ш|п\/э|с\/т|с\/х|т\/о|х\/д|х\/к|ч\/б|ч\/м|э\/св"; +my @spec_words_array = split(/\|/g, $spec_words_preg); +my @terms = (); +my $position = 1; + +foreach $word (@words_without_stop_words) { + # если слово является спец-словом, то не разбиваем его + @wrds = (); + #push(@wrds, $word); + $to_check_for_num = ''; + if (grep $_ eq $word, @spec_words_array) { + # skip + push(@wrds, $word); + } else { + @word_parts = (); + push(@word_parts, $word); + # дефисы + if ($word =~ m/((?:[^' \/\-]{1}|(? $word, position => $term}); + } + } + $i++; +} + +return undef; +$_X$; + + +-- +-- Name: extract_terms(text); Type: FUNCTION; Schema: search; Owner: - +-- + +CREATE FUNCTION extract_terms(str text) RETURNS SETOF classes.search_term + LANGUAGE plpgsql IMMUTABLE + AS $$ + BEGIN + RETURN QUERY + SELECT word, MIN(position)::smallint FROM ( + WITH not_stemmed AS ( + SELECT * FROM search.extract_not_stemmed_terms(str) + ), + dict AS ( + SELECT * + FROM search_wordforms + WHERE "form" IN (SELECT word FROM not_stemmed WHERE word ~* '^[а-я]{3,}') AND + is_deleted = FALSE + ) + SELECT + COALESCE(dict.word, t.word) AS word, t.position + FROM + not_stemmed t LEFT JOIN + dict ON t.word = dict."form" + ) a + GROUP BY word + ORDER BY MIN(position) ASC; + END; + $$; + + +-- +-- Name: heuristic_stemm_word(character varying); Type: FUNCTION; Schema: search; Owner: - +-- + +CREATE FUNCTION heuristic_stemm_word(str character varying) RETURNS character varying + LANGUAGE plperl + AS $_X$ +my $VOWEL = 'аеиоуыэюя'; +my $PERFECTIVEGROUND = '((ив|ивши|ившись|ыв|ывши|ывшись)|((?<=[ая])(в|вши|вшись)))$'; +my $REFLEXIVE = '(с[яь])$'; +my $ADJECTIVE = '(ее|ие|ые|ое|ими|ыми|ей|ий|ый|ой|ем|им|ым|ом|его|ого|ему|ому|их|ых|ую|юю|ая|яя|ою|ею)$'; +my $PARTICIPLE = '((ивш|ывш|ующ)|((?<=[ая])(ем|нн|вш|ющ|щ)))$'; +my $VERB = '((ила|ыла|ена|ейте|уйте|ите|или|ыли|ей|уй|ил|ыл|им|ым|ен|ило|ыло|ено|ят|ует|уют|ит|ыт|ены|ить|ыть|ишь|ую|ю)|((?<=[ая])(ла|на|ете|йте|ли|й|л|ем|н|ло|но|ет|ют|ны|ть|ешь|нно)))$'; +my $NOUN = '(а|ев|ов|ие|ье|е|иями|ями|ами|еи|ии|и|ией|ей|ой|ий|й|иям|ям|ием|ем|ам|ом|о|у|ах|иях|ях|ы|ь|ию|ью|ю|ия|ья|я)$'; +my $RVRE = '^(.*?[аеиоуыэюя])(.*)$'; +my $DERIVATIONAL = '[^аеиоуыэюя][аеиоуыэюя]+[^аеиоуыэюя]+[аеиоуыэюя].*(?<=о)сть?$'; + +my $word = lc($_[0]); # lowercase +$word =~ s/ё/е/g; + +my ($start, $RV) = $word =~ /^(.*?[аеиоуыэюя])(.*)$/; +return $word unless $RV; + +# Step 1 +unless ($RV =~ s/$PERFECTIVEGROUND//) { + $RV =~ s/$REFLEXIVE//; + + if ($RV =~ s/$ADJECTIVE//) { + $RV =~ s/$PARTICIPLE//; + } else { + $RV =~ s/$NOUN// unless $RV =~ s/$VERB//; + } +} + +# Step 2 +$RV =~ s/й$//; + +# Step 3 +$RV =~ s/пуфш?$// if $RV =~ /$DERIVATIONAL/; + +# Step 4 +unless ($RV =~ s/ш$//) { + $RV =~ s/екые?//; + $RV =~ s/оо$/о/; +} + +return $start . $RV; +$_X$; + + +-- +-- Name: index_company(integer); Type: FUNCTION; Schema: search; Owner: - +-- + +CREATE FUNCTION index_company(_id integer) RETURNS integer + LANGUAGE plpgsql + AS $$ +DECLARE + current_index RECORD; + new_index search.companies_index_fieldset; +BEGIN + SELECT * INTO new_index FROM search.companies_index_fields(ARRAY[_id]); + + SELECT * INTO current_index FROM search_index_companies WHERE company_id = _id; + IF NOT FOUND THEN + INSERT INTO search_index_companies + (company_id, w1, w2, w3, w4, w5, w6, w7, w8, w9, created_at, updated_at) + VALUES ( + new_index.company_id, + new_index.w1, + new_index.w2, + new_index.w3, + new_index.w4, + new_index.w5, + new_index.w6, + new_index.w7, + new_index.w8, + new_index.w9, + import.to_utc(clock_timestamp()), + import.to_utc(clock_timestamp()) + ); + ELSE + IF COALESCE(current_index.w1, '') <> new_index.w1 OR + COALESCE(current_index.w2, '') <> new_index.w2 OR + COALESCE(current_index.w3, '') <> new_index.w3 OR + COALESCE(current_index.w4, '') <> new_index.w4 OR + COALESCE(current_index.w5, '') <> new_index.w5 OR + COALESCE(current_index.w6, '') <> new_index.w6 OR + COALESCE(current_index.w7, '') <> new_index.w7 OR + COALESCE(current_index.w8, '') <> new_index.w8 OR + COALESCE(current_index.w9, '') <> new_index.w9 + THEN + UPDATE search_index_companies SET + w1 = new_index.w1, + w2 = new_index.w2, + w3 = new_index.w3, + w4 = new_index.w4, + w5 = new_index.w5, + w6 = new_index.w6, + w7 = new_index.w7, + w8 = new_index.w8, + w9 = new_index.w9, + updated_at = import.to_utc(clock_timestamp()) + WHERE id = current_index.id; + END IF; + END IF; + + RETURN 1; +END; +$$; + + +-- +-- Name: index_demands(integer[]); Type: FUNCTION; Schema: search; Owner: - +-- + +CREATE FUNCTION index_demands(ids integer[]) RETURNS void + LANGUAGE plpgsql + AS $$ +DECLARE + _ids INTEGER[]; +BEGIN + _ids := ids; + IF ids IS NULL THEN + SELECT array_agg(id) INTO _ids FROM demands; + END IF; + + DELETE FROM search_index_demands WHERE demand_id = ANY(_ids); + + INSERT INTO search_index_demands (demand_id, w1, w2) + WITH _demand_items AS ( + SELECT demands.id, + demand_items.title, + demand_items.rubric_id, + rdt.rubric_l1_id, + rdt.rubric_l2_id, + rdt.rubric_l3_id, + rdt.rubric_l4_id + FROM demands + INNER JOIN demand_items ON demand_items.demand_id = demands.id + INNER JOIN rubrics_denormalization_tree rdt ON rdt.rubric_id = demand_items.rubric_id + WHERE demands.id = ANY(_ids) + ), + _terms AS ( + SELECT DISTINCT + t.id, + COALESCE(w.word, t.term) AS word, + 1 AS position + FROM + ( + SELECT id, + (search.extract_not_stemmed_terms(title)).word AS term + FROM _demand_items + ) t LEFT JOIN + search_wordforms AS w ON (t.term = w."form" AND w.is_deleted = FALSE) + ), + _synonyms AS ( + SELECT + r.id, + bw.name synonym + FROM + _demand_items r INNER JOIN + synonyms s ON (s.rubric_id IN (r.rubric_l1_id, r.rubric_l2_id, r.rubric_l3_id, r.rubric_l4_id, r.rubric_id) AND s.is_new = FALSE AND s.is_deleted = FALSE) INNER JOIN + base_words bw ON (bw.id = s.synonym_id AND bw.is_deleted = FALSE) + WHERE s.base_id IS NULL + UNION ALL + SELECT + r.id, + bs.name synonym + FROM + _demand_items r INNER JOIN + _terms t ON r.id = t.id INNER JOIN + synonyms s ON (s.rubric_id IN (r.rubric_l1_id, r.rubric_l2_id, r.rubric_l3_id, r.rubric_l4_id, r.rubric_id) AND s.is_new = FALSE AND s.is_deleted = FALSE) INNER JOIN + base_words bs ON (bs.id = s.synonym_id AND bs.is_deleted = FALSE) INNER JOIN + base_words bw ON (bw.id = s.base_id AND bw.is_deleted = FALSE) + WHERE bw.name = t.word + UNION ALL + SELECT + r.id, + bs.name synonym + FROM + _demand_items r INNER JOIN + _terms t ON r.id = t.id INNER JOIN + synonyms s ON (s.rubric_id IS NULL AND s.is_new = FALSE AND s.is_deleted = FALSE) INNER JOIN + base_words bs ON (bs.id = s.synonym_id AND bs.is_deleted = FALSE) INNER JOIN + base_words bw ON (bw.id = s.base_id AND bw.is_deleted = FALSE) + WHERE bw.name = t.word + ), + _terms_and_synonyms AS ( + SELECT + DISTINCT id, word, MIN(position) AS position + FROM + ( + SELECT * FROM _terms + UNION + SELECT id, synonym, 2 FROM _synonyms + ) t + GROUP BY id, word + ) + SELECT + id, + array_to_string(array_agg(w1), ' ') AS w1, + array_to_string(array_agg(w2), ' ') AS w2 + FROM + ( + SELECT + id, + CASE WHEN position = 1 THEN word ELSE NULL END AS w1, + CASE WHEN position = 2 THEN word ELSE NULL END AS w2 + FROM + _terms_and_synonyms + ) a + GROUP BY id; +END; +$$; + + +-- +-- Name: index_price_list_row(integer); Type: FUNCTION; Schema: search; Owner: - +-- + +CREATE FUNCTION index_price_list_row(_id integer) RETURNS integer + LANGUAGE plpgsql + AS $$ +DECLARE + price_list_row RECORD; + current_index RECORD; + + _w1 TEXT; + _w2 TEXT; + _w3 TEXT; + _w4 TEXT; + _w5 TEXT; + _w6 TEXT; +BEGIN + -- сначала загрузить саму строчку + SELECT + p.id, + p.rubric_id, + p.rubric_l4_id, + p.rubric_l3_id, + p.rubric_l2_id, + CASE + WHEN + r.is_normativka = TRUE AND + r.prefix_normativka IS NOT NULL AND + r.prefix_normativka <> '' + THEN + r.prefix_normativka || ' ' || p.title + ELSE + p.title + END AS t + INTO price_list_row + FROM + price_list_rows p INNER JOIN + rubrics r ON p.rubric_id = r.id + WHERE + p.id = _id AND + p.is_deleted = FALSE; + IF NOT FOUND THEN + RETURN 0; + END IF; + + SELECT array_to_string(array_agg(t.word), ' ') INTO _w1 + FROM search.extract_terms(price_list_row.t) AS t + WHERE t.position = 1; + + -- 2 поле = синонимы + SELECT + array_to_string(array_agg(synonym), ' ') INTO _w2 + FROM + search.synonyms + WHERE + ( + rubric_id IN (price_list_row.rubric_l3_id, price_list_row.rubric_l2_id) AND + rubric_level = 3 + ) OR + ( + rubric_id IN (price_list_row.rubric_l4_id, price_list_row.rubric_l3_id) AND + rubric_level = 4 + ) OR + ( + rubric_id IN (price_list_row.rubric_id, price_list_row.rubric_l4_id) AND + rubric_level = 5 AND + keyword IN ( + SELECT word FROM search.extract_terms(price_list_row.t) + ) + ); + + SELECT array_to_string(array_agg(t.word), ' ') INTO _w3 + FROM search.extract_terms(price_list_row.t) AS t + WHERE t.position = 2; + + SELECT array_to_string(array_agg(t.word), ' ') INTO _w4 + FROM search.extract_terms(price_list_row.t) AS t + WHERE t.position = 3; + + SELECT array_to_string(array_agg(t.word), ' ') INTO _w5 + FROM search.extract_terms(price_list_row.t) AS t + WHERE t.position = 4; + + SELECT array_to_string(array_agg(t.word), ' ') INTO _w6 + FROM search.extract_terms(price_list_row.t) AS t + WHERE t.position > 4; + + _w1 := SUBSTRING(_w1 from 1 for 300); + _w2 := SUBSTRING(_w2 from 1 for 300); + _w3 := SUBSTRING(_w3 from 1 for 300); + _w4 := SUBSTRING(_w4 from 1 for 300); + _w5 := SUBSTRING(_w5 from 1 for 300); + _w6 := SUBSTRING(_w6 from 1 for 300); + + SELECT * INTO current_index FROM search_index_price_list_rows WHERE price_list_row_id = _id; + IF NOT FOUND THEN + INSERT INTO search_index_price_list_rows (price_list_row_id, w1, w2, w3, w4, w5, w6, created_at, updated_at) + VALUES (_id, + _w1, + _w2, + _w3, + _w4, + _w5, + _w6, + NOW(), + NOW() + ); + ELSE + IF COALESCE(current_index.w1, '') <> _w1 OR + COALESCE(current_index.w2, '') <> _w2 OR + COALESCE(current_index.w3, '') <> _w3 OR + COALESCE(current_index.w4, '') <> _w4 OR + COALESCE(current_index.w5, '') <> _w5 OR + COALESCE(current_index.w6, '') <> _w6 + THEN + UPDATE search_index_price_list_rows SET w1 = _w1, w2 = _w2, w3 = _w3, w4 = _w4, w5 = _w5, + w6 = _w6, updated_at = NOW() WHERE id = current_index.id; + END IF; + END IF; + + RETURN 1; +END; +$$; + + +-- +-- Name: index_product_fefelov(integer); Type: FUNCTION; Schema: search; Owner: - +-- + +CREATE FUNCTION index_product_fefelov(_id integer) RETURNS integer + LANGUAGE plpgsql COST 10 + AS $$ +DECLARE + prod RECORD; + current_index RECORD; + _w1 character(256); + _w2 character(256); + _w3 character(256); + _w4 character(256); + _w5 character(256); + _w6 character(256); + _terms_index TEXT; + _tags_idx INT[]; + _traits_idx INT[]; + _rate INT; + _img_count INT; + _arr_name character varying[]; + _arr_announce character varying[]; + _term TEXT; +BEGIN + -- сначала загрузить сам товар + SELECT + products.*, + r.rubric_l1_id, + r.rubric_l2_id, + r.rubric_l3_id, + r.rubric_l4_id + INTO prod + FROM + products LEFT JOIN + rubrics_denormalization_tree AS r ON products.rubric_id = r.rubric_id + WHERE id = _id; + + IF NOT FOUND THEN + RETURN 0; + END IF; + + SELECT array_to_string(array_agg(word), ' ') into _w1 from search.extract_terms(prod.name) as t where t.position = 1 ; + SELECT array_to_string(array_agg(word), ' ') into _w3 from search.extract_terms(prod.name) as t where t.position = 2 ; + SELECT array_to_string(array_agg(word), ' ') into _w4 from search.extract_terms(prod.name) as t where t.position = 3 ; + SELECT array_to_string(array_agg(word), ' ') into _w5 from search.extract_terms(prod.name) as t where t.position > 3 ; + SELECT array_to_string(array_agg(word), ' ') into _w6 from search.extract_terms(prod.announce) as t; + SELECT array_agg(word) into _terms_index from search.extract_terms(prod.name||' '||prod.announce) as t; + + --_w1 := SUBSTRING(_w1 from 1 for 256); + + SELECT array_to_string(array_agg(a.synonym), ' ') INTO _w2 + FROM ( + SELECT prod.id id, bw.name synonym + FROM synonyms s + INNER JOIN base_words bw ON (bw.id = s.synonym_id AND bw.is_deleted = FALSE) + WHERE + s.rubric_id IN (prod.rubric_l1_id, prod.rubric_l2_id, prod.rubric_l3_id, prod.rubric_l4_id, prod.rubric_id) + AND s.is_new = FALSE AND s.is_deleted = FALSE AND s.base_id IS NULL + + UNION + + SELECT prod.id id, bs.name synonym + FROM synonyms s + INNER JOIN base_words bs ON (bs.id = s.synonym_id AND bs.is_deleted = FALSE) + INNER JOIN base_words bw ON (bw.id = s.base_id AND bw.is_deleted = FALSE) + INNER JOIN + (select unnest(_arr_name) as word + union + select unnest(_arr_announce) as word) t + ON bw.name = t.word + WHERE + s.rubric_id IN (prod.rubric_l1_id, prod.rubric_l2_id, prod.rubric_l3_id, prod.rubric_l4_id, prod.rubric_id) + AND s.is_new = FALSE AND s.is_deleted = FALSE + + UNION + + SELECT prod.id id, bs.name synonym + FROM synonyms s + INNER JOIN base_words bs ON (bs.id = s.synonym_id AND bs.is_deleted = FALSE) + INNER JOIN base_words bw ON (bw.id = s.base_id AND bw.is_deleted = FALSE) + INNER JOIN + (select unnest(_arr_name) as word + union + select unnest(_arr_announce) as word) t + ON bw.name = t.word + WHERE + s.rubric_id IS NULL + AND s.is_new = FALSE AND s.is_deleted = FALSE + ) a + GROUP BY a.id; + SELECT array_agg(g.tag_id) INTO _tags_idx + FROM taggings g + WHERE g.taggable_type = 'Product' and g.context = 'tags' AND g.taggable_id = _id + GROUP BY g.taggable_id; + + SELECT array_agg(g.trait_id) INTO _traits_idx + FROM trait_products g + WHERE g.product_id = _id + GROUP BY g.product_id; + + -- расчитаем рейтинг товара + _rate := 0; + + IF prod.price > 0 OR prod.price_max > 0 THEN + _rate := _rate + 25; + END IF; + + IF length(COALESCE(prod.announce, '')) > 1 AND prod.announce != prod.name THEN + _rate := _rate + 21; + END IF; + + IF length(COALESCE(prod.description, '')) > 1 AND prod.description != prod.name THEN + _rate := _rate + 18; + END IF; + + SELECT COUNT(*) INTO _img_count FROM product_images WHERE product_id = prod.id; + IF _img_count > 0 THEN + _rate := _rate + 15; + END IF; + + IF _tags_idx IS NOT NULL THEN + _rate := _rate + array_length(_tags_idx, 1) * 3; + END IF; + + IF prod.exists IS NOT NULL THEN + _rate := _rate + 2; + END IF; + + IF length(COALESCE(prod.paid_conditions, '')) > 1 THEN + _rate := _rate + 2; + END IF; + + IF length(COALESCE(prod.delivery_time, '')) > 1 THEN + _rate := _rate + 2; + END IF; +select * from search_index_products into current_index where product_id = _id; + IF NOT FOUND THEN + INSERT INTO search_index_products (product_id, w1, w2, w3, w4, w5, w6, + terms_index, + name_ord_1, name_ord_2, name_ord_3, tags, traits, rate, created_at, updated_at) + VALUES (_id, + _w1, + _w2, + _w3, + _w4, + _w5, + _w6, + to_tsvector('simple', _terms_index), + search.string_ordinal(COALESCE(prod.name, ''), 1), + search.string_ordinal(COALESCE(prod.name, ''), 2), + search.string_ordinal(COALESCE(prod.name, ''), 3), + 'tag_id_' || array_to_string(_tags_idx, ' tag_id_'), + 'trait_id_' || array_to_string(_traits_idx, ' trait_id_'), + _rate, + import.to_utc(clock_timestamp()), + import.to_utc(clock_timestamp()) + ); +else + + UPDATE search_index_products + SET + w1 = _w1, w2 = _w2, w3 = _w3, w4 = _w4, w5 = _w5, w6 = _w6, + terms_index = to_tsvector('simple', _terms_index), -- ибо не используецо? + name_ord_1 = search.string_ordinal(COALESCE(prod.name, ''), 1), + name_ord_2 = search.string_ordinal(COALESCE(prod.name, ''), 2), + name_ord_3 = search.string_ordinal(COALESCE(prod.name, ''), 3), + tags = 'tag_id_' || array_to_string(_tags_idx, ' tag_id_'), + traits = 'trait_id_' || array_to_string(_traits_idx, ' trait_id_'), + rate = _rate, + updated_at = import.to_utc(clock_timestamp()) + WHERE product_id = _id; + END IF; + RETURN 1; +END; +$$; + + +-- +-- Name: index_product_merkushin(integer); Type: FUNCTION; Schema: search; Owner: - +-- + +CREATE FUNCTION index_product_merkushin(_id integer) RETURNS integer + LANGUAGE plpgsql + AS $$ + DECLARE + prod RECORD; + current_index INT[]; + _name_terms classes.search_term[]; + _announce_terms classes.search_term[]; + _w1 TEXT; + _w2 TEXT; + _w3 TEXT; + _w4 TEXT; + _w5 TEXT; + _w6 TEXT; + _terms_index TEXT; + _tags_idx INT[]; + _traits_idx INT[]; + _rate INT; + _img_count INT; + BEGIN + -- сначала загрузить сам товар + SELECT + products.*, + r.rubric_l1_id, + r.rubric_l2_id, + r.rubric_l3_id, + r.rubric_l4_id + INTO prod + FROM + products LEFT JOIN + rubrics_denormalization_tree AS r ON products.rubric_id = r.rubric_id + WHERE + id = _id; + + IF NOT FOUND THEN + RETURN 0; + END IF; + + SELECT array_agg( ROW(terms.word, terms.position)::classes.search_term )::classes.search_term[] INTO _name_terms + FROM search.extract_terms(prod.name) AS terms; + + SELECT array_agg( ROW(terms.word, terms.position)::classes.search_term )::classes.search_term[] INTO _announce_terms + FROM search.extract_terms(prod.announce) AS terms; + + SELECT array_to_string(array_agg((terms).word), ' ') INTO _w1 + FROM ( + SELECT unnest(_name_terms) AS terms + ) t + WHERE (terms).position = 1; + + SELECT array_to_string(array_agg((terms).word), ' ') INTO _w3 + FROM ( + SELECT unnest(_name_terms) AS terms + ) t + WHERE (terms).position = 2; + + SELECT array_to_string(array_agg((terms).word), ' ') INTO _w4 + FROM ( + SELECT unnest(_name_terms) AS terms + ) t + WHERE (terms).position = 3; + + SELECT array_to_string(array_agg((terms).word), ' ') INTO _w5 + FROM ( + SELECT unnest(_name_terms) AS terms + ) t + WHERE (terms).position > 3; + + SELECT array_to_string(array_agg((terms).word), ' ') INTO _w6 + FROM ( + SELECT unnest(_announce_terms) AS terms + ) t; + + SELECT array_to_string(array_agg((terms).word), ' ') INTO _terms_index + FROM ( + SELECT unnest(_name_terms) AS terms + UNION + SELECT unnest(_announce_terms) AS terms + ) t; + + -- в поле w2 нужно запихать синонимы + SELECT array_to_string(array_agg(a.synonym), ' ') INTO _w2 + FROM ( + SELECT prod.id id, bw.name synonym + FROM synonyms s + INNER JOIN base_words bw ON (bw.id = s.synonym_id AND bw.is_deleted = FALSE) + WHERE + s.rubric_id IN (prod.rubric_l1_id, prod.rubric_l2_id, prod.rubric_l3_id, prod.rubric_l4_id, prod.rubric_id) + AND s.is_new = FALSE AND s.is_deleted = FALSE AND s.base_id IS NULL + + UNION + + SELECT prod.id id, bs.name synonym + FROM synonyms s + INNER JOIN base_words bs ON (bs.id = s.synonym_id AND bs.is_deleted = FALSE) + INNER JOIN base_words bw ON (bw.id = s.base_id AND bw.is_deleted = FALSE) + INNER JOIN search.extract_terms(prod.name || ' ' || prod.announce) t ON bw.name = t.word + WHERE + s.rubric_id IN (prod.rubric_l1_id, prod.rubric_l2_id, prod.rubric_l3_id, prod.rubric_l4_id, prod.rubric_id) + AND s.is_new = FALSE AND s.is_deleted = FALSE + + UNION + + SELECT prod.id id, bs.name synonym + FROM synonyms s + INNER JOIN base_words bs ON (bs.id = s.synonym_id AND bs.is_deleted = FALSE) + INNER JOIN base_words bw ON (bw.id = s.base_id AND bw.is_deleted = FALSE) + INNER JOIN search.extract_terms(prod.name || ' ' || prod.announce) t ON bw.name = t.word + WHERE + s.rubric_id IS NULL + AND s.is_new = FALSE AND s.is_deleted = FALSE + ) a + GROUP BY a.id; + + + _w1 := SUBSTRING(_w1 from 1 for 255); + _w2 := SUBSTRING(_w2 from 1 for 255); + _w3 := SUBSTRING(_w3 from 1 for 255); + _w4 := SUBSTRING(_w4 from 1 for 255); + _w5 := SUBSTRING(_w5 from 1 for 255); + + SELECT array_agg(g.tag_id) INTO _tags_idx + FROM taggings g + WHERE g.taggable_type = 'Product' and g.context = 'tags' AND g.taggable_id = _id + GROUP BY g.taggable_id; + + SELECT array_agg(g.trait_id) INTO _traits_idx + FROM trait_products g + WHERE g.product_id = _id + GROUP BY g.product_id; + + -- расчитаем рейтинг товара + _rate := 0; + + IF prod.price > 0 OR prod.price_max > 0 THEN + _rate := _rate + 25; + END IF; + + IF length(COALESCE(prod.announce, '')) > 1 AND prod.announce != prod.name THEN + _rate := _rate + 21; + END IF; + + IF length(COALESCE(prod.description, '')) > 1 THEN + _rate := _rate + 18; + END IF; + + SELECT COUNT(*) INTO _img_count FROM product_images WHERE product_id = prod.id; + IF _img_count > 0 THEN + _rate := _rate + 15; + END IF; + + IF _tags_idx IS NOT NULL THEN + _rate := _rate + array_length(_tags_idx, 1) * 3; + END IF; + + IF prod.exists IS NOT NULL THEN + _rate := _rate + 2; + END IF; + + IF length(COALESCE(prod.paid_conditions, '')) > 1 THEN + _rate := _rate + 2; + END IF; + + IF length(COALESCE(prod.delivery_time, '')) > 1 THEN + _rate := _rate + 2; + END IF; + + + SELECT array_agg(id) INTO current_index FROM search_index_products WHERE product_id = _id; + IF current_index IS NULL THEN + INSERT INTO search_index_products (product_id, w1, w2, w3, w4, w5, w6, terms_index, name_ord_1, name_ord_2, name_ord_3, tags, traits, rate, created_at, updated_at) + VALUES (_id, + _w1, + _w2, + _w3, + _w4, + _w5, + _w6, + to_tsvector('simple', _terms_index), + search.string_ordinal(COALESCE(prod.name, ''), 1), + search.string_ordinal(COALESCE(prod.name, ''), 2), + search.string_ordinal(COALESCE(prod.name, ''), 3), + 'tag_id_' || array_to_string(_tags_idx, ' tag_id_'), + 'trait_id_' || array_to_string(_traits_idx, ' trait_id_'), + _rate, + import.to_utc(clock_timestamp()), + import.to_utc(clock_timestamp()) + ); + ELSE + UPDATE search_index_products + SET + w1 = _w1, w2 = _w2, w3 = _w3, w4 = _w4, w5 = _w5, w6 = _w6, + terms_index = to_tsvector('simple', _terms_index), + name_ord_1 = search.string_ordinal(COALESCE(prod.name, ''), 1), + name_ord_2 = search.string_ordinal(COALESCE(prod.name, ''), 2), + name_ord_3 = search.string_ordinal(COALESCE(prod.name, ''), 3), + tags = 'tag_id_' || array_to_string(_tags_idx, ' tag_id_'), + traits = 'trait_id_' || array_to_string(_traits_idx, ' trait_id_'), + rate = _rate, + updated_at = import.to_utc(clock_timestamp()) + WHERE id in (select id from unnest(current_index) id); + END IF; + + RETURN 1; + END; + $$; + + +-- +-- Name: index_products_terms(integer, integer, integer[]); Type: FUNCTION; Schema: search; Owner: - +-- + +CREATE FUNCTION index_products_terms(_id_start integer, _id_end integer, _ids integer[]) RETURNS void + LANGUAGE plpgsql + AS $_$ +DECLARE +BEGIN + EXECUTE +$$ + CREATE TEMPORARY TABLE _products_terms ON COMMIT DROP AS + WITH _products AS ( + SELECT + p.id, + p.name, + p.announce, + r.rubric_l1_id, + r.rubric_l2_id, + r.rubric_l3_id, + r.rubric_l4_id, + r.rubric_id, + ( + SELECT array_agg(ROW(terms.word, terms.position)::classes.search_term)::classes.search_term[] + FROM search.extract_terms(p.name) AS terms + ) AS terms_title, + CASE WHEN TRIM(BOTH ' ' FROM COALESCE(p.announce, '')) <> '' THEN + ( + SELECT array_agg(ROW(terms.word, terms.position)::classes.search_term)::classes.search_term[] + FROM search.extract_terms(p.announce) AS terms + ) + ELSE NULL END + AS terms_announce, + ( + SELECT array_agg(terms.word) + FROM search.extract_full_terms(coalesce(p.name, '') || ' ' || coalesce(p.announce, '')) AS terms + ) AS fulltext_terms + FROM products AS p + LEFT JOIN rubrics_denormalization_tree AS r ON p.rubric_id = r.rubric_id + WHERE + $$ || + CASE + WHEN _id_end IS NULL AND _ids IS NULL THEN 'p.id = ' || _id_start + WHEN _ids IS NULL THEN 'p.id >= ' || _id_start || ' AND p.id <= ' || _id_end + ELSE 'p.id = ANY(' || quote_literal(_ids) || ')' + END + || $$ + ), + _name_terms AS ( + SELECT + id, + (terms).word, + (terms).position + FROM ( + SELECT id, unnest(terms_title) AS terms + FROM _products + ) AS t + ORDER BY t.id, (terms).position + ), + _name_terms_array AS ( + SELECT + id, + array_agg(word) AS terms, + array_agg(case when position < 10000 then word else null end) AS first_terms, + array_agg(case when position >= 10000 then word else null end) AS last_terms + FROM _name_terms + GROUP BY id + ), + _announce_terms AS ( + SELECT + id, + (terms).word, + (terms).position + FROM ( + SELECT id, unnest(terms_announce) AS terms + FROM _products + ) AS t + ORDER BY t.id, (terms).position + ), + _announce_terms_array AS ( + SELECT + _announce_terms.id, + array_agg(case when position < 10000 then word else null end) AS first_terms, + array_agg(case when position >= 10000 then word else null end) AS last_terms + FROM _announce_terms + INNER JOIN _name_terms_array ON _name_terms_array.id = _announce_terms.id + WHERE _announce_terms.word = ANY(_name_terms_array.terms) IS FALSE + GROUP BY _announce_terms.id + ) + SELECT + p.id, + array_to_string(coalesce(n.first_terms, array[]::character varying[]), ' ') || '! ' || array_to_string(coalesce(n.last_terms, array[]::character varying[]), ' ') AS name, + array_to_string(coalesce(a.first_terms, array[]::character varying[]), ' ') || '! ' || array_to_string(coalesce(a.last_terms, array[]::character varying[]), ' ') AS announce, + p.fulltext_terms, + array[p.rubric_l1_id, p.rubric_l2_id, p.rubric_l3_id, p.rubric_l4_id, p.rubric_id] AS rubrics + FROM _products AS p + LEFT JOIN _name_terms_array AS n ON n.id = p.id + LEFT JOIN _announce_terms_array AS a ON a.id = p.id; +$$; + + CREATE INDEX terms_idx ON _products_terms USING GIN (fulltext_terms); + ANALYZE _products_terms; + + UPDATE search_index_products + SET + name = q.name, + announce = q.announce, + synonyms = q.synonyms, + full_terms = q.full_terms, + terms_index = to_tsvector('simple', q.full_terms) + FROM ( + WITH _synonyms_array AS ( + SELECT t.id, array_agg(DISTINCT bs.name) as terms + FROM _products_terms t + INNER JOIN base_words bw ON bw.is_deleted = FALSE AND bw.name_terms <@ t.fulltext_terms + INNER JOIN synonyms s ON s.base_id = bw.id AND s.is_deleted = FALSE + INNER JOIN base_words bs ON bs.id = s.synonym_id AND bs.is_deleted = FALSE + WHERE + (s.rubric_id = ANY(t.rubrics) OR s.rubric_id IS NULL) + AND (bs.name_terms <@ t.fulltext_terms) IS FALSE + GROUP BY t.id + ) + SELECT + t.id, + t.name, + t.announce, + array_to_string(COALESCE(s.terms, array[]::text[]), ' ') AS synonyms, + array_to_string(t.fulltext_terms, ' ') AS full_terms + FROM _products_terms AS t + LEFT JOIN _synonyms_array AS s ON s.id = t.id + ) q + WHERE product_id = q.id; +END; +$_$; + + +-- +-- Name: normal_code(character); Type: FUNCTION; Schema: search; Owner: - +-- + +CREATE FUNCTION normal_code(sym character) RETURNS integer + LANGUAGE plpgsql + AS $$ +DECLARE + code SMALLINT; + norm_code SMALLINT; +BEGIN + code := ascii(sym); + norm_code := 0; + + IF code >= 48 AND code <= 57 THEN -- 0-9 + norm_code := code - 47; + ELSIF code >= 97 AND code <= 122 THEN -- a-z + norm_code := code - (96 - 9); + ELSIF code >= 1072 AND code <= 1105 THEN -- а-я + ё + IF code = 1105 THEN -- ё имеет код больший, чем я, это плохо + code := 1078; + ELSIF code > 1077 THEN + code := code + 1; + END IF; + norm_code := code - (1071 - 35); + END IF; + + RETURN norm_code; +END; +$$; + + +-- +-- Name: process_queue(); Type: FUNCTION; Schema: search; Owner: - +-- + +CREATE FUNCTION process_queue() RETURNS integer + LANGUAGE plpgsql + AS $$ +DECLARE + item RECORD; + idx RECORD; + result INTEGER; +BEGIN + PERFORM setval('search_index_companies_id_seq', (SELECT MAX(id) + 1 FROM search_index_companies)); + PERFORM setval('search_index_products_id_seq', (SELECT MAX(id) + 1 FROM search_index_products)); + + FOR item IN SELECT * FROM search_index_queue LOOP + IF item.error IS NULL OR item.error = 0 THEN + result := 0; + -- товар + IF item.class_name = 'Product' THEN + SELECT search.index_product(item.obj_id) INTO result; + END IF; + + -- компания + IF item.class_name = 'Company' THEN + SELECT search.index_company(item.obj_id) INTO result; + END IF; + + -- удалить итем + IF result = 1 THEN + DELETE FROM search_index_queue WHERE id = item.id; + ELSE + UPDATE search_index_queue SET error = 1 WHERE id = item.id; + END IF; + END IF; + END LOOP; + + RETURN 1; +END; +$$; + + +-- +-- Name: process_queue_all(); Type: FUNCTION; Schema: search; Owner: - +-- + +CREATE FUNCTION process_queue_all() RETURNS void + LANGUAGE plpgsql + AS $$ +BEGIN + PERFORM search.process_queue_companies(); + + PERFORM search.add_to_queue_changed_synonyms_product(); + PERFORM search.process_queue_products(); +END; +$$; + + +-- +-- Name: FUNCTION process_queue_all(); Type: COMMENT; Schema: search; Owner: - +-- + +COMMENT ON FUNCTION process_queue_all() IS 'Индексирует всю очередь массовым, более быстрым способом'; + + +-- +-- Name: process_queue_companies(); Type: FUNCTION; Schema: search; Owner: - +-- + +CREATE FUNCTION process_queue_companies() RETURNS void + LANGUAGE plpgsql + AS $$ +DECLARE + _offset INTEGER; + _limit INTEGER; + _queue_size INTEGER; +BEGIN + _offset := 0; + _limit := 1000; + -- вычисляем размер очереди + SELECT COUNT(*) INTO _queue_size FROM search_index_queue WHERE class_name = 'Company'; + + FOR _offset IN 0.._queue_size BY _limit LOOP + PERFORM search.process_queue_companies(_offset, _limit); + END LOOP; + + -- очищаем очередь + DELETE FROM search_index_queue WHERE class_name = 'Company'; +END; +$$; + + +-- +-- Name: FUNCTION process_queue_companies(); Type: COMMENT; Schema: search; Owner: - +-- + +COMMENT ON FUNCTION process_queue_companies() IS 'Массовая быстрая индексация компаний'; + + +-- +-- Name: process_queue_companies(integer, integer); Type: FUNCTION; Schema: search; Owner: - +-- + +CREATE FUNCTION process_queue_companies(_offset integer, _limit integer) RETURNS void + LANGUAGE plpgsql + AS $$ +BEGIN + -- делаем временную таблицу + CREATE TEMPORARY TABLE "_tmp_search_index_companies" AS + SELECT * FROM search.companies_index_fields(NULL) WITH NO DATA; + + -- создаем индекс во временной таблице + INSERT INTO "_tmp_search_index_companies" + SELECT * FROM + search.companies_index_fields(( + SELECT + array_agg(obj_id) + FROM ( + SELECT + obj_id + FROM + search_index_queue + WHERE + class_name = 'Company' + LIMIT _limit OFFSET _offset + ) _queue_ids + )); + + -- удаляем из текущего индекса записи + DELETE FROM + ONLY search_index_companies s + USING _tmp_search_index_companies t + WHERE s.company_id = t.company_id; + + INSERT INTO search_index_companies ( + company_id, + w1, + w2, + w3, + w4, + w5, + w6, + w7, + w8, + w9, + created_at, + updated_at + ) + SELECT + company_id, + w1, + w2, + w3, + w4, + w5, + w6, + w7, + w8, + w9, + import.to_utc(clock_timestamp()), + import.to_utc(clock_timestamp()) + FROM + _tmp_search_index_companies; + + DROP TABLE "_tmp_search_index_companies"; +END; +$$; + + +-- +-- Name: FUNCTION process_queue_companies(_offset integer, _limit integer); Type: COMMENT; Schema: search; Owner: - +-- + +COMMENT ON FUNCTION process_queue_companies(_offset integer, _limit integer) IS 'Массовая быстрая индексация компаний'; + + +-- +-- Name: process_queue_price_list_rows_v2(); Type: FUNCTION; Schema: search; Owner: - +-- + +CREATE FUNCTION process_queue_price_list_rows_v2() RETURNS void + LANGUAGE plpgsql + AS $$ +DECLARE + _offset INTEGER; + _limit INTEGER; + _queue_size INTEGER; +BEGIN + _offset := 0; + _limit := 500; + + -- удалим повторяющиеся строчки в очереди + DELETE FROM search_index_queue + WHERE id IN ( + SELECT a.id + FROM ( + SELECT id, row_number() OVER (PARTITION BY obj_id) r + FROM search_index_queue + WHERE class_name = 'PriceListRow' + ) a + WHERE a.r > 1 + ); + + -- вычисляем размер очереди + SELECT COUNT(*) INTO _queue_size FROM search_index_queue WHERE class_name = 'PriceListRow'; + + -- делаем временную таблицу + CREATE TEMPORARY TABLE "_tmp_search_index_rows" ( + "price_list_row_id" INTEGER, + "w1" TEXT, + "w2" TEXT, + "w3" TEXT, + "w4" TEXT, + "w5" TEXT, + "w6" TEXT, + "terms_index" TEXT + ); + + FOR _offset IN 0.._queue_size BY _limit LOOP + -- создаем индекс во временной таблице + INSERT INTO "_tmp_search_index_rows" + WITH _rows AS ( + SELECT + p.id, + p.title, + p.rubric_l1_id, + p.rubric_l2_id, + p.rubric_l3_id, + p.rubric_l4_id, + p.rubric_id, + ( + SELECT array_agg( + ROW(terms.word, terms.position)::classes.search_term + )::classes.search_term[] + FROM + search.extract_not_stemmed_terms(p.title) AS terms + ) AS terms_title + FROM + price_list_rows AS p + WHERE + p.id IN ( + SELECT + obj_id + FROM + search_index_queue + WHERE + class_name = 'PriceListRow' + LIMIT _limit OFFSET _offset + ) + ), + _terms_title AS ( + SELECT + t.id, + COALESCE(search_wordforms.word, t.word) AS word, + CASE + WHEN t.position <= 1 THEN 1 + ELSE LEAST(t.position + 1, 6) + END AS position + FROM + ( + SELECT + id, + (terms).word, + (terms).position + FROM + ( + SELECT + id, + unnest(terms_title) AS terms + FROM + _rows + ) AS t + ) AS t LEFT JOIN + search_wordforms ON t.word = search_wordforms."form" + ), + _terms_unique AS ( + SELECT + id, word, MIN(position) AS position + FROM + _terms_title + GROUP BY id, word + ), + -- 5. получаем для товаров синонимы + _synonyms AS ( + SELECT + r.id, + bw.name synonym + FROM + _rows r INNER JOIN + synonyms s ON (s.rubric_id IN (r.rubric_l1_id, r.rubric_l2_id, r.rubric_l3_id, r.rubric_l4_id, r.rubric_id) AND s.is_new = FALSE AND s.is_deleted = FALSE) INNER JOIN + base_words bw ON (bw.id = s.synonym_id AND bw.is_deleted = FALSE) + WHERE s.base_id IS NULL + UNION ALL + SELECT + r.id, + bs.name synonym + FROM + _rows r INNER JOIN + _terms_unique t ON r.id = t.id INNER JOIN + synonyms s ON (s.rubric_id IN (r.rubric_l1_id, r.rubric_l2_id, r.rubric_l3_id, r.rubric_l4_id, r.rubric_id) AND s.is_new = FALSE AND s.is_deleted = FALSE) INNER JOIN + base_words bs ON (bs.id = s.synonym_id AND bs.is_deleted = FALSE) INNER JOIN + base_words bw ON (bw.id = s.base_id AND bw.is_deleted = FALSE) + WHERE bw.name = t.word + UNION ALL + SELECT + r.id, + bs.name synonym + FROM + _rows r INNER JOIN + _terms_unique t ON r.id = t.id INNER JOIN + synonyms s ON (s.rubric_id IS NULL AND s.is_new = FALSE AND s.is_deleted = FALSE) INNER JOIN + base_words bs ON (bs.id = s.synonym_id AND bs.is_deleted = FALSE) INNER JOIN + base_words bw ON (bw.id = s.base_id AND bw.is_deleted = FALSE) + WHERE bw.name = t.word + ), + -- 6. объединяем синонимы и термы в одну таблицу, выкидывая дубли + _terms_and_synonyms AS ( + SELECT + * + FROM + ( + SELECT + id, word, MIN(position) AS position + FROM + ( + SELECT + id, + word, + position + FROM + _terms_unique + UNION ALL + SELECT + id, + synonym AS word, + 2 AS position + FROM + _synonyms + ) a + GROUP BY + id, word + ) b + ) + SELECT + id, + array_to_string(array_agg(w1), ' ') AS w1, + array_to_string(array_agg(w2), ' ') AS w2, + array_to_string(array_agg(w3), ' ') AS w3, + array_to_string(array_agg(w4), ' ') AS w4, + array_to_string(array_agg(w5), ' ') AS w5, + array_to_string(array_agg(w6), ' ') AS w6, + array_to_string(array_agg(terms_index), ' ') AS terms_index + FROM + ( + SELECT + id, + CASE WHEN position = 1 THEN word ELSE NULL END AS w1, + CASE WHEN position = 2 THEN word ELSE NULL END AS w2, + CASE WHEN position = 3 THEN word ELSE NULL END AS w3, + CASE WHEN position = 4 THEN word ELSE NULL END AS w4, + CASE WHEN position = 5 THEN word ELSE NULL END AS w5, + CASE WHEN position = 6 THEN word ELSE NULL END AS w6, + CASE WHEN position <> 2 THEN word ELSE NULL END AS terms_index + FROM + _terms_and_synonyms + ) a + GROUP BY id; + + -- удаляем из текущего индекса записи + DELETE FROM + ONLY search_index_price_list_rows s + USING _tmp_search_index_rows t + WHERE s.price_list_row_id = t.price_list_row_id; + + INSERT INTO search_index_price_list_rows ( + price_list_row_id, + w1, + w2, + w3, + w4, + w5, + w6, + created_at, + updated_at, + terms_index + ) + SELECT + price_list_row_id, + SUBSTRING(w1 FROM 1 FOR 300), + SUBSTRING(w2 FROM 1 FOR 300), + SUBSTRING(w3 FROM 1 FOR 300), + SUBSTRING(w4 FROM 1 FOR 300), + SUBSTRING(w5 FROM 1 FOR 300), + SUBSTRING(w6 FROM 1 FOR 300), + import.to_utc(clock_timestamp()), + import.to_utc(clock_timestamp()), + to_tsvector('simple', terms_index) + FROM + _tmp_search_index_rows; + + TRUNCATE TABLE "_tmp_search_index_rows"; + END LOOP; + + DROP TABLE "_tmp_search_index_rows"; + + -- очищаем очередь + DELETE FROM search_index_queue WHERE class_name = 'PriceListRow'; + + -- зафиксируем дату индексации + INSERT INTO public.glossary_log (operation, created_at, updated_at) + SELECT 'index_rows', import.to_utc(clock_timestamp()), import.to_utc(clock_timestamp()); +END; +$$; + + +-- +-- Name: FUNCTION process_queue_price_list_rows_v2(); Type: COMMENT; Schema: search; Owner: - +-- + +COMMENT ON FUNCTION process_queue_price_list_rows_v2() IS 'Массовая, быстрая индексация лотов'; + + +-- +-- Name: process_queue_rubrics(); Type: FUNCTION; Schema: search; Owner: - +-- + +CREATE FUNCTION process_queue_rubrics() RETURNS void + LANGUAGE plpgsql + AS $$ +DECLARE + _offset INTEGER; + _limit INTEGER; + _queue_size INTEGER; +BEGIN + _offset := 0; + _limit := 1000; + -- вычисляем размер очереди + SELECT COUNT(*) INTO _queue_size FROM search_index_queue WHERE class_name = 'Rubric'; + + FOR _offset IN 0.._queue_size BY _limit LOOP + PERFORM search.process_queue_rubrics(_offset, _limit); + END LOOP; + + -- очищаем очередь + DELETE FROM search_index_queue WHERE class_name = 'Rubric'; +END; +$$; + + +-- +-- Name: process_queue_rubrics(integer, integer); Type: FUNCTION; Schema: search; Owner: - +-- + +CREATE FUNCTION process_queue_rubrics(_offset integer, _limit integer) RETURNS void + LANGUAGE plpgsql + AS $$ +BEGIN + CREATE TEMPORARY TABLE "_tmp_search_index_rubrics" AS + SELECT * + FROM + search.rubrics_index_fields(( + SELECT + array_agg(obj_id) + FROM ( + SELECT + obj_id + FROM + search_index_queue + WHERE + class_name = 'Rubric' + LIMIT _limit OFFSET _offset + ) _queue_ids + )) as f(rubric_id int, w1 varchar, terms_hash varchar); + + -- удаляем из текущего индекса записи + DELETE FROM + ONLY search_index_rubrics s + USING _tmp_search_index_rubrics t + WHERE s.rubric_id = t.rubric_id; + + INSERT INTO search_index_rubrics ( + rubric_id, + w1, + terms_hash + ) + SELECT + rubric_id, + w1, + terms_hash + FROM + _tmp_search_index_rubrics; + + DROP TABLE "_tmp_search_index_rubrics"; +END; +$$; + + +-- +-- Name: FUNCTION process_queue_rubrics(_offset integer, _limit integer); Type: COMMENT; Schema: search; Owner: - +-- + +COMMENT ON FUNCTION process_queue_rubrics(_offset integer, _limit integer) IS 'Массовая быстрая индексация рубрик'; + + +-- +-- Name: product_groups(integer); Type: FUNCTION; Schema: search; Owner: - +-- + +CREATE FUNCTION product_groups(product integer) RETURNS integer[] + LANGUAGE plpgsql + AS $$ +DECLARE + result integer[]; +BEGIN + WITH RECURSIVE group_path(p_group_id, p_product_id) AS ( + SELECT product_group_id, id FROM products WHERE id = product + UNION ALL + SELECT g.parent_id, p_product_id + FROM product_groups g + INNER JOIN group_path ON p_group_id = g.id + WHERE g.parent_id IS NOT NULL + ) + SELECT array_accum(p_group_id) INTO result FROM group_path GROUP BY p_product_id; + RETURN result; +END; +$$; + + +-- +-- Name: product_groups_positions(integer); Type: FUNCTION; Schema: search; Owner: - +-- + +CREATE FUNCTION product_groups_positions(product integer) RETURNS bigint + LANGUAGE plpgsql + AS $$ +DECLARE + result bigint; +BEGIN + WITH RECURSIVE group_path(p_group_id, group_position, group_depth, p_product_id) AS ( + SELECT product_groups.parent_id, product_groups.position, product_groups.depth, products.id + FROM products + INNER JOIN product_groups on product_groups.id = products.product_group_id + WHERE products.id = product + UNION ALL + SELECT g.parent_id, g.position, g.depth, p_product_id + FROM product_groups g + INNER JOIN group_path ON p_group_id = g.id + ) + SELECT SUM(group_position) INTO result + FROM ( + SELECT p_product_id, (power(6000, 4 - group_depth) * group_position)::bigint as group_position + FROM group_path + ) a + GROUP BY p_product_id; + RETURN result; +END; +$$; + + +-- +-- Name: products_update_search_terms(); Type: FUNCTION; Schema: search; Owner: - +-- + +CREATE FUNCTION products_update_search_terms() RETURNS trigger + LANGUAGE plpgsql + AS $$ +declare + _name_terms classes.search_term[]; + _name_words character varying[]; + _announce_terms classes.search_term[]; + _announce_words character varying[]; + _all_words character varying[]; + _name text; + _announce text; + _synonyms text; + _full_terms text; + current_index_id int; +begin + -- название + select + array_agg(row(terms.word, terms.position)::classes.search_term)::classes.search_term[], + array_agg(terms.word) + into _name_terms, _name_words + from search.extract_terms(new.name) as terms; + + select + array_to_string(array_agg(case when (a).terms.position < 10000 then (a).terms.word else null end), ' ') + || '! ' || + array_to_string(array_agg(case when (a).terms.position >= 10000 then (a).terms.word else null end), ' ') + into _name + from ( + select unnest(_name_terms) as terms + ) a; + + -- краткое описание + select + array_agg(row(terms.word, terms.position)::classes.search_term)::classes.search_term[], + array_agg(terms.word) + into _announce_terms, _announce_words + from search.extract_terms(new.announce) as terms; + + select + array_to_string(array_agg(case when (a).terms.position < 10000 then (a).terms.word else null end), ' ') + || '! ' || + array_to_string(array_agg(case when (a).terms.position >= 10000 then (a).terms.word else null end), ' ') + into _announce + from ( + select unnest(_announce_terms) as terms + ) a + where (a).terms.word = any(_name_words) is false; + + -- фултекс термы + select + array_agg(terms.word) into _all_words + from search.extract_full_terms(coalesce(new.name, '') || ' ' || coalesce(new.announce, '')) as terms; + + select array_to_string(_all_words, ' ') into _full_terms; + + -- синонимы + select array_to_string(array_agg(distinct a.synonym), ' ') into _synonyms + from ( + select new.id as id, bs.name as synonym + from synonyms as s + inner join base_words bs on bs.id = s.synonym_id and bs.is_deleted = false + inner join base_words bw on bw.id = s.base_id and bw.is_deleted = false + where + ( + s.rubric_id in ( + select unnest(rubric_ids) + from ( + select array[rubric_l1_id, rubric_l2_id, rubric_l3_id, rubric_l4_id, rubric_id] as rubric_ids + from rubrics_denormalization_tree + where rubric_id = new.rubric_id + limit 1 + ) as a + ) + or s.rubric_id is null + ) + and s.is_deleted = false + and bw.name_terms <@ _all_words + and (bs.name_terms <@ _all_words) is false + ) a + group by a.id; + + select id into current_index_id from search_index_products where product_id = new.id limit 1 for update nowait; + + if current_index_id is null then + insert into search_index_products (product_id, name, announce, synonyms, full_terms, terms_index, created_at) + values ( + new.id, + _name, + _announce, + _synonyms, + _full_terms, + to_tsvector('simple', _full_terms), + now() at time zone 'UTC' + ); + else + update search_index_products + set + name = _name, + announce = _announce, + synonyms = _synonyms, + full_terms = _full_terms, + terms_index = to_tsvector('simple', _full_terms) + where id = current_index_id; + end if; + + return new; +end +$$; + + +-- +-- Name: read_spec_words(); Type: FUNCTION; Schema: search; Owner: - +-- + +CREATE FUNCTION read_spec_words() RETURNS text + LANGUAGE plperl IMMUTABLE + AS $_X$ +# прочитать и запомнить спец-слова +if (!$_SHARED{search_spec_words}) +{ + my @spec_words = (); + $db_data = spi_exec_query('SELECT word FROM search_specwords'); + foreach my $rownum (0 .. $db_data->{processed} - 1) { + my $row = $db_data->{rows}[$rownum]; + push( @spec_words, quotemeta($row->{word}) ); # quotemeta = preg_quote + } + $_SHARED{search_spec_words} = join('|',@spec_words); +} + +return $_SHARED{search_spec_words}; +$_X$; + + +-- +-- Name: read_stop_words(); Type: FUNCTION; Schema: search; Owner: - +-- + +CREATE FUNCTION read_stop_words() RETURNS text + LANGUAGE plperl IMMUTABLE + AS $_X$ +return $_SHARED{search_stop_words} + if (defined($_SHARED{search_stop_words}) + and defined($_SHARED{actualised_search_stop_words}) + and ($_SHARED{actualised_search_stop_words} + 3600 > time)); + +if (not defined($_SHARED{search_stop_words})) +{ + my @stop_words = (); + $db_data = spi_exec_query('SELECT word FROM search_stopwords'); + foreach my $rownum (0 .. $db_data->{processed} - 1) { + my $row = $db_data->{rows}[$rownum]; + push( @stop_words, quotemeta($row->{word}) ); # quotemeta = preg_quote + } + $_SHARED{search_stop_words} = join('|',@stop_words); + $_SHARED{actualised_search_stop_words} = time; +} +return $_SHARED{search_stop_words}; +$_X$; + + +-- +-- Name: read_unit_names(); Type: FUNCTION; Schema: search; Owner: - +-- + +CREATE FUNCTION read_unit_names() RETURNS text + LANGUAGE plperl + AS $_X$ +# прочитать и запомнить имена единиц измерения +if (!$_SHARED{search_unit_names}) +{ + my @unit_names = (); + $db_data = spi_exec_query('SELECT word FROM search_unitnames'); + foreach my $rownum (0 .. $db_data->{processed} - 1) { + my $row = $db_data->{rows}[$rownum]; + push( @unit_names, $row->{word} ); # quotemeta = preg_quote + } + $_SHARED{search_unit_names} = join('|',@unit_names); +} + +return $_SHARED{search_unit_names}; +$_X$; + + +-- +-- Name: rubrics_index_fields(integer[]); Type: FUNCTION; Schema: search; Owner: - +-- + +CREATE FUNCTION rubrics_index_fields(_ids integer[]) RETURNS SETOF record + LANGUAGE plpgsql IMMUTABLE + AS $$ +DECLARE + returnRecord RECORD; +BEGIN + FOR returnRecord IN + -- получаем рубрики + WITH _rubrics AS ( + SELECT + r.id, + CASE WHEN r.is_normativka IS TRUE AND r.prefix_normativka IS NOT NULL THEN r.prefix_normativka||' '||r.title ELSE r.title END AS title + FROM + rubrics r + WHERE + r.id IN (SELECT * FROM unnest(_ids)) + ), + -- раскидываем сырые данные + _fields AS ( + -- 1 поле = название + SELECT + rubric_id, + word, + field, + position + FROM ( + WITH _title_terms AS ( + SELECT + id AS rubric_id, + search.extract_not_stemmed_terms_custom( + COALESCE(title, '') + ) AS term + FROM + _rubrics + ) + SELECT + rubric_id, + (term).word AS word, + 1 AS field, + (term).position AS position + FROM + _title_terms + WHERE + (term).position > 0 + ) _name_fields + ), + -- загружаем словарь + _dict AS ( + SELECT + word, + form + FROM + search_wordforms + WHERE + "form" IN ( + SELECT + DISTINCT word + FROM + _fields + WHERE + word ~* '^[а-я]{3,}' + ) AND is_deleted != TRUE + ), + -- приводим слова к базовой форме и выбрасываем дублирующиеся термы + _fields_morphological AS ( + SELECT + f.rubric_id, + COALESCE(d.word, f.word) AS word, + f.field, + f.position + 5000 + FROM + _fields f LEFT JOIN + _dict d ON f.word = d."form" + ORDER BY + position ASC + ), + -- считаем поля для индекса + -- w1 + _index_w1 AS ( + SELECT + rubric_id, + array_to_string(array_agg(word), ' ') f, + array_to_string(array_agg(DISTINCT word), ' ') ordered_f + FROM _fields_morphological + WHERE field = 1 + GROUP BY rubric_id + ) + -- объединяем всё вместе + SELECT + i1.rubric_id AS rubric_id, + COALESCE(i1.f, '')::varchar AS w1, + md5(i1.ordered_f)::varchar AS terms_crc + FROM + _index_w1 i1 + + LOOP + RETURN NEXT returnRecord; + END LOOP; + + RETURN; +END; +$$; + + +-- +-- Name: string_ordinal(character varying, integer); Type: FUNCTION; Schema: search; Owner: - +-- + +CREATE FUNCTION string_ordinal(str character varying, chunk integer) RETURNS integer + LANGUAGE plpgsql + AS $$ +DECLARE + _norm VARCHAR; + _ln SMALLINT; + _max_ln SMALLINT; + i SMALLINT; + o INT4; + norm_code SMALLINT; +BEGIN + _max_ln := 4; + _norm := regexp_replace(lower(str), '[^A-Za-z0-9а-яА-ЯЁё]', '', 'g'); + _norm := SUBSTRING(_norm FROM ((chunk - 1) * _max_ln + 1) FOR _max_ln); + _ln := length(_norm); + + IF _ln > _max_ln THEN + _ln := _max_ln; + END IF; + + o := 0; + FOR i IN 1.._ln LOOP + norm_code := search.normal_code(SUBSTRING(_norm FROM i FOR 1)::CHAR); + o := o + norm_code * power( power(2, _ln - i), 8); + END LOOP; + + RETURN o; +END; +$$; + + +-- +-- Name: terms_with_position(text, integer); Type: FUNCTION; Schema: search; Owner: - +-- + +CREATE FUNCTION terms_with_position(str text, pos integer) RETURNS character varying + LANGUAGE plpgsql IMMUTABLE + AS $$ +DECLARE + result VARCHAR; +BEGIN + SELECT array_to_string(array_agg(word), ' ') INTO result + FROM + search.extract_not_stemmed_terms(str) + WHERE + position = pos; + RETURN result; +END; +$$; + + +-- +-- Name: terms_with_position_gt(text, integer); Type: FUNCTION; Schema: search; Owner: - +-- + +CREATE FUNCTION terms_with_position_gt(str text, pos integer) RETURNS character varying + LANGUAGE plpgsql IMMUTABLE + AS $$ +DECLARE + result VARCHAR; +BEGIN + SELECT array_to_string(array_agg(word), ' ') INTO result + FROM + search.extract_not_stemmed_terms(str) + WHERE + position > pos; + RETURN result; +END; +$$; + + +SET search_path = statistics, pg_catalog; + +-- +-- Name: blog_post_statistic_total_by_days_insert_trigger(); Type: FUNCTION; Schema: statistics; Owner: - +-- + +CREATE FUNCTION blog_post_statistic_total_by_days_insert_trigger() RETURNS trigger + LANGUAGE plpgsql + AS $$ BEGIN IF (NEW.date >= TIMESTAMP '2014-07-01 00:00:00' AND NEW.date < TIMESTAMP '2014-08-01 00:00:00') THEN INSERT INTO statistics.blog_post_statistic_total_by_days_14_07 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2014-08-01 00:00:00' AND NEW.date < TIMESTAMP '2014-09-01 00:00:00') THEN INSERT INTO statistics.blog_post_statistic_total_by_days_14_08 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2014-09-01 00:00:00' AND NEW.date < TIMESTAMP '2014-10-01 00:00:00') THEN INSERT INTO statistics.blog_post_statistic_total_by_days_14_09 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2014-10-01 00:00:00' AND NEW.date < TIMESTAMP '2014-11-01 00:00:00') THEN INSERT INTO statistics.blog_post_statistic_total_by_days_14_10 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2014-11-01 00:00:00' AND NEW.date < TIMESTAMP '2014-12-01 00:00:00') THEN INSERT INTO statistics.blog_post_statistic_total_by_days_14_11 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2014-12-01 00:00:00' AND NEW.date < TIMESTAMP '2015-01-01 00:00:00') THEN INSERT INTO statistics.blog_post_statistic_total_by_days_14_12 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2015-01-01 00:00:00' AND NEW.date < TIMESTAMP '2015-02-01 00:00:00') THEN INSERT INTO statistics.blog_post_statistic_total_by_days_15_01 VALUES (NEW.*); ELSE RAISE EXCEPTION 'Inserted data is out of range. Fix statistics.blog_post_statistic_total_by_days_insert_trigger.'; END IF; RETURN NULL; END; $$; + + +-- +-- Name: company_statistic_activities_by_days_insert_trigger(); Type: FUNCTION; Schema: statistics; Owner: - +-- + +CREATE FUNCTION company_statistic_activities_by_days_insert_trigger() RETURNS trigger + LANGUAGE plpgsql + AS $$ BEGIN IF (NEW.date >= TIMESTAMP '2015-09-01 00:00:00' AND NEW.date < TIMESTAMP '2015-10-01 00:00:00') THEN INSERT INTO statistics.company_statistic_activities_by_days_15_09 VALUES (NEW.*); ELSE RAISE EXCEPTION 'Inserted data is out of range. Fix statistics.company_statistic_activities_by_days_insert_trigger.'; END IF; RETURN NULL; END; $$; + + +-- +-- Name: company_statistic_activities_by_months_insert_trigger(); Type: FUNCTION; Schema: statistics; Owner: - +-- + +CREATE FUNCTION company_statistic_activities_by_months_insert_trigger() RETURNS trigger + LANGUAGE plpgsql + AS $$ BEGIN IF (NEW.date >= TIMESTAMP '2015-09-01 00:00:00' AND NEW.date < TIMESTAMP '2015-10-01 00:00:00') THEN INSERT INTO statistics.company_statistic_activities_by_months_15_09 VALUES (NEW.*); ELSE RAISE EXCEPTION 'Inserted data is out of range. Fix statistics.company_statistic_activities_by_months_insert_trigger.'; END IF; RETURN NULL; END; $$; + + +-- +-- Name: company_statistic_activities_by_weeks_insert_trigger(); Type: FUNCTION; Schema: statistics; Owner: - +-- + +CREATE FUNCTION company_statistic_activities_by_weeks_insert_trigger() RETURNS trigger + LANGUAGE plpgsql + AS $$ BEGIN IF (NEW.first_week_day >= TIMESTAMP '2015-09-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2015-10-01 00:00:00') THEN INSERT INTO statistics.company_statistic_activities_by_weeks_15_09 VALUES (NEW.*); ELSE RAISE EXCEPTION 'Inserted data is out of range. Fix statistics.company_statistic_activities_by_weeks_insert_trigger.'; END IF; RETURN NULL; END; $$; + + +-- +-- Name: company_statistic_geo_by_months_insert_trigger(); Type: FUNCTION; Schema: statistics; Owner: - +-- + +CREATE FUNCTION company_statistic_geo_by_months_insert_trigger() RETURNS trigger + LANGUAGE plpgsql + AS $$ BEGIN IF (NEW.date >= TIMESTAMP '2015-09-01 00:00:00' AND NEW.date < TIMESTAMP '2015-10-01 00:00:00') THEN INSERT INTO statistics.company_statistic_geo_by_months_15_09 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2010-02-01 00:00:00' AND NEW.date < TIMESTAMP '2010-03-01 00:00:00') THEN INSERT INTO statistics.company_statistic_geo_by_months_10_02 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2010-03-01 00:00:00' AND NEW.date < TIMESTAMP '2010-04-01 00:00:00') THEN INSERT INTO statistics.company_statistic_geo_by_months_10_03 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2010-04-01 00:00:00' AND NEW.date < TIMESTAMP '2010-05-01 00:00:00') THEN INSERT INTO statistics.company_statistic_geo_by_months_10_04 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2010-05-01 00:00:00' AND NEW.date < TIMESTAMP '2010-06-01 00:00:00') THEN INSERT INTO statistics.company_statistic_geo_by_months_10_05 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2010-06-01 00:00:00' AND NEW.date < TIMESTAMP '2010-07-01 00:00:00') THEN INSERT INTO statistics.company_statistic_geo_by_months_10_06 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2010-07-01 00:00:00' AND NEW.date < TIMESTAMP '2010-08-01 00:00:00') THEN INSERT INTO statistics.company_statistic_geo_by_months_10_07 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2010-08-01 00:00:00' AND NEW.date < TIMESTAMP '2010-09-01 00:00:00') THEN INSERT INTO statistics.company_statistic_geo_by_months_10_08 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2010-09-01 00:00:00' AND NEW.date < TIMESTAMP '2010-10-01 00:00:00') THEN INSERT INTO statistics.company_statistic_geo_by_months_10_09 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2010-10-01 00:00:00' AND NEW.date < TIMESTAMP '2010-11-01 00:00:00') THEN INSERT INTO statistics.company_statistic_geo_by_months_10_10 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2010-11-01 00:00:00' AND NEW.date < TIMESTAMP '2010-12-01 00:00:00') THEN INSERT INTO statistics.company_statistic_geo_by_months_10_11 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2009-05-01 00:00:00' AND NEW.date < TIMESTAMP '2009-06-01 00:00:00') THEN INSERT INTO statistics.company_statistic_geo_by_months_09_05 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2009-04-01 00:00:00' AND NEW.date < TIMESTAMP '2009-05-01 00:00:00') THEN INSERT INTO statistics.company_statistic_geo_by_months_09_04 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2009-06-01 00:00:00' AND NEW.date < TIMESTAMP '2009-07-01 00:00:00') THEN INSERT INTO statistics.company_statistic_geo_by_months_09_06 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2009-07-01 00:00:00' AND NEW.date < TIMESTAMP '2009-08-01 00:00:00') THEN INSERT INTO statistics.company_statistic_geo_by_months_09_07 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2009-08-01 00:00:00' AND NEW.date < TIMESTAMP '2009-09-01 00:00:00') THEN INSERT INTO statistics.company_statistic_geo_by_months_09_08 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2009-09-01 00:00:00' AND NEW.date < TIMESTAMP '2009-10-01 00:00:00') THEN INSERT INTO statistics.company_statistic_geo_by_months_09_09 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2009-10-01 00:00:00' AND NEW.date < TIMESTAMP '2009-11-01 00:00:00') THEN INSERT INTO statistics.company_statistic_geo_by_months_09_10 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2009-11-01 00:00:00' AND NEW.date < TIMESTAMP '2009-12-01 00:00:00') THEN INSERT INTO statistics.company_statistic_geo_by_months_09_11 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2009-12-01 00:00:00' AND NEW.date < TIMESTAMP '2010-01-01 00:00:00') THEN INSERT INTO statistics.company_statistic_geo_by_months_09_12 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2010-01-01 00:00:00' AND NEW.date < TIMESTAMP '2010-02-01 00:00:00') THEN INSERT INTO statistics.company_statistic_geo_by_months_10_01 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2010-12-01 00:00:00' AND NEW.date < TIMESTAMP '2011-01-01 00:00:00') THEN INSERT INTO statistics.company_statistic_geo_by_months_10_12 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2011-01-01 00:00:00' AND NEW.date < TIMESTAMP '2011-02-01 00:00:00') THEN INSERT INTO statistics.company_statistic_geo_by_months_11_01 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2011-02-01 00:00:00' AND NEW.date < TIMESTAMP '2011-03-01 00:00:00') THEN INSERT INTO statistics.company_statistic_geo_by_months_11_02 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2011-03-01 00:00:00' AND NEW.date < TIMESTAMP '2011-04-01 00:00:00') THEN INSERT INTO statistics.company_statistic_geo_by_months_11_03 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2011-11-01 00:00:00' AND NEW.date < TIMESTAMP '2011-12-01 00:00:00') THEN INSERT INTO statistics.company_statistic_geo_by_months_11_11 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2011-12-01 00:00:00' AND NEW.date < TIMESTAMP '2012-01-01 00:00:00') THEN INSERT INTO statistics.company_statistic_geo_by_months_11_12 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2012-01-01 00:00:00' AND NEW.date < TIMESTAMP '2012-02-01 00:00:00') THEN INSERT INTO statistics.company_statistic_geo_by_months_12_01 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2012-02-01 00:00:00' AND NEW.date < TIMESTAMP '2012-03-01 00:00:00') THEN INSERT INTO statistics.company_statistic_geo_by_months_12_02 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2012-03-01 00:00:00' AND NEW.date < TIMESTAMP '2012-04-01 00:00:00') THEN INSERT INTO statistics.company_statistic_geo_by_months_12_03 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2012-04-01 00:00:00' AND NEW.date < TIMESTAMP '2012-05-01 00:00:00') THEN INSERT INTO statistics.company_statistic_geo_by_months_12_04 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2012-05-01 00:00:00' AND NEW.date < TIMESTAMP '2012-06-01 00:00:00') THEN INSERT INTO statistics.company_statistic_geo_by_months_12_05 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2012-06-01 00:00:00' AND NEW.date < TIMESTAMP '2012-07-01 00:00:00') THEN INSERT INTO statistics.company_statistic_geo_by_months_12_06 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2012-07-01 00:00:00' AND NEW.date < TIMESTAMP '2012-08-01 00:00:00') THEN INSERT INTO statistics.company_statistic_geo_by_months_12_07 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2012-08-01 00:00:00' AND NEW.date < TIMESTAMP '2012-09-01 00:00:00') THEN INSERT INTO statistics.company_statistic_geo_by_months_12_08 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2012-09-01 00:00:00' AND NEW.date < TIMESTAMP '2012-10-01 00:00:00') THEN INSERT INTO statistics.company_statistic_geo_by_months_12_09 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2012-10-01 00:00:00' AND NEW.date < TIMESTAMP '2012-11-01 00:00:00') THEN INSERT INTO statistics.company_statistic_geo_by_months_12_10 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2012-11-01 00:00:00' AND NEW.date < TIMESTAMP '2012-12-01 00:00:00') THEN INSERT INTO statistics.company_statistic_geo_by_months_12_11 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2012-12-01 00:00:00' AND NEW.date < TIMESTAMP '2013-01-01 00:00:00') THEN INSERT INTO statistics.company_statistic_geo_by_months_12_12 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2013-01-01 00:00:00' AND NEW.date < TIMESTAMP '2013-02-01 00:00:00') THEN INSERT INTO statistics.company_statistic_geo_by_months_13_01 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2013-02-01 00:00:00' AND NEW.date < TIMESTAMP '2013-03-01 00:00:00') THEN INSERT INTO statistics.company_statistic_geo_by_months_13_02 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2013-03-01 00:00:00' AND NEW.date < TIMESTAMP '2013-04-01 00:00:00') THEN INSERT INTO statistics.company_statistic_geo_by_months_13_03 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2013-04-01 00:00:00' AND NEW.date < TIMESTAMP '2013-05-01 00:00:00') THEN INSERT INTO statistics.company_statistic_geo_by_months_13_04 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2013-05-01 00:00:00' AND NEW.date < TIMESTAMP '2013-06-01 00:00:00') THEN INSERT INTO statistics.company_statistic_geo_by_months_13_05 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2013-06-01 00:00:00' AND NEW.date < TIMESTAMP '2013-07-01 00:00:00') THEN INSERT INTO statistics.company_statistic_geo_by_months_13_06 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2013-07-01 00:00:00' AND NEW.date < TIMESTAMP '2013-08-01 00:00:00') THEN INSERT INTO statistics.company_statistic_geo_by_months_13_07 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2013-08-01 00:00:00' AND NEW.date < TIMESTAMP '2013-09-01 00:00:00') THEN INSERT INTO statistics.company_statistic_geo_by_months_13_08 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2013-09-01 00:00:00' AND NEW.date < TIMESTAMP '2013-10-01 00:00:00') THEN INSERT INTO statistics.company_statistic_geo_by_months_13_09 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2013-10-01 00:00:00' AND NEW.date < TIMESTAMP '2013-11-01 00:00:00') THEN INSERT INTO statistics.company_statistic_geo_by_months_13_10 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2013-11-01 00:00:00' AND NEW.date < TIMESTAMP '2013-12-01 00:00:00') THEN INSERT INTO statistics.company_statistic_geo_by_months_13_11 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2013-12-01 00:00:00' AND NEW.date < TIMESTAMP '2014-01-01 00:00:00') THEN INSERT INTO statistics.company_statistic_geo_by_months_13_12 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2014-01-01 00:00:00' AND NEW.date < TIMESTAMP '2014-02-01 00:00:00') THEN INSERT INTO statistics.company_statistic_geo_by_months_14_01 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2014-02-01 00:00:00' AND NEW.date < TIMESTAMP '2014-03-01 00:00:00') THEN INSERT INTO statistics.company_statistic_geo_by_months_14_02 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2014-03-01 00:00:00' AND NEW.date < TIMESTAMP '2014-04-01 00:00:00') THEN INSERT INTO statistics.company_statistic_geo_by_months_14_03 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2014-04-01 00:00:00' AND NEW.date < TIMESTAMP '2014-05-01 00:00:00') THEN INSERT INTO statistics.company_statistic_geo_by_months_14_04 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2014-05-01 00:00:00' AND NEW.date < TIMESTAMP '2014-06-01 00:00:00') THEN INSERT INTO statistics.company_statistic_geo_by_months_14_05 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2014-06-01 00:00:00' AND NEW.date < TIMESTAMP '2014-07-01 00:00:00') THEN INSERT INTO statistics.company_statistic_geo_by_months_14_06 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2014-07-01 00:00:00' AND NEW.date < TIMESTAMP '2014-08-01 00:00:00') THEN INSERT INTO statistics.company_statistic_geo_by_months_14_07 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2014-08-01 00:00:00' AND NEW.date < TIMESTAMP '2014-09-01 00:00:00') THEN INSERT INTO statistics.company_statistic_geo_by_months_14_08 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2014-09-01 00:00:00' AND NEW.date < TIMESTAMP '2014-10-01 00:00:00') THEN INSERT INTO statistics.company_statistic_geo_by_months_14_09 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2014-10-01 00:00:00' AND NEW.date < TIMESTAMP '2014-11-01 00:00:00') THEN INSERT INTO statistics.company_statistic_geo_by_months_14_10 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2014-11-01 00:00:00' AND NEW.date < TIMESTAMP '2014-12-01 00:00:00') THEN INSERT INTO statistics.company_statistic_geo_by_months_14_11 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2014-12-01 00:00:00' AND NEW.date < TIMESTAMP '2015-01-01 00:00:00') THEN INSERT INTO statistics.company_statistic_geo_by_months_14_12 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2015-01-01 00:00:00' AND NEW.date < TIMESTAMP '2015-02-01 00:00:00') THEN INSERT INTO statistics.company_statistic_geo_by_months_15_01 VALUES (NEW.*); ELSE RAISE EXCEPTION 'Inserted data is out of range. Fix statistics.company_statistic_geo_by_months_insert_trigger.'; END IF; RETURN NULL; END; $$; + + +-- +-- Name: company_statistic_geo_by_weeks_insert_trigger(); Type: FUNCTION; Schema: statistics; Owner: - +-- + +CREATE FUNCTION company_statistic_geo_by_weeks_insert_trigger() RETURNS trigger + LANGUAGE plpgsql + AS $$ BEGIN IF (NEW.first_week_day >= TIMESTAMP '2015-09-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2015-10-01 00:00:00') THEN INSERT INTO statistics.company_statistic_geo_by_weeks_15_09 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2010-02-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2010-03-01 00:00:00') THEN INSERT INTO statistics.company_statistic_geo_by_weeks_10_02 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2010-03-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2010-04-01 00:00:00') THEN INSERT INTO statistics.company_statistic_geo_by_weeks_10_03 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2010-04-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2010-05-01 00:00:00') THEN INSERT INTO statistics.company_statistic_geo_by_weeks_10_04 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2010-05-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2010-06-01 00:00:00') THEN INSERT INTO statistics.company_statistic_geo_by_weeks_10_05 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2010-06-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2010-07-01 00:00:00') THEN INSERT INTO statistics.company_statistic_geo_by_weeks_10_06 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2010-07-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2010-08-01 00:00:00') THEN INSERT INTO statistics.company_statistic_geo_by_weeks_10_07 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2010-08-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2010-09-01 00:00:00') THEN INSERT INTO statistics.company_statistic_geo_by_weeks_10_08 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2010-09-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2010-10-01 00:00:00') THEN INSERT INTO statistics.company_statistic_geo_by_weeks_10_09 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2010-10-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2010-11-01 00:00:00') THEN INSERT INTO statistics.company_statistic_geo_by_weeks_10_10 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2010-11-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2010-12-01 00:00:00') THEN INSERT INTO statistics.company_statistic_geo_by_weeks_10_11 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2009-05-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2009-06-01 00:00:00') THEN INSERT INTO statistics.company_statistic_geo_by_weeks_09_05 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2009-04-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2009-05-01 00:00:00') THEN INSERT INTO statistics.company_statistic_geo_by_weeks_09_04 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2009-06-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2009-07-01 00:00:00') THEN INSERT INTO statistics.company_statistic_geo_by_weeks_09_06 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2009-07-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2009-08-01 00:00:00') THEN INSERT INTO statistics.company_statistic_geo_by_weeks_09_07 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2009-08-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2009-09-01 00:00:00') THEN INSERT INTO statistics.company_statistic_geo_by_weeks_09_08 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2009-09-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2009-10-01 00:00:00') THEN INSERT INTO statistics.company_statistic_geo_by_weeks_09_09 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2009-10-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2009-11-01 00:00:00') THEN INSERT INTO statistics.company_statistic_geo_by_weeks_09_10 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2009-11-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2009-12-01 00:00:00') THEN INSERT INTO statistics.company_statistic_geo_by_weeks_09_11 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2009-12-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2010-01-01 00:00:00') THEN INSERT INTO statistics.company_statistic_geo_by_weeks_09_12 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2010-01-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2010-02-01 00:00:00') THEN INSERT INTO statistics.company_statistic_geo_by_weeks_10_01 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2010-12-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2011-01-01 00:00:00') THEN INSERT INTO statistics.company_statistic_geo_by_weeks_10_12 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2011-01-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2011-02-01 00:00:00') THEN INSERT INTO statistics.company_statistic_geo_by_weeks_11_01 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2011-02-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2011-03-01 00:00:00') THEN INSERT INTO statistics.company_statistic_geo_by_weeks_11_02 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2011-03-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2011-04-01 00:00:00') THEN INSERT INTO statistics.company_statistic_geo_by_weeks_11_03 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2011-12-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2012-01-01 00:00:00') THEN INSERT INTO statistics.company_statistic_geo_by_weeks_11_12 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2011-11-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2011-12-01 00:00:00') THEN INSERT INTO statistics.company_statistic_geo_by_weeks_11_11 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2012-01-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2012-02-01 00:00:00') THEN INSERT INTO statistics.company_statistic_geo_by_weeks_12_01 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2012-02-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2012-03-01 00:00:00') THEN INSERT INTO statistics.company_statistic_geo_by_weeks_12_02 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2012-03-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2012-04-01 00:00:00') THEN INSERT INTO statistics.company_statistic_geo_by_weeks_12_03 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2012-04-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2012-05-01 00:00:00') THEN INSERT INTO statistics.company_statistic_geo_by_weeks_12_04 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2012-05-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2012-06-01 00:00:00') THEN INSERT INTO statistics.company_statistic_geo_by_weeks_12_05 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2012-06-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2012-07-01 00:00:00') THEN INSERT INTO statistics.company_statistic_geo_by_weeks_12_06 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2012-07-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2012-08-01 00:00:00') THEN INSERT INTO statistics.company_statistic_geo_by_weeks_12_07 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2012-08-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2012-09-01 00:00:00') THEN INSERT INTO statistics.company_statistic_geo_by_weeks_12_08 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2012-09-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2012-10-01 00:00:00') THEN INSERT INTO statistics.company_statistic_geo_by_weeks_12_09 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2012-10-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2012-11-01 00:00:00') THEN INSERT INTO statistics.company_statistic_geo_by_weeks_12_10 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2012-11-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2012-12-01 00:00:00') THEN INSERT INTO statistics.company_statistic_geo_by_weeks_12_11 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2012-12-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2013-01-01 00:00:00') THEN INSERT INTO statistics.company_statistic_geo_by_weeks_12_12 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2013-01-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2013-02-01 00:00:00') THEN INSERT INTO statistics.company_statistic_geo_by_weeks_13_01 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2013-02-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2013-03-01 00:00:00') THEN INSERT INTO statistics.company_statistic_geo_by_weeks_13_02 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2013-03-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2013-04-01 00:00:00') THEN INSERT INTO statistics.company_statistic_geo_by_weeks_13_03 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2013-04-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2013-05-01 00:00:00') THEN INSERT INTO statistics.company_statistic_geo_by_weeks_13_04 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2013-05-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2013-06-01 00:00:00') THEN INSERT INTO statistics.company_statistic_geo_by_weeks_13_05 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2013-06-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2013-07-01 00:00:00') THEN INSERT INTO statistics.company_statistic_geo_by_weeks_13_06 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2013-07-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2013-08-01 00:00:00') THEN INSERT INTO statistics.company_statistic_geo_by_weeks_13_07 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2013-08-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2013-09-01 00:00:00') THEN INSERT INTO statistics.company_statistic_geo_by_weeks_13_08 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2013-09-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2013-10-01 00:00:00') THEN INSERT INTO statistics.company_statistic_geo_by_weeks_13_09 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2013-10-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2013-11-01 00:00:00') THEN INSERT INTO statistics.company_statistic_geo_by_weeks_13_10 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2013-11-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2013-12-01 00:00:00') THEN INSERT INTO statistics.company_statistic_geo_by_weeks_13_11 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2013-12-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2014-01-01 00:00:00') THEN INSERT INTO statistics.company_statistic_geo_by_weeks_13_12 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2014-01-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2014-02-01 00:00:00') THEN INSERT INTO statistics.company_statistic_geo_by_weeks_14_01 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2014-02-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2014-03-01 00:00:00') THEN INSERT INTO statistics.company_statistic_geo_by_weeks_14_02 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2014-03-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2014-04-01 00:00:00') THEN INSERT INTO statistics.company_statistic_geo_by_weeks_14_03 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2014-04-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2014-05-01 00:00:00') THEN INSERT INTO statistics.company_statistic_geo_by_weeks_14_04 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2014-05-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2014-06-01 00:00:00') THEN INSERT INTO statistics.company_statistic_geo_by_weeks_14_05 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2014-06-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2014-07-01 00:00:00') THEN INSERT INTO statistics.company_statistic_geo_by_weeks_14_06 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2014-07-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2014-08-01 00:00:00') THEN INSERT INTO statistics.company_statistic_geo_by_weeks_14_07 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2014-08-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2014-09-01 00:00:00') THEN INSERT INTO statistics.company_statistic_geo_by_weeks_14_08 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2014-09-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2014-10-01 00:00:00') THEN INSERT INTO statistics.company_statistic_geo_by_weeks_14_09 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2014-10-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2014-11-01 00:00:00') THEN INSERT INTO statistics.company_statistic_geo_by_weeks_14_10 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2014-11-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2014-12-01 00:00:00') THEN INSERT INTO statistics.company_statistic_geo_by_weeks_14_11 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2014-12-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2015-01-01 00:00:00') THEN INSERT INTO statistics.company_statistic_geo_by_weeks_14_12 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2015-01-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2015-02-01 00:00:00') THEN INSERT INTO statistics.company_statistic_geo_by_weeks_15_01 VALUES (NEW.*); ELSE RAISE EXCEPTION 'Inserted data is out of range. Fix statistics.company_statistic_geo_by_weeks_insert_trigger.'; END IF; RETURN NULL; END; $$; + + +-- +-- Name: company_statistic_pages_by_months_insert_trigger(); Type: FUNCTION; Schema: statistics; Owner: - +-- + +CREATE FUNCTION company_statistic_pages_by_months_insert_trigger() RETURNS trigger + LANGUAGE plpgsql + AS $$ BEGIN IF (NEW.date >= TIMESTAMP '2015-09-01 00:00:00' AND NEW.date < TIMESTAMP '2015-10-01 00:00:00') THEN INSERT INTO statistics.company_statistic_pages_by_months_15_09 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2010-02-01 00:00:00' AND NEW.date < TIMESTAMP '2010-03-01 00:00:00') THEN INSERT INTO statistics.company_statistic_pages_by_months_10_02 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2010-03-01 00:00:00' AND NEW.date < TIMESTAMP '2010-04-01 00:00:00') THEN INSERT INTO statistics.company_statistic_pages_by_months_10_03 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2010-04-01 00:00:00' AND NEW.date < TIMESTAMP '2010-05-01 00:00:00') THEN INSERT INTO statistics.company_statistic_pages_by_months_10_04 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2010-05-01 00:00:00' AND NEW.date < TIMESTAMP '2010-06-01 00:00:00') THEN INSERT INTO statistics.company_statistic_pages_by_months_10_05 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2010-06-01 00:00:00' AND NEW.date < TIMESTAMP '2010-07-01 00:00:00') THEN INSERT INTO statistics.company_statistic_pages_by_months_10_06 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2010-07-01 00:00:00' AND NEW.date < TIMESTAMP '2010-08-01 00:00:00') THEN INSERT INTO statistics.company_statistic_pages_by_months_10_07 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2010-08-01 00:00:00' AND NEW.date < TIMESTAMP '2010-09-01 00:00:00') THEN INSERT INTO statistics.company_statistic_pages_by_months_10_08 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2010-09-01 00:00:00' AND NEW.date < TIMESTAMP '2010-10-01 00:00:00') THEN INSERT INTO statistics.company_statistic_pages_by_months_10_09 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2010-10-01 00:00:00' AND NEW.date < TIMESTAMP '2010-11-01 00:00:00') THEN INSERT INTO statistics.company_statistic_pages_by_months_10_10 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2010-11-01 00:00:00' AND NEW.date < TIMESTAMP '2010-12-01 00:00:00') THEN INSERT INTO statistics.company_statistic_pages_by_months_10_11 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2009-05-01 00:00:00' AND NEW.date < TIMESTAMP '2009-06-01 00:00:00') THEN INSERT INTO statistics.company_statistic_pages_by_months_09_05 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2009-04-01 00:00:00' AND NEW.date < TIMESTAMP '2009-05-01 00:00:00') THEN INSERT INTO statistics.company_statistic_pages_by_months_09_04 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2009-06-01 00:00:00' AND NEW.date < TIMESTAMP '2009-07-01 00:00:00') THEN INSERT INTO statistics.company_statistic_pages_by_months_09_06 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2009-07-01 00:00:00' AND NEW.date < TIMESTAMP '2009-08-01 00:00:00') THEN INSERT INTO statistics.company_statistic_pages_by_months_09_07 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2009-08-01 00:00:00' AND NEW.date < TIMESTAMP '2009-09-01 00:00:00') THEN INSERT INTO statistics.company_statistic_pages_by_months_09_08 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2009-09-01 00:00:00' AND NEW.date < TIMESTAMP '2009-10-01 00:00:00') THEN INSERT INTO statistics.company_statistic_pages_by_months_09_09 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2009-10-01 00:00:00' AND NEW.date < TIMESTAMP '2009-11-01 00:00:00') THEN INSERT INTO statistics.company_statistic_pages_by_months_09_10 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2009-11-01 00:00:00' AND NEW.date < TIMESTAMP '2009-12-01 00:00:00') THEN INSERT INTO statistics.company_statistic_pages_by_months_09_11 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2009-12-01 00:00:00' AND NEW.date < TIMESTAMP '2010-01-01 00:00:00') THEN INSERT INTO statistics.company_statistic_pages_by_months_09_12 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2010-01-01 00:00:00' AND NEW.date < TIMESTAMP '2010-02-01 00:00:00') THEN INSERT INTO statistics.company_statistic_pages_by_months_10_01 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2010-12-01 00:00:00' AND NEW.date < TIMESTAMP '2011-01-01 00:00:00') THEN INSERT INTO statistics.company_statistic_pages_by_months_10_12 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2011-01-01 00:00:00' AND NEW.date < TIMESTAMP '2011-02-01 00:00:00') THEN INSERT INTO statistics.company_statistic_pages_by_months_11_01 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2011-02-01 00:00:00' AND NEW.date < TIMESTAMP '2011-03-01 00:00:00') THEN INSERT INTO statistics.company_statistic_pages_by_months_11_02 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2011-03-01 00:00:00' AND NEW.date < TIMESTAMP '2011-04-01 00:00:00') THEN INSERT INTO statistics.company_statistic_pages_by_months_11_03 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2011-11-01 00:00:00' AND NEW.date < TIMESTAMP '2011-12-01 00:00:00') THEN INSERT INTO statistics.company_statistic_pages_by_months_11_11 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2011-12-01 00:00:00' AND NEW.date < TIMESTAMP '2012-01-01 00:00:00') THEN INSERT INTO statistics.company_statistic_pages_by_months_11_12 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2012-01-01 00:00:00' AND NEW.date < TIMESTAMP '2012-02-01 00:00:00') THEN INSERT INTO statistics.company_statistic_pages_by_months_12_01 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2012-02-01 00:00:00' AND NEW.date < TIMESTAMP '2012-03-01 00:00:00') THEN INSERT INTO statistics.company_statistic_pages_by_months_12_02 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2012-03-01 00:00:00' AND NEW.date < TIMESTAMP '2012-04-01 00:00:00') THEN INSERT INTO statistics.company_statistic_pages_by_months_12_03 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2012-04-01 00:00:00' AND NEW.date < TIMESTAMP '2012-05-01 00:00:00') THEN INSERT INTO statistics.company_statistic_pages_by_months_12_04 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2012-05-01 00:00:00' AND NEW.date < TIMESTAMP '2012-06-01 00:00:00') THEN INSERT INTO statistics.company_statistic_pages_by_months_12_05 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2012-06-01 00:00:00' AND NEW.date < TIMESTAMP '2012-07-01 00:00:00') THEN INSERT INTO statistics.company_statistic_pages_by_months_12_06 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2012-07-01 00:00:00' AND NEW.date < TIMESTAMP '2012-08-01 00:00:00') THEN INSERT INTO statistics.company_statistic_pages_by_months_12_07 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2012-08-01 00:00:00' AND NEW.date < TIMESTAMP '2012-09-01 00:00:00') THEN INSERT INTO statistics.company_statistic_pages_by_months_12_08 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2012-09-01 00:00:00' AND NEW.date < TIMESTAMP '2012-10-01 00:00:00') THEN INSERT INTO statistics.company_statistic_pages_by_months_12_09 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2012-10-01 00:00:00' AND NEW.date < TIMESTAMP '2012-11-01 00:00:00') THEN INSERT INTO statistics.company_statistic_pages_by_months_12_10 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2012-11-01 00:00:00' AND NEW.date < TIMESTAMP '2012-12-01 00:00:00') THEN INSERT INTO statistics.company_statistic_pages_by_months_12_11 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2012-12-01 00:00:00' AND NEW.date < TIMESTAMP '2013-01-01 00:00:00') THEN INSERT INTO statistics.company_statistic_pages_by_months_12_12 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2013-01-01 00:00:00' AND NEW.date < TIMESTAMP '2013-02-01 00:00:00') THEN INSERT INTO statistics.company_statistic_pages_by_months_13_01 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2013-02-01 00:00:00' AND NEW.date < TIMESTAMP '2013-03-01 00:00:00') THEN INSERT INTO statistics.company_statistic_pages_by_months_13_02 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2013-03-01 00:00:00' AND NEW.date < TIMESTAMP '2013-04-01 00:00:00') THEN INSERT INTO statistics.company_statistic_pages_by_months_13_03 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2013-04-01 00:00:00' AND NEW.date < TIMESTAMP '2013-05-01 00:00:00') THEN INSERT INTO statistics.company_statistic_pages_by_months_13_04 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2013-05-01 00:00:00' AND NEW.date < TIMESTAMP '2013-06-01 00:00:00') THEN INSERT INTO statistics.company_statistic_pages_by_months_13_05 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2013-06-01 00:00:00' AND NEW.date < TIMESTAMP '2013-07-01 00:00:00') THEN INSERT INTO statistics.company_statistic_pages_by_months_13_06 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2013-07-01 00:00:00' AND NEW.date < TIMESTAMP '2013-08-01 00:00:00') THEN INSERT INTO statistics.company_statistic_pages_by_months_13_07 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2013-08-01 00:00:00' AND NEW.date < TIMESTAMP '2013-09-01 00:00:00') THEN INSERT INTO statistics.company_statistic_pages_by_months_13_08 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2013-09-01 00:00:00' AND NEW.date < TIMESTAMP '2013-10-01 00:00:00') THEN INSERT INTO statistics.company_statistic_pages_by_months_13_09 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2013-10-01 00:00:00' AND NEW.date < TIMESTAMP '2013-11-01 00:00:00') THEN INSERT INTO statistics.company_statistic_pages_by_months_13_10 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2013-11-01 00:00:00' AND NEW.date < TIMESTAMP '2013-12-01 00:00:00') THEN INSERT INTO statistics.company_statistic_pages_by_months_13_11 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2013-12-01 00:00:00' AND NEW.date < TIMESTAMP '2014-01-01 00:00:00') THEN INSERT INTO statistics.company_statistic_pages_by_months_13_12 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2014-01-01 00:00:00' AND NEW.date < TIMESTAMP '2014-02-01 00:00:00') THEN INSERT INTO statistics.company_statistic_pages_by_months_14_01 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2014-02-01 00:00:00' AND NEW.date < TIMESTAMP '2014-03-01 00:00:00') THEN INSERT INTO statistics.company_statistic_pages_by_months_14_02 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2014-03-01 00:00:00' AND NEW.date < TIMESTAMP '2014-04-01 00:00:00') THEN INSERT INTO statistics.company_statistic_pages_by_months_14_03 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2014-04-01 00:00:00' AND NEW.date < TIMESTAMP '2014-05-01 00:00:00') THEN INSERT INTO statistics.company_statistic_pages_by_months_14_04 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2014-05-01 00:00:00' AND NEW.date < TIMESTAMP '2014-06-01 00:00:00') THEN INSERT INTO statistics.company_statistic_pages_by_months_14_05 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2014-06-01 00:00:00' AND NEW.date < TIMESTAMP '2014-07-01 00:00:00') THEN INSERT INTO statistics.company_statistic_pages_by_months_14_06 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2014-07-01 00:00:00' AND NEW.date < TIMESTAMP '2014-08-01 00:00:00') THEN INSERT INTO statistics.company_statistic_pages_by_months_14_07 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2014-08-01 00:00:00' AND NEW.date < TIMESTAMP '2014-09-01 00:00:00') THEN INSERT INTO statistics.company_statistic_pages_by_months_14_08 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2014-09-01 00:00:00' AND NEW.date < TIMESTAMP '2014-10-01 00:00:00') THEN INSERT INTO statistics.company_statistic_pages_by_months_14_09 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2014-10-01 00:00:00' AND NEW.date < TIMESTAMP '2014-11-01 00:00:00') THEN INSERT INTO statistics.company_statistic_pages_by_months_14_10 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2014-11-01 00:00:00' AND NEW.date < TIMESTAMP '2014-12-01 00:00:00') THEN INSERT INTO statistics.company_statistic_pages_by_months_14_11 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2014-12-01 00:00:00' AND NEW.date < TIMESTAMP '2015-01-01 00:00:00') THEN INSERT INTO statistics.company_statistic_pages_by_months_14_12 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2015-01-01 00:00:00' AND NEW.date < TIMESTAMP '2015-02-01 00:00:00') THEN INSERT INTO statistics.company_statistic_pages_by_months_15_01 VALUES (NEW.*); ELSE RAISE EXCEPTION 'Inserted data is out of range. Fix statistics.company_statistic_pages_by_months_insert_trigger.'; END IF; RETURN NULL; END; $$; + + +-- +-- Name: company_statistic_pages_by_weeks_insert_trigger(); Type: FUNCTION; Schema: statistics; Owner: - +-- + +CREATE FUNCTION company_statistic_pages_by_weeks_insert_trigger() RETURNS trigger + LANGUAGE plpgsql + AS $$ BEGIN IF (NEW.first_week_day >= TIMESTAMP '2015-09-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2015-10-01 00:00:00') THEN INSERT INTO statistics.company_statistic_pages_by_weeks_15_09 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2010-02-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2010-03-01 00:00:00') THEN INSERT INTO statistics.company_statistic_pages_by_weeks_10_02 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2010-03-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2010-04-01 00:00:00') THEN INSERT INTO statistics.company_statistic_pages_by_weeks_10_03 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2010-04-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2010-05-01 00:00:00') THEN INSERT INTO statistics.company_statistic_pages_by_weeks_10_04 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2010-05-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2010-06-01 00:00:00') THEN INSERT INTO statistics.company_statistic_pages_by_weeks_10_05 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2010-06-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2010-07-01 00:00:00') THEN INSERT INTO statistics.company_statistic_pages_by_weeks_10_06 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2010-07-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2010-08-01 00:00:00') THEN INSERT INTO statistics.company_statistic_pages_by_weeks_10_07 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2010-08-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2010-09-01 00:00:00') THEN INSERT INTO statistics.company_statistic_pages_by_weeks_10_08 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2010-09-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2010-10-01 00:00:00') THEN INSERT INTO statistics.company_statistic_pages_by_weeks_10_09 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2010-10-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2010-11-01 00:00:00') THEN INSERT INTO statistics.company_statistic_pages_by_weeks_10_10 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2010-11-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2010-12-01 00:00:00') THEN INSERT INTO statistics.company_statistic_pages_by_weeks_10_11 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2009-05-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2009-06-01 00:00:00') THEN INSERT INTO statistics.company_statistic_pages_by_weeks_09_05 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2009-04-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2009-05-01 00:00:00') THEN INSERT INTO statistics.company_statistic_pages_by_weeks_09_04 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2009-06-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2009-07-01 00:00:00') THEN INSERT INTO statistics.company_statistic_pages_by_weeks_09_06 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2009-07-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2009-08-01 00:00:00') THEN INSERT INTO statistics.company_statistic_pages_by_weeks_09_07 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2009-08-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2009-09-01 00:00:00') THEN INSERT INTO statistics.company_statistic_pages_by_weeks_09_08 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2009-09-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2009-10-01 00:00:00') THEN INSERT INTO statistics.company_statistic_pages_by_weeks_09_09 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2009-10-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2009-11-01 00:00:00') THEN INSERT INTO statistics.company_statistic_pages_by_weeks_09_10 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2009-11-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2009-12-01 00:00:00') THEN INSERT INTO statistics.company_statistic_pages_by_weeks_09_11 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2009-12-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2010-01-01 00:00:00') THEN INSERT INTO statistics.company_statistic_pages_by_weeks_09_12 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2010-01-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2010-02-01 00:00:00') THEN INSERT INTO statistics.company_statistic_pages_by_weeks_10_01 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2010-12-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2011-01-01 00:00:00') THEN INSERT INTO statistics.company_statistic_pages_by_weeks_10_12 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2011-01-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2011-02-01 00:00:00') THEN INSERT INTO statistics.company_statistic_pages_by_weeks_11_01 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2011-02-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2011-03-01 00:00:00') THEN INSERT INTO statistics.company_statistic_pages_by_weeks_11_02 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2011-03-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2011-04-01 00:00:00') THEN INSERT INTO statistics.company_statistic_pages_by_weeks_11_03 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2011-12-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2012-01-01 00:00:00') THEN INSERT INTO statistics.company_statistic_pages_by_weeks_11_12 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2011-11-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2011-12-01 00:00:00') THEN INSERT INTO statistics.company_statistic_pages_by_weeks_11_11 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2012-01-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2012-02-01 00:00:00') THEN INSERT INTO statistics.company_statistic_pages_by_weeks_12_01 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2012-02-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2012-03-01 00:00:00') THEN INSERT INTO statistics.company_statistic_pages_by_weeks_12_02 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2012-03-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2012-04-01 00:00:00') THEN INSERT INTO statistics.company_statistic_pages_by_weeks_12_03 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2012-04-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2012-05-01 00:00:00') THEN INSERT INTO statistics.company_statistic_pages_by_weeks_12_04 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2012-05-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2012-06-01 00:00:00') THEN INSERT INTO statistics.company_statistic_pages_by_weeks_12_05 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2012-06-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2012-07-01 00:00:00') THEN INSERT INTO statistics.company_statistic_pages_by_weeks_12_06 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2012-07-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2012-08-01 00:00:00') THEN INSERT INTO statistics.company_statistic_pages_by_weeks_12_07 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2012-08-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2012-09-01 00:00:00') THEN INSERT INTO statistics.company_statistic_pages_by_weeks_12_08 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2012-09-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2012-10-01 00:00:00') THEN INSERT INTO statistics.company_statistic_pages_by_weeks_12_09 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2012-10-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2012-11-01 00:00:00') THEN INSERT INTO statistics.company_statistic_pages_by_weeks_12_10 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2012-11-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2012-12-01 00:00:00') THEN INSERT INTO statistics.company_statistic_pages_by_weeks_12_11 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2012-12-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2013-01-01 00:00:00') THEN INSERT INTO statistics.company_statistic_pages_by_weeks_12_12 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2013-01-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2013-02-01 00:00:00') THEN INSERT INTO statistics.company_statistic_pages_by_weeks_13_01 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2013-02-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2013-03-01 00:00:00') THEN INSERT INTO statistics.company_statistic_pages_by_weeks_13_02 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2013-03-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2013-04-01 00:00:00') THEN INSERT INTO statistics.company_statistic_pages_by_weeks_13_03 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2013-04-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2013-05-01 00:00:00') THEN INSERT INTO statistics.company_statistic_pages_by_weeks_13_04 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2013-05-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2013-06-01 00:00:00') THEN INSERT INTO statistics.company_statistic_pages_by_weeks_13_05 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2013-06-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2013-07-01 00:00:00') THEN INSERT INTO statistics.company_statistic_pages_by_weeks_13_06 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2013-07-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2013-08-01 00:00:00') THEN INSERT INTO statistics.company_statistic_pages_by_weeks_13_07 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2013-08-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2013-09-01 00:00:00') THEN INSERT INTO statistics.company_statistic_pages_by_weeks_13_08 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2013-09-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2013-10-01 00:00:00') THEN INSERT INTO statistics.company_statistic_pages_by_weeks_13_09 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2013-10-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2013-11-01 00:00:00') THEN INSERT INTO statistics.company_statistic_pages_by_weeks_13_10 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2013-11-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2013-12-01 00:00:00') THEN INSERT INTO statistics.company_statistic_pages_by_weeks_13_11 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2013-12-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2014-01-01 00:00:00') THEN INSERT INTO statistics.company_statistic_pages_by_weeks_13_12 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2014-01-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2014-02-01 00:00:00') THEN INSERT INTO statistics.company_statistic_pages_by_weeks_14_01 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2014-02-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2014-03-01 00:00:00') THEN INSERT INTO statistics.company_statistic_pages_by_weeks_14_02 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2014-03-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2014-04-01 00:00:00') THEN INSERT INTO statistics.company_statistic_pages_by_weeks_14_03 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2014-04-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2014-05-01 00:00:00') THEN INSERT INTO statistics.company_statistic_pages_by_weeks_14_04 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2014-05-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2014-06-01 00:00:00') THEN INSERT INTO statistics.company_statistic_pages_by_weeks_14_05 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2014-06-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2014-07-01 00:00:00') THEN INSERT INTO statistics.company_statistic_pages_by_weeks_14_06 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2014-07-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2014-08-01 00:00:00') THEN INSERT INTO statistics.company_statistic_pages_by_weeks_14_07 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2014-08-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2014-09-01 00:00:00') THEN INSERT INTO statistics.company_statistic_pages_by_weeks_14_08 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2014-09-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2014-10-01 00:00:00') THEN INSERT INTO statistics.company_statistic_pages_by_weeks_14_09 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2014-10-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2014-11-01 00:00:00') THEN INSERT INTO statistics.company_statistic_pages_by_weeks_14_10 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2014-11-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2014-12-01 00:00:00') THEN INSERT INTO statistics.company_statistic_pages_by_weeks_14_11 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2014-12-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2015-01-01 00:00:00') THEN INSERT INTO statistics.company_statistic_pages_by_weeks_14_12 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2015-01-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2015-02-01 00:00:00') THEN INSERT INTO statistics.company_statistic_pages_by_weeks_15_01 VALUES (NEW.*); ELSE RAISE EXCEPTION 'Inserted data is out of range. Fix statistics.company_statistic_pages_by_weeks_insert_trigger.'; END IF; RETURN NULL; END; $$; + + +-- +-- Name: company_statistic_referers_by_months_insert_trigger(); Type: FUNCTION; Schema: statistics; Owner: - +-- + +CREATE FUNCTION company_statistic_referers_by_months_insert_trigger() RETURNS trigger + LANGUAGE plpgsql + AS $$ BEGIN IF (NEW.date >= TIMESTAMP '2015-08-01 00:00:00' AND NEW.date < TIMESTAMP '2015-09-01 00:00:00') THEN INSERT INTO statistics.company_statistic_referers_by_months_15_08 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2009-12-01 00:00:00' AND NEW.date < TIMESTAMP '2010-01-01 00:00:00') THEN INSERT INTO statistics.company_statistic_referers_by_months_09_12 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2010-01-01 00:00:00' AND NEW.date < TIMESTAMP '2010-02-01 00:00:00') THEN INSERT INTO statistics.company_statistic_referers_by_months_10_01 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2010-02-01 00:00:00' AND NEW.date < TIMESTAMP '2010-03-01 00:00:00') THEN INSERT INTO statistics.company_statistic_referers_by_months_10_02 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2010-03-01 00:00:00' AND NEW.date < TIMESTAMP '2010-04-01 00:00:00') THEN INSERT INTO statistics.company_statistic_referers_by_months_10_03 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2010-04-01 00:00:00' AND NEW.date < TIMESTAMP '2010-05-01 00:00:00') THEN INSERT INTO statistics.company_statistic_referers_by_months_10_04 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2010-05-01 00:00:00' AND NEW.date < TIMESTAMP '2010-06-01 00:00:00') THEN INSERT INTO statistics.company_statistic_referers_by_months_10_05 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2010-06-01 00:00:00' AND NEW.date < TIMESTAMP '2010-07-01 00:00:00') THEN INSERT INTO statistics.company_statistic_referers_by_months_10_06 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2010-07-01 00:00:00' AND NEW.date < TIMESTAMP '2010-08-01 00:00:00') THEN INSERT INTO statistics.company_statistic_referers_by_months_10_07 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2010-08-01 00:00:00' AND NEW.date < TIMESTAMP '2010-09-01 00:00:00') THEN INSERT INTO statistics.company_statistic_referers_by_months_10_08 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2010-09-01 00:00:00' AND NEW.date < TIMESTAMP '2010-10-01 00:00:00') THEN INSERT INTO statistics.company_statistic_referers_by_months_10_09 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2010-10-01 00:00:00' AND NEW.date < TIMESTAMP '2010-11-01 00:00:00') THEN INSERT INTO statistics.company_statistic_referers_by_months_10_10 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2010-11-01 00:00:00' AND NEW.date < TIMESTAMP '2010-12-01 00:00:00') THEN INSERT INTO statistics.company_statistic_referers_by_months_10_11 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2009-08-01 00:00:00' AND NEW.date < TIMESTAMP '2009-09-01 00:00:00') THEN INSERT INTO statistics.company_statistic_referers_by_months_09_08 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2009-07-01 00:00:00' AND NEW.date < TIMESTAMP '2009-08-01 00:00:00') THEN INSERT INTO statistics.company_statistic_referers_by_months_09_07 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2009-09-01 00:00:00' AND NEW.date < TIMESTAMP '2009-10-01 00:00:00') THEN INSERT INTO statistics.company_statistic_referers_by_months_09_09 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2009-10-01 00:00:00' AND NEW.date < TIMESTAMP '2009-11-01 00:00:00') THEN INSERT INTO statistics.company_statistic_referers_by_months_09_10 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2009-11-01 00:00:00' AND NEW.date < TIMESTAMP '2009-12-01 00:00:00') THEN INSERT INTO statistics.company_statistic_referers_by_months_09_11 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2010-12-01 00:00:00' AND NEW.date < TIMESTAMP '2011-01-01 00:00:00') THEN INSERT INTO statistics.company_statistic_referers_by_months_10_12 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2011-01-01 00:00:00' AND NEW.date < TIMESTAMP '2011-02-01 00:00:00') THEN INSERT INTO statistics.company_statistic_referers_by_months_11_01 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2011-02-01 00:00:00' AND NEW.date < TIMESTAMP '2011-03-01 00:00:00') THEN INSERT INTO statistics.company_statistic_referers_by_months_11_02 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2011-03-01 00:00:00' AND NEW.date < TIMESTAMP '2011-04-01 00:00:00') THEN INSERT INTO statistics.company_statistic_referers_by_months_11_03 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2011-11-01 00:00:00' AND NEW.date < TIMESTAMP '2011-12-01 00:00:00') THEN INSERT INTO statistics.company_statistic_referers_by_months_11_11 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2011-12-01 00:00:00' AND NEW.date < TIMESTAMP '2012-01-01 00:00:00') THEN INSERT INTO statistics.company_statistic_referers_by_months_11_12 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2012-01-01 00:00:00' AND NEW.date < TIMESTAMP '2012-02-01 00:00:00') THEN INSERT INTO statistics.company_statistic_referers_by_months_12_01 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2012-02-01 00:00:00' AND NEW.date < TIMESTAMP '2012-03-01 00:00:00') THEN INSERT INTO statistics.company_statistic_referers_by_months_12_02 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2012-03-01 00:00:00' AND NEW.date < TIMESTAMP '2012-04-01 00:00:00') THEN INSERT INTO statistics.company_statistic_referers_by_months_12_03 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2012-04-01 00:00:00' AND NEW.date < TIMESTAMP '2012-05-01 00:00:00') THEN INSERT INTO statistics.company_statistic_referers_by_months_12_04 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2012-05-01 00:00:00' AND NEW.date < TIMESTAMP '2012-06-01 00:00:00') THEN INSERT INTO statistics.company_statistic_referers_by_months_12_05 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2012-06-01 00:00:00' AND NEW.date < TIMESTAMP '2012-07-01 00:00:00') THEN INSERT INTO statistics.company_statistic_referers_by_months_12_06 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2012-07-01 00:00:00' AND NEW.date < TIMESTAMP '2012-08-01 00:00:00') THEN INSERT INTO statistics.company_statistic_referers_by_months_12_07 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2012-08-01 00:00:00' AND NEW.date < TIMESTAMP '2012-09-01 00:00:00') THEN INSERT INTO statistics.company_statistic_referers_by_months_12_08 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2012-09-01 00:00:00' AND NEW.date < TIMESTAMP '2012-10-01 00:00:00') THEN INSERT INTO statistics.company_statistic_referers_by_months_12_09 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2012-10-01 00:00:00' AND NEW.date < TIMESTAMP '2012-11-01 00:00:00') THEN INSERT INTO statistics.company_statistic_referers_by_months_12_10 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2012-11-01 00:00:00' AND NEW.date < TIMESTAMP '2012-12-01 00:00:00') THEN INSERT INTO statistics.company_statistic_referers_by_months_12_11 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2012-12-01 00:00:00' AND NEW.date < TIMESTAMP '2013-01-01 00:00:00') THEN INSERT INTO statistics.company_statistic_referers_by_months_12_12 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2013-01-01 00:00:00' AND NEW.date < TIMESTAMP '2013-02-01 00:00:00') THEN INSERT INTO statistics.company_statistic_referers_by_months_13_01 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2013-02-01 00:00:00' AND NEW.date < TIMESTAMP '2013-03-01 00:00:00') THEN INSERT INTO statistics.company_statistic_referers_by_months_13_02 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2013-03-01 00:00:00' AND NEW.date < TIMESTAMP '2013-04-01 00:00:00') THEN INSERT INTO statistics.company_statistic_referers_by_months_13_03 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2013-04-01 00:00:00' AND NEW.date < TIMESTAMP '2013-05-01 00:00:00') THEN INSERT INTO statistics.company_statistic_referers_by_months_13_04 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2013-05-01 00:00:00' AND NEW.date < TIMESTAMP '2013-06-01 00:00:00') THEN INSERT INTO statistics.company_statistic_referers_by_months_13_05 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2013-06-01 00:00:00' AND NEW.date < TIMESTAMP '2013-07-01 00:00:00') THEN INSERT INTO statistics.company_statistic_referers_by_months_13_06 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2013-07-01 00:00:00' AND NEW.date < TIMESTAMP '2013-08-01 00:00:00') THEN INSERT INTO statistics.company_statistic_referers_by_months_13_07 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2013-08-01 00:00:00' AND NEW.date < TIMESTAMP '2013-09-01 00:00:00') THEN INSERT INTO statistics.company_statistic_referers_by_months_13_08 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2013-09-01 00:00:00' AND NEW.date < TIMESTAMP '2013-10-01 00:00:00') THEN INSERT INTO statistics.company_statistic_referers_by_months_13_09 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2013-10-01 00:00:00' AND NEW.date < TIMESTAMP '2013-11-01 00:00:00') THEN INSERT INTO statistics.company_statistic_referers_by_months_13_10 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2013-11-01 00:00:00' AND NEW.date < TIMESTAMP '2013-12-01 00:00:00') THEN INSERT INTO statistics.company_statistic_referers_by_months_13_11 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2013-12-01 00:00:00' AND NEW.date < TIMESTAMP '2014-01-01 00:00:00') THEN INSERT INTO statistics.company_statistic_referers_by_months_13_12 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2014-01-01 00:00:00' AND NEW.date < TIMESTAMP '2014-02-01 00:00:00') THEN INSERT INTO statistics.company_statistic_referers_by_months_14_01 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2014-02-01 00:00:00' AND NEW.date < TIMESTAMP '2014-03-01 00:00:00') THEN INSERT INTO statistics.company_statistic_referers_by_months_14_02 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2014-03-01 00:00:00' AND NEW.date < TIMESTAMP '2014-04-01 00:00:00') THEN INSERT INTO statistics.company_statistic_referers_by_months_14_03 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2014-04-01 00:00:00' AND NEW.date < TIMESTAMP '2014-05-01 00:00:00') THEN INSERT INTO statistics.company_statistic_referers_by_months_14_04 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2014-05-01 00:00:00' AND NEW.date < TIMESTAMP '2014-06-01 00:00:00') THEN INSERT INTO statistics.company_statistic_referers_by_months_14_05 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2014-06-01 00:00:00' AND NEW.date < TIMESTAMP '2014-07-01 00:00:00') THEN INSERT INTO statistics.company_statistic_referers_by_months_14_06 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2014-07-01 00:00:00' AND NEW.date < TIMESTAMP '2014-08-01 00:00:00') THEN INSERT INTO statistics.company_statistic_referers_by_months_14_07 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2014-08-01 00:00:00' AND NEW.date < TIMESTAMP '2014-09-01 00:00:00') THEN INSERT INTO statistics.company_statistic_referers_by_months_14_08 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2014-09-01 00:00:00' AND NEW.date < TIMESTAMP '2014-10-01 00:00:00') THEN INSERT INTO statistics.company_statistic_referers_by_months_14_09 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2014-10-01 00:00:00' AND NEW.date < TIMESTAMP '2014-11-01 00:00:00') THEN INSERT INTO statistics.company_statistic_referers_by_months_14_10 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2014-11-01 00:00:00' AND NEW.date < TIMESTAMP '2014-12-01 00:00:00') THEN INSERT INTO statistics.company_statistic_referers_by_months_14_11 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2014-12-01 00:00:00' AND NEW.date < TIMESTAMP '2015-01-01 00:00:00') THEN INSERT INTO statistics.company_statistic_referers_by_months_14_12 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2015-01-01 00:00:00' AND NEW.date < TIMESTAMP '2015-02-01 00:00:00') THEN INSERT INTO statistics.company_statistic_referers_by_months_15_01 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2015-09-01 00:00:00' AND NEW.date < TIMESTAMP '2015-10-01 00:00:00') THEN INSERT INTO statistics.company_statistic_referers_by_months_15_09 VALUES (NEW.*); ELSE RAISE EXCEPTION 'Inserted data is out of range. Fix statistics.company_statistic_referers_by_months_insert_trigger.'; END IF; RETURN NULL; END; $$; + + +-- +-- Name: company_statistic_referers_by_weeks_insert_trigger(); Type: FUNCTION; Schema: statistics; Owner: - +-- + +CREATE FUNCTION company_statistic_referers_by_weeks_insert_trigger() RETURNS trigger + LANGUAGE plpgsql + AS $$ BEGIN IF (NEW.first_week_day >= TIMESTAMP '2015-09-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2015-10-01 00:00:00') THEN INSERT INTO statistics.company_statistic_referers_by_weeks_15_09 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2009-12-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2010-01-01 00:00:00') THEN INSERT INTO statistics.company_statistic_referers_by_weeks_09_12 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2010-01-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2010-02-01 00:00:00') THEN INSERT INTO statistics.company_statistic_referers_by_weeks_10_01 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2010-02-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2010-03-01 00:00:00') THEN INSERT INTO statistics.company_statistic_referers_by_weeks_10_02 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2010-03-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2010-04-01 00:00:00') THEN INSERT INTO statistics.company_statistic_referers_by_weeks_10_03 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2010-04-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2010-05-01 00:00:00') THEN INSERT INTO statistics.company_statistic_referers_by_weeks_10_04 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2010-05-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2010-06-01 00:00:00') THEN INSERT INTO statistics.company_statistic_referers_by_weeks_10_05 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2010-06-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2010-07-01 00:00:00') THEN INSERT INTO statistics.company_statistic_referers_by_weeks_10_06 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2010-07-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2010-08-01 00:00:00') THEN INSERT INTO statistics.company_statistic_referers_by_weeks_10_07 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2010-08-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2010-09-01 00:00:00') THEN INSERT INTO statistics.company_statistic_referers_by_weeks_10_08 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2010-09-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2010-10-01 00:00:00') THEN INSERT INTO statistics.company_statistic_referers_by_weeks_10_09 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2010-10-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2010-11-01 00:00:00') THEN INSERT INTO statistics.company_statistic_referers_by_weeks_10_10 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2010-11-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2010-12-01 00:00:00') THEN INSERT INTO statistics.company_statistic_referers_by_weeks_10_11 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2009-07-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2009-08-01 00:00:00') THEN INSERT INTO statistics.company_statistic_referers_by_weeks_09_07 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2009-06-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2009-07-01 00:00:00') THEN INSERT INTO statistics.company_statistic_referers_by_weeks_09_06 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2009-08-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2009-09-01 00:00:00') THEN INSERT INTO statistics.company_statistic_referers_by_weeks_09_08 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2009-09-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2009-10-01 00:00:00') THEN INSERT INTO statistics.company_statistic_referers_by_weeks_09_09 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2009-10-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2009-11-01 00:00:00') THEN INSERT INTO statistics.company_statistic_referers_by_weeks_09_10 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2009-11-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2009-12-01 00:00:00') THEN INSERT INTO statistics.company_statistic_referers_by_weeks_09_11 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2010-12-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2011-01-01 00:00:00') THEN INSERT INTO statistics.company_statistic_referers_by_weeks_10_12 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2011-01-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2011-02-01 00:00:00') THEN INSERT INTO statistics.company_statistic_referers_by_weeks_11_01 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2011-02-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2011-03-01 00:00:00') THEN INSERT INTO statistics.company_statistic_referers_by_weeks_11_02 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2011-03-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2011-04-01 00:00:00') THEN INSERT INTO statistics.company_statistic_referers_by_weeks_11_03 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2011-12-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2012-01-01 00:00:00') THEN INSERT INTO statistics.company_statistic_referers_by_weeks_11_12 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2011-11-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2011-12-01 00:00:00') THEN INSERT INTO statistics.company_statistic_referers_by_weeks_11_11 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2012-01-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2012-02-01 00:00:00') THEN INSERT INTO statistics.company_statistic_referers_by_weeks_12_01 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2012-02-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2012-03-01 00:00:00') THEN INSERT INTO statistics.company_statistic_referers_by_weeks_12_02 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2012-03-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2012-04-01 00:00:00') THEN INSERT INTO statistics.company_statistic_referers_by_weeks_12_03 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2012-04-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2012-05-01 00:00:00') THEN INSERT INTO statistics.company_statistic_referers_by_weeks_12_04 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2012-05-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2012-06-01 00:00:00') THEN INSERT INTO statistics.company_statistic_referers_by_weeks_12_05 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2012-06-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2012-07-01 00:00:00') THEN INSERT INTO statistics.company_statistic_referers_by_weeks_12_06 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2012-07-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2012-08-01 00:00:00') THEN INSERT INTO statistics.company_statistic_referers_by_weeks_12_07 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2012-08-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2012-09-01 00:00:00') THEN INSERT INTO statistics.company_statistic_referers_by_weeks_12_08 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2012-09-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2012-10-01 00:00:00') THEN INSERT INTO statistics.company_statistic_referers_by_weeks_12_09 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2012-10-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2012-11-01 00:00:00') THEN INSERT INTO statistics.company_statistic_referers_by_weeks_12_10 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2012-11-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2012-12-01 00:00:00') THEN INSERT INTO statistics.company_statistic_referers_by_weeks_12_11 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2012-12-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2013-01-01 00:00:00') THEN INSERT INTO statistics.company_statistic_referers_by_weeks_12_12 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2013-01-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2013-02-01 00:00:00') THEN INSERT INTO statistics.company_statistic_referers_by_weeks_13_01 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2013-02-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2013-03-01 00:00:00') THEN INSERT INTO statistics.company_statistic_referers_by_weeks_13_02 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2013-03-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2013-04-01 00:00:00') THEN INSERT INTO statistics.company_statistic_referers_by_weeks_13_03 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2013-04-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2013-05-01 00:00:00') THEN INSERT INTO statistics.company_statistic_referers_by_weeks_13_04 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2013-05-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2013-06-01 00:00:00') THEN INSERT INTO statistics.company_statistic_referers_by_weeks_13_05 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2013-06-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2013-07-01 00:00:00') THEN INSERT INTO statistics.company_statistic_referers_by_weeks_13_06 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2013-07-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2013-08-01 00:00:00') THEN INSERT INTO statistics.company_statistic_referers_by_weeks_13_07 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2013-08-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2013-09-01 00:00:00') THEN INSERT INTO statistics.company_statistic_referers_by_weeks_13_08 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2013-09-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2013-10-01 00:00:00') THEN INSERT INTO statistics.company_statistic_referers_by_weeks_13_09 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2013-10-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2013-11-01 00:00:00') THEN INSERT INTO statistics.company_statistic_referers_by_weeks_13_10 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2013-11-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2013-12-01 00:00:00') THEN INSERT INTO statistics.company_statistic_referers_by_weeks_13_11 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2013-12-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2014-01-01 00:00:00') THEN INSERT INTO statistics.company_statistic_referers_by_weeks_13_12 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2014-01-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2014-02-01 00:00:00') THEN INSERT INTO statistics.company_statistic_referers_by_weeks_14_01 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2014-02-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2014-03-01 00:00:00') THEN INSERT INTO statistics.company_statistic_referers_by_weeks_14_02 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2014-03-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2014-04-01 00:00:00') THEN INSERT INTO statistics.company_statistic_referers_by_weeks_14_03 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2014-04-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2014-05-01 00:00:00') THEN INSERT INTO statistics.company_statistic_referers_by_weeks_14_04 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2014-05-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2014-06-01 00:00:00') THEN INSERT INTO statistics.company_statistic_referers_by_weeks_14_05 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2014-06-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2014-07-01 00:00:00') THEN INSERT INTO statistics.company_statistic_referers_by_weeks_14_06 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2014-07-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2014-08-01 00:00:00') THEN INSERT INTO statistics.company_statistic_referers_by_weeks_14_07 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2014-08-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2014-09-01 00:00:00') THEN INSERT INTO statistics.company_statistic_referers_by_weeks_14_08 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2014-09-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2014-10-01 00:00:00') THEN INSERT INTO statistics.company_statistic_referers_by_weeks_14_09 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2014-10-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2014-11-01 00:00:00') THEN INSERT INTO statistics.company_statistic_referers_by_weeks_14_10 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2014-11-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2014-12-01 00:00:00') THEN INSERT INTO statistics.company_statistic_referers_by_weeks_14_11 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2014-12-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2015-01-01 00:00:00') THEN INSERT INTO statistics.company_statistic_referers_by_weeks_14_12 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2015-01-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2015-02-01 00:00:00') THEN INSERT INTO statistics.company_statistic_referers_by_weeks_15_01 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2015-08-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2015-09-01 00:00:00') THEN INSERT INTO statistics.company_statistic_referers_by_weeks_15_08 VALUES (NEW.*); ELSE RAISE EXCEPTION 'Inserted data is out of range. Fix statistics.company_statistic_referers_by_weeks_insert_trigger.'; END IF; RETURN NULL; END; $$; + + +-- +-- Name: company_statistic_total_by_days_insert_trigger(); Type: FUNCTION; Schema: statistics; Owner: - +-- + +CREATE FUNCTION company_statistic_total_by_days_insert_trigger() RETURNS trigger + LANGUAGE plpgsql + AS $$ BEGIN IF (NEW.date >= TIMESTAMP '2015-09-01 00:00:00' AND NEW.date < TIMESTAMP '2015-10-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_days_15_09 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2009-11-01 00:00:00' AND NEW.date < TIMESTAMP '2009-12-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_days_09_11 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2010-01-01 00:00:00' AND NEW.date < TIMESTAMP '2010-02-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_days_10_01 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2010-02-01 00:00:00' AND NEW.date < TIMESTAMP '2010-03-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_days_10_02 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2010-03-01 00:00:00' AND NEW.date < TIMESTAMP '2010-04-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_days_10_03 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2010-04-01 00:00:00' AND NEW.date < TIMESTAMP '2010-05-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_days_10_04 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2010-05-01 00:00:00' AND NEW.date < TIMESTAMP '2010-06-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_days_10_05 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2010-06-01 00:00:00' AND NEW.date < TIMESTAMP '2010-07-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_days_10_06 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2010-07-01 00:00:00' AND NEW.date < TIMESTAMP '2010-08-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_days_10_07 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2010-08-01 00:00:00' AND NEW.date < TIMESTAMP '2010-09-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_days_10_08 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2010-09-01 00:00:00' AND NEW.date < TIMESTAMP '2010-10-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_days_10_09 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2010-10-01 00:00:00' AND NEW.date < TIMESTAMP '2010-11-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_days_10_10 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2010-11-01 00:00:00' AND NEW.date < TIMESTAMP '2010-12-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_days_10_11 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2009-12-01 00:00:00' AND NEW.date < TIMESTAMP '2010-01-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_days_09_12 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2010-12-01 00:00:00' AND NEW.date < TIMESTAMP '2011-01-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_days_10_12 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2011-01-01 00:00:00' AND NEW.date < TIMESTAMP '2011-02-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_days_11_01 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2011-02-01 00:00:00' AND NEW.date < TIMESTAMP '2011-03-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_days_11_02 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2011-03-01 00:00:00' AND NEW.date < TIMESTAMP '2011-04-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_days_11_03 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2011-11-01 00:00:00' AND NEW.date < TIMESTAMP '2011-12-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_days_11_11 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2011-12-01 00:00:00' AND NEW.date < TIMESTAMP '2012-01-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_days_11_12 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2012-01-01 00:00:00' AND NEW.date < TIMESTAMP '2012-02-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_days_12_01 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2012-02-01 00:00:00' AND NEW.date < TIMESTAMP '2012-03-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_days_12_02 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2012-03-01 00:00:00' AND NEW.date < TIMESTAMP '2012-04-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_days_12_03 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2012-04-01 00:00:00' AND NEW.date < TIMESTAMP '2012-05-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_days_12_04 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2012-05-01 00:00:00' AND NEW.date < TIMESTAMP '2012-06-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_days_12_05 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2012-06-01 00:00:00' AND NEW.date < TIMESTAMP '2012-07-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_days_12_06 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2012-07-01 00:00:00' AND NEW.date < TIMESTAMP '2012-08-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_days_12_07 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2012-08-01 00:00:00' AND NEW.date < TIMESTAMP '2012-09-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_days_12_08 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2012-09-01 00:00:00' AND NEW.date < TIMESTAMP '2012-10-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_days_12_09 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2012-10-01 00:00:00' AND NEW.date < TIMESTAMP '2012-11-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_days_12_10 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2012-11-01 00:00:00' AND NEW.date < TIMESTAMP '2012-12-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_days_12_11 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2012-12-01 00:00:00' AND NEW.date < TIMESTAMP '2013-01-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_days_12_12 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2013-01-01 00:00:00' AND NEW.date < TIMESTAMP '2013-02-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_days_13_01 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2013-02-01 00:00:00' AND NEW.date < TIMESTAMP '2013-03-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_days_13_02 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2013-03-01 00:00:00' AND NEW.date < TIMESTAMP '2013-04-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_days_13_03 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2013-04-01 00:00:00' AND NEW.date < TIMESTAMP '2013-05-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_days_13_04 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2013-05-01 00:00:00' AND NEW.date < TIMESTAMP '2013-06-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_days_13_05 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2013-06-01 00:00:00' AND NEW.date < TIMESTAMP '2013-07-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_days_13_06 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2013-07-01 00:00:00' AND NEW.date < TIMESTAMP '2013-08-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_days_13_07 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2013-08-01 00:00:00' AND NEW.date < TIMESTAMP '2013-09-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_days_13_08 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2013-09-01 00:00:00' AND NEW.date < TIMESTAMP '2013-10-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_days_13_09 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2013-10-01 00:00:00' AND NEW.date < TIMESTAMP '2013-11-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_days_13_10 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2013-11-01 00:00:00' AND NEW.date < TIMESTAMP '2013-12-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_days_13_11 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2013-12-01 00:00:00' AND NEW.date < TIMESTAMP '2014-01-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_days_13_12 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2014-01-01 00:00:00' AND NEW.date < TIMESTAMP '2014-02-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_days_14_01 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2014-02-01 00:00:00' AND NEW.date < TIMESTAMP '2014-03-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_days_14_02 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2014-03-01 00:00:00' AND NEW.date < TIMESTAMP '2014-04-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_days_14_03 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2014-04-01 00:00:00' AND NEW.date < TIMESTAMP '2014-05-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_days_14_04 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2014-05-01 00:00:00' AND NEW.date < TIMESTAMP '2014-06-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_days_14_05 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2014-06-01 00:00:00' AND NEW.date < TIMESTAMP '2014-07-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_days_14_06 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2014-07-01 00:00:00' AND NEW.date < TIMESTAMP '2014-08-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_days_14_07 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2014-08-01 00:00:00' AND NEW.date < TIMESTAMP '2014-09-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_days_14_08 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2014-09-01 00:00:00' AND NEW.date < TIMESTAMP '2014-10-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_days_14_09 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2014-10-01 00:00:00' AND NEW.date < TIMESTAMP '2014-11-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_days_14_10 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2014-11-01 00:00:00' AND NEW.date < TIMESTAMP '2014-12-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_days_14_11 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2014-12-01 00:00:00' AND NEW.date < TIMESTAMP '2015-01-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_days_14_12 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2015-01-01 00:00:00' AND NEW.date < TIMESTAMP '2015-02-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_days_15_01 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2015-08-01 00:00:00' AND NEW.date < TIMESTAMP '2015-09-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_days_15_08 VALUES (NEW.*); ELSE RAISE EXCEPTION 'Inserted data is out of range. Fix statistics.company_statistic_total_by_days_insert_trigger.'; END IF; RETURN NULL; END; $$; + + +-- +-- Name: company_statistic_total_by_months_insert_trigger(); Type: FUNCTION; Schema: statistics; Owner: - +-- + +CREATE FUNCTION company_statistic_total_by_months_insert_trigger() RETURNS trigger + LANGUAGE plpgsql + AS $$ BEGIN IF (NEW.date >= TIMESTAMP '2015-09-01 00:00:00' AND NEW.date < TIMESTAMP '2015-10-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_months_15_09 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2009-12-01 00:00:00' AND NEW.date < TIMESTAMP '2010-01-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_months_09_12 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2010-01-01 00:00:00' AND NEW.date < TIMESTAMP '2010-02-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_months_10_01 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2010-02-01 00:00:00' AND NEW.date < TIMESTAMP '2010-03-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_months_10_02 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2010-04-01 00:00:00' AND NEW.date < TIMESTAMP '2010-05-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_months_10_04 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2010-05-01 00:00:00' AND NEW.date < TIMESTAMP '2010-06-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_months_10_05 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2010-06-01 00:00:00' AND NEW.date < TIMESTAMP '2010-07-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_months_10_06 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2010-07-01 00:00:00' AND NEW.date < TIMESTAMP '2010-08-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_months_10_07 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2010-08-01 00:00:00' AND NEW.date < TIMESTAMP '2010-09-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_months_10_08 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2010-09-01 00:00:00' AND NEW.date < TIMESTAMP '2010-10-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_months_10_09 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2010-10-01 00:00:00' AND NEW.date < TIMESTAMP '2010-11-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_months_10_10 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2010-11-01 00:00:00' AND NEW.date < TIMESTAMP '2010-12-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_months_10_11 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2009-04-01 00:00:00' AND NEW.date < TIMESTAMP '2009-05-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_months_09_04 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2010-03-01 00:00:00' AND NEW.date < TIMESTAMP '2010-04-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_months_10_03 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2009-05-01 00:00:00' AND NEW.date < TIMESTAMP '2009-06-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_months_09_05 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2009-06-01 00:00:00' AND NEW.date < TIMESTAMP '2009-07-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_months_09_06 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2009-07-01 00:00:00' AND NEW.date < TIMESTAMP '2009-08-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_months_09_07 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2009-08-01 00:00:00' AND NEW.date < TIMESTAMP '2009-09-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_months_09_08 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2009-09-01 00:00:00' AND NEW.date < TIMESTAMP '2009-10-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_months_09_09 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2009-10-01 00:00:00' AND NEW.date < TIMESTAMP '2009-11-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_months_09_10 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2009-11-01 00:00:00' AND NEW.date < TIMESTAMP '2009-12-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_months_09_11 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2010-12-01 00:00:00' AND NEW.date < TIMESTAMP '2011-01-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_months_10_12 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2011-01-01 00:00:00' AND NEW.date < TIMESTAMP '2011-02-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_months_11_01 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2011-02-01 00:00:00' AND NEW.date < TIMESTAMP '2011-03-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_months_11_02 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2011-03-01 00:00:00' AND NEW.date < TIMESTAMP '2011-04-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_months_11_03 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2011-11-01 00:00:00' AND NEW.date < TIMESTAMP '2011-12-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_months_11_11 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2011-12-01 00:00:00' AND NEW.date < TIMESTAMP '2012-01-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_months_11_12 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2012-01-01 00:00:00' AND NEW.date < TIMESTAMP '2012-02-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_months_12_01 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2012-02-01 00:00:00' AND NEW.date < TIMESTAMP '2012-03-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_months_12_02 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2012-03-01 00:00:00' AND NEW.date < TIMESTAMP '2012-04-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_months_12_03 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2012-04-01 00:00:00' AND NEW.date < TIMESTAMP '2012-05-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_months_12_04 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2012-05-01 00:00:00' AND NEW.date < TIMESTAMP '2012-06-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_months_12_05 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2012-06-01 00:00:00' AND NEW.date < TIMESTAMP '2012-07-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_months_12_06 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2012-07-01 00:00:00' AND NEW.date < TIMESTAMP '2012-08-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_months_12_07 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2012-08-01 00:00:00' AND NEW.date < TIMESTAMP '2012-09-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_months_12_08 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2012-09-01 00:00:00' AND NEW.date < TIMESTAMP '2012-10-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_months_12_09 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2012-10-01 00:00:00' AND NEW.date < TIMESTAMP '2012-11-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_months_12_10 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2012-11-01 00:00:00' AND NEW.date < TIMESTAMP '2012-12-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_months_12_11 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2012-12-01 00:00:00' AND NEW.date < TIMESTAMP '2013-01-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_months_12_12 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2013-01-01 00:00:00' AND NEW.date < TIMESTAMP '2013-02-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_months_13_01 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2013-02-01 00:00:00' AND NEW.date < TIMESTAMP '2013-03-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_months_13_02 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2013-03-01 00:00:00' AND NEW.date < TIMESTAMP '2013-04-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_months_13_03 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2013-04-01 00:00:00' AND NEW.date < TIMESTAMP '2013-05-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_months_13_04 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2013-05-01 00:00:00' AND NEW.date < TIMESTAMP '2013-06-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_months_13_05 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2013-06-01 00:00:00' AND NEW.date < TIMESTAMP '2013-07-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_months_13_06 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2013-07-01 00:00:00' AND NEW.date < TIMESTAMP '2013-08-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_months_13_07 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2013-08-01 00:00:00' AND NEW.date < TIMESTAMP '2013-09-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_months_13_08 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2013-09-01 00:00:00' AND NEW.date < TIMESTAMP '2013-10-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_months_13_09 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2013-10-01 00:00:00' AND NEW.date < TIMESTAMP '2013-11-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_months_13_10 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2013-11-01 00:00:00' AND NEW.date < TIMESTAMP '2013-12-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_months_13_11 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2013-12-01 00:00:00' AND NEW.date < TIMESTAMP '2014-01-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_months_13_12 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2014-01-01 00:00:00' AND NEW.date < TIMESTAMP '2014-02-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_months_14_01 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2014-02-01 00:00:00' AND NEW.date < TIMESTAMP '2014-03-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_months_14_02 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2014-03-01 00:00:00' AND NEW.date < TIMESTAMP '2014-04-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_months_14_03 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2014-04-01 00:00:00' AND NEW.date < TIMESTAMP '2014-05-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_months_14_04 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2014-05-01 00:00:00' AND NEW.date < TIMESTAMP '2014-06-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_months_14_05 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2014-06-01 00:00:00' AND NEW.date < TIMESTAMP '2014-07-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_months_14_06 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2014-07-01 00:00:00' AND NEW.date < TIMESTAMP '2014-08-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_months_14_07 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2014-08-01 00:00:00' AND NEW.date < TIMESTAMP '2014-09-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_months_14_08 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2014-09-01 00:00:00' AND NEW.date < TIMESTAMP '2014-10-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_months_14_09 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2014-10-01 00:00:00' AND NEW.date < TIMESTAMP '2014-11-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_months_14_10 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2014-11-01 00:00:00' AND NEW.date < TIMESTAMP '2014-12-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_months_14_11 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2014-12-01 00:00:00' AND NEW.date < TIMESTAMP '2015-01-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_months_14_12 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2015-01-01 00:00:00' AND NEW.date < TIMESTAMP '2015-02-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_months_15_01 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2015-08-01 00:00:00' AND NEW.date < TIMESTAMP '2015-09-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_months_15_08 VALUES (NEW.*); ELSE RAISE EXCEPTION 'Inserted data is out of range. Fix statistics.company_statistic_total_by_months_insert_trigger.'; END IF; RETURN NULL; END; $$; + + +-- +-- Name: company_statistic_total_by_weeks_insert_trigger(); Type: FUNCTION; Schema: statistics; Owner: - +-- + +CREATE FUNCTION company_statistic_total_by_weeks_insert_trigger() RETURNS trigger + LANGUAGE plpgsql + AS $$ BEGIN IF (NEW.first_week_day >= TIMESTAMP '2015-09-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2015-10-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_weeks_15_09 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2010-01-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2010-02-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_weeks_10_01 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2010-02-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2010-03-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_weeks_10_02 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2010-03-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2010-04-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_weeks_10_03 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2010-04-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2010-05-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_weeks_10_04 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2010-05-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2010-06-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_weeks_10_05 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2010-06-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2010-07-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_weeks_10_06 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2010-07-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2010-08-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_weeks_10_07 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2010-08-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2010-09-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_weeks_10_08 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2010-09-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2010-10-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_weeks_10_09 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2010-10-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2010-11-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_weeks_10_10 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2010-11-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2010-12-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_weeks_10_11 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2009-05-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2009-06-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_weeks_09_05 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2009-04-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2009-05-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_weeks_09_04 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2009-06-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2009-07-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_weeks_09_06 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2009-07-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2009-08-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_weeks_09_07 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2009-08-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2009-09-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_weeks_09_08 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2009-09-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2009-10-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_weeks_09_09 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2009-10-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2009-11-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_weeks_09_10 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2009-11-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2009-12-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_weeks_09_11 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2009-12-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2010-01-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_weeks_09_12 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2010-12-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2011-01-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_weeks_10_12 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2011-01-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2011-02-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_weeks_11_01 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2011-02-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2011-03-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_weeks_11_02 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2011-03-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2011-04-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_weeks_11_03 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2011-11-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2011-12-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_weeks_11_11 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2011-12-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2012-01-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_weeks_11_12 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2012-01-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2012-02-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_weeks_12_01 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2012-02-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2012-03-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_weeks_12_02 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2012-03-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2012-04-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_weeks_12_03 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2012-04-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2012-05-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_weeks_12_04 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2012-05-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2012-06-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_weeks_12_05 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2012-06-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2012-07-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_weeks_12_06 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2012-07-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2012-08-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_weeks_12_07 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2012-08-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2012-09-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_weeks_12_08 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2012-09-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2012-10-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_weeks_12_09 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2012-10-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2012-11-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_weeks_12_10 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2012-11-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2012-12-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_weeks_12_11 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2012-12-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2013-01-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_weeks_12_12 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2013-01-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2013-02-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_weeks_13_01 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2013-02-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2013-03-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_weeks_13_02 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2013-03-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2013-04-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_weeks_13_03 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2013-04-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2013-05-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_weeks_13_04 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2013-05-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2013-06-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_weeks_13_05 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2013-06-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2013-07-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_weeks_13_06 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2013-07-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2013-08-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_weeks_13_07 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2013-08-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2013-09-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_weeks_13_08 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2013-09-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2013-10-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_weeks_13_09 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2013-10-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2013-11-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_weeks_13_10 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2013-11-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2013-12-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_weeks_13_11 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2013-12-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2014-01-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_weeks_13_12 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2014-01-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2014-02-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_weeks_14_01 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2014-02-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2014-03-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_weeks_14_02 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2014-03-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2014-04-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_weeks_14_03 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2014-04-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2014-05-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_weeks_14_04 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2014-05-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2014-06-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_weeks_14_05 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2014-06-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2014-07-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_weeks_14_06 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2014-07-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2014-08-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_weeks_14_07 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2014-08-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2014-09-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_weeks_14_08 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2014-09-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2014-10-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_weeks_14_09 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2014-10-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2014-11-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_weeks_14_10 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2014-11-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2014-12-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_weeks_14_11 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2014-12-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2015-01-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_weeks_14_12 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2015-01-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2015-02-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_weeks_15_01 VALUES (NEW.*); ELSIF (NEW.first_week_day >= TIMESTAMP '2015-08-01 00:00:00' AND NEW.first_week_day < TIMESTAMP '2015-09-01 00:00:00') THEN INSERT INTO statistics.company_statistic_total_by_weeks_15_08 VALUES (NEW.*); ELSE RAISE EXCEPTION 'Inserted data is out of range. Fix statistics.company_statistic_total_by_weeks_insert_trigger.'; END IF; RETURN NULL; END; $$; + + +-- +-- Name: drop_statistics_partition(integer, character, character, boolean); Type: FUNCTION; Schema: statistics; Owner: - +-- + +CREATE FUNCTION drop_statistics_partition(p_days integer, p_part_name character, p_column_name character, p_dry_run boolean DEFAULT true) RETURNS void + LANGUAGE plpgsql SECURITY DEFINER + AS $$ +DECLARE + a_date date; + c_partition record; +BEGIN + FOR c_partition IN + SELECT relname + FROM pg_catalog.pg_stat_all_tables + WHERE ( relname LIKE '%_'||p_part_name||'_%' ) + AND schemaname = 'statistics' + LOOP + EXECUTE format('SELECT %s FROM statistics.%s ORDER BY %s DESC LIMIT 1', p_column_name, c_partition.relname, p_column_name) into a_date; + IF a_date <= DATE (NOW()) - p_days THEN + IF NOT p_dry_run THEN + EXECUTE FORMAT('DROP TABLE statistics.%s', c_partition.relname); + END IF; + RAISE WARNING 'DROP OLD PARTITION: statistics.%', c_partition.relname; + END IF; + END LOOP; +END; +$$; + + +-- +-- Name: news_statistic_mainpage_by_days_insert_trigger(); Type: FUNCTION; Schema: statistics; Owner: - +-- + +CREATE FUNCTION news_statistic_mainpage_by_days_insert_trigger() RETURNS trigger + LANGUAGE plpgsql + AS $$ BEGIN IF (NEW.date >= TIMESTAMP '2015-01-01 00:00:00' AND NEW.date < TIMESTAMP '2015-02-01 00:00:00') THEN INSERT INTO statistics.news_statistic_mainpage_by_days_15_01 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2011-10-01 00:00:00' AND NEW.date < TIMESTAMP '2011-11-01 00:00:00') THEN INSERT INTO statistics.news_statistic_mainpage_by_days_11_10 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2011-11-01 00:00:00' AND NEW.date < TIMESTAMP '2011-12-01 00:00:00') THEN INSERT INTO statistics.news_statistic_mainpage_by_days_11_11 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2011-12-01 00:00:00' AND NEW.date < TIMESTAMP '2012-01-01 00:00:00') THEN INSERT INTO statistics.news_statistic_mainpage_by_days_11_12 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2012-01-01 00:00:00' AND NEW.date < TIMESTAMP '2012-02-01 00:00:00') THEN INSERT INTO statistics.news_statistic_mainpage_by_days_12_01 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2012-02-01 00:00:00' AND NEW.date < TIMESTAMP '2012-03-01 00:00:00') THEN INSERT INTO statistics.news_statistic_mainpage_by_days_12_02 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2012-03-01 00:00:00' AND NEW.date < TIMESTAMP '2012-04-01 00:00:00') THEN INSERT INTO statistics.news_statistic_mainpage_by_days_12_03 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2012-04-01 00:00:00' AND NEW.date < TIMESTAMP '2012-05-01 00:00:00') THEN INSERT INTO statistics.news_statistic_mainpage_by_days_12_04 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2012-05-01 00:00:00' AND NEW.date < TIMESTAMP '2012-06-01 00:00:00') THEN INSERT INTO statistics.news_statistic_mainpage_by_days_12_05 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2012-06-01 00:00:00' AND NEW.date < TIMESTAMP '2012-07-01 00:00:00') THEN INSERT INTO statistics.news_statistic_mainpage_by_days_12_06 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2012-07-01 00:00:00' AND NEW.date < TIMESTAMP '2012-08-01 00:00:00') THEN INSERT INTO statistics.news_statistic_mainpage_by_days_12_07 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2012-08-01 00:00:00' AND NEW.date < TIMESTAMP '2012-09-01 00:00:00') THEN INSERT INTO statistics.news_statistic_mainpage_by_days_12_08 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2012-09-01 00:00:00' AND NEW.date < TIMESTAMP '2012-10-01 00:00:00') THEN INSERT INTO statistics.news_statistic_mainpage_by_days_12_09 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2012-10-01 00:00:00' AND NEW.date < TIMESTAMP '2012-11-01 00:00:00') THEN INSERT INTO statistics.news_statistic_mainpage_by_days_12_10 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2012-11-01 00:00:00' AND NEW.date < TIMESTAMP '2012-12-01 00:00:00') THEN INSERT INTO statistics.news_statistic_mainpage_by_days_12_11 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2012-12-01 00:00:00' AND NEW.date < TIMESTAMP '2013-01-01 00:00:00') THEN INSERT INTO statistics.news_statistic_mainpage_by_days_12_12 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2013-01-01 00:00:00' AND NEW.date < TIMESTAMP '2013-02-01 00:00:00') THEN INSERT INTO statistics.news_statistic_mainpage_by_days_13_01 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2013-02-01 00:00:00' AND NEW.date < TIMESTAMP '2013-03-01 00:00:00') THEN INSERT INTO statistics.news_statistic_mainpage_by_days_13_02 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2013-03-01 00:00:00' AND NEW.date < TIMESTAMP '2013-04-01 00:00:00') THEN INSERT INTO statistics.news_statistic_mainpage_by_days_13_03 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2013-04-01 00:00:00' AND NEW.date < TIMESTAMP '2013-05-01 00:00:00') THEN INSERT INTO statistics.news_statistic_mainpage_by_days_13_04 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2013-05-01 00:00:00' AND NEW.date < TIMESTAMP '2013-06-01 00:00:00') THEN INSERT INTO statistics.news_statistic_mainpage_by_days_13_05 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2013-06-01 00:00:00' AND NEW.date < TIMESTAMP '2013-07-01 00:00:00') THEN INSERT INTO statistics.news_statistic_mainpage_by_days_13_06 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2013-07-01 00:00:00' AND NEW.date < TIMESTAMP '2013-08-01 00:00:00') THEN INSERT INTO statistics.news_statistic_mainpage_by_days_13_07 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2013-08-01 00:00:00' AND NEW.date < TIMESTAMP '2013-09-01 00:00:00') THEN INSERT INTO statistics.news_statistic_mainpage_by_days_13_08 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2013-09-01 00:00:00' AND NEW.date < TIMESTAMP '2013-10-01 00:00:00') THEN INSERT INTO statistics.news_statistic_mainpage_by_days_13_09 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2013-10-01 00:00:00' AND NEW.date < TIMESTAMP '2013-11-01 00:00:00') THEN INSERT INTO statistics.news_statistic_mainpage_by_days_13_10 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2013-11-01 00:00:00' AND NEW.date < TIMESTAMP '2013-12-01 00:00:00') THEN INSERT INTO statistics.news_statistic_mainpage_by_days_13_11 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2013-12-01 00:00:00' AND NEW.date < TIMESTAMP '2014-01-01 00:00:00') THEN INSERT INTO statistics.news_statistic_mainpage_by_days_13_12 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2014-01-01 00:00:00' AND NEW.date < TIMESTAMP '2014-02-01 00:00:00') THEN INSERT INTO statistics.news_statistic_mainpage_by_days_14_01 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2014-02-01 00:00:00' AND NEW.date < TIMESTAMP '2014-03-01 00:00:00') THEN INSERT INTO statistics.news_statistic_mainpage_by_days_14_02 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2014-03-01 00:00:00' AND NEW.date < TIMESTAMP '2014-04-01 00:00:00') THEN INSERT INTO statistics.news_statistic_mainpage_by_days_14_03 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2014-04-01 00:00:00' AND NEW.date < TIMESTAMP '2014-05-01 00:00:00') THEN INSERT INTO statistics.news_statistic_mainpage_by_days_14_04 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2014-05-01 00:00:00' AND NEW.date < TIMESTAMP '2014-06-01 00:00:00') THEN INSERT INTO statistics.news_statistic_mainpage_by_days_14_05 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2014-06-01 00:00:00' AND NEW.date < TIMESTAMP '2014-07-01 00:00:00') THEN INSERT INTO statistics.news_statistic_mainpage_by_days_14_06 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2014-07-01 00:00:00' AND NEW.date < TIMESTAMP '2014-08-01 00:00:00') THEN INSERT INTO statistics.news_statistic_mainpage_by_days_14_07 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2014-08-01 00:00:00' AND NEW.date < TIMESTAMP '2014-09-01 00:00:00') THEN INSERT INTO statistics.news_statistic_mainpage_by_days_14_08 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2014-09-01 00:00:00' AND NEW.date < TIMESTAMP '2014-10-01 00:00:00') THEN INSERT INTO statistics.news_statistic_mainpage_by_days_14_09 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2014-10-01 00:00:00' AND NEW.date < TIMESTAMP '2014-11-01 00:00:00') THEN INSERT INTO statistics.news_statistic_mainpage_by_days_14_10 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2014-11-01 00:00:00' AND NEW.date < TIMESTAMP '2014-12-01 00:00:00') THEN INSERT INTO statistics.news_statistic_mainpage_by_days_14_11 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2014-12-01 00:00:00' AND NEW.date < TIMESTAMP '2015-01-01 00:00:00') THEN INSERT INTO statistics.news_statistic_mainpage_by_days_14_12 VALUES (NEW.*); ELSE RAISE EXCEPTION 'Inserted data is out of range. Fix statistics.news_statistic_mainpage_by_days_insert_trigger.'; END IF; RETURN NULL; END; $$; + + +-- +-- Name: news_statistic_referers_by_months_insert_trigger(); Type: FUNCTION; Schema: statistics; Owner: - +-- + +CREATE FUNCTION news_statistic_referers_by_months_insert_trigger() RETURNS trigger + LANGUAGE plpgsql + AS $$ BEGIN IF (NEW.date >= TIMESTAMP '2015-09-01 00:00:00' AND NEW.date < TIMESTAMP '2015-10-01 00:00:00') THEN INSERT INTO statistics.news_statistic_referers_by_months_15_09 VALUES (NEW.*); ELSIF (NEW.date >= TIMESTAMP '2015-08-01 00:00:00' AND NEW.date < TIMESTAMP '2015-09-01 00:00:00') THEN INSERT INTO statistics.news_statistic_referers_by_months_15_08 VALUES (NEW.*); ELSE RAISE EXCEPTION 'Inserted data is out of range. Fix statistics.news_statistic_referers_by_months_insert_trigger.'; END IF; RETURN NULL; END; $$; + + +-- +-- Name: query_log_insert_trigger(); Type: FUNCTION; Schema: statistics; Owner: - +-- + +CREATE FUNCTION query_log_insert_trigger() RETURNS trigger + LANGUAGE plpgsql + AS $$ BEGIN IF (NEW.created_at >= TIMESTAMP '2011-02-01 00:00:00' AND NEW.created_at < TIMESTAMP '2011-03-01 00:00:00') THEN INSERT INTO statistics.query_log_11_02 VALUES (NEW.*); ELSIF (NEW.created_at >= TIMESTAMP '2010-12-01 00:00:00' AND NEW.created_at < TIMESTAMP '2011-01-01 00:00:00') THEN INSERT INTO statistics.query_log_10_12 VALUES (NEW.*); ELSIF (NEW.created_at >= TIMESTAMP '2010-11-01 00:00:00' AND NEW.created_at < TIMESTAMP '2010-12-01 00:00:00') THEN INSERT INTO statistics.query_log_10_11 VALUES (NEW.*); ELSIF (NEW.created_at >= TIMESTAMP '2010-10-01 00:00:00' AND NEW.created_at < TIMESTAMP '2010-11-01 00:00:00') THEN INSERT INTO statistics.query_log_10_10 VALUES (NEW.*); ELSIF (NEW.created_at >= TIMESTAMP '2010-09-01 00:00:00' AND NEW.created_at < TIMESTAMP '2010-10-01 00:00:00') THEN INSERT INTO statistics.query_log_10_09 VALUES (NEW.*); ELSIF (NEW.created_at >= TIMESTAMP '2010-08-01 00:00:00' AND NEW.created_at < TIMESTAMP '2010-09-01 00:00:00') THEN INSERT INTO statistics.query_log_10_08 VALUES (NEW.*); ELSIF (NEW.created_at >= TIMESTAMP '2010-07-01 00:00:00' AND NEW.created_at < TIMESTAMP '2010-08-01 00:00:00') THEN INSERT INTO statistics.query_log_10_07 VALUES (NEW.*); ELSE RAISE EXCEPTION 'Inserted data is out of range. Fix statistics.query_log_insert_trigger.'; END IF; RETURN NULL; END; $$; + + +SET search_path = system, pg_catalog; + +-- +-- Name: _pg_check_to_trigger(text, text); Type: FUNCTION; Schema: system; Owner: - +-- + +CREATE FUNCTION _pg_check_to_trigger(master_table text, range_check text) RETURNS text + LANGUAGE plpgsql + AS $$ +DECLARE + v_schema text := COALESCE(SUBSTRING(master_table FROM E'([a-z0-9_]+).'),'public'); + v_tablename text := replace(master_table, v_schema || '.', ''); + v_range_check text := range_check; + rec record; +BEGIN + RAISE NOTICE '%', v_schema; + RAISE NOTICE '%', v_tablename; + + FOR rec IN (SELECT column_name + FROM information_schema.columns + WHERE table_schema = v_schema + AND table_name = v_tablename) LOOP + v_range_check := replace(v_range_check, '[' || rec.column_name || ']', 'NEW.' || rec.column_name); + END LOOP; + + RETURN v_range_check; +END; +$$; + + +-- +-- Name: drop_all_foreign_keys(character varying); Type: FUNCTION; Schema: system; Owner: - +-- + +CREATE FUNCTION drop_all_foreign_keys(table_name character varying) RETURNS void + LANGUAGE plpgsql + AS $$ +DECLARE + pg_constr RECORD; +BEGIN + FOR pg_constr IN + SELECT pg_constraint.* + FROM pg_class + INNER JOIN pg_constraint on pg_constraint.conrelid = pg_class.relfilenode AND pg_constraint.contype = 'f' + WHERE pg_class.relname = table_name + LOOP + EXECUTE 'ALTER TABLE ' || table_name || ' DROP CONSTRAINT ' || pg_constr.conname; + END LOOP; +END; +$$; + + +-- +-- Name: pg_add_range_partition(text, text, text, text, text[], text); Type: FUNCTION; Schema: system; Owner: - +-- + +CREATE FUNCTION pg_add_range_partition(p_master_table text, p_partition_table text, p_range_check text, p_trigger_function text, p_indexes text[], p_index_prefix text, OUT status_code text) RETURNS text + LANGUAGE plpgsql + AS $_$ +DECLARE + v_table_ddl text := 'CREATE TABLE [PARTITION_TABLE] ( CHECK ( [RANGE_CHECK] ) ) INHERITS ([MASTER_TABLE]);'; + v_trigger_ddl text := 'CREATE OR REPLACE FUNCTION [TRIGGER_FUNCTION]() RETURNS TRIGGER AS $body$ ' || + 'BEGIN [RANGE_CHECKS] ELSE RAISE EXCEPTION ' || + '''Inserted data is out of range. Fix [TRIGGER_FUNCTION].''; ' || + 'END IF; RETURN NULL; END; $body$ LANGUAGE plpgsql;'; + v_index_ddl text := 'CREATE INDEX [INDEX_NAME] ON [PARTITION_TABLE] USING btree([COLUMNS]);'; + v_index text := ''; + v_index_query text := ''; + v_range_checks text := ''; + v_p_n_range_checks text := ''; + rec record; + i integer; +BEGIN + IF EXISTS (SELECT 1 FROM system.table_partitions + WHERE master_table = p_master_table + AND partition_table = p_partition_table) THEN + status_code := 'Partition ' || p_partition_table || ' already exists'; + RETURN; + END IF; + + v_table_ddl := replace(v_table_ddl, '[PARTITION_TABLE]', p_partition_table); + v_p_n_range_checks := replace(replace(p_range_check, '[', ''), ']', ''); + v_table_ddl := replace(v_table_ddl, '[RANGE_CHECK]', v_p_n_range_checks); + v_table_ddl := replace(v_table_ddl, '[MASTER_TABLE]', p_master_table); + + FOR rec IN (SELECT 'ELSIF (' || tp.range_check || ') THEN INSERT INTO ' || + tp.partition_table || ' VALUES (NEW.*); ' AS range_check + FROM system.table_partitions tp + WHERE tp.master_table = p_master_table + ORDER BY tp.time_added DESC) LOOP + v_range_checks := system._pg_check_to_trigger(p_master_table, rec.range_check) || v_range_checks; + END LOOP; + + v_range_checks := 'IF (' || system._pg_check_to_trigger(p_master_table, p_range_check) || + ') THEN INSERT INTO ' || p_partition_table || + ' VALUES (NEW.*); ' || v_range_checks; + + v_trigger_ddl := replace(v_trigger_ddl, '[TRIGGER_FUNCTION]', p_trigger_function); + v_trigger_ddl := replace(v_trigger_ddl, '[RANGE_CHECKS]', v_range_checks); + + RAISE NOTICE 'Partition script: %', v_table_ddl; + RAISE NOTICE 'Trigger script: %', v_trigger_ddl; + + EXECUTE v_table_ddl; + EXECUTE v_trigger_ddl; + + FOR i IN 1..array_length(p_indexes, 1) LOOP + v_index = p_indexes[i]; + v_index_query := replace(v_index_ddl, '[PARTITION_TABLE]', p_partition_table); + v_index_query := replace(v_index_query, '[COLUMNS]', v_index); + v_index_query := replace(v_index_query, '[INDEX_NAME]', p_index_prefix || '_' || replace(v_index, ',', '_') || '_idx'); + EXECUTE v_index_query; + END LOOP; + + INSERT INTO system.table_partitions (master_table, partition_table, range_check) + VALUES (p_master_table, p_partition_table, p_range_check); + + status_code := 'OK'; + RETURN; +END; +$_$; + + +-- +-- Name: stdout(character varying); Type: FUNCTION; Schema: system; Owner: - +-- + +CREATE FUNCTION stdout(str character varying) RETURNS void + LANGUAGE plpgsql + AS $$ +BEGIN + RAISE NOTICE '%: %', clock_timestamp(), str; +END; +$$; + + +SET search_path = public, pg_catalog; + +-- +-- Name: array_accum(anyelement); Type: AGGREGATE; Schema: public; Owner: - +-- + +CREATE AGGREGATE array_accum(anyelement) ( + SFUNC = array_append, + STYPE = anyarray, + INITCOND = '{}' +); + + +-- +-- Name: btree_hstore_ops; Type: OPERATOR FAMILY; Schema: public; Owner: - +-- + +CREATE OPERATOR FAMILY btree_hstore_ops USING btree; + + +-- +-- Name: gin_hstore_ops; Type: OPERATOR FAMILY; Schema: public; Owner: - +-- + +CREATE OPERATOR FAMILY gin_hstore_ops USING gin; + + +-- +-- Name: gist_hstore_ops; Type: OPERATOR FAMILY; Schema: public; Owner: - +-- + +CREATE OPERATOR FAMILY gist_hstore_ops USING gist; + + +-- +-- Name: hash_hstore_ops; Type: OPERATOR FAMILY; Schema: public; Owner: - +-- + +CREATE OPERATOR FAMILY hash_hstore_ops USING hash; + + +SET search_path = pg_catalog; + +-- +-- Name: CAST (public.product_state AS integer); Type: CAST; Schema: pg_catalog; Owner: - +-- + +CREATE CAST (public.product_state AS integer) WITH FUNCTION public.cast_product_state_into_integer(public.product_state) AS ASSIGNMENT; + + +SET search_path = public, pg_catalog; + +-- +-- Name: russian; Type: TEXT SEARCH CONFIGURATION; Schema: public; Owner: - +-- + +CREATE TEXT SEARCH CONFIGURATION russian ( + PARSER = pg_catalog."default" ); + + +-- +-- Name: russian_simple; Type: TEXT SEARCH CONFIGURATION; Schema: public; Owner: - +-- + +CREATE TEXT SEARCH CONFIGURATION russian_simple ( + PARSER = pg_catalog."default" ); + +ALTER TEXT SEARCH CONFIGURATION russian_simple + ADD MAPPING FOR numword WITH simple; + +ALTER TEXT SEARCH CONFIGURATION russian_simple + ADD MAPPING FOR email WITH simple; + +ALTER TEXT SEARCH CONFIGURATION russian_simple + ADD MAPPING FOR url WITH simple; + +ALTER TEXT SEARCH CONFIGURATION russian_simple + ADD MAPPING FOR host WITH simple; + +ALTER TEXT SEARCH CONFIGURATION russian_simple + ADD MAPPING FOR sfloat WITH simple; + +ALTER TEXT SEARCH CONFIGURATION russian_simple + ADD MAPPING FOR version WITH simple; + +ALTER TEXT SEARCH CONFIGURATION russian_simple + ADD MAPPING FOR hword_numpart WITH simple; + +ALTER TEXT SEARCH CONFIGURATION russian_simple + ADD MAPPING FOR numhword WITH simple; + +ALTER TEXT SEARCH CONFIGURATION russian_simple + ADD MAPPING FOR url_path WITH simple; + +ALTER TEXT SEARCH CONFIGURATION russian_simple + ADD MAPPING FOR file WITH simple; + +ALTER TEXT SEARCH CONFIGURATION russian_simple + ADD MAPPING FOR "float" WITH simple; + +ALTER TEXT SEARCH CONFIGURATION russian_simple + ADD MAPPING FOR "int" WITH simple; + +ALTER TEXT SEARCH CONFIGURATION russian_simple + ADD MAPPING FOR uint WITH simple; + + +SET search_path = denormalization, pg_catalog; + +-- +-- Name: events_log; Type: TABLE; Schema: denormalization; Owner: -; Tablespace: +-- + +CREATE TABLE events_log ( + id integer NOT NULL, + processed_at timestamp without time zone NOT NULL, + consumer character varying(256) NOT NULL, + event_id character varying(255) NOT NULL, + event_type character varying(1) NOT NULL, + event_time character varying(128) NOT NULL, + event_txid character varying(128) NOT NULL, + event_ev_data text NOT NULL, + event_extra1 text NOT NULL, + event_data text NOT NULL, + event_prev_data text NOT NULL, + event_data_changed boolean NOT NULL, + message character varying(512), + payload character varying(512), + suspected boolean NOT NULL +); + + +-- +-- Name: TABLE events_log; Type: COMMENT; Schema: denormalization; Owner: - +-- + +COMMENT ON TABLE events_log IS 'Отладочный журнал событий'; + + +-- +-- Name: events_log_id_seq; Type: SEQUENCE; Schema: denormalization; Owner: - +-- + +CREATE SEQUENCE events_log_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: events_log_id_seq; Type: SEQUENCE OWNED BY; Schema: denormalization; Owner: - +-- + +ALTER SEQUENCE events_log_id_seq OWNED BY events_log.id; + + +-- +-- Name: fields; Type: TABLE; Schema: denormalization; Owner: -; Tablespace: +-- + +CREATE TABLE fields ( + id integer NOT NULL, + title character varying(128) NOT NULL, + "group" character varying(128) NOT NULL, + field_class character varying(128) NOT NULL, + active boolean DEFAULT false NOT NULL, + need_terminate boolean DEFAULT false NOT NULL, + state character varying(128) DEFAULT 'need_initialize'::character varying NOT NULL, + progress character varying(128), + snapshot_id character varying(4000), + last_error character varying(4000), + worker_id integer, + oid integer NOT NULL, + params character varying(4000), + storage character varying(4000), + pid integer +); + + +-- +-- Name: TABLE fields; Type: COMMENT; Schema: denormalization; Owner: - +-- + +COMMENT ON TABLE fields IS 'Поля'; + + +-- +-- Name: COLUMN fields.title; Type: COMMENT; Schema: denormalization; Owner: - +-- + +COMMENT ON COLUMN fields.title IS 'Название поля'; + + +-- +-- Name: COLUMN fields."group"; Type: COMMENT; Schema: denormalization; Owner: - +-- + +COMMENT ON COLUMN fields."group" IS 'Группа поля'; + + +-- +-- Name: COLUMN fields.field_class; Type: COMMENT; Schema: denormalization; Owner: - +-- + +COMMENT ON COLUMN fields.field_class IS 'Класс поля'; + + +-- +-- Name: COLUMN fields.active; Type: COMMENT; Schema: denormalization; Owner: - +-- + +COMMENT ON COLUMN fields.active IS 'Активно/не активно'; + + +-- +-- Name: COLUMN fields.need_terminate; Type: COMMENT; Schema: denormalization; Owner: - +-- + +COMMENT ON COLUMN fields.need_terminate IS 'Флаг необходимости прекращения текущей операции'; + + +-- +-- Name: COLUMN fields.state; Type: COMMENT; Schema: denormalization; Owner: - +-- + +COMMENT ON COLUMN fields.state IS 'Состояние поля'; + + +-- +-- Name: COLUMN fields.progress; Type: COMMENT; Schema: denormalization; Owner: - +-- + +COMMENT ON COLUMN fields.progress IS 'Прогресс иницилизации'; + + +-- +-- Name: COLUMN fields.snapshot_id; Type: COMMENT; Schema: denormalization; Owner: - +-- + +COMMENT ON COLUMN fields.snapshot_id IS 'ИД снапшота БД, в котором проводилась иницилизация'; + + +-- +-- Name: COLUMN fields.last_error; Type: COMMENT; Schema: denormalization; Owner: - +-- + +COMMENT ON COLUMN fields.last_error IS 'Последняя ошибка'; + + +-- +-- Name: COLUMN fields.worker_id; Type: COMMENT; Schema: denormalization; Owner: - +-- + +COMMENT ON COLUMN fields.worker_id IS 'Ссылка на воркера (worker.id)'; + + +-- +-- Name: COLUMN fields.oid; Type: COMMENT; Schema: denormalization; Owner: - +-- + +COMMENT ON COLUMN fields.oid IS 'Порядковый номер поля'; + + +-- +-- Name: fields_id_seq; Type: SEQUENCE; Schema: denormalization; Owner: - +-- + +CREATE SEQUENCE fields_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: fields_id_seq; Type: SEQUENCE OWNED BY; Schema: denormalization; Owner: - +-- + +ALTER SEQUENCE fields_id_seq OWNED BY fields.id; + + +-- +-- Name: processors; Type: TABLE; Schema: denormalization; Owner: -; Tablespace: +-- + +CREATE TABLE processors ( + id integer NOT NULL, + queue_id integer NOT NULL, + field_id integer NOT NULL, + processor_class character varying(128) NOT NULL, + oid integer NOT NULL, + params character varying(2000), + consumer_name character varying(255) NOT NULL +); + + +-- +-- Name: TABLE processors; Type: COMMENT; Schema: denormalization; Owner: - +-- + +COMMENT ON TABLE processors IS 'Процессоры - обработчики'; + + +-- +-- Name: COLUMN processors.queue_id; Type: COMMENT; Schema: denormalization; Owner: - +-- + +COMMENT ON COLUMN processors.queue_id IS 'Ссылка на очередь (queues.id)'; + + +-- +-- Name: COLUMN processors.field_id; Type: COMMENT; Schema: denormalization; Owner: - +-- + +COMMENT ON COLUMN processors.field_id IS 'Ссылка на поле (fields.id)'; + + +-- +-- Name: COLUMN processors.processor_class; Type: COMMENT; Schema: denormalization; Owner: - +-- + +COMMENT ON COLUMN processors.processor_class IS 'Класс обработчика'; + + +-- +-- Name: COLUMN processors.oid; Type: COMMENT; Schema: denormalization; Owner: - +-- + +COMMENT ON COLUMN processors.oid IS 'Порядковый номер обработчика в рамках поля'; + + +-- +-- Name: COLUMN processors.params; Type: COMMENT; Schema: denormalization; Owner: - +-- + +COMMENT ON COLUMN processors.params IS 'Параметры обработчика'; + + +-- +-- Name: processors_id_seq; Type: SEQUENCE; Schema: denormalization; Owner: - +-- + +CREATE SEQUENCE processors_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: processors_id_seq; Type: SEQUENCE OWNED BY; Schema: denormalization; Owner: - +-- + +ALTER SEQUENCE processors_id_seq OWNED BY processors.id; + + +-- +-- Name: queues; Type: TABLE; Schema: denormalization; Owner: -; Tablespace: +-- + +CREATE TABLE queues ( + id integer NOT NULL, + name character varying(128) NOT NULL, + table_name character varying(256), + trigger_code character varying(2000), + db_link_class character varying(256) +); + + +-- +-- Name: TABLE queues; Type: COMMENT; Schema: denormalization; Owner: - +-- + +COMMENT ON TABLE queues IS 'Очереди'; + + +-- +-- Name: COLUMN queues.name; Type: COMMENT; Schema: denormalization; Owner: - +-- + +COMMENT ON COLUMN queues.name IS 'Название'; + + +-- +-- Name: COLUMN queues.table_name; Type: COMMENT; Schema: denormalization; Owner: - +-- + +COMMENT ON COLUMN queues.table_name IS 'Имя таблицы'; + + +-- +-- Name: COLUMN queues.trigger_code; Type: COMMENT; Schema: denormalization; Owner: - +-- + +COMMENT ON COLUMN queues.trigger_code IS 'Код триггера'; + + +-- +-- Name: COLUMN queues.db_link_class; Type: COMMENT; Schema: denormalization; Owner: - +-- + +COMMENT ON COLUMN queues.db_link_class IS 'Имя класс - модели ActiveRecord, обеспечивающего соединение с БД, в рамках которого обрабатывается очередь (опционально)'; + + +-- +-- Name: queues_id_seq; Type: SEQUENCE; Schema: denormalization; Owner: - +-- + +CREATE SEQUENCE queues_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: queues_id_seq; Type: SEQUENCE OWNED BY; Schema: denormalization; Owner: - +-- + +ALTER SEQUENCE queues_id_seq OWNED BY queues.id; + + +-- +-- Name: supervisor_status; Type: TABLE; Schema: denormalization; Owner: -; Tablespace: +-- + +CREATE TABLE supervisor_status ( + id integer NOT NULL, + active boolean DEFAULT false NOT NULL, + state character varying(128) DEFAULT 'stopped'::character varying NOT NULL, + need_terminate boolean DEFAULT false NOT NULL, + last_error character varying(4000), + pid integer +); + + +-- +-- Name: COLUMN supervisor_status.active; Type: COMMENT; Schema: denormalization; Owner: - +-- + +COMMENT ON COLUMN supervisor_status.active IS 'Активно/не активно'; + + +-- +-- Name: COLUMN supervisor_status.state; Type: COMMENT; Schema: denormalization; Owner: - +-- + +COMMENT ON COLUMN supervisor_status.state IS 'Состояние поля'; + + +-- +-- Name: COLUMN supervisor_status.need_terminate; Type: COMMENT; Schema: denormalization; Owner: - +-- + +COMMENT ON COLUMN supervisor_status.need_terminate IS 'Флаг необходимости прекращения текущей операции'; + + +-- +-- Name: supervisor_status_id_seq; Type: SEQUENCE; Schema: denormalization; Owner: - +-- + +CREATE SEQUENCE supervisor_status_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: supervisor_status_id_seq; Type: SEQUENCE OWNED BY; Schema: denormalization; Owner: - +-- + +ALTER SEQUENCE supervisor_status_id_seq OWNED BY supervisor_status.id; + + +-- +-- Name: workers; Type: TABLE; Schema: denormalization; Owner: -; Tablespace: +-- + +CREATE TABLE workers ( + id integer NOT NULL, + active boolean DEFAULT false NOT NULL, + state character varying(128) DEFAULT 'stopped'::character varying NOT NULL, + need_terminate boolean DEFAULT false NOT NULL, + last_error character varying(4000), + name character varying(25) NOT NULL, + pid integer +); + + +-- +-- Name: TABLE workers; Type: COMMENT; Schema: denormalization; Owner: - +-- + +COMMENT ON TABLE workers IS 'Воркеры'; + + +-- +-- Name: COLUMN workers.active; Type: COMMENT; Schema: denormalization; Owner: - +-- + +COMMENT ON COLUMN workers.active IS 'Активно/не активно'; + + +-- +-- Name: COLUMN workers.state; Type: COMMENT; Schema: denormalization; Owner: - +-- + +COMMENT ON COLUMN workers.state IS 'Состояние поля'; + + +-- +-- Name: COLUMN workers.need_terminate; Type: COMMENT; Schema: denormalization; Owner: - +-- + +COMMENT ON COLUMN workers.need_terminate IS 'Флаг необходимости прекращения текущей операции'; + + +-- +-- Name: COLUMN workers.last_error; Type: COMMENT; Schema: denormalization; Owner: - +-- + +COMMENT ON COLUMN workers.last_error IS 'Последняя ошибка'; + + +-- +-- Name: workers_id_seq; Type: SEQUENCE; Schema: denormalization; Owner: - +-- + +CREATE SEQUENCE workers_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: workers_id_seq; Type: SEQUENCE OWNED BY; Schema: denormalization; Owner: - +-- + +ALTER SEQUENCE workers_id_seq OWNED BY workers.id; + + +SET search_path = export, pg_catalog; + +-- +-- Name: export_log; Type: TABLE; Schema: export; Owner: -; Tablespace: +-- + +CREATE TABLE export_log ( + id integer DEFAULT nextval(('"export"."export_log_id_seq"'::text)::regclass) NOT NULL, + event_date timestamp(0) without time zone NOT NULL, + message character varying(500) NOT NULL +); + + +-- +-- Name: export_log_id_seq; Type: SEQUENCE; Schema: export; Owner: - +-- + +CREATE SEQUENCE export_log_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + MAXVALUE 2147483647 + CACHE 1; + + +-- +-- Name: sync_companies_ids_queue; Type: TABLE; Schema: export; Owner: -; Tablespace: +-- + +CREATE TABLE sync_companies_ids_queue ( + oferta_id integer, + site_id integer +); + + +-- +-- Name: TABLE sync_companies_ids_queue; Type: COMMENT; Schema: export; Owner: - +-- + +COMMENT ON TABLE sync_companies_ids_queue IS 'Очередь на синхронизацию IDов новых компаний, пришедших из Оферты'; + + +-- +-- Name: sync_companies_queue; Type: TABLE; Schema: export; Owner: -; Tablespace: +-- + +CREATE TABLE sync_companies_queue ( + site_id integer NOT NULL +); + + +-- +-- Name: TABLE sync_companies_queue; Type: COMMENT; Schema: export; Owner: - +-- + +COMMENT ON TABLE sync_companies_queue IS 'Очередь компаний, созданных или измененных на сайте, которые нужно перенести в Оферту'; + + +-- +-- Name: sync_deleted_companies_queue; Type: TABLE; Schema: export; Owner: -; Tablespace: +-- + +CREATE TABLE sync_deleted_companies_queue ( + oferta_id integer +); + + +-- +-- Name: TABLE sync_deleted_companies_queue; Type: COMMENT; Schema: export; Owner: - +-- + +COMMENT ON TABLE sync_deleted_companies_queue IS 'Очередь на удаление компаний из Оферты'; + + +-- +-- Name: sync_deleted_products_queue; Type: TABLE; Schema: export; Owner: -; Tablespace: +-- + +CREATE TABLE sync_deleted_products_queue ( + oferta_sync_id integer, + oferta_firm_id integer +); + + +-- +-- Name: sync_products_queue; Type: TABLE; Schema: export; Owner: -; Tablespace: +-- + +CREATE TABLE sync_products_queue ( + product_id integer, + force boolean DEFAULT false +); + + +SET search_path = import, pg_catalog; + +-- +-- Name: import_log; Type: TABLE; Schema: import; Owner: -; Tablespace: +-- + +CREATE TABLE import_log ( + id integer NOT NULL, + event_date timestamp(0) without time zone NOT NULL, + message text +) +WITH (autovacuum_enabled=false, toast.autovacuum_enabled=false); + + +-- +-- Name: import_log_id_seq; Type: SEQUENCE; Schema: import; Owner: - +-- + +CREATE SEQUENCE import_log_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: import_log_id_seq; Type: SEQUENCE OWNED BY; Schema: import; Owner: - +-- + +ALTER SEQUENCE import_log_id_seq OWNED BY import_log.id; + + +-- +-- Name: vw_site_rubric; Type: TABLE; Schema: import; Owner: -; Tablespace: +-- + +CREATE TABLE vw_site_rubric ( + id integer NOT NULL, + parent_id integer, + title character varying(255), + oid integer DEFAULT 0, + lev integer DEFAULT 0 NOT NULL, + tag character varying(255), + path character varying(255), + modified timestamp(0) without time zone, + created timestamp(0) without time zone, + old_url character varying(2000), + synonims character varying(255), + is_prodnorm boolean DEFAULT false NOT NULL, + num_left integer DEFAULT 0 NOT NULL, + num_right integer DEFAULT 0 NOT NULL, + is_leaf boolean DEFAULT false NOT NULL, + next_level_prodnorm boolean DEFAULT false NOT NULL, + prodnorm_prefix character varying(256), + prodnorm_position smallint DEFAULT 0 NOT NULL, + target_rubric_id integer, + old_id integer, + is_publish boolean, + snippet character varying(2000), + project_list character varying(2000), + use_new_url boolean DEFAULT false NOT NULL, + new_path character varying(2000), + prodnorm_new_path character varying(255), + is_elaborated boolean DEFAULT false NOT NULL, + genitive character varying(255), + dative character varying(255), + accusative character varying(255), + instrumentative character varying(255), + preposition character varying(255), + is_plural boolean DEFAULT false NOT NULL, + is_service boolean DEFAULT false NOT NULL, + is_referenceable boolean DEFAULT false NOT NULL +) +WITH (autovacuum_enabled=false, toast.autovacuum_enabled=false); + + +-- +-- Name: vw_site_rubric_log; Type: TABLE; Schema: import; Owner: -; Tablespace: +-- + +CREATE TABLE vw_site_rubric_log ( + rubric_id integer NOT NULL, + event_date timestamp(0) without time zone NOT NULL, + event_type smallint NOT NULL, + event_param character varying(256), + oid integer +) +WITH (autovacuum_enabled=false); + + +-- +-- Name: vw_site_rubric_redirect; Type: TABLE; Schema: import; Owner: -; Tablespace: +-- + +CREATE TABLE vw_site_rubric_redirect ( + rubric_id integer NOT NULL, + redirect character varying(2000) +); + + +-- +-- Name: vw_site_trait_value_redirects; Type: TABLE; Schema: import; Owner: -; Tablespace: +-- + +CREATE TABLE vw_site_trait_value_redirects ( + rubric_id integer NOT NULL, + redirect_from character varying(512) NOT NULL, + trait_value_id integer NOT NULL +); + + +SET search_path = import_full, pg_catalog; + +-- +-- Name: companies_images_to_delete; Type: TABLE; Schema: import_full; Owner: -; Tablespace: +-- + +CREATE TABLE companies_images_to_delete ( + id integer NOT NULL, + class_name character varying(50) +); + + +-- +-- Name: TABLE companies_images_to_delete; Type: COMMENT; Schema: import_full; Owner: - +-- + +COMMENT ON TABLE companies_images_to_delete IS 'Сюда вставляются изображения, которые следует удалить перед началом большого импорта'; + + +-- +-- Name: companies_regions; Type: TABLE; Schema: import_full; Owner: -; Tablespace: +-- + +CREATE TABLE companies_regions ( + company_id integer NOT NULL, + region_id integer NOT NULL +); + + +-- +-- Name: TABLE companies_regions; Type: COMMENT; Schema: import_full; Owner: - +-- + +COMMENT ON TABLE companies_regions IS 'Сюда перед началом большого импорта вставляются привязки компаний к регионам'; + + +-- +-- Name: companies_regions_attributes; Type: TABLE; Schema: import_full; Owner: -; Tablespace: +-- + +CREATE TABLE companies_regions_attributes ( + firm_id integer NOT NULL, + region_id integer NOT NULL, + print_limit integer NOT NULL, + is_bold boolean NOT NULL +); + + +-- +-- Name: TABLE companies_regions_attributes; Type: COMMENT; Schema: import_full; Owner: - +-- + +COMMENT ON TABLE companies_regions_attributes IS 'Сюда перед началом большого импорта вставляются коммерческие привязки компаний к регионам'; + + +-- +-- Name: import_log; Type: TABLE; Schema: import_full; Owner: -; Tablespace: +-- + +CREATE TABLE import_log ( + id integer NOT NULL, + event_date timestamp(0) without time zone NOT NULL, + message text +); + + +-- +-- Name: import_log_id_seq; Type: SEQUENCE; Schema: import_full; Owner: - +-- + +CREATE SEQUENCE import_log_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: import_log_id_seq; Type: SEQUENCE OWNED BY; Schema: import_full; Owner: - +-- + +ALTER SEQUENCE import_log_id_seq OWNED BY import_log.id; + + +-- +-- Name: logo_to_upload; Type: TABLE; Schema: import_full; Owner: -; Tablespace: +-- + +CREATE TABLE logo_to_upload ( + firm_id integer NOT NULL, + to_delete boolean DEFAULT false NOT NULL +); + + +-- +-- Name: TABLE logo_to_upload; Type: COMMENT; Schema: import_full; Owner: - +-- + +COMMENT ON TABLE logo_to_upload IS 'Очередь на удаление или загрузку логотипов после импорта, разбор идёт в RoR'; + + +SET default_with_oids = true; + +-- +-- Name: new_addresses_ids; Type: TABLE; Schema: import_full; Owner: -; Tablespace: +-- + +CREATE TABLE new_addresses_ids ( + oferta_id integer NOT NULL, + address_id integer NOT NULL +); + + +SET default_with_oids = false; + +-- +-- Name: new_companies_ids; Type: TABLE; Schema: import_full; Owner: -; Tablespace: +-- + +CREATE TABLE new_companies_ids ( + oferta_id integer NOT NULL, + site_id integer NOT NULL +); + + +-- +-- Name: orig_price_to_upload; Type: TABLE; Schema: import_full; Owner: -; Tablespace: +-- + +CREATE TABLE orig_price_to_upload ( + firm_id integer NOT NULL, + to_delete boolean DEFAULT false NOT NULL +); + + +-- +-- Name: TABLE orig_price_to_upload; Type: COMMENT; Schema: import_full; Owner: - +-- + +COMMENT ON TABLE orig_price_to_upload IS 'Очередь на удаление или загрузку оригинальных прайсов после импорта, разбор идёт в RoR'; + + +-- +-- Name: tmp_companies; Type: TABLE; Schema: import_full; Owner: -; Tablespace: +-- + +CREATE TABLE tmp_companies ( + company_id integer NOT NULL, + packet integer, + products_limit integer, + regions text, + products_region_id integer +); + + +-- +-- Name: vw_site_actualize_offer; Type: TABLE; Schema: import_full; Owner: -; Tablespace: +-- + +CREATE TABLE vw_site_actualize_offer ( + id integer NOT NULL, + actualization_date timestamp(0) without time zone +); + + +-- +-- Name: vw_site_all_synonym; Type: TABLE; Schema: import_full; Owner: -; Tablespace: +-- + +CREATE TABLE vw_site_all_synonym ( + rubric_id integer NOT NULL, + lev smallint NOT NULL, + keyword character varying(255), + synonym character varying(255) NOT NULL +); + + +-- +-- Name: vw_site_clear_price_firm; Type: TABLE; Schema: import_full; Owner: -; Tablespace: +-- + +CREATE TABLE vw_site_clear_price_firm ( + firm_id integer NOT NULL, + site_firm_id integer NOT NULL +); + + +-- +-- Name: vw_site_deleted_firm; Type: TABLE; Schema: import_full; Owner: -; Tablespace: +-- + +CREATE TABLE vw_site_deleted_firm ( + site_id integer NOT NULL +); + + +-- +-- Name: vw_site_deleted_offer; Type: TABLE; Schema: import_full; Owner: -; Tablespace: +-- + +CREATE TABLE vw_site_deleted_offer ( + id integer NOT NULL, + firm_id integer, + site_firm_id integer +); + + +-- +-- Name: vw_site_estate; Type: TABLE; Schema: import_full; Owner: -; Tablespace: +-- + +CREATE TABLE vw_site_estate ( + id integer NOT NULL, + oferta_firm_id integer, + site_firm_id integer, + oid smallint, + name character varying(256), + city_id integer, + street_id integer, + house character varying(10), + letter character varying(40), + address_other character varying(256), + map_x integer, + map_y integer +); + + +-- +-- Name: vw_site_estate_contact; Type: TABLE; Schema: import_full; Owner: -; Tablespace: +-- + +CREATE TABLE vw_site_estate_contact ( + id integer NOT NULL, + estate_id integer NOT NULL, + oid smallint, + contact_type integer, + value character varying(128) +); + + +-- +-- Name: vw_site_estate_phone; Type: TABLE; Schema: import_full; Owner: -; Tablespace: +-- + +CREATE TABLE vw_site_estate_phone ( + id integer NOT NULL, + estate_id integer NOT NULL, + oid smallint, + prefix character varying(10), + phone character varying(10), + phone_type smallint, + comm character varying(2000) +); + + +-- +-- Name: vw_site_firm; Type: TABLE; Schema: import_full; Owner: -; Tablespace: +-- + +CREATE TABLE vw_site_firm ( + oferta_id integer NOT NULL, + site_id integer, + name character varying(255), + alt_name character varying(255), + opf_name character varying(256), + annotation text, + is_online_edit boolean, + industry_str character varying(4000), + is_new boolean, + package smallint, + created timestamp(0) without time zone, + modified timestamp(0) without time zone, + logo_ext character varying(25), + has_original_price boolean, + has_logo boolean, + inet_limit integer, + area_link character varying(4000), + main_area_id integer +); + + +-- +-- Name: vw_site_firm_business; Type: TABLE; Schema: import_full; Owner: -; Tablespace: +-- + +CREATE TABLE vw_site_firm_business ( + firm_id integer NOT NULL, + site_firm_id integer, + business_type_id smallint NOT NULL +); + + +-- +-- Name: vw_site_firm_site; Type: TABLE; Schema: import_full; Owner: -; Tablespace: +-- + +CREATE TABLE vw_site_firm_site ( + id integer NOT NULL, + oferta_firm_id integer NOT NULL, + site_firm_id integer, + oid smallint, + url character varying(256) +); + + +-- +-- Name: vw_site_modified_offer; Type: TABLE; Schema: import_full; Owner: -; Tablespace: +-- + +CREATE TABLE vw_site_modified_offer ( + id integer NOT NULL, + firm_id integer, + site_firm_id integer, + rubric_id integer, + price_from double precision, + price_to double precision, + is_price_from boolean, + c_currency_id smallint DEFAULT 3 NOT NULL, + title character varying(255) NOT NULL, + actualization_date timestamp(0) without time zone, + prop_modified timestamp(0) without time zone, + is_demand boolean DEFAULT false NOT NULL, + x_city_link character varying(4000), + sort_level smallint, + pricesort double precision, + created_at timestamp(0) without time zone +); + + +-- +-- Name: vw_site_rubric; Type: TABLE; Schema: import_full; Owner: -; Tablespace: +-- + +CREATE TABLE vw_site_rubric ( + id integer NOT NULL, + parent_id integer, + title character varying(255), + oid integer DEFAULT 0 NOT NULL, + lev integer DEFAULT 0 NOT NULL, + tag character varying(25), + path character varying(255), + modified timestamp(0) without time zone, + created timestamp(0) without time zone, + old_url character varying(2000), + synonims character varying(100), + is_prodnorm boolean DEFAULT false NOT NULL, + num_left integer DEFAULT 0 NOT NULL, + num_right integer DEFAULT 0 NOT NULL, + is_leaf boolean DEFAULT false NOT NULL, + next_level_prodnorm boolean DEFAULT false NOT NULL, + prodnorm_prefix character varying(256), + prodnorm_position smallint DEFAULT 0 NOT NULL, + target_rubric_id integer +); + + +-- +-- Name: vw_site_rubric_log; Type: TABLE; Schema: import_full; Owner: -; Tablespace: +-- + +CREATE TABLE vw_site_rubric_log ( + rubric_id integer NOT NULL, + event_date timestamp(0) without time zone NOT NULL, + event_type smallint NOT NULL, + event_param integer +); + + +SET search_path = londiste, pg_catalog; + +-- +-- Name: applied_execute; Type: TABLE; Schema: londiste; Owner: -; Tablespace: +-- + +CREATE TABLE applied_execute ( + queue_name text NOT NULL, + execute_file text NOT NULL, + execute_time timestamp with time zone DEFAULT now() NOT NULL, + execute_sql text NOT NULL +); + + +-- +-- Name: seq_info; Type: TABLE; Schema: londiste; Owner: -; Tablespace: +-- + +CREATE TABLE seq_info ( + nr integer NOT NULL, + queue_name text NOT NULL, + seq_name text NOT NULL, + local boolean DEFAULT false NOT NULL, + last_value bigint NOT NULL +); + + +-- +-- Name: seq_info_nr_seq; Type: SEQUENCE; Schema: londiste; Owner: - +-- + +CREATE SEQUENCE seq_info_nr_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: seq_info_nr_seq; Type: SEQUENCE OWNED BY; Schema: londiste; Owner: - +-- + +ALTER SEQUENCE seq_info_nr_seq OWNED BY seq_info.nr; + + +-- +-- Name: table_info; Type: TABLE; Schema: londiste; Owner: -; Tablespace: +-- + +CREATE TABLE table_info ( + nr integer NOT NULL, + queue_name text NOT NULL, + table_name text NOT NULL, + local boolean DEFAULT false NOT NULL, + merge_state text, + custom_snapshot text, + dropped_ddl text, + table_attrs text, + dest_table text, + CONSTRAINT table_info_check CHECK (((dropped_ddl IS NULL) OR (merge_state = ANY (ARRAY['in-copy'::text, 'catching-up'::text])))) +); + + +-- +-- Name: table_info_nr_seq; Type: SEQUENCE; Schema: londiste; Owner: - +-- + +CREATE SEQUENCE table_info_nr_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: table_info_nr_seq; Type: SEQUENCE OWNED BY; Schema: londiste; Owner: - +-- + +ALTER SEQUENCE table_info_nr_seq OWNED BY table_info.nr; + + +SET search_path = mail_deliveries, pg_catalog; + +-- +-- Name: categories; Type: TABLE; Schema: mail_deliveries; Owner: -; Tablespace: +-- + +CREATE TABLE categories ( + id integer NOT NULL, + title character varying(64) NOT NULL, + portal_title character varying(64) NOT NULL, + description character varying(255) NOT NULL, + portal_description character varying(255) NOT NULL, + "default" boolean DEFAULT false NOT NULL, + allowed_unsubscribing boolean DEFAULT true NOT NULL, + created_at timestamp without time zone, + updated_at timestamp without time zone, + delivery_class character varying(255), + has_personal_settings boolean DEFAULT false NOT NULL +); + + +-- +-- Name: COLUMN categories.delivery_class; Type: COMMENT; Schema: mail_deliveries; Owner: - +-- + +COMMENT ON COLUMN categories.delivery_class IS 'Имя класса реализующего custom рассылку'; + + +-- +-- Name: COLUMN categories.has_personal_settings; Type: COMMENT; Schema: mail_deliveries; Owner: - +-- + +COMMENT ON COLUMN categories.has_personal_settings IS 'Имеет ли подписка на данную категорию дополнительные опции для каждого пользователя'; + + +-- +-- Name: categories_id_seq; Type: SEQUENCE; Schema: mail_deliveries; Owner: - +-- + +CREATE SEQUENCE categories_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: categories_id_seq; Type: SEQUENCE OWNED BY; Schema: mail_deliveries; Owner: - +-- + +ALTER SEQUENCE categories_id_seq OWNED BY categories.id; + + +-- +-- Name: company_sends_log; Type: TABLE; Schema: mail_deliveries; Owner: -; Tablespace: +-- + +CREATE TABLE company_sends_log ( + id integer NOT NULL, + delivery_id integer NOT NULL, + company_id integer NOT NULL, + sent_at timestamp without time zone NOT NULL +); + + +-- +-- Name: TABLE company_sends_log; Type: COMMENT; Schema: mail_deliveries; Owner: - +-- + +COMMENT ON TABLE company_sends_log IS 'Лог отправок рассылок по компаниям'; + + +-- +-- Name: company_sends_log_id_seq; Type: SEQUENCE; Schema: mail_deliveries; Owner: - +-- + +CREATE SEQUENCE company_sends_log_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: company_sends_log_id_seq; Type: SEQUENCE OWNED BY; Schema: mail_deliveries; Owner: - +-- + +ALTER SEQUENCE company_sends_log_id_seq OWNED BY company_sends_log.id; + + +-- +-- Name: deliveries; Type: TABLE; Schema: mail_deliveries; Owner: -; Tablespace: +-- + +CREATE TABLE deliveries ( + id integer NOT NULL, + title character varying(255) NOT NULL, + type character varying(255) NOT NULL, + mail_content text NOT NULL, + is_active boolean DEFAULT false NOT NULL, + description text, + created_at timestamp without time zone, + updated_at timestamp without time zone, + mail_subject character varying(255) NOT NULL, + mail_from character varying(255) NOT NULL, + mail_from_title character varying(255) NOT NULL, + mail_to_title character varying(255), + period integer, + processed_at timestamp without time zone, + category_id integer NOT NULL, + is_test_mode boolean DEFAULT true NOT NULL, + slug character varying(128), + delivery_group character varying(255) NOT NULL, + send_day integer, + week_processed_at timestamp without time zone +); + + +-- +-- Name: TABLE deliveries; Type: COMMENT; Schema: mail_deliveries; Owner: - +-- + +COMMENT ON TABLE deliveries IS 'Почтовые рассылки'; + + +-- +-- Name: COLUMN deliveries.mail_subject; Type: COMMENT; Schema: mail_deliveries; Owner: - +-- + +COMMENT ON COLUMN deliveries.mail_subject IS 'Тема письма'; + + +-- +-- Name: COLUMN deliveries.mail_from; Type: COMMENT; Schema: mail_deliveries; Owner: - +-- + +COMMENT ON COLUMN deliveries.mail_from IS 'Адрес отправителя'; + + +-- +-- Name: COLUMN deliveries.mail_from_title; Type: COMMENT; Schema: mail_deliveries; Owner: - +-- + +COMMENT ON COLUMN deliveries.mail_from_title IS 'Наименование отправителя'; + + +-- +-- Name: COLUMN deliveries.mail_to_title; Type: COMMENT; Schema: mail_deliveries; Owner: - +-- + +COMMENT ON COLUMN deliveries.mail_to_title IS 'Наименование получателя'; + + +-- +-- Name: COLUMN deliveries.period; Type: COMMENT; Schema: mail_deliveries; Owner: - +-- + +COMMENT ON COLUMN deliveries.period IS 'Период в часах'; + + +-- +-- Name: COLUMN deliveries.processed_at; Type: COMMENT; Schema: mail_deliveries; Owner: - +-- + +COMMENT ON COLUMN deliveries.processed_at IS 'Дата и время последнего успешного формирования рассылки'; + + +-- +-- Name: COLUMN deliveries.category_id; Type: COMMENT; Schema: mail_deliveries; Owner: - +-- + +COMMENT ON COLUMN deliveries.category_id IS 'Ссылка на категорию рассылки (category.id)'; + + +-- +-- Name: COLUMN deliveries.is_test_mode; Type: COMMENT; Schema: mail_deliveries; Owner: - +-- + +COMMENT ON COLUMN deliveries.is_test_mode IS 'Тестовый режим рассылки'; + + +-- +-- Name: COLUMN deliveries.delivery_group; Type: COMMENT; Schema: mail_deliveries; Owner: - +-- + +COMMENT ON COLUMN deliveries.delivery_group IS 'Группа рассылки'; + + +-- +-- Name: COLUMN deliveries.week_processed_at; Type: COMMENT; Schema: mail_deliveries; Owner: - +-- + +COMMENT ON COLUMN deliveries.week_processed_at IS 'Дата и время последнего успешного формирования рассылки в еженедельном режиме'; + + +-- +-- Name: deliveries_id_seq; Type: SEQUENCE; Schema: mail_deliveries; Owner: - +-- + +CREATE SEQUENCE deliveries_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: deliveries_id_seq; Type: SEQUENCE OWNED BY; Schema: mail_deliveries; Owner: - +-- + +ALTER SEQUENCE deliveries_id_seq OWNED BY deliveries.id; + + +-- +-- Name: delivery_company_filters; Type: TABLE; Schema: mail_deliveries; Owner: -; Tablespace: +-- + +CREATE TABLE delivery_company_filters ( + id integer NOT NULL, + delivery_id integer NOT NULL, + filter_id character varying(255) NOT NULL, + params text NOT NULL, + oid integer NOT NULL +); + + +-- +-- Name: TABLE delivery_company_filters; Type: COMMENT; Schema: mail_deliveries; Owner: - +-- + +COMMENT ON TABLE delivery_company_filters IS 'Фильтры рассылок'; + + +-- +-- Name: delivery_company_filters_id_seq; Type: SEQUENCE; Schema: mail_deliveries; Owner: - +-- + +CREATE SEQUENCE delivery_company_filters_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: delivery_company_filters_id_seq; Type: SEQUENCE OWNED BY; Schema: mail_deliveries; Owner: - +-- + +ALTER SEQUENCE delivery_company_filters_id_seq OWNED BY delivery_company_filters.id; + + +-- +-- Name: unsubscribed_users; Type: TABLE; Schema: mail_deliveries; Owner: -; Tablespace: +-- + +CREATE TABLE unsubscribed_users ( + id integer NOT NULL, + category_id integer NOT NULL, + user_id integer NOT NULL, + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: unsubscribed_users_id_seq; Type: SEQUENCE; Schema: mail_deliveries; Owner: - +-- + +CREATE SEQUENCE unsubscribed_users_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: unsubscribed_users_id_seq; Type: SEQUENCE OWNED BY; Schema: mail_deliveries; Owner: - +-- + +ALTER SEQUENCE unsubscribed_users_id_seq OWNED BY unsubscribed_users.id; + + +-- +-- Name: user_category_settings; Type: TABLE; Schema: mail_deliveries; Owner: -; Tablespace: +-- + +CREATE TABLE user_category_settings ( + id integer NOT NULL, + user_id integer NOT NULL, + category_id integer NOT NULL, + settings character varying(2000) NOT NULL, + fast_settings public.hstore, + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: TABLE user_category_settings; Type: COMMENT; Schema: mail_deliveries; Owner: - +-- + +COMMENT ON TABLE user_category_settings IS 'Настройки пользователей по категориям рассылок'; + + +-- +-- Name: user_category_settings_id_seq; Type: SEQUENCE; Schema: mail_deliveries; Owner: - +-- + +CREATE SEQUENCE user_category_settings_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: user_category_settings_id_seq; Type: SEQUENCE OWNED BY; Schema: mail_deliveries; Owner: - +-- + +ALTER SEQUENCE user_category_settings_id_seq OWNED BY user_category_settings.id; + + +SET search_path = mail_delivery, pg_catalog; + +-- +-- Name: attached_blogs; Type: TABLE; Schema: mail_delivery; Owner: -; Tablespace: +-- + +CREATE TABLE attached_blogs ( + id integer NOT NULL, + blog_post_id integer NOT NULL, + mail_set_content_template_id integer NOT NULL, + is_accepted boolean DEFAULT false NOT NULL, + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: TABLE attached_blogs; Type: COMMENT; Schema: mail_delivery; Owner: - +-- + +COMMENT ON TABLE attached_blogs IS 'Посты блогов, прикрепленные к редакционной новостной рассылке'; + + +-- +-- Name: attached_blogs_id_seq; Type: SEQUENCE; Schema: mail_delivery; Owner: - +-- + +CREATE SEQUENCE attached_blogs_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: attached_blogs_id_seq; Type: SEQUENCE OWNED BY; Schema: mail_delivery; Owner: - +-- + +ALTER SEQUENCE attached_blogs_id_seq OWNED BY attached_blogs.id; + + +-- +-- Name: attached_company_events; Type: TABLE; Schema: mail_delivery; Owner: -; Tablespace: +-- + +CREATE TABLE attached_company_events ( + id integer NOT NULL, + company_event_id integer NOT NULL, + mail_set_content_template_id integer NOT NULL, + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: TABLE attached_company_events; Type: COMMENT; Schema: mail_delivery; Owner: - +-- + +COMMENT ON TABLE attached_company_events IS 'Мероприятия, прикрепленные к новостной рассылке ДК'; + + +-- +-- Name: attached_company_events_id_seq; Type: SEQUENCE; Schema: mail_delivery; Owner: - +-- + +CREATE SEQUENCE attached_company_events_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: attached_company_events_id_seq; Type: SEQUENCE OWNED BY; Schema: mail_delivery; Owner: - +-- + +ALTER SEQUENCE attached_company_events_id_seq OWNED BY attached_company_events.id; + + +-- +-- Name: attached_partner_projects; Type: TABLE; Schema: mail_delivery; Owner: -; Tablespace: +-- + +CREATE TABLE attached_partner_projects ( + id integer NOT NULL, + portal_news_subscription_delivery_id integer NOT NULL, + url character varying(255), + title character varying(255), + lead character varying(255), + is_shown_in_deliveries boolean DEFAULT false NOT NULL +); + + +-- +-- Name: attached_partner_projects_id_seq; Type: SEQUENCE; Schema: mail_delivery; Owner: - +-- + +CREATE SEQUENCE attached_partner_projects_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: attached_partner_projects_id_seq; Type: SEQUENCE OWNED BY; Schema: mail_delivery; Owner: - +-- + +ALTER SEQUENCE attached_partner_projects_id_seq OWNED BY attached_partner_projects.id; + + +-- +-- Name: auto_deliveries; Type: TABLE; Schema: mail_delivery; Owner: -; Tablespace: +-- + +CREATE TABLE auto_deliveries ( + id integer NOT NULL, + delivery_at date, + mail_set_id integer, + state character varying(20) DEFAULT 'pending'::character varying NOT NULL, + created_at timestamp without time zone, + updated_at timestamp without time zone, + subject_id integer, + subject_type character varying(255) +); + + +-- +-- Name: TABLE auto_deliveries; Type: COMMENT; Schema: mail_delivery; Owner: - +-- + +COMMENT ON TABLE auto_deliveries IS 'Автоматическая рассылка'; + + +-- +-- Name: COLUMN auto_deliveries.delivery_at; Type: COMMENT; Schema: mail_delivery; Owner: - +-- + +COMMENT ON COLUMN auto_deliveries.delivery_at IS 'День, в который должна состояться отправка'; + + +-- +-- Name: auto_deliveries_id_seq; Type: SEQUENCE; Schema: mail_delivery; Owner: - +-- + +CREATE SEQUENCE auto_deliveries_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: auto_deliveries_id_seq; Type: SEQUENCE OWNED BY; Schema: mail_delivery; Owner: - +-- + +ALTER SEQUENCE auto_deliveries_id_seq OWNED BY auto_deliveries.id; + + +-- +-- Name: companies_data_sets; Type: TABLE; Schema: mail_delivery; Owner: -; Tablespace: +-- + +CREATE TABLE companies_data_sets ( + id integer NOT NULL, + filter_id integer, + mail_set_id integer, + token character varying(255), + email character varying(255), + company_id integer, + user_id integer, + region_id integer, + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: companies_data_sets_id_seq; Type: SEQUENCE; Schema: mail_delivery; Owner: - +-- + +CREATE SEQUENCE companies_data_sets_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: companies_data_sets_id_seq; Type: SEQUENCE OWNED BY; Schema: mail_delivery; Owner: - +-- + +ALTER SEQUENCE companies_data_sets_id_seq OWNED BY companies_data_sets.id; + + +-- +-- Name: companies_datasources; Type: TABLE; Schema: mail_delivery; Owner: -; Tablespace: +-- + +CREATE TABLE companies_datasources ( + id integer NOT NULL, + delivery_id integer, + regions text, + commercial_regions text, + price_regions text, + packets text, + has_price boolean, + has_products boolean, + has_public_products boolean, + from_created_at date, + to_created_at date, + from_updated_at date, + to_updated_at date, + oferta_ids_file_name character varying(255), + oferta_ids_content_type character varying(255), + oferta_ids_file_size integer, + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: companies_datasources_id_seq; Type: SEQUENCE; Schema: mail_delivery; Owner: - +-- + +CREATE SEQUENCE companies_datasources_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: companies_datasources_id_seq; Type: SEQUENCE OWNED BY; Schema: mail_delivery; Owner: - +-- + +ALTER SEQUENCE companies_datasources_id_seq OWNED BY companies_datasources.id; + + +-- +-- Name: companies_filters; Type: TABLE; Schema: mail_delivery; Owner: -; Tablespace: +-- + +CREATE TABLE companies_filters ( + id integer NOT NULL, + delivery_id integer, + regions text, + commercial_regions text, + price_regions text, + packets text, + has_price boolean, + has_products boolean, + has_public_products boolean, + from_created_at date, + to_created_at date, + from_updated_at date, + to_updated_at date, + oferta_ids_file_name character varying(255), + oferta_ids_content_type character varying(255), + oferta_ids_file_size integer, + created_at timestamp without time zone, + updated_at timestamp without time zone, + is_only_imported boolean DEFAULT false NOT NULL, + products_count_min integer, + products_count_max integer, + products_update_date_min date, + products_update_date_max date, + last_seen_date_min date, + last_seen_date_max date, + is_pricelist_online boolean, + imports text, + test_packet_status character varying(255), + test_packet_day_remains integer, + test_packet_day_remains_min integer, + test_packet_day_after integer, + test_packet_day_after_min integer, + online_store_types character varying(255), + company_status character varying(255) DEFAULT 'all'::character varying NOT NULL, + site_ids_file_name character varying(255), + site_ids_content_type character varying(255), + site_ids_file_size integer, + site_ids_updated_at timestamp without time zone, + has_user boolean, + days_after_created_max integer, + days_after_created_min integer, + CONSTRAINT companies_filters_last_seen_date_max_chk CHECK ((last_seen_date_max >= last_seen_date_min)), + CONSTRAINT companies_filters_products_count_max_chk CHECK (((products_count_max > 0) AND (products_count_max > products_count_min))), + CONSTRAINT companies_filters_products_count_min_chk CHECK ((products_count_min >= 0)), + CONSTRAINT companies_filters_products_update_date_max_chk CHECK ((products_update_date_max >= products_update_date_min)) +); + + +-- +-- Name: COLUMN companies_filters.test_packet_status; Type: COMMENT; Schema: mail_delivery; Owner: - +-- + +COMMENT ON COLUMN companies_filters.test_packet_status IS 'Статус тестового размещения'; + + +-- +-- Name: COLUMN companies_filters.test_packet_day_remains; Type: COMMENT; Schema: mail_delivery; Owner: - +-- + +COMMENT ON COLUMN companies_filters.test_packet_day_remains IS 'Кол-во дней до конца тестового размещения'; + + +-- +-- Name: companies_filters_id_seq; Type: SEQUENCE; Schema: mail_delivery; Owner: - +-- + +CREATE SEQUENCE companies_filters_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: companies_filters_id_seq; Type: SEQUENCE OWNED BY; Schema: mail_delivery; Owner: - +-- + +ALTER SEQUENCE companies_filters_id_seq OWNED BY companies_filters.id; + + +-- +-- Name: deliveries; Type: TABLE; Schema: mail_delivery; Owner: -; Tablespace: +-- + +CREATE TABLE deliveries ( + id integer NOT NULL, + title character varying(255), + description text, + data_manager character varying(255) NOT NULL, + content_manager character varying(255) NOT NULL, + mail_subject character varying(255) NOT NULL, + mail_from character varying(255), + mail_from_title character varying(255), + mail_from_is_regional boolean DEFAULT false NOT NULL, + mail_content text NOT NULL, + created_at timestamp without time zone, + updated_at timestamp without time zone, + mail_to_title character varying(255), + is_active boolean DEFAULT true NOT NULL, + send_type character varying(10) DEFAULT 'manual'::character varying NOT NULL, + report_email character varying(50), + token character varying(255) +); + + +-- +-- Name: COLUMN deliveries.report_email; Type: COMMENT; Schema: mail_delivery; Owner: - +-- + +COMMENT ON COLUMN deliveries.report_email IS 'E-mail на который отправляется статистика при автоматической рассылке'; + + +-- +-- Name: COLUMN deliveries.token; Type: COMMENT; Schema: mail_delivery; Owner: - +-- + +COMMENT ON COLUMN deliveries.token IS 'Токен, идентифицирующий рассылку. По нему проводится отписка. Лучше не перегенерировать.'; + + +-- +-- Name: deliveries_id_seq; Type: SEQUENCE; Schema: mail_delivery; Owner: - +-- + +CREATE SEQUENCE deliveries_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: deliveries_id_seq; Type: SEQUENCE OWNED BY; Schema: mail_delivery; Owner: - +-- + +ALTER SEQUENCE deliveries_id_seq OWNED BY deliveries.id; + + +-- +-- Name: mail_sets; Type: TABLE; Schema: mail_delivery; Owner: -; Tablespace: +-- + +CREATE TABLE mail_sets ( + id integer NOT NULL, + state character varying(255), + is_sample boolean DEFAULT false NOT NULL, + status text, + success_count integer, + unsubscribed_count integer, + wrong_count integer, + fail_count integer, + sent_count integer, + created_at timestamp without time zone, + updated_at timestamp without time zone, + send_errors_count integer DEFAULT 0, + send_at timestamp without time zone, + subject_id integer, + subject_type character varying(255), + inline_attachments text, + mail_subject character varying(70) +); + + +-- +-- Name: mail_sets_id_seq; Type: SEQUENCE; Schema: mail_delivery; Owner: - +-- + +CREATE SEQUENCE mail_sets_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: mail_sets_id_seq; Type: SEQUENCE OWNED BY; Schema: mail_delivery; Owner: - +-- + +ALTER SEQUENCE mail_sets_id_seq OWNED BY mail_sets.id; + + +-- +-- Name: mails; Type: TABLE; Schema: mail_delivery; Owner: -; Tablespace: +-- + +CREATE TABLE mails ( + id integer NOT NULL, + mail_set_id integer, + "from" character varying(255), + "to" character varying(255), + subject text, + content text, + created_at timestamp without time zone, + updated_at timestamp without time zone, + state character varying(255) DEFAULT 'new'::character varying NOT NULL, + attached_images boolean DEFAULT false NOT NULL +); + + +-- +-- Name: mails_id_seq; Type: SEQUENCE; Schema: mail_delivery; Owner: - +-- + +CREATE SEQUENCE mails_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: mails_id_seq; Type: SEQUENCE OWNED BY; Schema: mail_delivery; Owner: - +-- + +ALTER SEQUENCE mails_id_seq OWNED BY mails.id; + + +-- +-- Name: personal_subscription_data_prepared; Type: TABLE; Schema: mail_delivery; Owner: -; Tablespace: +-- + +CREATE TABLE personal_subscription_data_prepared ( + delivery_id integer, + region_id integer, + rubric_id integer, + prepared_ids text +); + + +-- +-- Name: TABLE personal_subscription_data_prepared; Type: COMMENT; Schema: mail_delivery; Owner: - +-- + +COMMENT ON TABLE personal_subscription_data_prepared IS 'Таблица с подготовленными выборками ИД-шников для подписок'; + + +-- +-- Name: personal_subscription_data_sets; Type: TABLE; Schema: mail_delivery; Owner: -; Tablespace: +-- + +CREATE TABLE personal_subscription_data_sets ( + id integer NOT NULL, + mail_set_id integer, + user_id integer, + email character varying(255), + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: TABLE personal_subscription_data_sets; Type: COMMENT; Schema: mail_delivery; Owner: - +-- + +COMMENT ON TABLE personal_subscription_data_sets IS 'Таблица с временными данными из которых генерируются письма'; + + +-- +-- Name: personal_subscription_data_sets_id_seq; Type: SEQUENCE; Schema: mail_delivery; Owner: - +-- + +CREATE SEQUENCE personal_subscription_data_sets_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: personal_subscription_data_sets_id_seq; Type: SEQUENCE OWNED BY; Schema: mail_delivery; Owner: - +-- + +ALTER SEQUENCE personal_subscription_data_sets_id_seq OWNED BY personal_subscription_data_sets.id; + + +-- +-- Name: personal_subscription_deliveries; Type: TABLE; Schema: mail_delivery; Owner: -; Tablespace: +-- + +CREATE TABLE personal_subscription_deliveries ( + id integer NOT NULL, + title character varying(255), + description text, + data_manager character varying(255) NOT NULL, + content_manager character varying(255) NOT NULL, + mail_subject character varying(255) NOT NULL, + mail_from character varying(255), + mail_from_title character varying(255), + mail_from_is_regional boolean DEFAULT false NOT NULL, + mail_content text, + mail_to_title character varying(255), + is_active boolean DEFAULT true, + report_email character varying(50), + show_in_dashboard boolean DEFAULT true NOT NULL, + show_in_listing character varying(50), + show_for_packet_ids character varying(20), + option_region boolean DEFAULT false, + option_rubrics integer, + option_use character varying(20), + show_flash boolean DEFAULT false NOT NULL, + subscribed_by_filter integer DEFAULT 0 NOT NULL, + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: TABLE personal_subscription_deliveries; Type: COMMENT; Schema: mail_delivery; Owner: - +-- + +COMMENT ON TABLE personal_subscription_deliveries IS 'Подписки (персональные рассылки)'; + + +-- +-- Name: COLUMN personal_subscription_deliveries.report_email; Type: COMMENT; Schema: mail_delivery; Owner: - +-- + +COMMENT ON COLUMN personal_subscription_deliveries.report_email IS 'E-mail на который отправляется статистика'; + + +-- +-- Name: COLUMN personal_subscription_deliveries.show_in_listing; Type: COMMENT; Schema: mail_delivery; Owner: - +-- + +COMMENT ON COLUMN personal_subscription_deliveries.show_in_listing IS 'Показывать ли подписку в листинге'; + + +-- +-- Name: COLUMN personal_subscription_deliveries.option_use; Type: COMMENT; Schema: mail_delivery; Owner: - +-- + +COMMENT ON COLUMN personal_subscription_deliveries.option_use IS 'Использовать ли таблицу для выборки'; + + +-- +-- Name: COLUMN personal_subscription_deliveries.show_flash; Type: COMMENT; Schema: mail_delivery; Owner: - +-- + +COMMENT ON COLUMN personal_subscription_deliveries.show_flash IS 'Показывать ли сообщение о подписаных по фильтру'; + + +-- +-- Name: COLUMN personal_subscription_deliveries.subscribed_by_filter; Type: COMMENT; Schema: mail_delivery; Owner: - +-- + +COMMENT ON COLUMN personal_subscription_deliveries.subscribed_by_filter IS 'Количество подписанных по фильтру пользователей'; + + +-- +-- Name: personal_subscription_deliveries_id_seq; Type: SEQUENCE; Schema: mail_delivery; Owner: - +-- + +CREATE SEQUENCE personal_subscription_deliveries_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: personal_subscription_deliveries_id_seq; Type: SEQUENCE OWNED BY; Schema: mail_delivery; Owner: - +-- + +ALTER SEQUENCE personal_subscription_deliveries_id_seq OWNED BY personal_subscription_deliveries.id; + + +-- +-- Name: personal_subscriptions; Type: TABLE; Schema: mail_delivery; Owner: -; Tablespace: +-- + +CREATE TABLE personal_subscriptions ( + id integer NOT NULL, + delivery_id integer, + user_id integer, + email character varying(255) NOT NULL, + token character varying(255) NOT NULL, + option_region integer, + option_rubrics text, + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: TABLE personal_subscriptions; Type: COMMENT; Schema: mail_delivery; Owner: - +-- + +COMMENT ON TABLE personal_subscriptions IS 'Персональные рассылки (по подпискам)'; + + +-- +-- Name: COLUMN personal_subscriptions.token; Type: COMMENT; Schema: mail_delivery; Owner: - +-- + +COMMENT ON COLUMN personal_subscriptions.token IS 'Токен для отписки'; + + +-- +-- Name: COLUMN personal_subscriptions.option_region; Type: COMMENT; Schema: mail_delivery; Owner: - +-- + +COMMENT ON COLUMN personal_subscriptions.option_region IS 'Регион, выбранный пользователем при подписке'; + + +-- +-- Name: COLUMN personal_subscriptions.option_rubrics; Type: COMMENT; Schema: mail_delivery; Owner: - +-- + +COMMENT ON COLUMN personal_subscriptions.option_rubrics IS 'Рубрики, выбранный пользователем при подписке'; + + +-- +-- Name: personal_subscriptions_id_seq; Type: SEQUENCE; Schema: mail_delivery; Owner: - +-- + +CREATE SEQUENCE personal_subscriptions_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: personal_subscriptions_id_seq; Type: SEQUENCE OWNED BY; Schema: mail_delivery; Owner: - +-- + +ALTER SEQUENCE personal_subscriptions_id_seq OWNED BY personal_subscriptions.id; + + +-- +-- Name: portal_news_subscription_deliveries; Type: TABLE; Schema: mail_delivery; Owner: -; Tablespace: +-- + +CREATE TABLE portal_news_subscription_deliveries ( + id integer NOT NULL, + title character varying(255), + description text, + mail_subject character varying(255), + mail_from character varying(255), + mail_from_title character varying(255), + mail_to_title character varying(255), + is_active boolean, + region_id integer, + created_at timestamp without time zone, + updated_at timestamp without time zone, + send_at timestamp without time zone +); + + +-- +-- Name: portal_news_subscription_deliveries_id_seq; Type: SEQUENCE; Schema: mail_delivery; Owner: - +-- + +CREATE SEQUENCE portal_news_subscription_deliveries_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: portal_news_subscription_deliveries_id_seq; Type: SEQUENCE OWNED BY; Schema: mail_delivery; Owner: - +-- + +ALTER SEQUENCE portal_news_subscription_deliveries_id_seq OWNED BY portal_news_subscription_deliveries.id; + + +-- +-- Name: portal_news_subscriptions; Type: TABLE; Schema: mail_delivery; Owner: -; Tablespace: +-- + +CREATE TABLE portal_news_subscriptions ( + id integer NOT NULL, + email character varying(255), + token character varying(255), + is_unsubscribed boolean, + portal_news_subscription_delivery_id integer, + created_at timestamp without time zone, + updated_at timestamp without time zone, + user_id integer, + is_add_to_mailchimp boolean DEFAULT false +); + + +-- +-- Name: portal_news_subscriptions_id_seq; Type: SEQUENCE; Schema: mail_delivery; Owner: - +-- + +CREATE SEQUENCE portal_news_subscriptions_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: portal_news_subscriptions_id_seq; Type: SEQUENCE OWNED BY; Schema: mail_delivery; Owner: - +-- + +ALTER SEQUENCE portal_news_subscriptions_id_seq OWNED BY portal_news_subscriptions.id; + + +-- +-- Name: portal_news_subscriptions_mail_set_content_templates; Type: TABLE; Schema: mail_delivery; Owner: -; Tablespace: +-- + +CREATE TABLE portal_news_subscriptions_mail_set_content_templates ( + id integer NOT NULL, + html_content text, + updated_by integer, + updated_at timestamp without time zone, + mail_set_id integer, + is_generated_user_mails boolean DEFAULT false, + generated_mails_count integer DEFAULT 0 NOT NULL, + theme_of_day_news_id integer, + editors_choice_news_id integer, + blog_of_day_id integer +); + + +-- +-- Name: portal_news_subscriptions_mail_set_content_templates_id_seq; Type: SEQUENCE; Schema: mail_delivery; Owner: - +-- + +CREATE SEQUENCE portal_news_subscriptions_mail_set_content_templates_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: portal_news_subscriptions_mail_set_content_templates_id_seq; Type: SEQUENCE OWNED BY; Schema: mail_delivery; Owner: - +-- + +ALTER SEQUENCE portal_news_subscriptions_mail_set_content_templates_id_seq OWNED BY portal_news_subscriptions_mail_set_content_templates.id; + + +-- +-- Name: portal_subscription_mail_set_news; Type: TABLE; Schema: mail_delivery; Owner: -; Tablespace: +-- + +CREATE TABLE portal_subscription_mail_set_news ( + id integer NOT NULL, + news_id integer, + mail_set_content_template_id integer, + "position" integer +); + + +-- +-- Name: COLUMN portal_subscription_mail_set_news."position"; Type: COMMENT; Schema: mail_delivery; Owner: - +-- + +COMMENT ON COLUMN portal_subscription_mail_set_news."position" IS 'Позиция новости в рассылке'; + + +-- +-- Name: portal_subscription_mail_set_news_id_seq; Type: SEQUENCE; Schema: mail_delivery; Owner: - +-- + +CREATE SEQUENCE portal_subscription_mail_set_news_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: portal_subscription_mail_set_news_id_seq; Type: SEQUENCE OWNED BY; Schema: mail_delivery; Owner: - +-- + +ALTER SEQUENCE portal_subscription_mail_set_news_id_seq OWNED BY portal_subscription_mail_set_news.id; + + +-- +-- Name: schedules; Type: TABLE; Schema: mail_delivery; Owner: -; Tablespace: +-- + +CREATE TABLE schedules ( + id integer NOT NULL, + send_frequency character varying(20), + send_date integer, + subject_id integer, + subject_type character varying(255), + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: TABLE schedules; Type: COMMENT; Schema: mail_delivery; Owner: - +-- + +COMMENT ON TABLE schedules IS 'Расписание для автоматических рассылок'; + + +-- +-- Name: COLUMN schedules.send_frequency; Type: COMMENT; Schema: mail_delivery; Owner: - +-- + +COMMENT ON COLUMN schedules.send_frequency IS 'Частота отправления рассылки'; + + +-- +-- Name: COLUMN schedules.send_date; Type: COMMENT; Schema: mail_delivery; Owner: - +-- + +COMMENT ON COLUMN schedules.send_date IS 'День недели/Число'; + + +-- +-- Name: schedules_id_seq; Type: SEQUENCE; Schema: mail_delivery; Owner: - +-- + +CREATE SEQUENCE schedules_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: schedules_id_seq; Type: SEQUENCE OWNED BY; Schema: mail_delivery; Owner: - +-- + +ALTER SEQUENCE schedules_id_seq OWNED BY schedules.id; + + +-- +-- Name: senders; Type: TABLE; Schema: mail_delivery; Owner: -; Tablespace: +-- + +CREATE TABLE senders ( + id integer NOT NULL, + region_id integer, + title character varying(255), + email text, + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: senders_id_seq; Type: SEQUENCE; Schema: mail_delivery; Owner: - +-- + +CREATE SEQUENCE senders_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: senders_id_seq; Type: SEQUENCE OWNED BY; Schema: mail_delivery; Owner: - +-- + +ALTER SEQUENCE senders_id_seq OWNED BY senders.id; + + +-- +-- Name: subscriptions; Type: TABLE; Schema: mail_delivery; Owner: -; Tablespace: +-- + +CREATE TABLE subscriptions ( + id integer NOT NULL, + email character varying(255), + token character varying(255), + is_unsubscribed boolean DEFAULT false NOT NULL, + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: subscriptions_id_seq; Type: SEQUENCE; Schema: mail_delivery; Owner: - +-- + +CREATE SEQUENCE subscriptions_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: subscriptions_id_seq; Type: SEQUENCE OWNED BY; Schema: mail_delivery; Owner: - +-- + +ALTER SEQUENCE subscriptions_id_seq OWNED BY subscriptions.id; + + +-- +-- Name: unreachable_emails; Type: TABLE; Schema: mail_delivery; Owner: -; Tablespace: +-- + +CREATE TABLE unreachable_emails ( + id integer NOT NULL, + email character varying(255) NOT NULL, + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: TABLE unreachable_emails; Type: COMMENT; Schema: mail_delivery; Owner: - +-- + +COMMENT ON TABLE unreachable_emails IS 'Кладбище мертвых email-адресов (отлупы)'; + + +-- +-- Name: unreachable_emails_id_seq; Type: SEQUENCE; Schema: mail_delivery; Owner: - +-- + +CREATE SEQUENCE unreachable_emails_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: unreachable_emails_id_seq; Type: SEQUENCE OWNED BY; Schema: mail_delivery; Owner: - +-- + +ALTER SEQUENCE unreachable_emails_id_seq OWNED BY unreachable_emails.id; + + +-- +-- Name: unsubscribed_emails; Type: TABLE; Schema: mail_delivery; Owner: -; Tablespace: +-- + +CREATE TABLE unsubscribed_emails ( + id integer NOT NULL, + delivery_id integer, + email character varying(255) NOT NULL, + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: TABLE unsubscribed_emails; Type: COMMENT; Schema: mail_delivery; Owner: - +-- + +COMMENT ON TABLE unsubscribed_emails IS 'Email отписавшихся от конкретной рассылки'; + + +-- +-- Name: unsubscribed_emails_id_seq; Type: SEQUENCE; Schema: mail_delivery; Owner: - +-- + +CREATE SEQUENCE unsubscribed_emails_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: unsubscribed_emails_id_seq; Type: SEQUENCE OWNED BY; Schema: mail_delivery; Owner: - +-- + +ALTER SEQUENCE unsubscribed_emails_id_seq OWNED BY unsubscribed_emails.id; + + +-- +-- Name: variables; Type: TABLE; Schema: mail_delivery; Owner: -; Tablespace: +-- + +CREATE TABLE variables ( + id integer NOT NULL, + name character varying(255), + content text, + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: variables_id_seq; Type: SEQUENCE; Schema: mail_delivery; Owner: - +-- + +CREATE SEQUENCE variables_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: variables_id_seq; Type: SEQUENCE OWNED BY; Schema: mail_delivery; Owner: - +-- + +ALTER SEQUENCE variables_id_seq OWNED BY variables.id; + + +SET search_path = permissions, pg_catalog; + +-- +-- Name: admin_permissions; Type: TABLE; Schema: permissions; Owner: -; Tablespace: +-- + +CREATE TABLE admin_permissions ( + id integer NOT NULL, + user_id integer, + section_id integer, + last_editor_id integer, + mode integer, + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: TABLE admin_permissions; Type: COMMENT; Schema: permissions; Owner: - +-- + +COMMENT ON TABLE admin_permissions IS 'Права для разделов админки'; + + +-- +-- Name: COLUMN admin_permissions.user_id; Type: COMMENT; Schema: permissions; Owner: - +-- + +COMMENT ON COLUMN admin_permissions.user_id IS 'Пользователь'; + + +-- +-- Name: COLUMN admin_permissions.section_id; Type: COMMENT; Schema: permissions; Owner: - +-- + +COMMENT ON COLUMN admin_permissions.section_id IS 'Раздел админки'; + + +-- +-- Name: COLUMN admin_permissions.last_editor_id; Type: COMMENT; Schema: permissions; Owner: - +-- + +COMMENT ON COLUMN admin_permissions.last_editor_id IS 'Последний редактировавший запись пользователь'; + + +-- +-- Name: COLUMN admin_permissions.mode; Type: COMMENT; Schema: permissions; Owner: - +-- + +COMMENT ON COLUMN admin_permissions.mode IS 'Режим доступа 1-чтение 2-запись'; + + +-- +-- Name: admin_permissions_id_seq; Type: SEQUENCE; Schema: permissions; Owner: - +-- + +CREATE SEQUENCE admin_permissions_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: admin_permissions_id_seq; Type: SEQUENCE OWNED BY; Schema: permissions; Owner: - +-- + +ALTER SEQUENCE admin_permissions_id_seq OWNED BY admin_permissions.id; + + +-- +-- Name: admin_sections; Type: TABLE; Schema: permissions; Owner: -; Tablespace: +-- + +CREATE TABLE admin_sections ( + id integer NOT NULL, + name character varying(255), + slug character varying(255) +); + + +-- +-- Name: TABLE admin_sections; Type: COMMENT; Schema: permissions; Owner: - +-- + +COMMENT ON TABLE admin_sections IS 'Разделы админки'; + + +-- +-- Name: COLUMN admin_sections.name; Type: COMMENT; Schema: permissions; Owner: - +-- + +COMMENT ON COLUMN admin_sections.name IS 'Название раздела'; + + +-- +-- Name: COLUMN admin_sections.slug; Type: COMMENT; Schema: permissions; Owner: - +-- + +COMMENT ON COLUMN admin_sections.slug IS 'Текстовый идентификатор'; + + +-- +-- Name: admin_sections_id_seq; Type: SEQUENCE; Schema: permissions; Owner: - +-- + +CREATE SEQUENCE admin_sections_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: admin_sections_id_seq; Type: SEQUENCE OWNED BY; Schema: permissions; Owner: - +-- + +ALTER SEQUENCE admin_sections_id_seq OWNED BY admin_sections.id; + + +SET search_path = pgq, pg_catalog; + +-- +-- Name: batch_id_seq; Type: SEQUENCE; Schema: pgq; Owner: - +-- + +CREATE SEQUENCE batch_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: consumer; Type: TABLE; Schema: pgq; Owner: -; Tablespace: +-- + +CREATE TABLE consumer ( + co_id integer NOT NULL, + co_name text NOT NULL +); + + +-- +-- Name: consumer_co_id_seq; Type: SEQUENCE; Schema: pgq; Owner: - +-- + +CREATE SEQUENCE consumer_co_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: consumer_co_id_seq; Type: SEQUENCE OWNED BY; Schema: pgq; Owner: - +-- + +ALTER SEQUENCE consumer_co_id_seq OWNED BY consumer.co_id; + + +-- +-- Name: event_template; Type: TABLE; Schema: pgq; Owner: -; Tablespace: +-- + +CREATE TABLE event_template ( + ev_id bigint NOT NULL, + ev_time timestamp with time zone NOT NULL, + ev_txid bigint DEFAULT txid_current() NOT NULL, + ev_owner integer, + ev_retry integer, + ev_type text, + ev_data text, + ev_extra1 text, + ev_extra2 text, + ev_extra3 text, + ev_extra4 text +); + + +-- +-- Name: event_1; Type: TABLE; Schema: pgq; Owner: -; Tablespace: +-- + +CREATE TABLE event_1 ( +) +INHERITS (event_template); + + +-- +-- Name: event_10; Type: TABLE; Schema: pgq; Owner: -; Tablespace: +-- + +CREATE TABLE event_10 ( +) +INHERITS (event_template); + + +-- +-- Name: event_10_0; Type: TABLE; Schema: pgq; Owner: -; Tablespace: +-- + +CREATE TABLE event_10_0 ( +) +INHERITS (event_10) +WITH (fillfactor=100, autovacuum_enabled=off, toast.autovacuum_enabled=off); + + +-- +-- Name: event_10_1; Type: TABLE; Schema: pgq; Owner: -; Tablespace: +-- + +CREATE TABLE event_10_1 ( +) +INHERITS (event_10) +WITH (fillfactor=100, autovacuum_enabled=off, toast.autovacuum_enabled=off); + + +-- +-- Name: event_10_2; Type: TABLE; Schema: pgq; Owner: -; Tablespace: +-- + +CREATE TABLE event_10_2 ( +) +INHERITS (event_10) +WITH (fillfactor=100, autovacuum_enabled=off, toast.autovacuum_enabled=off); + + +-- +-- Name: event_10_id_seq; Type: SEQUENCE; Schema: pgq; Owner: - +-- + +CREATE SEQUENCE event_10_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: event_10_tick_seq; Type: SEQUENCE; Schema: pgq; Owner: - +-- + +CREATE SEQUENCE event_10_tick_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: event_11; Type: TABLE; Schema: pgq; Owner: -; Tablespace: +-- + +CREATE TABLE event_11 ( +) +INHERITS (event_template); + + +-- +-- Name: event_11_0; Type: TABLE; Schema: pgq; Owner: -; Tablespace: +-- + +CREATE TABLE event_11_0 ( +) +INHERITS (event_11) +WITH (fillfactor=100, autovacuum_enabled=off, toast.autovacuum_enabled=off); + + +-- +-- Name: event_11_1; Type: TABLE; Schema: pgq; Owner: -; Tablespace: +-- + +CREATE TABLE event_11_1 ( +) +INHERITS (event_11) +WITH (fillfactor=100, autovacuum_enabled=off, toast.autovacuum_enabled=off); + + +-- +-- Name: event_11_2; Type: TABLE; Schema: pgq; Owner: -; Tablespace: +-- + +CREATE TABLE event_11_2 ( +) +INHERITS (event_11) +WITH (fillfactor=100, autovacuum_enabled=off, toast.autovacuum_enabled=off); + + +-- +-- Name: event_11_id_seq; Type: SEQUENCE; Schema: pgq; Owner: - +-- + +CREATE SEQUENCE event_11_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: event_11_tick_seq; Type: SEQUENCE; Schema: pgq; Owner: - +-- + +CREATE SEQUENCE event_11_tick_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: event_12; Type: TABLE; Schema: pgq; Owner: -; Tablespace: +-- + +CREATE TABLE event_12 ( +) +INHERITS (event_template); + + +-- +-- Name: event_12_0; Type: TABLE; Schema: pgq; Owner: -; Tablespace: +-- + +CREATE TABLE event_12_0 ( +) +INHERITS (event_12) +WITH (fillfactor=100, autovacuum_enabled=off, toast.autovacuum_enabled=off); + + +-- +-- Name: event_12_1; Type: TABLE; Schema: pgq; Owner: -; Tablespace: +-- + +CREATE TABLE event_12_1 ( +) +INHERITS (event_12) +WITH (fillfactor=100, autovacuum_enabled=off, toast.autovacuum_enabled=off); + + +-- +-- Name: event_12_2; Type: TABLE; Schema: pgq; Owner: -; Tablespace: +-- + +CREATE TABLE event_12_2 ( +) +INHERITS (event_12) +WITH (fillfactor=100, autovacuum_enabled=off, toast.autovacuum_enabled=off); + + +-- +-- Name: event_12_id_seq; Type: SEQUENCE; Schema: pgq; Owner: - +-- + +CREATE SEQUENCE event_12_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: event_12_tick_seq; Type: SEQUENCE; Schema: pgq; Owner: - +-- + +CREATE SEQUENCE event_12_tick_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: event_13; Type: TABLE; Schema: pgq; Owner: -; Tablespace: +-- + +CREATE TABLE event_13 ( +) +INHERITS (event_template); + + +-- +-- Name: event_13_0; Type: TABLE; Schema: pgq; Owner: -; Tablespace: +-- + +CREATE TABLE event_13_0 ( +) +INHERITS (event_13) +WITH (fillfactor=100, autovacuum_enabled=off, toast.autovacuum_enabled=off); + + +-- +-- Name: event_13_1; Type: TABLE; Schema: pgq; Owner: -; Tablespace: +-- + +CREATE TABLE event_13_1 ( +) +INHERITS (event_13) +WITH (fillfactor=100, autovacuum_enabled=off, toast.autovacuum_enabled=off); + + +-- +-- Name: event_13_2; Type: TABLE; Schema: pgq; Owner: -; Tablespace: +-- + +CREATE TABLE event_13_2 ( +) +INHERITS (event_13) +WITH (fillfactor=100, autovacuum_enabled=off, toast.autovacuum_enabled=off); + + +-- +-- Name: event_13_id_seq; Type: SEQUENCE; Schema: pgq; Owner: - +-- + +CREATE SEQUENCE event_13_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: event_13_tick_seq; Type: SEQUENCE; Schema: pgq; Owner: - +-- + +CREATE SEQUENCE event_13_tick_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: event_14; Type: TABLE; Schema: pgq; Owner: -; Tablespace: +-- + +CREATE TABLE event_14 ( +) +INHERITS (event_template); + + +-- +-- Name: event_14_0; Type: TABLE; Schema: pgq; Owner: -; Tablespace: +-- + +CREATE TABLE event_14_0 ( +) +INHERITS (event_14) +WITH (fillfactor=100, autovacuum_enabled=off, toast.autovacuum_enabled=off); + + +-- +-- Name: event_14_1; Type: TABLE; Schema: pgq; Owner: -; Tablespace: +-- + +CREATE TABLE event_14_1 ( +) +INHERITS (event_14) +WITH (fillfactor=100, autovacuum_enabled=off, toast.autovacuum_enabled=off); + + +-- +-- Name: event_14_2; Type: TABLE; Schema: pgq; Owner: -; Tablespace: +-- + +CREATE TABLE event_14_2 ( +) +INHERITS (event_14) +WITH (fillfactor=100, autovacuum_enabled=off, toast.autovacuum_enabled=off); + + +-- +-- Name: event_14_id_seq; Type: SEQUENCE; Schema: pgq; Owner: - +-- + +CREATE SEQUENCE event_14_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: event_14_tick_seq; Type: SEQUENCE; Schema: pgq; Owner: - +-- + +CREATE SEQUENCE event_14_tick_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: event_1_0; Type: TABLE; Schema: pgq; Owner: -; Tablespace: +-- + +CREATE TABLE event_1_0 ( +) +INHERITS (event_1) +WITH (fillfactor=100, autovacuum_enabled=off, toast.autovacuum_enabled=off); + + +-- +-- Name: event_1_1; Type: TABLE; Schema: pgq; Owner: -; Tablespace: +-- + +CREATE TABLE event_1_1 ( +) +INHERITS (event_1) +WITH (fillfactor=100, autovacuum_enabled=off, toast.autovacuum_enabled=off); + + +-- +-- Name: event_1_2; Type: TABLE; Schema: pgq; Owner: -; Tablespace: +-- + +CREATE TABLE event_1_2 ( +) +INHERITS (event_1) +WITH (fillfactor=100, autovacuum_enabled=off, toast.autovacuum_enabled=off); + + +-- +-- Name: event_1_id_seq; Type: SEQUENCE; Schema: pgq; Owner: - +-- + +CREATE SEQUENCE event_1_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: event_1_tick_seq; Type: SEQUENCE; Schema: pgq; Owner: - +-- + +CREATE SEQUENCE event_1_tick_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: event_2; Type: TABLE; Schema: pgq; Owner: -; Tablespace: +-- + +CREATE TABLE event_2 ( +) +INHERITS (event_template); + + +-- +-- Name: event_2_0; Type: TABLE; Schema: pgq; Owner: -; Tablespace: +-- + +CREATE TABLE event_2_0 ( +) +INHERITS (event_2) +WITH (fillfactor=100, autovacuum_enabled=off, toast.autovacuum_enabled=off); + + +-- +-- Name: event_2_1; Type: TABLE; Schema: pgq; Owner: -; Tablespace: +-- + +CREATE TABLE event_2_1 ( +) +INHERITS (event_2) +WITH (fillfactor=100, autovacuum_enabled=off, toast.autovacuum_enabled=off); + + +-- +-- Name: event_2_2; Type: TABLE; Schema: pgq; Owner: -; Tablespace: +-- + +CREATE TABLE event_2_2 ( +) +INHERITS (event_2) +WITH (fillfactor=100, autovacuum_enabled=off, toast.autovacuum_enabled=off); + + +-- +-- Name: event_2_id_seq; Type: SEQUENCE; Schema: pgq; Owner: - +-- + +CREATE SEQUENCE event_2_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: event_2_tick_seq; Type: SEQUENCE; Schema: pgq; Owner: - +-- + +CREATE SEQUENCE event_2_tick_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: event_3; Type: TABLE; Schema: pgq; Owner: -; Tablespace: +-- + +CREATE TABLE event_3 ( +) +INHERITS (event_template); + + +-- +-- Name: event_3_0; Type: TABLE; Schema: pgq; Owner: -; Tablespace: +-- + +CREATE TABLE event_3_0 ( +) +INHERITS (event_3) +WITH (fillfactor=100, autovacuum_enabled=off, toast.autovacuum_enabled=off); + + +-- +-- Name: event_3_1; Type: TABLE; Schema: pgq; Owner: -; Tablespace: +-- + +CREATE TABLE event_3_1 ( +) +INHERITS (event_3) +WITH (fillfactor=100, autovacuum_enabled=off, toast.autovacuum_enabled=off); + + +-- +-- Name: event_3_2; Type: TABLE; Schema: pgq; Owner: -; Tablespace: +-- + +CREATE TABLE event_3_2 ( +) +INHERITS (event_3) +WITH (fillfactor=100, autovacuum_enabled=off, toast.autovacuum_enabled=off); + + +-- +-- Name: event_3_id_seq; Type: SEQUENCE; Schema: pgq; Owner: - +-- + +CREATE SEQUENCE event_3_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: event_3_tick_seq; Type: SEQUENCE; Schema: pgq; Owner: - +-- + +CREATE SEQUENCE event_3_tick_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: event_4; Type: TABLE; Schema: pgq; Owner: -; Tablespace: +-- + +CREATE TABLE event_4 ( +) +INHERITS (event_template); + + +-- +-- Name: event_4_0; Type: TABLE; Schema: pgq; Owner: -; Tablespace: +-- + +CREATE TABLE event_4_0 ( +) +INHERITS (event_4) +WITH (fillfactor=100, autovacuum_enabled=off, toast.autovacuum_enabled=off); + + +-- +-- Name: event_4_1; Type: TABLE; Schema: pgq; Owner: -; Tablespace: +-- + +CREATE TABLE event_4_1 ( +) +INHERITS (event_4) +WITH (fillfactor=100, autovacuum_enabled=off, toast.autovacuum_enabled=off); + + +-- +-- Name: event_4_2; Type: TABLE; Schema: pgq; Owner: -; Tablespace: +-- + +CREATE TABLE event_4_2 ( +) +INHERITS (event_4) +WITH (fillfactor=100, autovacuum_enabled=off, toast.autovacuum_enabled=off); + + +-- +-- Name: event_4_id_seq; Type: SEQUENCE; Schema: pgq; Owner: - +-- + +CREATE SEQUENCE event_4_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: event_4_tick_seq; Type: SEQUENCE; Schema: pgq; Owner: - +-- + +CREATE SEQUENCE event_4_tick_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: event_5; Type: TABLE; Schema: pgq; Owner: -; Tablespace: +-- + +CREATE TABLE event_5 ( +) +INHERITS (event_template); + + +-- +-- Name: event_5_0; Type: TABLE; Schema: pgq; Owner: -; Tablespace: +-- + +CREATE TABLE event_5_0 ( +) +INHERITS (event_5) +WITH (fillfactor=100, autovacuum_enabled=off, toast.autovacuum_enabled=off); + + +-- +-- Name: event_5_1; Type: TABLE; Schema: pgq; Owner: -; Tablespace: +-- + +CREATE TABLE event_5_1 ( +) +INHERITS (event_5) +WITH (fillfactor=100, autovacuum_enabled=off, toast.autovacuum_enabled=off); + + +-- +-- Name: event_5_2; Type: TABLE; Schema: pgq; Owner: -; Tablespace: +-- + +CREATE TABLE event_5_2 ( +) +INHERITS (event_5) +WITH (fillfactor=100, autovacuum_enabled=off, toast.autovacuum_enabled=off); + + +-- +-- Name: event_5_id_seq; Type: SEQUENCE; Schema: pgq; Owner: - +-- + +CREATE SEQUENCE event_5_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: event_5_tick_seq; Type: SEQUENCE; Schema: pgq; Owner: - +-- + +CREATE SEQUENCE event_5_tick_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: event_6; Type: TABLE; Schema: pgq; Owner: -; Tablespace: +-- + +CREATE TABLE event_6 ( +) +INHERITS (event_template); + + +-- +-- Name: event_6_0; Type: TABLE; Schema: pgq; Owner: -; Tablespace: +-- + +CREATE TABLE event_6_0 ( +) +INHERITS (event_6) +WITH (fillfactor=100, autovacuum_enabled=off, toast.autovacuum_enabled=off); + + +-- +-- Name: event_6_1; Type: TABLE; Schema: pgq; Owner: -; Tablespace: +-- + +CREATE TABLE event_6_1 ( +) +INHERITS (event_6) +WITH (fillfactor=100, autovacuum_enabled=off, toast.autovacuum_enabled=off); + + +-- +-- Name: event_6_2; Type: TABLE; Schema: pgq; Owner: -; Tablespace: +-- + +CREATE TABLE event_6_2 ( +) +INHERITS (event_6) +WITH (fillfactor=100, autovacuum_enabled=off, toast.autovacuum_enabled=off); + + +-- +-- Name: event_6_id_seq; Type: SEQUENCE; Schema: pgq; Owner: - +-- + +CREATE SEQUENCE event_6_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: event_6_tick_seq; Type: SEQUENCE; Schema: pgq; Owner: - +-- + +CREATE SEQUENCE event_6_tick_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: event_7; Type: TABLE; Schema: pgq; Owner: -; Tablespace: +-- + +CREATE TABLE event_7 ( +) +INHERITS (event_template); + + +-- +-- Name: event_7_0; Type: TABLE; Schema: pgq; Owner: -; Tablespace: +-- + +CREATE TABLE event_7_0 ( +) +INHERITS (event_7) +WITH (fillfactor=100, autovacuum_enabled=off, toast.autovacuum_enabled=off); + + +-- +-- Name: event_7_1; Type: TABLE; Schema: pgq; Owner: -; Tablespace: +-- + +CREATE TABLE event_7_1 ( +) +INHERITS (event_7) +WITH (fillfactor=100, autovacuum_enabled=off, toast.autovacuum_enabled=off); + + +-- +-- Name: event_7_2; Type: TABLE; Schema: pgq; Owner: -; Tablespace: +-- + +CREATE TABLE event_7_2 ( +) +INHERITS (event_7) +WITH (fillfactor=100, autovacuum_enabled=off, toast.autovacuum_enabled=off); + + +-- +-- Name: event_7_id_seq; Type: SEQUENCE; Schema: pgq; Owner: - +-- + +CREATE SEQUENCE event_7_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: event_7_tick_seq; Type: SEQUENCE; Schema: pgq; Owner: - +-- + +CREATE SEQUENCE event_7_tick_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: event_8; Type: TABLE; Schema: pgq; Owner: -; Tablespace: +-- + +CREATE TABLE event_8 ( +) +INHERITS (event_template); + + +-- +-- Name: event_8_0; Type: TABLE; Schema: pgq; Owner: -; Tablespace: +-- + +CREATE TABLE event_8_0 ( +) +INHERITS (event_8) +WITH (fillfactor=100, autovacuum_enabled=off, toast.autovacuum_enabled=off); + + +-- +-- Name: event_8_1; Type: TABLE; Schema: pgq; Owner: -; Tablespace: +-- + +CREATE TABLE event_8_1 ( +) +INHERITS (event_8) +WITH (fillfactor=100, autovacuum_enabled=off, toast.autovacuum_enabled=off); + + +-- +-- Name: event_8_2; Type: TABLE; Schema: pgq; Owner: -; Tablespace: +-- + +CREATE TABLE event_8_2 ( +) +INHERITS (event_8) +WITH (fillfactor=100, autovacuum_enabled=off, toast.autovacuum_enabled=off); + + +-- +-- Name: event_8_id_seq; Type: SEQUENCE; Schema: pgq; Owner: - +-- + +CREATE SEQUENCE event_8_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: event_8_tick_seq; Type: SEQUENCE; Schema: pgq; Owner: - +-- + +CREATE SEQUENCE event_8_tick_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: event_9; Type: TABLE; Schema: pgq; Owner: -; Tablespace: +-- + +CREATE TABLE event_9 ( +) +INHERITS (event_template); + + +-- +-- Name: event_9_0; Type: TABLE; Schema: pgq; Owner: -; Tablespace: +-- + +CREATE TABLE event_9_0 ( +) +INHERITS (event_9) +WITH (fillfactor=100, autovacuum_enabled=off, toast.autovacuum_enabled=off); + + +-- +-- Name: event_9_1; Type: TABLE; Schema: pgq; Owner: -; Tablespace: +-- + +CREATE TABLE event_9_1 ( +) +INHERITS (event_9) +WITH (fillfactor=100, autovacuum_enabled=off, toast.autovacuum_enabled=off); + + +-- +-- Name: event_9_2; Type: TABLE; Schema: pgq; Owner: -; Tablespace: +-- + +CREATE TABLE event_9_2 ( +) +INHERITS (event_9) +WITH (fillfactor=100, autovacuum_enabled=off, toast.autovacuum_enabled=off); + + +-- +-- Name: event_9_id_seq; Type: SEQUENCE; Schema: pgq; Owner: - +-- + +CREATE SEQUENCE event_9_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: event_9_tick_seq; Type: SEQUENCE; Schema: pgq; Owner: - +-- + +CREATE SEQUENCE event_9_tick_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: queue; Type: TABLE; Schema: pgq; Owner: -; Tablespace: +-- + +CREATE TABLE queue ( + queue_id integer NOT NULL, + queue_name text NOT NULL, + queue_ntables integer DEFAULT 3 NOT NULL, + queue_cur_table integer DEFAULT 0 NOT NULL, + queue_rotation_period interval DEFAULT '02:00:00'::interval NOT NULL, + queue_switch_step1 bigint DEFAULT txid_current() NOT NULL, + queue_switch_step2 bigint DEFAULT txid_current(), + queue_switch_time timestamp with time zone DEFAULT now() NOT NULL, + queue_external_ticker boolean DEFAULT false NOT NULL, + queue_disable_insert boolean DEFAULT false NOT NULL, + queue_ticker_paused boolean DEFAULT false NOT NULL, + queue_ticker_max_count integer DEFAULT 500 NOT NULL, + queue_ticker_max_lag interval DEFAULT '00:00:03'::interval NOT NULL, + queue_ticker_idle_period interval DEFAULT '00:01:00'::interval NOT NULL, + queue_per_tx_limit integer, + queue_data_pfx text NOT NULL, + queue_event_seq text NOT NULL, + queue_tick_seq text NOT NULL +); + + +-- +-- Name: queue_queue_id_seq; Type: SEQUENCE; Schema: pgq; Owner: - +-- + +CREATE SEQUENCE queue_queue_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: queue_queue_id_seq; Type: SEQUENCE OWNED BY; Schema: pgq; Owner: - +-- + +ALTER SEQUENCE queue_queue_id_seq OWNED BY queue.queue_id; + + +-- +-- Name: retry_queue; Type: TABLE; Schema: pgq; Owner: -; Tablespace: +-- + +CREATE TABLE retry_queue ( + ev_retry_after timestamp with time zone NOT NULL, + ev_queue integer NOT NULL, + ev_id bigint NOT NULL, + ev_time timestamp with time zone NOT NULL, + ev_txid bigint, + ev_owner integer NOT NULL, + ev_retry integer, + ev_type text, + ev_data text, + ev_extra1 text, + ev_extra2 text, + ev_extra3 text, + ev_extra4 text +); + + +-- +-- Name: subscription; Type: TABLE; Schema: pgq; Owner: -; Tablespace: +-- + +CREATE TABLE subscription ( + sub_id integer NOT NULL, + sub_queue integer NOT NULL, + sub_consumer integer NOT NULL, + sub_last_tick bigint, + sub_active timestamp with time zone DEFAULT now() NOT NULL, + sub_batch bigint, + sub_next_tick bigint +); + + +-- +-- Name: subscription_sub_id_seq; Type: SEQUENCE; Schema: pgq; Owner: - +-- + +CREATE SEQUENCE subscription_sub_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: subscription_sub_id_seq; Type: SEQUENCE OWNED BY; Schema: pgq; Owner: - +-- + +ALTER SEQUENCE subscription_sub_id_seq OWNED BY subscription.sub_id; + + +-- +-- Name: tick; Type: TABLE; Schema: pgq; Owner: -; Tablespace: +-- + +CREATE TABLE tick ( + tick_queue integer NOT NULL, + tick_id bigint NOT NULL, + tick_time timestamp with time zone DEFAULT now() NOT NULL, + tick_snapshot txid_snapshot DEFAULT txid_current_snapshot() NOT NULL, + tick_event_seq bigint NOT NULL +); + + +SET search_path = pgq_ext, pg_catalog; + +-- +-- Name: completed_batch; Type: TABLE; Schema: pgq_ext; Owner: -; Tablespace: +-- + +CREATE TABLE completed_batch ( + consumer_id text NOT NULL, + subconsumer_id text DEFAULT ''::text NOT NULL, + last_batch_id bigint NOT NULL +); + + +-- +-- Name: completed_event; Type: TABLE; Schema: pgq_ext; Owner: -; Tablespace: +-- + +CREATE TABLE completed_event ( + consumer_id text NOT NULL, + subconsumer_id text DEFAULT ''::text NOT NULL, + batch_id bigint NOT NULL, + event_id bigint NOT NULL +); + + +-- +-- Name: completed_tick; Type: TABLE; Schema: pgq_ext; Owner: -; Tablespace: +-- + +CREATE TABLE completed_tick ( + consumer_id text NOT NULL, + subconsumer_id text DEFAULT ''::text NOT NULL, + last_tick_id bigint NOT NULL +); + + +-- +-- Name: partial_batch; Type: TABLE; Schema: pgq_ext; Owner: -; Tablespace: +-- + +CREATE TABLE partial_batch ( + consumer_id text NOT NULL, + subconsumer_id text DEFAULT ''::text NOT NULL, + cur_batch_id bigint NOT NULL +); + + +SET search_path = pgq_node, pg_catalog; + +-- +-- Name: local_state; Type: TABLE; Schema: pgq_node; Owner: -; Tablespace: +-- + +CREATE TABLE local_state ( + queue_name text NOT NULL, + consumer_name text NOT NULL, + provider_node text NOT NULL, + last_tick_id bigint NOT NULL, + cur_error text, + paused boolean DEFAULT false NOT NULL, + uptodate boolean DEFAULT false NOT NULL +); + + +-- +-- Name: node_info; Type: TABLE; Schema: pgq_node; Owner: -; Tablespace: +-- + +CREATE TABLE node_info ( + queue_name text NOT NULL, + node_type text NOT NULL, + node_name text NOT NULL, + worker_name text, + combined_queue text, + node_attrs text, + CONSTRAINT node_info_check CHECK (CASE WHEN (node_type = 'root'::text) THEN ((worker_name IS NOT NULL) AND (combined_queue IS NULL)) WHEN (node_type = 'branch'::text) THEN ((worker_name IS NOT NULL) AND (combined_queue IS NULL)) WHEN (node_type = 'leaf'::text) THEN (worker_name IS NOT NULL) ELSE false END), + CONSTRAINT node_info_node_type_check CHECK ((node_type = ANY (ARRAY['root'::text, 'branch'::text, 'leaf'::text]))) +); + + +-- +-- Name: node_location; Type: TABLE; Schema: pgq_node; Owner: -; Tablespace: +-- + +CREATE TABLE node_location ( + queue_name text NOT NULL, + node_name text NOT NULL, + node_location text NOT NULL, + dead boolean DEFAULT false NOT NULL +); + + +-- +-- Name: subscriber_info; Type: TABLE; Schema: pgq_node; Owner: -; Tablespace: +-- + +CREATE TABLE subscriber_info ( + queue_name text NOT NULL, + subscriber_node text NOT NULL, + worker_name text NOT NULL, + watermark_name text NOT NULL +); + + +SET search_path = public, pg_catalog; + +-- +-- Name: account_export_configs; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE account_export_configs ( + id integer NOT NULL, + name character varying(128) NOT NULL, + value character varying(128) NOT NULL +); + + +-- +-- Name: account_export_configs_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE account_export_configs_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: account_export_configs_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE account_export_configs_id_seq OWNED BY account_export_configs.id; + + +-- +-- Name: accounts; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE accounts ( + id integer NOT NULL, + company_id integer NOT NULL, + num character varying(16) DEFAULT get_next_account_num() NOT NULL, + amount numeric NOT NULL, + customer_name character varying(255), + main_region_id integer NOT NULL, + products_region_id integer NOT NULL, + packet integer NOT NULL, + product_limit integer NOT NULL, + cnt integer NOT NULL, + acc_type character varying(255) NOT NULL, + state character varying(255) DEFAULT 'normal'::character varying NOT NULL, + created_by integer NOT NULL, + updated_by integer NOT NULL, + created_at timestamp without time zone, + updated_at timestamp without time zone, + type character varying(255) NOT NULL, + business_entity character varying(255), + company_name character varying(255), + inn character varying(12), + kpp character varying(9), + city_id integer, + street_id integer, + estate character varying(10), + building character varying(40), + phone character varying(16), + email character varying(255), + key character varying(32) NOT NULL, + description character varying(255), + CONSTRAINT accounts_check_acc_type CHECK (((acc_type)::text = ANY (ARRAY[('manual'::character varying)::text, ('auto'::character varying)::text]))), + CONSTRAINT accounts_check_state CHECK (((state)::text = ANY (ARRAY[('normal'::character varying)::text, ('deleted'::character varying)::text, ('paid'::character varying)::text]))) +); + + +-- +-- Name: TABLE accounts; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE accounts IS 'Счета'; + + +-- +-- Name: accounts_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE accounts_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: accounts_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE accounts_id_seq OWNED BY accounts.id; + + +-- +-- Name: accounts_num_seq_2011; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE accounts_num_seq_2011 + START WITH 800 + INCREMENT BY 1 + NO MINVALUE + MAXVALUE 9999 + CACHE 1; + + +-- +-- Name: action_queue; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE action_queue ( + id integer NOT NULL, + initiator_id integer NOT NULL, + initiator_type character varying(255) NOT NULL, + action character varying(50) NOT NULL, + status character varying(20) NOT NULL, + action_changes text, + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: action_queue_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE action_queue_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: action_queue_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE action_queue_id_seq OWNED BY action_queue.id; + + +-- +-- Name: addresses; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE addresses ( + id integer NOT NULL, + company_id integer, + name character varying(256), + city_id integer, + street_id integer, + created_at timestamp without time zone, + updated_at timestamp without time zone, + estate character varying(10), + building character varying(40), + literal character varying(200), + comments character varying(256), + "position" integer NOT NULL, + oferta_sync_id integer, + rm_comment character varying(255), + rm_hide_yandex boolean, + map_address_id integer, + office character varying(20) +); + + +-- +-- Name: TABLE addresses; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE addresses IS 'Адреса (усадьбы) компаний'; + + +-- +-- Name: COLUMN addresses.name; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN addresses.name IS 'Название адреса'; + + +-- +-- Name: COLUMN addresses.estate; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN addresses.estate IS 'Номер дома'; + + +-- +-- Name: COLUMN addresses.building; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN addresses.building IS 'Номер корпуса'; + + +-- +-- Name: COLUMN addresses.literal; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN addresses.literal IS 'deprecated'; + + +-- +-- Name: COLUMN addresses.comments; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN addresses.comments IS 'Комментарии к адресу'; + + +-- +-- Name: COLUMN addresses."position"; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN addresses."position" IS 'Порядковый номер усадьбы внутри компании'; + + +-- +-- Name: COLUMN addresses.oferta_sync_id; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN addresses.oferta_sync_id IS 'ID усадьбы в Оферте (табл. ESTATE)'; + + +-- +-- Name: COLUMN addresses.rm_comment; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN addresses.rm_comment IS 'Комментарий к схеме проезда'; + + +-- +-- Name: COLUMN addresses.rm_hide_yandex; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN addresses.rm_hide_yandex IS 'Флаг скрытия яндекс-карты'; + + +-- +-- Name: COLUMN addresses.map_address_id; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN addresses.map_address_id IS 'Адрес на карте'; + + +-- +-- Name: COLUMN addresses.office; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN addresses.office IS 'Номер офиса'; + + +-- +-- Name: addresses_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE addresses_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: addresses_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE addresses_id_seq OWNED BY addresses.id; + + +-- +-- Name: admin_dk_news; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE admin_dk_news ( + id integer NOT NULL, + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: admin_dk_news_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE admin_dk_news_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: admin_dk_news_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE admin_dk_news_id_seq OWNED BY admin_dk_news.id; + + +-- +-- Name: amazon_s3_assets; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE amazon_s3_assets ( + id integer NOT NULL, + local_file_name character varying(255), + local_content_type character varying(255), + local_file_size integer, + local_updated_at timestamp without time zone, + remote_file_name character varying(255), + remote_content_type character varying(255), + remote_file_size integer, + remote_updated_at timestamp without time zone, + attachable_id integer, + attachable_type character varying(255) +); + + +-- +-- Name: amazon_s3_assets_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE amazon_s3_assets_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: amazon_s3_assets_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE amazon_s3_assets_id_seq OWNED BY amazon_s3_assets.id; + + +-- +-- Name: amazon_s3_public_assets; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE amazon_s3_public_assets ( + id integer NOT NULL, + local_file_name character varying(255), + local_content_type character varying(255), + local_file_size integer, + local_updated_at timestamp without time zone, + remote_file_name character varying(255), + remote_content_type character varying(255), + remote_file_size integer, + remote_updated_at timestamp without time zone, + attachable_id integer, + attachable_type character varying(255) +); + + +-- +-- Name: amazon_s3_public_assets_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE amazon_s3_public_assets_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: amazon_s3_public_assets_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE amazon_s3_public_assets_id_seq OWNED BY amazon_s3_public_assets.id; + + +-- +-- Name: answers; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE answers ( + id integer NOT NULL, + question character varying(255) NOT NULL, + answer text, + company_id integer NOT NULL, + updated_by integer, + "position" integer, + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: TABLE answers; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE answers IS 'FAQ компаний'; + + +-- +-- Name: answers_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE answers_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: answers_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE answers_id_seq OWNED BY answers.id; + + +-- +-- Name: arrangements; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE arrangements ( + id integer NOT NULL, + title character varying(255), + lead text, + content text, + start_date date, + end_date date, + user_id integer, + created_at timestamp without time zone, + updated_at timestamp without time zone, + company_id integer +); + + +-- +-- Name: TABLE arrangements; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE arrangements IS 'Акции компаний'; + + +-- +-- Name: COLUMN arrangements.title; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN arrangements.title IS 'Заголовок'; + + +-- +-- Name: COLUMN arrangements.lead; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN arrangements.lead IS 'Анонс'; + + +-- +-- Name: COLUMN arrangements.content; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN arrangements.content IS 'Текст-описание'; + + +-- +-- Name: COLUMN arrangements.start_date; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN arrangements.start_date IS 'Дата начала'; + + +-- +-- Name: COLUMN arrangements.end_date; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN arrangements.end_date IS 'Дата окончания'; + + +-- +-- Name: COLUMN arrangements.user_id; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN arrangements.user_id IS 'Идентификатор пользователя, который последний раз вносил изменения'; + + +-- +-- Name: arrangements_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE arrangements_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: arrangements_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE arrangements_id_seq OWNED BY arrangements.id; + + +-- +-- Name: articles; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE articles ( + id integer NOT NULL, + title character varying(255) NOT NULL, + lead text, + content text, + company_id integer NOT NULL, + updated_by integer, + created_at timestamp without time zone, + updated_at timestamp without time zone, + "position" integer +); + + +-- +-- Name: TABLE articles; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE articles IS 'Статьи компаний'; + + +-- +-- Name: articles_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE articles_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: articles_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE articles_id_seq OWNED BY articles.id; + + +-- +-- Name: avatars; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE avatars ( + id integer NOT NULL, + user_profile_id integer, + size integer, + content_type character varying(255), + filename character varying(255), + height integer, + width integer, + parent_id integer, + thumbnail character varying(255), + created_at timestamp without time zone, + updated_at timestamp without time zone, + img_file_name character varying(255), + img_content_type character varying(255), + img_file_size integer, + img_updated_at timestamp without time zone +); + + +-- +-- Name: TABLE avatars; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE avatars IS 'Таблица с учетными записями аватарок пользователей (оригинальные изображения + уменьшенные копии)'; + + +-- +-- Name: COLUMN avatars.size; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN avatars.size IS 'Размер файла'; + + +-- +-- Name: COLUMN avatars.content_type; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN avatars.content_type IS 'MIME-тип файла'; + + +-- +-- Name: COLUMN avatars.filename; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN avatars.filename IS 'Имя файла в файловой системе'; + + +-- +-- Name: COLUMN avatars.height; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN avatars.height IS 'Высота картинки'; + + +-- +-- Name: COLUMN avatars.width; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN avatars.width IS 'Ширина картинки'; + + +-- +-- Name: COLUMN avatars.parent_id; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN avatars.parent_id IS 'Ссылка на родительский аватар в том случае, если учетка для уменьшенной копии'; + + +-- +-- Name: COLUMN avatars.thumbnail; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN avatars.thumbnail IS 'Тип уменьшенной копии (большая, средняя, маленькая)'; + + +-- +-- Name: avatars_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE avatars_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: avatars_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE avatars_id_seq OWNED BY avatars.id; + + +-- +-- Name: award_candidates; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE award_candidates ( + id integer NOT NULL, + award_id integer, + user_id integer, + company_id integer, + award_rubric_id integer, + company_name character varying(255), + company_city character varying(255), + company_phone character varying(255), + company_site character varying(255), + company_contact_person character varying(255), + reject_reason text, + state integer DEFAULT 1 +); + + +-- +-- Name: award_candidates_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE award_candidates_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: award_candidates_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE award_candidates_id_seq OWNED BY award_candidates.id; + + +-- +-- Name: award_nominations; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE award_nominations ( + id integer NOT NULL, + award_id integer, + name character varying(255), + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: TABLE award_nominations; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE award_nominations IS 'Лауреаты конкурсов'; + + +-- +-- Name: award_nominations_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE award_nominations_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: award_nominations_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE award_nominations_id_seq OWNED BY award_nominations.id; + + +-- +-- Name: award_nominee_votes; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE award_nominee_votes ( + id integer NOT NULL, + award_id integer, + award_nominee_id integer, + user_id integer +); + + +-- +-- Name: award_nominee_votes_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE award_nominee_votes_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: award_nominee_votes_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE award_nominee_votes_id_seq OWNED BY award_nominee_votes.id; + + +-- +-- Name: award_nominees; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE award_nominees ( + id integer NOT NULL, + award_id integer, + company_id integer, + award_rubric_id integer, + votes_count integer +); + + +-- +-- Name: award_nominees_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE award_nominees_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: award_nominees_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE award_nominees_id_seq OWNED BY award_nominees.id; + + +-- +-- Name: award_rubrics; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE award_rubrics ( + id integer NOT NULL, + award_id integer, + name character varying(255), + maximum_finalists integer +); + + +-- +-- Name: award_rubrics_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE award_rubrics_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: award_rubrics_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE award_rubrics_id_seq OWNED BY award_rubrics.id; + + +-- +-- Name: award_winner_nomination_votes; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE award_winner_nomination_votes ( + id integer NOT NULL, + award_nomination_id integer, + award_winner_id integer, + user_id integer, + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: TABLE award_winner_nomination_votes; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE award_winner_nomination_votes IS 'Список пользователей, проголосовавших во втором этапе'; + + +-- +-- Name: award_winner_nomination_votes_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE award_winner_nomination_votes_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: award_winner_nomination_votes_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE award_winner_nomination_votes_id_seq OWNED BY award_winner_nomination_votes.id; + + +-- +-- Name: award_winners; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE award_winners ( + id integer NOT NULL, + company_id integer NOT NULL, + award_id integer, + votes_count integer +); + + +-- +-- Name: TABLE award_winners; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE award_winners IS 'Лауреаты конкурсов'; + + +-- +-- Name: award_winners_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE award_winners_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: award_winners_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE award_winners_id_seq OWNED BY award_winners.id; + + +-- +-- Name: awards; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE awards ( + id integer NOT NULL, + name character varying(255), + slug character varying(255) NOT NULL, + stage integer DEFAULT 0, + moderator_id integer, + possible_regions character varying(255), + finish_date date +); + + +-- +-- Name: COLUMN awards.finish_date; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN awards.finish_date IS 'Дата завершения этапа'; + + +-- +-- Name: awards_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE awards_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: awards_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE awards_id_seq OWNED BY awards.id; + + +-- +-- Name: banner_zones; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE banner_zones ( + id integer NOT NULL, + rubric_id integer NOT NULL, + rubric_type character varying(255) NOT NULL, + place character varying(255) NOT NULL +); + + +-- +-- Name: TABLE banner_zones; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE banner_zones IS 'Зоны баннеров'; + + +-- +-- Name: COLUMN banner_zones.rubric_id; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN banner_zones.rubric_id IS 'Рубрика, к которой привязана зона'; + + +-- +-- Name: COLUMN banner_zones.rubric_type; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN banner_zones.rubric_type IS 'Тип рубрики'; + + +-- +-- Name: COLUMN banner_zones.place; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN banner_zones.place IS 'Место в шаблоне, где баннер находится'; + + +-- +-- Name: base_words; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE base_words ( + id integer NOT NULL, + name character varying(255) NOT NULL, + is_deleted boolean DEFAULT false, + created_at timestamp without time zone, + updated_at timestamp without time zone, + name_terms character varying[] +); + + +-- +-- Name: base_words_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE base_words_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: base_words_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE base_words_id_seq OWNED BY base_words.id; + + +-- +-- Name: bdrb_job_queues; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE bdrb_job_queues ( + id integer NOT NULL, + args text, + worker_name character varying(255), + worker_method character varying(255), + job_key character varying(255), + taken integer, + finished integer, + timeout integer, + priority integer, + submitted_at timestamp without time zone, + started_at timestamp without time zone, + finished_at timestamp without time zone, + archived_at timestamp without time zone, + tag character varying(255), + submitter_info character varying(255), + runner_info character varying(255), + worker_key character varying(255), + scheduled_at timestamp without time zone +); + + +-- +-- Name: bdrb_job_queues_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE bdrb_job_queues_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: bdrb_job_queues_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE bdrb_job_queues_id_seq OWNED BY bdrb_job_queues.id; + + +-- +-- Name: blacklists; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE blacklists ( + id integer NOT NULL, + user_id integer NOT NULL, + interlocutor_id integer NOT NULL, + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: TABLE blacklists; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE blacklists IS 'deprecated'; + + +-- +-- Name: blacklists_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE blacklists_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: blacklists_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE blacklists_id_seq OWNED BY blacklists.id; + + +-- +-- Name: blog_comments; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE blog_comments ( + id integer NOT NULL, + guest_user_name character varying(255), + user_id integer, + blog_post_id integer, + state character varying(255) DEFAULT 'active'::character varying, + content text, + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: blog_comments_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE blog_comments_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: blog_comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE blog_comments_id_seq OWNED BY blog_comments.id; + + +-- +-- Name: blog_ping_services; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE blog_ping_services ( + id integer NOT NULL, + url character varying(255) NOT NULL, + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: blog_ping_services_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE blog_ping_services_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: blog_ping_services_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE blog_ping_services_id_seq OWNED BY blog_ping_services.id; + + +-- +-- Name: blog_post_contents; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE blog_post_contents ( + id integer NOT NULL, + blog_post_id integer, + "position" integer, + content text, + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: blog_post_contents_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE blog_post_contents_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: blog_post_contents_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE blog_post_contents_id_seq OWNED BY blog_post_contents.id; + + +-- +-- Name: blog_post_images; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE blog_post_images ( + id integer NOT NULL, + blog_post_content_id integer, + "position" integer, + img_file_name character varying(255), + img_content_type character varying(255), + img_file_size integer, + comment character varying(255), + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: blog_post_images_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE blog_post_images_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: blog_post_images_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE blog_post_images_id_seq OWNED BY blog_post_images.id; + + +-- +-- Name: blog_post_regions; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE blog_post_regions ( + id integer NOT NULL, + blog_post_id integer NOT NULL, + region_id integer NOT NULL +); + + +-- +-- Name: blog_post_regions_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE blog_post_regions_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: blog_post_regions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE blog_post_regions_id_seq OWNED BY blog_post_regions.id; + + +-- +-- Name: blog_posts; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE blog_posts ( + id integer NOT NULL, + title character varying(255) NOT NULL, + slug character varying(255) NOT NULL, + body text, + state character varying(255) DEFAULT 'new'::character varying NOT NULL, + published_at timestamp without time zone, + deleted_at timestamp without time zone, + moderated_at timestamp without time zone, + user_id integer NOT NULL, + moderated_by integer, + main_region_id integer NOT NULL, + blog_rubric_id integer NOT NULL, + img_file_name character varying(255), + img_content_type character varying(255), + img_file_size integer, + created_at timestamp without time zone, + updated_at timestamp without time zone, + delta boolean DEFAULT true NOT NULL, + moderator_message text, + comment_count integer DEFAULT 0, + flags integer DEFAULT 0 NOT NULL, + views_count integer DEFAULT 0 NOT NULL, + for_block_on_root boolean DEFAULT false, + lead text +); + + +-- +-- Name: COLUMN blog_posts.moderator_message; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN blog_posts.moderator_message IS 'Причина отклонения'; + + +-- +-- Name: COLUMN blog_posts.flags; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN blog_posts.flags IS 'Флаги поста, значения битов: 1 - "Шоппинг года"'; + + +-- +-- Name: COLUMN blog_posts.views_count; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN blog_posts.views_count IS 'Количество просмотров поста'; + + +-- +-- Name: COLUMN blog_posts.for_block_on_root; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN blog_posts.for_block_on_root IS 'true - выводить пост на главную, false - нет'; + + +-- +-- Name: blog_posts_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE blog_posts_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: blog_posts_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE blog_posts_id_seq OWNED BY blog_posts.id; + + +-- +-- Name: blog_rubric_mappings; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE blog_rubric_mappings ( + id integer NOT NULL, + rubric_id integer NOT NULL, + blog_rubric_id integer NOT NULL, + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: blog_rubric_mappings_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE blog_rubric_mappings_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: blog_rubric_mappings_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE blog_rubric_mappings_id_seq OWNED BY blog_rubric_mappings.id; + + +-- +-- Name: blog_rubric_statistics; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE blog_rubric_statistics ( + id integer NOT NULL, + region_id integer NOT NULL, + blog_rubric_id integer NOT NULL, + count_posts integer DEFAULT 0 NOT NULL, + count_new_posts integer DEFAULT 0 NOT NULL, + count_accept_posts integer DEFAULT 0 NOT NULL, + count_decline_posts integer DEFAULT 0 NOT NULL, + count_deleted_posts integer DEFAULT 0 NOT NULL, + count_published_posts integer DEFAULT 0 NOT NULL, + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: TABLE blog_rubric_statistics; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE blog_rubric_statistics IS 'Статистика по рубрикам блога.'; + + +-- +-- Name: COLUMN blog_rubric_statistics.region_id; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN blog_rubric_statistics.region_id IS 'Регион, к которому принадлежит данная статистика.'; + + +-- +-- Name: COLUMN blog_rubric_statistics.blog_rubric_id; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN blog_rubric_statistics.blog_rubric_id IS 'Рубрика блога, к которой принадлежит данная статистика.'; + + +-- +-- Name: COLUMN blog_rubric_statistics.count_posts; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN blog_rubric_statistics.count_posts IS 'Количество постов.'; + + +-- +-- Name: COLUMN blog_rubric_statistics.count_new_posts; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN blog_rubric_statistics.count_new_posts IS 'Количество постов со статусом new.'; + + +-- +-- Name: COLUMN blog_rubric_statistics.count_accept_posts; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN blog_rubric_statistics.count_accept_posts IS 'Количество постов со статусом accept.'; + + +-- +-- Name: COLUMN blog_rubric_statistics.count_decline_posts; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN blog_rubric_statistics.count_decline_posts IS 'Количество постов со статусом decline.'; + + +-- +-- Name: COLUMN blog_rubric_statistics.count_deleted_posts; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN blog_rubric_statistics.count_deleted_posts IS 'Количество постов со статусом deleted.'; + + +-- +-- Name: COLUMN blog_rubric_statistics.count_published_posts; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN blog_rubric_statistics.count_published_posts IS 'Количество обуликованных постов (посты, которые видны не только админам и авторам блогов).'; + + +-- +-- Name: blog_rubric_statistics_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE blog_rubric_statistics_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: blog_rubric_statistics_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE blog_rubric_statistics_id_seq OWNED BY blog_rubric_statistics.id; + + +-- +-- Name: blog_rubrics; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE blog_rubrics ( + id integer NOT NULL, + title character varying(255) NOT NULL, + slug character varying(255), + created_at timestamp without time zone, + updated_at timestamp without time zone, + "position" integer DEFAULT 0 NOT NULL +); + + +-- +-- Name: blog_rubrics_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE blog_rubrics_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: blog_rubrics_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE blog_rubrics_id_seq OWNED BY blog_rubrics.id; + + +-- +-- Name: blog_settings; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE blog_settings ( + id integer NOT NULL, + user_id integer NOT NULL, + nickname character varying(255), + region_id integer NOT NULL, + created_at timestamp without time zone, + updated_at timestamp without time zone, + privacy boolean DEFAULT false NOT NULL +); + + +-- +-- Name: COLUMN blog_settings.privacy; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN blog_settings.privacy IS 'Показывать посты только на странице автора'; + + +-- +-- Name: blog_settings_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE blog_settings_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: blog_settings_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE blog_settings_id_seq OWNED BY blog_settings.id; + + +-- +-- Name: blog_user_statistics; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE blog_user_statistics ( + id integer NOT NULL, + region_id integer, + user_id integer, + count_accepted_posts integer DEFAULT 0, + created_at timestamp without time zone, + updated_at timestamp without time zone, + first_letter character varying(1) +); + + +-- +-- Name: business_types; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE business_types ( + id integer NOT NULL, + name character varying(255), + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: TABLE business_types; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE business_types IS 'Справочник типов деятельности предприятий'; + + +-- +-- Name: COLUMN business_types.name; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN business_types.name IS 'Название типа деятельности'; + + +-- +-- Name: business_types_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE business_types_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: business_types_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE business_types_id_seq OWNED BY business_types.id; + + +-- +-- Name: catalogue_logs; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE catalogue_logs ( + id integer NOT NULL, + rubric_id integer, + a integer DEFAULT 0, + b integer DEFAULT 0, + d integer DEFAULT 0, + e integer DEFAULT 0, + f integer DEFAULT 0, + g integer DEFAULT 0, + h integer DEFAULT 0, + region_id integer, + c integer DEFAULT 0 +); + + +-- +-- Name: catalogue_logs_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE catalogue_logs_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: catalogue_logs_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE catalogue_logs_id_seq OWNED BY catalogue_logs.id; + + +-- +-- Name: categories; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE categories ( + id integer NOT NULL, + title character varying(255), + slug character varying(255) +); + + +-- +-- Name: categories_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE categories_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: categories_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE categories_id_seq OWNED BY categories.id; + + +-- +-- Name: category_rubrics; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE category_rubrics ( + id integer NOT NULL, + category_id integer, + rubric_id integer +); + + +-- +-- Name: category_rubrics_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE category_rubrics_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: category_rubrics_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE category_rubrics_id_seq OWNED BY category_rubrics.id; + + +-- +-- Name: cities; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE cities ( + id integer NOT NULL, + name character varying(200) NOT NULL, + type_id integer NOT NULL, + province_head boolean DEFAULT false NOT NULL, + province_id integer NOT NULL, + created_at timestamp without time zone, + updated_at timestamp without time zone, + phone_code character varying(255), + region_id integer +); + + +-- +-- Name: TABLE cities; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE cities IS 'Справочник городов'; + + +-- +-- Name: COLUMN cities.name; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN cities.name IS 'Название города'; + + +-- +-- Name: COLUMN cities.province_head; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN cities.province_head IS 'Является ли административным центром области'; + + +-- +-- Name: COLUMN cities.phone_code; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN cities.phone_code IS 'Телефонный код города'; + + +-- +-- Name: cities_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE cities_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: cities_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE cities_id_seq OWNED BY cities.id; + + +-- +-- Name: city_types; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE city_types ( + id integer NOT NULL, + name character varying(255), + created_at timestamp without time zone, + updated_at timestamp without time zone, + short_name character varying(255) +); + + +-- +-- Name: TABLE city_types; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE city_types IS 'Справочник типов городов'; + + +-- +-- Name: COLUMN city_types.name; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN city_types.name IS 'Полное название типа'; + + +-- +-- Name: COLUMN city_types.short_name; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN city_types.short_name IS 'Сокращенное название типа, используется при формировании строки адреса'; + + +-- +-- Name: city_types_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE city_types_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: city_types_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE city_types_id_seq OWNED BY city_types.id; + + +-- +-- Name: ckeditor_assets; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE ckeditor_assets ( + id integer NOT NULL, + data_file_name character varying(255) NOT NULL, + data_content_type character varying(255), + data_file_size integer, + assetable_id integer, + assetable_type character varying(30), + type character varying(25), + guid character varying(10), + locale smallint DEFAULT 0, + user_id integer, + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: ckeditor_assets_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE ckeditor_assets_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: ckeditor_assets_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE ckeditor_assets_id_seq OWNED BY ckeditor_assets.id; + + +-- +-- Name: cms_company_regions; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE cms_company_regions ( + id integer NOT NULL, + company_id integer, + region_id integer +); + + +-- +-- Name: TABLE cms_company_regions; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE cms_company_regions IS 'Список компаний для CMS'; + + +-- +-- Name: cms_company_regions_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE cms_company_regions_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: cms_company_regions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE cms_company_regions_id_seq OWNED BY cms_company_regions.id; + + +-- +-- Name: cms_page_industries_backup; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE cms_page_industries_backup ( + id integer NOT NULL, + cms_page_id integer, + industry_id integer, + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: TABLE cms_page_industries_backup; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE cms_page_industries_backup IS 'Привязки статических страниц к рубрикам отраслевого рубрикатора'; + + +-- +-- Name: cms_page_industries_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE cms_page_industries_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: cms_page_industries_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE cms_page_industries_id_seq OWNED BY cms_page_industries_backup.id; + + +-- +-- Name: cms_page_rubrics; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE cms_page_rubrics ( + id integer NOT NULL, + cms_page_id integer, + rubric_id integer, + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: TABLE cms_page_rubrics; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE cms_page_rubrics IS 'Привязки статических страниц к рубрика товарного рубрикатора'; + + +-- +-- Name: cms_page_rubrics_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE cms_page_rubrics_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: cms_page_rubrics_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE cms_page_rubrics_id_seq OWNED BY cms_page_rubrics.id; + + +-- +-- Name: cms_pages; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE cms_pages ( + id integer NOT NULL, + parent_id integer, + name character varying(128) NOT NULL, + title character varying(256), + content text, + created_at timestamp without time zone, + updated_at timestamp without time zone, + cached_path character varying(255), + sib_oid integer, + menu_published boolean, + region_dependent boolean, + meta_description text, + is_section boolean +); + + +-- +-- Name: TABLE cms_pages; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE cms_pages IS 'Статические страницы сайта'; + + +-- +-- Name: COLUMN cms_pages.name; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN cms_pages.name IS 'Часть URI на сайте'; + + +-- +-- Name: COLUMN cms_pages.title; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN cms_pages.title IS 'Название страницы'; + + +-- +-- Name: COLUMN cms_pages.content; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN cms_pages.content IS 'Содержание страницы'; + + +-- +-- Name: COLUMN cms_pages.cached_path; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN cms_pages.cached_path IS 'Полный URI страницы'; + + +-- +-- Name: COLUMN cms_pages.sib_oid; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN cms_pages.sib_oid IS 'Порядок страницы внутри братьев и сестер'; + + +-- +-- Name: COLUMN cms_pages.region_dependent; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN cms_pages.region_dependent IS 'Флаг зависимости страницы от региона'; + + +-- +-- Name: COLUMN cms_pages.meta_description; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN cms_pages.meta_description IS 'Содержание мета-тэга description'; + + +-- +-- Name: cms_pages_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE cms_pages_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: cms_pages_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE cms_pages_id_seq OWNED BY cms_pages.id; + + +-- +-- Name: comment_wiki_pages; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE comment_wiki_pages ( + id integer NOT NULL, + comment_id integer, + wiki_page_id integer, + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: comment_wiki_pages_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE comment_wiki_pages_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: comment_wiki_pages_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE comment_wiki_pages_id_seq OWNED BY comment_wiki_pages.id; + + +-- +-- Name: comments; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE comments ( + id integer NOT NULL, + author character varying(255), + text text NOT NULL, + commentable_id integer NOT NULL, + commentable_type character varying(255) NOT NULL, + status character varying(255) NOT NULL, + ip bigint NOT NULL, + user_agent text NOT NULL, + created_at timestamp without time zone, + updated_at timestamp without time zone, + user_id integer +); + + +-- +-- Name: comments_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE comments_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE comments_id_seq OWNED BY comments.id; + + +-- +-- Name: companies; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE companies ( + id integer NOT NULL, + name character varying(200) NOT NULL, + name_rest character varying(160), + synonym character varying(255), + description text, + created_at timestamp without time zone NOT NULL, + updated_at timestamp without time zone, + rubrics_denorm text, + regions character varying(255), + title_ord double precision, + first_letter_ord integer, + packet integer DEFAULT 0 NOT NULL, + state character varying(255) DEFAULT 'pending'::character varying NOT NULL, + name_alt character varying(255), + original_pricelist_file_name character varying(255), + original_pricelist_content_type character varying(255), + original_pricelist_file_size integer, + original_pricelist_updated_at timestamp without time zone, + oferta_sync_id integer, + oferta_online_flag boolean, + oferta_sync_dt timestamp without time zone, + moderated_at timestamp without time zone, + moderator_message text, + moderated_by integer, + updated_by integer, + updated_issues character varying(255), + annonce character varying(255), + has_email boolean, + pricelist_actualized_at timestamp without time zone, + oferta_modified_at timestamp without time zone, + csv_id integer, + tmp boolean DEFAULT false, + is_paid boolean DEFAULT false, + paid_till timestamp without time zone, + is_pricelist_online boolean DEFAULT true, + is_pricelist_printable boolean DEFAULT false, + products_count integer DEFAULT 0 NOT NULL, + products_limit integer, + products_region_id integer, + regions_with_comm character varying(1000), + b_types_denorm character varying(255), + is_price_notification_visible boolean, + main_region_id integer, + is_online_store boolean DEFAULT false, + news_count integer DEFAULT 0 NOT NULL, + images_count integer DEFAULT 0 NOT NULL, + showcases_count integer DEFAULT 0 NOT NULL, + industries_denorm text, + thematic_rubrics_denorm text, + main_company_id integer, + videos_count integer DEFAULT 0 NOT NULL, + is_pricelist_discable boolean DEFAULT false, + online_store_type character varying(255), + company_events_count integer DEFAULT 0 NOT NULL, + no_public_products_count integer DEFAULT 0 NOT NULL, + has_regional_product_properties boolean DEFAULT false NOT NULL, + deleted_at timestamp without time zone, + pricelist_mass_actualized_at timestamp without time zone, + deleted_by integer, + short_name character varying(75), + paid_placement_expired_at date, + CONSTRAINT check_companies_online_store_type CHECK (((online_store_type)::text = ANY (ARRAY[('client'::character varying)::text, ('redaction'::character varying)::text, ('online'::character varying)::text]))) +); + + +-- +-- Name: TABLE companies; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE companies IS 'Компании'; + + +-- +-- Name: COLUMN companies.name; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN companies.name IS 'Название предприятия'; + + +-- +-- Name: COLUMN companies.name_rest; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN companies.name_rest IS 'ОПФ предприятия'; + + +-- +-- Name: COLUMN companies.synonym; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN companies.synonym IS 'Альтернативное название предприятия'; + + +-- +-- Name: COLUMN companies.description; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN companies.description IS 'Страница "О компании"'; + + +-- +-- Name: COLUMN companies.rubrics_denorm; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN companies.rubrics_denorm IS 'IDы рубрик, к которым привязано предприятие, через запятую'; + + +-- +-- Name: COLUMN companies.regions; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN companies.regions IS 'IDы регионов, в которых существует предприятие, через запятую'; + + +-- +-- Name: COLUMN companies.title_ord; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN companies.title_ord IS 'Название предприятия, выраженное числом, используется для сортировки Сфинксом'; + + +-- +-- Name: COLUMN companies.first_letter_ord; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN companies.first_letter_ord IS 'Первая буква названия, выраженная числом, используется для сортировки Сфинксом'; + + +-- +-- Name: COLUMN companies.packet; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN companies.packet IS 'Пакет компании (ссылка на packets.id)'; + + +-- +-- Name: COLUMN companies.state; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN companies.state IS 'Статус предприятия (pending-новое, accepted-одобренное, rejected-отклоненное, changed-измененное, deleted-удаленное)'; + + +-- +-- Name: COLUMN companies.name_alt; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN companies.name_alt IS 'deprecated'; + + +-- +-- Name: COLUMN companies.original_pricelist_file_name; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN companies.original_pricelist_file_name IS 'Имя файла ориг.прайса'; + + +-- +-- Name: COLUMN companies.original_pricelist_content_type; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN companies.original_pricelist_content_type IS 'MIME-тип файла ориг.прайса'; + + +-- +-- Name: COLUMN companies.original_pricelist_file_size; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN companies.original_pricelist_file_size IS 'Размер файла ориг.прайса'; + + +-- +-- Name: COLUMN companies.original_pricelist_updated_at; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN companies.original_pricelist_updated_at IS 'Дата обновления ориг.прайса'; + + +-- +-- Name: COLUMN companies.oferta_sync_id; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN companies.oferta_sync_id IS 'ID предприятия в Оферте (табл. FIRM)'; + + +-- +-- Name: COLUMN companies.oferta_online_flag; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN companies.oferta_online_flag IS 'Редактируется ли предприятие на сайте (такие не обновляются из Оферты)'; + + +-- +-- Name: COLUMN companies.oferta_sync_dt; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN companies.oferta_sync_dt IS 'Дата последнего обновления предприятия из Оферты'; + + +-- +-- Name: COLUMN companies.moderated_at; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN companies.moderated_at IS 'Дата последней модерации'; + + +-- +-- Name: COLUMN companies.moderator_message; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN companies.moderator_message IS 'Сообщение модератора владельцу предприятия'; + + +-- +-- Name: COLUMN companies.moderated_by; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN companies.moderated_by IS 'Кем отмодерировано'; + + +-- +-- Name: COLUMN companies.updated_by; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN companies.updated_by IS 'Кем отредактировано последний раз'; + + +-- +-- Name: COLUMN companies.updated_issues; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN companies.updated_issues IS 'Какие разделы карточки предприятия были отредактированы последний раз на сайте'; + + +-- +-- Name: COLUMN companies.annonce; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN companies.annonce IS 'Кратко о предприятии (обрезается поле description)'; + + +-- +-- Name: COLUMN companies.has_email; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN companies.has_email IS 'Есть ли у предприятия хоть один электронный адрес'; + + +-- +-- Name: COLUMN companies.pricelist_actualized_at; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN companies.pricelist_actualized_at IS 'Дата актуализации прайс-листа предприятия'; + + +-- +-- Name: COLUMN companies.oferta_modified_at; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN companies.oferta_modified_at IS 'Дата изменения предприятия в Оферте. Это её системное время, обновляется только при импорте, используется только при экспорте'; + + +-- +-- Name: COLUMN companies.is_pricelist_online; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN companies.is_pricelist_online IS 'Флаг - прайс-лист редактируется на сайте'; + + +-- +-- Name: COLUMN companies.is_pricelist_printable; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN companies.is_pricelist_printable IS 'Флаг - прайс-лист выходит в печать (отправляется в Оферту)'; + + +-- +-- Name: COLUMN companies.products_count; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN companies.products_count IS 'Количество публичных товаров у компании'; + + +-- +-- Name: COLUMN companies.products_limit; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN companies.products_limit IS 'Лимит на количество товаров, публикуемых на портале (цифровой лимит из Оферты)'; + + +-- +-- Name: COLUMN companies.products_region_id; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN companies.products_region_id IS 'Основной регион для публикации товаров'; + + +-- +-- Name: COLUMN companies.regions_with_comm; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN companies.regions_with_comm IS 'Регионы офисов + коммерческие регионы'; + + +-- +-- Name: COLUMN companies.b_types_denorm; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN companies.b_types_denorm IS 'Виды деятельности компании (денормализация)'; + + +-- +-- Name: COLUMN companies.is_price_notification_visible; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN companies.is_price_notification_visible IS 'Показывать уведомление о смене типа прайс-листа(оферта/онлайн)'; + + +-- +-- Name: COLUMN companies.main_region_id; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN companies.main_region_id IS 'Регион главного офиса'; + + +-- +-- Name: COLUMN companies.news_count; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN companies.news_count IS 'Количество новостей у компании'; + + +-- +-- Name: COLUMN companies.images_count; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN companies.images_count IS 'Количество фотографий у компании'; + + +-- +-- Name: COLUMN companies.showcases_count; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN companies.showcases_count IS 'Количество спецпредложений у компании'; + + +-- +-- Name: COLUMN companies.industries_denorm; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN companies.industries_denorm IS 'Денормализация для связок с отраслевыми рубриками'; + + +-- +-- Name: COLUMN companies.thematic_rubrics_denorm; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN companies.thematic_rubrics_denorm IS 'Денормализация для связок с тематическими рубриками'; + + +-- +-- Name: COLUMN companies.main_company_id; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN companies.main_company_id IS 'Ссылка на главную компанию'; + + +-- +-- Name: COLUMN companies.videos_count; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN companies.videos_count IS 'Количество видеороликов у компании'; + + +-- +-- Name: COLUMN companies.online_store_type; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN companies.online_store_type IS 'Тип интернет-магазина (денормализованное поле)'; + + +-- +-- Name: COLUMN companies.company_events_count; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN companies.company_events_count IS 'Количество мероприятий у компании'; + + +-- +-- Name: companies_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE companies_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: companies_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE companies_id_seq OWNED BY companies.id; + + +-- +-- Name: products_335_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE products_335_id_seq + START WITH 5552364 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: products; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE products ( + id integer DEFAULT nextval('products_335_id_seq'::regclass) NOT NULL, + name character varying(255), + announce character varying(255), + description text, + company_id integer, + created_at timestamp without time zone, + rubric_id integer, + is_public boolean DEFAULT false, + regions character varying(4000), + moderator_comment text, + "position" integer, + updated_by integer, + moderated_at timestamp without time zone, + moderated_by integer, + state product_state DEFAULT 'pending'::product_state NOT NULL, + oferta_sync_id integer, + url_name character varying(255), + rubric_l4_priority boolean DEFAULT false, + rubric_l5_priority boolean DEFAULT false, + delta boolean DEFAULT false, + paid_conditions character varying(255), + delivery_time character varying(255), + rand_sort integer, + mainpage_position integer, + product_group_id integer, + article character varying(50), + order_url character varying(1000), + yml_id character varying(32), + yml_image_url_crc bigint, + deleted_at timestamp without time zone, + measure_unit_id integer, + page_title character varying(255), + total_order_clicks integer DEFAULT 0, + min_qty integer, + qty_measure_unit_id integer, + archived_at timestamp without time zone, + announce_valid boolean DEFAULT true NOT NULL +); + + +-- +-- Name: COLUMN products.min_qty; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN products.min_qty IS 'минимальный размер заказа'; + + +-- +-- Name: COLUMN products.qty_measure_unit_id; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN products.qty_measure_unit_id IS 'ids единиц измерения мин. партии'; + + +-- +-- Name: rubrics_denormalization_tree; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE rubrics_denormalization_tree ( + rubric_id integer NOT NULL, + rubric_l4_id integer NOT NULL, + rubric_l3_id integer NOT NULL, + rubric_l2_id integer NOT NULL, + rubric_l1_id integer NOT NULL, + rubric_lft integer NOT NULL, + rubric_l4_lft integer, + rubric_l3_lft integer +); + + +-- +-- Name: companies_main_rubrics; Type: VIEW; Schema: public; Owner: - +-- + +CREATE VIEW companies_main_rubrics AS + SELECT t.company_id, t.rubric_id, t.top FROM (WITH subq AS (SELECT t.company_id, rdt.rubric_l2_id AS rubric_id, sum(t.cnt) AS cnt FROM ((SELECT p.company_id, p.rubric_id, count(p.id) AS cnt FROM (companies c JOIN products p ON (((p.company_id = c.id) AND (p.is_public = true)))) GROUP BY p.company_id, p.rubric_id) t JOIN rubrics_denormalization_tree rdt ON ((rdt.rubric_id = t.rubric_id))) GROUP BY t.company_id, rdt.rubric_l2_id) SELECT subq.company_id, subq.rubric_id, row_number() OVER (PARTITION BY subq.company_id ORDER BY subq.cnt DESC) AS top FROM subq) t WHERE (t.top = 1); + + +-- +-- Name: companies_sync; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE companies_sync ( + new_company_id integer NOT NULL, + old_company_id integer, + region_id integer +); + + +-- +-- Name: company_abouts; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE company_abouts ( + id integer NOT NULL, + company_id integer, + announce character varying(255), + content text, + updated_by integer, + moderated_by integer, + moderated_at timestamp without time zone, + state company_about_state DEFAULT 'pending'::company_about_state, + created_at timestamp without time zone, + updated_at timestamp without time zone, + moderator_comment text, + company_founded integer, + employees integer, + authorized_capital integer, + brends character varying(255), + delivery_terms character varying(255), + volume_sales character varying(40), + coupon_text text, + print_count integer DEFAULT 0 +); + + +-- +-- Name: company_abouts_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE company_abouts_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: company_abouts_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE company_abouts_id_seq OWNED BY company_abouts.id; + + +-- +-- Name: company_arrangements_sort_methods; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE company_arrangements_sort_methods ( + id integer NOT NULL, + company_id integer, + sort_method integer +); + + +-- +-- Name: TABLE company_arrangements_sort_methods; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE company_arrangements_sort_methods IS 'Метод сортировки акций компаний'; + + +-- +-- Name: COLUMN company_arrangements_sort_methods.company_id; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN company_arrangements_sort_methods.company_id IS 'Идентификатор компании'; + + +-- +-- Name: COLUMN company_arrangements_sort_methods.sort_method; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN company_arrangements_sort_methods.sort_method IS 'Метод сортировки см. Arrangements.rb'; + + +-- +-- Name: company_arrangements_sort_methods_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE company_arrangements_sort_methods_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: company_arrangements_sort_methods_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE company_arrangements_sort_methods_id_seq OWNED BY company_arrangements_sort_methods.id; + + +-- +-- Name: company_background_images; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE company_background_images ( + id integer NOT NULL, + company_id integer NOT NULL, + local_file_name character varying(255), + local_content_type character varying(255), + local_file_size integer, + local_updated_at timestamp without time zone, + remote_file_name character varying(255), + remote_content_type character varying(255), + remote_file_size integer, + remote_updated_at timestamp without time zone, + local_meta text, + remote_meta text +); + + +-- +-- Name: company_background_images_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE company_background_images_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: company_background_images_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE company_background_images_id_seq OWNED BY company_background_images.id; + + +-- +-- Name: company_billings; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE company_billings ( + id integer NOT NULL, + company_id integer NOT NULL, + created_at timestamp without time zone, + updated_at timestamp without time zone, + ind_packet integer DEFAULT 0 NOT NULL, + ind_packet_paid_from timestamp without time zone, + ind_packet_paid_to timestamp without time zone, + advert_string character varying(500), + advert_url character varying(255), + advert_logo_file_name character varying(255), + advert_logo_content_type character varying(255), + advert_logo_file_size integer, + advert_logo_updated_at timestamp without time zone +); + + +-- +-- Name: TABLE company_billings; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE company_billings IS 'Платные свойства компаний'; + + +-- +-- Name: COLUMN company_billings.ind_packet; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN company_billings.ind_packet IS 'Пакет в каталоге компаний'; + + +-- +-- Name: COLUMN company_billings.ind_packet_paid_from; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN company_billings.ind_packet_paid_from IS 'Дата начала платного периода'; + + +-- +-- Name: COLUMN company_billings.ind_packet_paid_to; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN company_billings.ind_packet_paid_to IS 'Дата окончания платного периода'; + + +-- +-- Name: COLUMN company_billings.advert_string; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN company_billings.advert_string IS 'Рекламная строка компании'; + + +-- +-- Name: COLUMN company_billings.advert_url; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN company_billings.advert_url IS 'Рекламная ссылка компании'; + + +-- +-- Name: COLUMN company_billings.advert_logo_file_name; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN company_billings.advert_logo_file_name IS 'Платный логотип компании'; + + +-- +-- Name: company_billings_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE company_billings_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: company_billings_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE company_billings_id_seq OWNED BY company_billings.id; + + +-- +-- Name: company_business_types; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE company_business_types ( + id integer NOT NULL, + company_id integer, + business_type_id integer, + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: TABLE company_business_types; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE company_business_types IS 'Привязки компаний к типам деятельности'; + + +-- +-- Name: company_business_types_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE company_business_types_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: company_business_types_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE company_business_types_id_seq OWNED BY company_business_types.id; + + +-- +-- Name: company_categories; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE company_categories ( + id integer NOT NULL, + company_id integer, + category_id integer +); + + +-- +-- Name: company_categories_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE company_categories_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: company_categories_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE company_categories_id_seq OWNED BY company_categories.id; + + +-- +-- Name: company_custom_page_titles; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE company_custom_page_titles ( + id integer NOT NULL, + company_id integer, + main_page_title character varying(255), + products_page_title character varying(255), + about_page_title character varying(255), + contacts_page_title character varying(255), + arrangements_page_title character varying(255), + demands_page_title character varying(255), + pricelist_page_title character varying(255), + news_page_title character varying(255), + articles_page_title character varying(255), + licenses_page_title character varying(255), + answers_page_title character varying(255), + links_page_title character varying(255), + videos_page_title character varying(255), + created_at timestamp without time zone, + updated_at timestamp without time zone, + reviews_page_title character varying(255), + documents_page_title character varying(255), + company_events_page_title character varying(255) +); + + +-- +-- Name: company_custom_page_titles_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE company_custom_page_titles_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: company_custom_page_titles_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE company_custom_page_titles_id_seq OWNED BY company_custom_page_titles.id; + + +-- +-- Name: company_documents; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE company_documents ( + id integer NOT NULL, + company_id integer NOT NULL, + title character varying(255), + description text, + "position" integer, + state character varying(10) DEFAULT 'published'::character varying NOT NULL, + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: company_documents_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE company_documents_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: company_documents_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE company_documents_id_seq OWNED BY company_documents.id; + + +-- +-- Name: company_domain_stopwords; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE company_domain_stopwords ( + id integer NOT NULL, + name character varying(30) NOT NULL +); + + +-- +-- Name: TABLE company_domain_stopwords; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE company_domain_stopwords IS 'Стоп-слова для доменов компаний'; + + +-- +-- Name: company_domain_stopwords_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE company_domain_stopwords_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: company_domain_stopwords_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE company_domain_stopwords_id_seq OWNED BY company_domain_stopwords.id; + + +-- +-- Name: company_domains; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE company_domains ( + id integer NOT NULL, + company_id integer NOT NULL, + name character varying(30) NOT NULL, + level integer NOT NULL, + state character varying(255) DEFAULT 'accepted'::character varying NOT NULL, + updated_by integer, + moderated_by integer, + moderated_at timestamp without time zone, + moderator_comment text, + created_at timestamp without time zone, + updated_at timestamp without time zone, + previous_name character varying(30), + previous_level integer +); + + +-- +-- Name: TABLE company_domains; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE company_domains IS 'Домены компаний'; + + +-- +-- Name: COLUMN company_domains.company_id; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN company_domains.company_id IS 'Идентификатор компании'; + + +-- +-- Name: COLUMN company_domains.name; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN company_domains.name IS 'Название домена'; + + +-- +-- Name: COLUMN company_domains.level; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN company_domains.level IS 'Уровень домена'; + + +-- +-- Name: company_domains_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE company_domains_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: company_domains_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE company_domains_id_seq OWNED BY company_domains.id; + + +-- +-- Name: company_event_types; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE company_event_types ( + id integer NOT NULL, + name character varying(255) +); + + +-- +-- Name: company_event_types_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE company_event_types_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: company_event_types_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE company_event_types_id_seq OWNED BY company_event_types.id; + + +-- +-- Name: company_event_wiki_pages; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE company_event_wiki_pages ( + id integer NOT NULL, + company_event_id integer, + wiki_page_id integer, + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: company_event_wiki_pages_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE company_event_wiki_pages_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: company_event_wiki_pages_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE company_event_wiki_pages_id_seq OWNED BY company_event_wiki_pages.id; + + +-- +-- Name: company_events; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE company_events ( + id integer NOT NULL, + title character varying(255), + lead character varying(255), + text text, + begin_at timestamp without time zone, + end_in timestamp without time zone, + video text, + organizer character varying(255), + place character varying(255), + address_comment character varying(255), + site character varying(255), + reg_email character varying(255), + cost_min integer, + cost_max integer, + company_id integer, + region_id integer, + company_event_type_id integer, + created_at timestamp without time zone, + updated_at timestamp without time zone, + event_thematic_rubric_id integer, + cost_free boolean, + cost_invite boolean, + business_afisha boolean DEFAULT false, + business_afisha_placement_begin date, + business_afisha_placement_end date, + slug character varying(255), + delta boolean DEFAULT true NOT NULL, + discount double precision +); + + +-- +-- Name: company_events_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE company_events_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: company_events_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE company_events_id_seq OWNED BY company_events.id; + + +-- +-- Name: company_events_publish_regions; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE company_events_publish_regions ( + id integer NOT NULL, + region_id integer, + company_event_id integer +); + + +-- +-- Name: company_events_publish_regions_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE company_events_publish_regions_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: company_events_publish_regions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE company_events_publish_regions_id_seq OWNED BY company_events_publish_regions.id; + + +-- +-- Name: company_geo_denormalizations; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE company_geo_denormalizations ( + company_id integer, + addresses text, + cities text, + provinces text, + regions text, + countries text, + streets text, + map_addresses text, + dwelling_districts text, + adm_districts text, + districts text, + regions_index text, + streets_index text, + map_addresses_index text, + created_at timestamp without time zone, + updated_at timestamp without time zone, + longitude double precision, + latitude double precision +); + + +-- +-- Name: TABLE company_geo_denormalizations; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE company_geo_denormalizations IS 'Денормализованные данные по географическим привязкам компаний'; + + +-- +-- Name: COLUMN company_geo_denormalizations.longitude; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN company_geo_denormalizations.longitude IS 'Долгота'; + + +-- +-- Name: COLUMN company_geo_denormalizations.latitude; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN company_geo_denormalizations.latitude IS 'Широта'; + + +-- +-- Name: company_header_flashes; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE company_header_flashes ( + id integer NOT NULL, + company_id integer NOT NULL, + local_file_name character varying(255), + local_content_type character varying(255), + local_file_size integer, + local_updated_at timestamp without time zone, + remote_file_name character varying(255), + remote_content_type character varying(255), + remote_file_size integer, + remote_updated_at timestamp without time zone +); + + +-- +-- Name: company_header_flashes_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE company_header_flashes_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: company_header_flashes_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE company_header_flashes_id_seq OWNED BY company_header_flashes.id; + + +-- +-- Name: company_header_images; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE company_header_images ( + id integer NOT NULL, + company_id integer NOT NULL, + local_file_name character varying(255), + local_content_type character varying(255), + local_file_size integer, + local_updated_at timestamp without time zone, + remote_file_name character varying(255), + remote_content_type character varying(255), + remote_file_size integer, + remote_updated_at timestamp without time zone, + local_meta text, + remote_meta text +); + + +-- +-- Name: company_header_images_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE company_header_images_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: company_header_images_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE company_header_images_id_seq OWNED BY company_header_images.id; + + +-- +-- Name: company_imports; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE company_imports ( + id integer NOT NULL, + name character varying(256) NOT NULL, + country_id integer NOT NULL, + region_id integer NOT NULL, + "limit" integer NOT NULL, + companies_count integer DEFAULT 0 NOT NULL, + status character varying(255) DEFAULT 'new'::character varying NOT NULL, + log text, + loaded_at timestamp without time zone +); + + +-- +-- Name: TABLE company_imports; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE company_imports IS 'Заливки компаний из внешних источников'; + + +-- +-- Name: company_imports_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE company_imports_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: company_imports_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE company_imports_id_seq OWNED BY company_imports.id; + + +-- +-- Name: company_industries; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE company_industries ( + id integer NOT NULL, + company_id integer NOT NULL, + industry_id integer NOT NULL, + industry_level integer NOT NULL, + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: TABLE company_industries; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE company_industries IS 'Связки компаний с отраслевым рубрикатором'; + + +-- +-- Name: COLUMN company_industries.industry_level; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN company_industries.industry_level IS 'Уровень отраслевой рубрики (см. industries)'; + + +-- +-- Name: company_industries_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE company_industries_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: company_industries_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE company_industries_id_seq OWNED BY company_industries.id; + + +-- +-- Name: company_links; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE company_links ( + id integer NOT NULL, + company_id integer, + type integer DEFAULT 0, + title character varying(255), + url character varying(1000), + code character varying(1000), + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: company_links_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE company_links_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: company_links_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE company_links_id_seq OWNED BY company_links.id; + + +-- +-- Name: company_logos; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE company_logos ( + id integer NOT NULL, + company_id integer, + size integer, + content_type character varying(255), + filename character varying(255), + height integer, + width integer, + parent_id integer, + thumbnail character varying(255), + created_at timestamp without time zone, + updated_at timestamp without time zone, + img_file_name character varying(255), + img_content_type character varying(255), + img_file_size integer, + img_updated_at timestamp without time zone +); + + +-- +-- Name: TABLE company_logos; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE company_logos IS 'Логотипы компаний (учетки оригинальных файлов + уменьшенных копий)'; + + +-- +-- Name: COLUMN company_logos.size; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN company_logos.size IS 'Размер файла'; + + +-- +-- Name: COLUMN company_logos.content_type; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN company_logos.content_type IS 'MIME-тип файла'; + + +-- +-- Name: COLUMN company_logos.filename; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN company_logos.filename IS 'Имя файла'; + + +-- +-- Name: COLUMN company_logos.height; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN company_logos.height IS 'Высота картинки (в пискелях)'; + + +-- +-- Name: COLUMN company_logos.width; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN company_logos.width IS 'Ширина картинки (в пикселях)'; + + +-- +-- Name: COLUMN company_logos.parent_id; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN company_logos.parent_id IS 'Ссылка на родительский логотип, если файл является чьей-то уменьшенной копией'; + + +-- +-- Name: COLUMN company_logos.thumbnail; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN company_logos.thumbnail IS 'Тип уменьшенной копии'; + + +-- +-- Name: company_logos_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE company_logos_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: company_logos_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE company_logos_id_seq OWNED BY company_logos.id; + + +-- +-- Name: company_main_rubrics; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE company_main_rubrics ( + id integer NOT NULL, + company_id integer NOT NULL, + rubric_id integer NOT NULL, + rubric_level integer NOT NULL +); + + +-- +-- Name: company_main_rubrics_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE company_main_rubrics_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: company_main_rubrics_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE company_main_rubrics_id_seq OWNED BY company_main_rubrics.id; + + +-- +-- Name: company_manager_stats; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE company_manager_stats ( + id integer NOT NULL, + rubric_id integer NOT NULL, + region_id integer NOT NULL, + companies_in_region integer DEFAULT 0 NOT NULL, + companies_in_country integer DEFAULT 0 NOT NULL, + companies_in_region_with_packet_2 integer DEFAULT 0 NOT NULL, + companies_in_region_with_packet_3 integer DEFAULT 0 NOT NULL, + companies_in_region_with_packet_4 integer DEFAULT 0 NOT NULL, + companies_in_country_with_packet_2 integer DEFAULT 0 NOT NULL, + companies_in_country_with_packet_3 integer DEFAULT 0 NOT NULL, + companies_in_country_with_packet_4 integer DEFAULT 0 NOT NULL +); + + +-- +-- Name: TABLE company_manager_stats; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE company_manager_stats IS 'Статистика по компаниям в разрезе регионов, рубрик и пакетов'; + + +-- +-- Name: company_manager_stats_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE company_manager_stats_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: company_manager_stats_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE company_manager_stats_id_seq OWNED BY company_manager_stats.id; + + +-- +-- Name: company_menu_settings; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE company_menu_settings ( + id integer NOT NULL, + company_id integer, + show_horisontal_menu boolean DEFAULT true, + main_title character varying(255), + products_title character varying(255), + about_title character varying(255), + contacts_title character varying(255), + arrangements_title character varying(255), + demands_title character varying(255), + pricelist_title character varying(255), + news_title character varying(255), + articles_title character varying(255), + licenses_title character varying(255), + answers_title character varying(255), + links_title character varying(255), + created_at timestamp without time zone, + updated_at timestamp without time zone, + videos_title character varying(255), + reviews_title character varying(255), + documents_title character varying(255), + company_events_title character varying(255) +); + + +-- +-- Name: TABLE company_menu_settings; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE company_menu_settings IS 'Настройки меню для компаний'; + + +-- +-- Name: COLUMN company_menu_settings.company_id; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN company_menu_settings.company_id IS 'Контора'; + + +-- +-- Name: COLUMN company_menu_settings.show_horisontal_menu; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN company_menu_settings.show_horisontal_menu IS 'Показывать иль нет горизонтальное меню'; + + +-- +-- Name: COLUMN company_menu_settings.main_title; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN company_menu_settings.main_title IS 'Текст ссылки на главную'; + + +-- +-- Name: COLUMN company_menu_settings.products_title; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN company_menu_settings.products_title IS 'Текст ссылки на товары'; + + +-- +-- Name: COLUMN company_menu_settings.about_title; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN company_menu_settings.about_title IS 'Текст ссылки на о компании'; + + +-- +-- Name: COLUMN company_menu_settings.contacts_title; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN company_menu_settings.contacts_title IS 'Текст ссылки на контакты'; + + +-- +-- Name: COLUMN company_menu_settings.arrangements_title; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN company_menu_settings.arrangements_title IS 'Текст ссылки на акции'; + + +-- +-- Name: COLUMN company_menu_settings.demands_title; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN company_menu_settings.demands_title IS 'Текст ссылки на спрос'; + + +-- +-- Name: COLUMN company_menu_settings.pricelist_title; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN company_menu_settings.pricelist_title IS 'Текст ссылки на прайс-лист'; + + +-- +-- Name: COLUMN company_menu_settings.news_title; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN company_menu_settings.news_title IS 'Текст ссылки на новости'; + + +-- +-- Name: COLUMN company_menu_settings.articles_title; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN company_menu_settings.articles_title IS 'Текст ссылки на статьи'; + + +-- +-- Name: COLUMN company_menu_settings.licenses_title; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN company_menu_settings.licenses_title IS 'Текст ссылки на лицензии'; + + +-- +-- Name: COLUMN company_menu_settings.answers_title; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN company_menu_settings.answers_title IS 'Текст ссылки на вопросы и ответы'; + + +-- +-- Name: COLUMN company_menu_settings.links_title; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN company_menu_settings.links_title IS 'Текст ссылки на наши партнеры'; + + +-- +-- Name: COLUMN company_menu_settings.videos_title; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN company_menu_settings.videos_title IS 'Текст ссылки на видео'; + + +-- +-- Name: COLUMN company_menu_settings.reviews_title; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN company_menu_settings.reviews_title IS 'Текст ссылки на раздел отзывов'; + + +-- +-- Name: company_menu_settings_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE company_menu_settings_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: company_menu_settings_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE company_menu_settings_id_seq OWNED BY company_menu_settings.id; + + +-- +-- Name: company_moderations; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE company_moderations ( + id integer NOT NULL, + company_id integer, + note character varying(1000), + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: company_moderations_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE company_moderations_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: company_moderations_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE company_moderations_id_seq OWNED BY company_moderations.id; + + +-- +-- Name: company_news_rubrics; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE company_news_rubrics ( + id integer NOT NULL, + name character varying(255) NOT NULL, + path character varying(255) NOT NULL, + "position" integer DEFAULT 0 NOT NULL, + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: company_news_rubrics_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE company_news_rubrics_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: company_news_rubrics_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE company_news_rubrics_id_seq OWNED BY company_news_rubrics.id; + + +-- +-- Name: company_online_stats; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE company_online_stats ( + company_id integer NOT NULL, + last_seen_date date, + visits_in_current_month integer DEFAULT 0, + visits_in_prev_month integer DEFAULT 0 +); + + +-- +-- Name: TABLE company_online_stats; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE company_online_stats IS 'Статистика по присутствию в онлайн пользователей компаний'; + + +-- +-- Name: COLUMN company_online_stats.last_seen_date; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN company_online_stats.last_seen_date IS 'Дата последнего присутствия в онлайн, любого из пользователей компании'; + + +-- +-- Name: COLUMN company_online_stats.visits_in_current_month; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN company_online_stats.visits_in_current_month IS 'Кол-во авторизаций за текущий месяц'; + + +-- +-- Name: COLUMN company_online_stats.visits_in_prev_month; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN company_online_stats.visits_in_prev_month IS 'Кол-во авторизаций за прошлый месяц'; + + +-- +-- Name: company_payments; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE company_payments ( + id integer NOT NULL, + amount numeric NOT NULL, + currency_code character varying(255) NOT NULL, + operation_id integer, + moneta_user_acc integer, + payment_system_id integer, + corr_account integer, + is_paid boolean DEFAULT false NOT NULL, + is_test_mode boolean NOT NULL, + created_by integer NOT NULL, + updated_by integer, + created_at timestamp without time zone, + updated_at timestamp without time zone, + account_id integer NOT NULL +); + + +-- +-- Name: TABLE company_payments; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE company_payments IS 'Платежи компаний'; + + +-- +-- Name: COLUMN company_payments.amount; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN company_payments.amount IS 'Сумма платежа'; + + +-- +-- Name: COLUMN company_payments.currency_code; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN company_payments.currency_code IS 'ISO код валюты'; + + +-- +-- Name: COLUMN company_payments.operation_id; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN company_payments.operation_id IS 'Номер операции в системе MONETA.RU'; + + +-- +-- Name: COLUMN company_payments.moneta_user_acc; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN company_payments.moneta_user_acc IS 'Номер счета пользователя в системе MONETA.RU'; + + +-- +-- Name: COLUMN company_payments.payment_system_id; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN company_payments.payment_system_id IS 'Идентификатор платежной системы'; + + +-- +-- Name: COLUMN company_payments.corr_account; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN company_payments.corr_account IS 'Номер счета плательщика'; + + +-- +-- Name: COLUMN company_payments.is_paid; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN company_payments.is_paid IS 'Флаг - оплачена'; + + +-- +-- Name: COLUMN company_payments.is_test_mode; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN company_payments.is_test_mode IS 'Флаг - тестовый режим'; + + +-- +-- Name: COLUMN company_payments.account_id; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN company_payments.account_id IS 'Ссылка на счет'; + + +-- +-- Name: company_payments_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE company_payments_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: company_payments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE company_payments_id_seq OWNED BY company_payments.id; + + +-- +-- Name: company_previous_statistics; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE company_previous_statistics ( + id integer NOT NULL, + company_id integer NOT NULL, + week_visits integer, + week_pages integer, + month_visits integer, + month_pages integer +); + + +-- +-- Name: company_previous_statistics_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE company_previous_statistics_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: company_previous_statistics_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE company_previous_statistics_id_seq OWNED BY company_previous_statistics.id; + + +-- +-- Name: company_price_product_rubrics; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE company_price_product_rubrics ( + id integer NOT NULL, + company_id integer, + rubric_id integer +); + + +-- +-- Name: company_price_product_rubrics_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE company_price_product_rubrics_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: company_price_product_rubrics_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE company_price_product_rubrics_id_seq OWNED BY company_price_product_rubrics.id; + + +-- +-- Name: company_pricelist_online_status_logs; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE company_pricelist_online_status_logs ( + id integer NOT NULL, + company_id integer, + is_pricelist_online boolean, + datetime timestamp without time zone, + user_id integer +); + + +-- +-- Name: company_pricelist_online_status_logs_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE company_pricelist_online_status_logs_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: company_pricelist_online_status_logs_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE company_pricelist_online_status_logs_id_seq OWNED BY company_pricelist_online_status_logs.id; + + +-- +-- Name: company_prices; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE company_prices ( + id integer NOT NULL, + company_id integer NOT NULL, + title character varying(255), + description text, + "position" integer, + state character varying(10) DEFAULT 'published'::character varying NOT NULL, + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: company_prices_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE company_prices_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: company_prices_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE company_prices_id_seq OWNED BY company_prices.id; + + +-- +-- Name: company_publish_queue; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE company_publish_queue ( + id integer NOT NULL, + company_id integer NOT NULL, + packet integer NOT NULL, + product_limit integer NOT NULL, + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: company_publish_queue_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE company_publish_queue_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: company_publish_queue_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE company_publish_queue_id_seq OWNED BY company_publish_queue.id; + + +-- +-- Name: company_region_commercials; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE company_region_commercials ( + id integer NOT NULL, + company_id integer NOT NULL, + region_id integer NOT NULL, + department_id integer NOT NULL, + is_bold boolean DEFAULT false NOT NULL, + created_at timestamp without time zone, + updated_at timestamp without time zone, + print_limit integer, + cd_limit integer +); + + +-- +-- Name: TABLE company_region_commercials; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE company_region_commercials IS 'Коммерчесие привязки компаний к регионам (контексты)'; + + +-- +-- Name: COLUMN company_region_commercials.department_id; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN company_region_commercials.department_id IS 'Первая усадьба в регионе'; + + +-- +-- Name: COLUMN company_region_commercials.is_bold; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN company_region_commercials.is_bold IS 'Признак жирности лотов в регионе'; + + +-- +-- Name: COLUMN company_region_commercials.print_limit; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN company_region_commercials.print_limit IS 'Печатный лимит на размещение лотов в регионе'; + + +-- +-- Name: company_region_commercials_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE company_region_commercials_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: company_region_commercials_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE company_region_commercials_id_seq OWNED BY company_region_commercials.id; + + +-- +-- Name: company_regions; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE company_regions ( + id integer NOT NULL, + company_id integer NOT NULL, + region_id integer NOT NULL, + created_at timestamp without time zone, + updated_at timestamp without time zone, + department_id integer +); + + +-- +-- Name: TABLE company_regions; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE company_regions IS 'Привязки компаний к регионам (в каких регионах есть усадьбы)'; + + +-- +-- Name: COLUMN company_regions.department_id; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN company_regions.department_id IS 'ID первой усадьбы в регионе'; + + +-- +-- Name: company_regions_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE company_regions_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: company_regions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE company_regions_id_seq OWNED BY company_regions.id; + + +-- +-- Name: company_registration_sources; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE company_registration_sources ( + id integer NOT NULL, + company_id integer, + referer character varying(1024) +); + + +-- +-- Name: TABLE company_registration_sources; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE company_registration_sources IS 'Источники регистраций'; + + +-- +-- Name: COLUMN company_registration_sources.referer; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN company_registration_sources.referer IS 'Ссылка откуда первый раз пришел пользователь, создавший компанию'; + + +-- +-- Name: company_registration_sources_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE company_registration_sources_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: company_registration_sources_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE company_registration_sources_id_seq OWNED BY company_registration_sources.id; + + +-- +-- Name: company_review_comments; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE company_review_comments ( + id integer NOT NULL, + review_id integer NOT NULL, + body text NOT NULL, + state character varying(255) DEFAULT 'active'::character varying NOT NULL, + delete_reason text, + created_by integer NOT NULL, + updated_by integer NOT NULL, + created_at timestamp without time zone, + updated_at timestamp without time zone, + CONSTRAINT company_review_comments_check_state CHECK (((state)::text = ANY (ARRAY[('active'::character varying)::text, ('deleted'::character varying)::text]))) +); + + +-- +-- Name: TABLE company_review_comments; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE company_review_comments IS 'Комментарии представителей компании на отзывы'; + + +-- +-- Name: company_review_comments_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE company_review_comments_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: company_review_comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE company_review_comments_id_seq OWNED BY company_review_comments.id; + + +-- +-- Name: company_reviews; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE company_reviews ( + id integer NOT NULL, + company_id integer NOT NULL, + body text NOT NULL, + rating integer NOT NULL, + sender_company_id integer, + state character varying(255) DEFAULT 'active'::character varying NOT NULL, + delete_reason text, + created_by integer NOT NULL, + updated_by integer NOT NULL, + created_at timestamp without time zone, + updated_at timestamp without time zone, + CONSTRAINT company_reviews_check_state CHECK (((state)::text = ANY (ARRAY[('active'::character varying)::text, ('deleted'::character varying)::text]))) +); + + +-- +-- Name: TABLE company_reviews; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE company_reviews IS 'Отзывы о компаниях'; + + +-- +-- Name: company_reviews_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE company_reviews_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: company_reviews_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE company_reviews_id_seq OWNED BY company_reviews.id; + + +-- +-- Name: company_rubric_regions; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE company_rubric_regions ( + id integer NOT NULL, + company_id integer, + rubric_id integer, + region_id integer, + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: company_rubric_regions_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE company_rubric_regions_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: company_rubric_regions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE company_rubric_regions_id_seq OWNED BY company_rubric_regions.id; + + +-- +-- Name: company_rubrics; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE company_rubrics ( + id integer NOT NULL, + company_id integer NOT NULL, + rubric_id integer NOT NULL, + rubric_level integer NOT NULL, + created_at timestamp without time zone, + updated_at timestamp without time zone, + parent_rubric_id integer +); + + +-- +-- Name: TABLE company_rubrics; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE company_rubrics IS 'Привязки компаний к товарному рубрикатору'; + + +-- +-- Name: COLUMN company_rubrics.rubric_level; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN company_rubrics.rubric_level IS 'Уровень рубрики, к которой привязана компания'; + + +-- +-- Name: company_rubrics_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE company_rubrics_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: company_rubrics_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE company_rubrics_id_seq OWNED BY company_rubrics.id; + + +-- +-- Name: company_schedules; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE company_schedules ( + id integer NOT NULL, + address_id integer NOT NULL, + "position" integer DEFAULT 0 NOT NULL, + schedule_day_id integer, + schedule_days_text character varying(100), + schedule_time_id integer, + schedule_times_text character varying(100), + schedule_brake_id integer, + schedule_brakes_text character varying(100), + comment character varying(500), + created_user integer, + updated_user integer, + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: TABLE company_schedules; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE company_schedules IS 'Расписания компаний'; + + +-- +-- Name: COLUMN company_schedules.address_id; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN company_schedules.address_id IS 'Адрес компании'; + + +-- +-- Name: COLUMN company_schedules."position"; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN company_schedules."position" IS 'Порядковый номер записи'; + + +-- +-- Name: COLUMN company_schedules.schedule_day_id; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN company_schedules.schedule_day_id IS 'Дни работы'; + + +-- +-- Name: COLUMN company_schedules.schedule_days_text; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN company_schedules.schedule_days_text IS 'Дни работы в свободном виде'; + + +-- +-- Name: COLUMN company_schedules.schedule_time_id; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN company_schedules.schedule_time_id IS 'Время работы'; + + +-- +-- Name: COLUMN company_schedules.schedule_times_text; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN company_schedules.schedule_times_text IS 'Время работы в свободном виде'; + + +-- +-- Name: COLUMN company_schedules.schedule_brake_id; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN company_schedules.schedule_brake_id IS 'Время перерыва'; + + +-- +-- Name: COLUMN company_schedules.schedule_brakes_text; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN company_schedules.schedule_brakes_text IS 'Время перерыва в свбодном виде'; + + +-- +-- Name: COLUMN company_schedules.comment; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN company_schedules.comment IS 'Комментарий'; + + +-- +-- Name: COLUMN company_schedules.created_user; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN company_schedules.created_user IS 'Пользователь, создавший запись'; + + +-- +-- Name: COLUMN company_schedules.updated_user; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN company_schedules.updated_user IS 'Пользователь, обновивший запись'; + + +-- +-- Name: company_schedules_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE company_schedules_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: company_schedules_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE company_schedules_id_seq OWNED BY company_schedules.id; + + +-- +-- Name: company_searcher_confirmations; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE company_searcher_confirmations ( + id integer NOT NULL, + company_id integer, + searcher character varying(255), + code character varying(255), + user_id integer, + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: TABLE company_searcher_confirmations; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE company_searcher_confirmations IS 'Коды подтверждений права на управление сайтом для поисковиков'; + + +-- +-- Name: COLUMN company_searcher_confirmations.searcher; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN company_searcher_confirmations.searcher IS 'Поисковик'; + + +-- +-- Name: COLUMN company_searcher_confirmations.code; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN company_searcher_confirmations.code IS 'Код подтверждения'; + + +-- +-- Name: company_searcher_confirmations_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE company_searcher_confirmations_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: company_searcher_confirmations_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE company_searcher_confirmations_id_seq OWNED BY company_searcher_confirmations.id; + + +-- +-- Name: company_settings; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE company_settings ( + id integer NOT NULL, + company_id integer NOT NULL, + show_mycompany_link boolean DEFAULT false NOT NULL, + header_color character varying(255), + header_title character varying(250), + created_at timestamp without time zone, + updated_at timestamp without time zone, + header_text_color character varying(255), + show_product_groups boolean DEFAULT false NOT NULL, + template_name character varying(255) DEFAULT 'default'::character varying, + show_mainpage_products boolean DEFAULT true NOT NULL, + predl_listing_style character varying(255), + main_page_listing_style character varying(255), + show_prices_on_main_page boolean DEFAULT true, + title character varying(250), + title_x integer, + title_y integer, + title_align character varying(10) DEFAULT 'left'::character varying NOT NULL, + logo_x integer, + logo_y integer, + logo_align character varying(10) DEFAULT 'left'::character varying NOT NULL, + contacts_x integer, + contacts_y integer, + contacts_align character varying(10) DEFAULT 'right'::character varying NOT NULL, + header_image_style character varying(255), + background_image_style character varying(255), + header_height integer, + background_color character varying(50), + bg_content_color character varying(50), + show_title boolean DEFAULT true NOT NULL, + show_bevel boolean DEFAULT true NOT NULL, + hm_in_header boolean DEFAULT false NOT NULL, + name_font_size integer, + slogan_font_size integer, + background_opacity integer DEFAULT 100 NOT NULL, + block_head_color character varying(50), + block_head_color_stop character varying(50), + block_body_color character varying(50), + block_body_color_stop character varying(50), + hm_item_color character varying(50), + hm_item_color_stop character varying(50), + hm_active_item_color character varying(50), + hm_active_item_color_stop character varying(50), + scheme_name character varying(50) DEFAULT 'default'::character varying, + template_scheme_id integer, + save_settings text, + block_head_text_color character varying(50), + title_font character varying(50), + slogan_font character varying(50), + contacts_font character varying(50), + slogan_x integer, + slogan_y integer, + slogan_align character varying(10) DEFAULT 'left'::character varying NOT NULL, + slogan_color character varying(50), + contacts_color character varying(50), + contacts_font_size integer, + hm_active_item_text_color character varying(50), + header_opacity integer DEFAULT 100 NOT NULL, + sms_notification boolean DEFAULT false NOT NULL, + sms_number character varying(15) +); + + +-- +-- Name: TABLE company_settings; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE company_settings IS 'Онлайн-свойства компаний'; + + +-- +-- Name: COLUMN company_settings.show_mycompany_link; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN company_settings.show_mycompany_link IS 'Признак показывать ссылку $это моя компания$'; + + +-- +-- Name: COLUMN company_settings.header_color; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN company_settings.header_color IS 'Цвет фона в шапке'; + + +-- +-- Name: COLUMN company_settings.header_title; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN company_settings.header_title IS 'Текст в шапке'; + + +-- +-- Name: COLUMN company_settings.header_text_color; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN company_settings.header_text_color IS 'Цвет шрифта в шапке'; + + +-- +-- Name: COLUMN company_settings.show_product_groups; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN company_settings.show_product_groups IS 'Признак показывать пользовательские группы или рубрикатор ПЦ'; + + +-- +-- Name: COLUMN company_settings.template_name; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN company_settings.template_name IS 'Шаблон сайта компании'; + + +-- +-- Name: COLUMN company_settings.show_mainpage_products; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN company_settings.show_mainpage_products IS 'Флаг - показывать товары на главной'; + + +-- +-- Name: COLUMN company_settings.predl_listing_style; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN company_settings.predl_listing_style IS 'Вид листинга в ТиУ'; + + +-- +-- Name: COLUMN company_settings.main_page_listing_style; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN company_settings.main_page_listing_style IS 'Вид листинга на главной'; + + +-- +-- Name: COLUMN company_settings.show_prices_on_main_page; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN company_settings.show_prices_on_main_page IS 'Показывать или нет цены товаров'; + + +-- +-- Name: company_settings_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE company_settings_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: company_settings_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE company_settings_id_seq OWNED BY company_settings.id; + + +-- +-- Name: company_sites; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE company_sites ( + id integer NOT NULL, + company_id integer NOT NULL, + url character varying(200) NOT NULL, + "position" integer NOT NULL, + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: TABLE company_sites; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE company_sites IS 'Сайты компаний'; + + +-- +-- Name: COLUMN company_sites.url; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN company_sites.url IS 'URL сайта'; + + +-- +-- Name: COLUMN company_sites."position"; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN company_sites."position" IS 'Порядковый номер сайта'; + + +-- +-- Name: company_sites_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE company_sites_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: company_sites_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE company_sites_id_seq OWNED BY company_sites.id; + + +-- +-- Name: company_thematic_rubrics; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE company_thematic_rubrics ( + id integer NOT NULL, + company_id integer NOT NULL, + thematic_rubric_id integer NOT NULL, + rubric_level integer NOT NULL, + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: TABLE company_thematic_rubrics; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE company_thematic_rubrics IS 'Связки компаний с тематическими рубрикаторами'; + + +-- +-- Name: COLUMN company_thematic_rubrics.rubric_level; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN company_thematic_rubrics.rubric_level IS 'Уровень тематической рубрики (см. thematic_rubrics)'; + + +-- +-- Name: company_thematic_rubrics_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE company_thematic_rubrics_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: company_thematic_rubrics_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE company_thematic_rubrics_id_seq OWNED BY company_thematic_rubrics.id; + + +-- +-- Name: company_tokens; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE company_tokens ( + id integer NOT NULL, + company_id integer, + subject_id integer, + subject_type character varying(255), + email character varying(255) NOT NULL, + token character varying(128) NOT NULL, + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: TABLE company_tokens; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE company_tokens IS 'Связки компаний с адресами электронной почты для автоматической авторизации/регистрации пользователей на сайте'; + + +-- +-- Name: COLUMN company_tokens.company_id; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN company_tokens.company_id IS 'Идентификатор компании'; + + +-- +-- Name: COLUMN company_tokens.subject_id; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN company_tokens.subject_id IS 'Полиморфическая связка с привязанным объектом (email компании или пользователь)'; + + +-- +-- Name: COLUMN company_tokens.subject_type; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN company_tokens.subject_type IS 'Тип привязанного объекта (Contact или User)'; + + +-- +-- Name: COLUMN company_tokens.email; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN company_tokens.email IS 'Адрес электронной почты привязанного объекта (см. subject_id)'; + + +-- +-- Name: COLUMN company_tokens.token; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN company_tokens.token IS 'Уникальный в рамках таблицы ключ связки'; + + +-- +-- Name: company_tokens_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE company_tokens_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: company_tokens_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE company_tokens_id_seq OWNED BY company_tokens.id; + + +-- +-- Name: company_traffic_limits; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE company_traffic_limits ( + id integer NOT NULL, + company_id integer, + visits_limits integer, + visits_current integer, + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: company_traffic_limits_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE company_traffic_limits_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: company_traffic_limits_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE company_traffic_limits_id_seq OWNED BY company_traffic_limits.id; + + +-- +-- Name: company_users; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE company_users ( + id integer NOT NULL, + user_id integer, + company_id integer, + role character varying(255), + created_at timestamp without time zone, + updated_at timestamp without time zone, + is_representative boolean DEFAULT false +); + + +-- +-- Name: TABLE company_users; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE company_users IS 'Отношения пользователей и компаний'; + + +-- +-- Name: COLUMN company_users.role; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN company_users.role IS 'Роль пользователя в компании'; + + +-- +-- Name: COLUMN company_users.is_representative; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN company_users.is_representative IS 'Является ли пользователем полномочным представителем компании'; + + +-- +-- Name: company_users_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE company_users_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: company_users_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE company_users_id_seq OWNED BY company_users.id; + + +-- +-- Name: company_videos; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE company_videos ( + id integer NOT NULL, + company_id integer NOT NULL, + title character varying(50), + announce text, + html_code text NOT NULL, + moderator_comment text, + status character varying(255) DEFAULT 'pending'::character varying NOT NULL, + created_user integer, + updated_user integer, + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: TABLE company_videos; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE company_videos IS 'Видео компаний'; + + +-- +-- Name: COLUMN company_videos.company_id; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN company_videos.company_id IS 'Компания'; + + +-- +-- Name: COLUMN company_videos.title; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN company_videos.title IS 'Название видео'; + + +-- +-- Name: COLUMN company_videos.announce; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN company_videos.announce IS 'Анонс видео'; + + +-- +-- Name: COLUMN company_videos.html_code; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN company_videos.html_code IS 'HTML-код видео, взятый с видео-хостинга'; + + +-- +-- Name: COLUMN company_videos.moderator_comment; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN company_videos.moderator_comment IS 'Сообщение от модератора'; + + +-- +-- Name: COLUMN company_videos.status; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN company_videos.status IS 'Статус видео'; + + +-- +-- Name: COLUMN company_videos.created_user; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN company_videos.created_user IS 'Пользователь, создавший запись'; + + +-- +-- Name: COLUMN company_videos.updated_user; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN company_videos.updated_user IS 'Пользователь, обновивший запись'; + + +-- +-- Name: company_videos_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE company_videos_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: company_videos_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE company_videos_id_seq OWNED BY company_videos.id; + + +-- +-- Name: company_widgets; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE company_widgets ( + id integer NOT NULL, + company_id integer, + type character varying(20) NOT NULL, + color character varying(20) NOT NULL, + code character varying(32) NOT NULL, + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: company_widgets_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE company_widgets_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: company_widgets_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE company_widgets_id_seq OWNED BY company_widgets.id; + + +-- +-- Name: company_widgets_stats; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE company_widgets_stats ( + id integer NOT NULL, + addr character varying(255), + date date, + show_count integer +); + + +-- +-- Name: TABLE company_widgets_stats; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE company_widgets_stats IS 'Статистика по кнопкам'; + + +-- +-- Name: COLUMN company_widgets_stats.addr; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN company_widgets_stats.addr IS 'Адрес запрашивателя кнопки'; + + +-- +-- Name: COLUMN company_widgets_stats.show_count; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN company_widgets_stats.show_count IS 'Кол-во показов'; + + +-- +-- Name: company_widgets_stats_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE company_widgets_stats_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: company_widgets_stats_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE company_widgets_stats_id_seq OWNED BY company_widgets_stats.id; + + +-- +-- Name: company_yandex_rubrics; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE company_yandex_rubrics ( + id integer NOT NULL, + company_id integer, + yandex_rubric_id integer, + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: company_yandex_rubrics_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE company_yandex_rubrics_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: company_yandex_rubrics_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE company_yandex_rubrics_id_seq OWNED BY company_yandex_rubrics.id; + + +-- +-- Name: complaints; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE complaints ( + id integer NOT NULL, + complaint_text text, + comment_id integer, + user_id integer, + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: complaints_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE complaints_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: complaints_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE complaints_id_seq OWNED BY complaints.id; + + +-- +-- Name: contact_types; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE contact_types ( + id integer NOT NULL, + name character varying(200) NOT NULL, + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: TABLE contact_types; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE contact_types IS 'Справочник типов электронных контактов'; + + +-- +-- Name: contact_types_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE contact_types_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: contact_types_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE contact_types_id_seq OWNED BY contact_types.id; + + +-- +-- Name: contacts; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE contacts ( + id integer NOT NULL, + contact_type_id integer NOT NULL, + address_id integer NOT NULL, + value character varying(255) NOT NULL, + comment character varying(200), + created_at timestamp without time zone, + updated_at timestamp without time zone, + "position" integer NOT NULL, + published boolean DEFAULT false +); + + +-- +-- Name: TABLE contacts; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE contacts IS 'Электронные контакты усадеб компаний'; + + +-- +-- Name: COLUMN contacts.value; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN contacts.value IS 'Значение контакта'; + + +-- +-- Name: COLUMN contacts.comment; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN contacts.comment IS 'Комментарий к контакту'; + + +-- +-- Name: COLUMN contacts."position"; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN contacts."position" IS 'Порядковый номер контакта внутри усадьбы и типа контакта'; + + +-- +-- Name: contacts_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE contacts_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: contacts_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE contacts_id_seq OWNED BY contacts.id; + + +-- +-- Name: copied_users; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE copied_users ( + id integer NOT NULL, + user_id integer NOT NULL, + copied_from character varying(255) NOT NULL, + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: copied_users_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE copied_users_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: copied_users_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE copied_users_id_seq OWNED BY copied_users.id; + + +-- +-- Name: countries; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE countries ( + id integer NOT NULL, + name character varying(128) NOT NULL, + created_at timestamp without time zone, + updated_at timestamp without time zone, + phone_code integer DEFAULT 7, + head_position integer, + phone_length integer DEFAULT 10, + visible boolean DEFAULT true NOT NULL +); + + +-- +-- Name: TABLE countries; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE countries IS 'Справочник стран'; + + +-- +-- Name: COLUMN countries.name; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN countries.name IS 'Название страны'; + + +-- +-- Name: COLUMN countries.phone_code; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN countries.phone_code IS 'Телефонный код страны'; + + +-- +-- Name: COLUMN countries.head_position; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN countries.head_position IS 'По этому полю сортируется верхушка списка стран (а уже потом - по имени)'; + + +-- +-- Name: COLUMN countries.phone_length; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN countries.phone_length IS 'Количество знаков в телефоне'; + + +-- +-- Name: countries_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE countries_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: countries_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE countries_id_seq OWNED BY countries.id; + + +-- +-- Name: demand_items; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE demand_items ( + id integer NOT NULL, + demand_id integer NOT NULL, + title character varying(160) NOT NULL, + rubric_id integer, + price numeric, + qty character varying(50) +); + + +-- +-- Name: TABLE demand_items; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE demand_items IS 'Спрос-элементы объявлений'; + + +-- +-- Name: COLUMN demand_items.demand_id; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN demand_items.demand_id IS 'FK на объявление чья это строчка'; + + +-- +-- Name: COLUMN demand_items.title; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN demand_items.title IS 'Наименование'; + + +-- +-- Name: COLUMN demand_items.rubric_id; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN demand_items.rubric_id IS 'Ссылка на рубрику'; + + +-- +-- Name: COLUMN demand_items.price; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN demand_items.price IS 'Цена, руб'; + + +-- +-- Name: COLUMN demand_items.qty; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN demand_items.qty IS 'Кол-во'; + + +-- +-- Name: demand_items_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE demand_items_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: demand_items_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE demand_items_id_seq OWNED BY demand_items.id; + + +-- +-- Name: demand_statistics; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE demand_statistics ( + id integer NOT NULL, + region_id integer, + rubric_id integer, + demands_count integer +); + + +-- +-- Name: demand_statistics_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE demand_statistics_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: demand_statistics_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE demand_statistics_id_seq OWNED BY demand_statistics.id; + + +-- +-- Name: demands; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE demands ( + id integer NOT NULL, + user_id integer NOT NULL, + company_id integer, + region_id integer, + supply_terms character varying(1000), + valid_till timestamp without time zone NOT NULL, + actualized_at timestamp without time zone DEFAULT now() NOT NULL, + moderated_by integer, + moderated_at timestamp without time zone, + created_at timestamp without time zone, + updated_at timestamp without time zone, + is_published boolean, + state product_state DEFAULT 'pending'::product_state NOT NULL, + moderator_comment text +); + + +-- +-- Name: TABLE demands; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE demands IS 'Спрос-объявления'; + + +-- +-- Name: COLUMN demands.user_id; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN demands.user_id IS 'Пользователь, разместивший объявление'; + + +-- +-- Name: COLUMN demands.company_id; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN demands.company_id IS 'Компания, от имени которой пользователь разместил объявление'; + + +-- +-- Name: COLUMN demands.region_id; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN demands.region_id IS 'Регион, в котором должно публиковаться объявление'; + + +-- +-- Name: COLUMN demands.supply_terms; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN demands.supply_terms IS 'Условия поставки'; + + +-- +-- Name: COLUMN demands.valid_till; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN demands.valid_till IS 'Срок действия объявления'; + + +-- +-- Name: COLUMN demands.moderated_by; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN demands.moderated_by IS 'Пользователь, который последний раз отмодерировал объявление'; + + +-- +-- Name: COLUMN demands.moderated_at; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN demands.moderated_at IS 'Время последней модерации'; + + +-- +-- Name: COLUMN demands.created_at; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN demands.created_at IS 'Дата создания (служебная)'; + + +-- +-- Name: COLUMN demands.updated_at; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN demands.updated_at IS 'Дата модификации (служебная)'; + + +-- +-- Name: demands_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE demands_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: demands_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE demands_id_seq OWNED BY demands.id; + + +-- +-- Name: dialog_messages; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE dialog_messages ( + id integer NOT NULL, + dialog_id integer NOT NULL, + dialog_participant_id integer NOT NULL, + content text NOT NULL, + state character varying(32) DEFAULT 'unread'::character varying NOT NULL, + user_id integer, + recipient_participant_id integer, + created_at timestamp without time zone, + updated_at timestamp without time zone, + demand_item_id integer +); + + +-- +-- Name: TABLE dialog_messages; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE dialog_messages IS 'Переписки - тексты сообщений'; + + +-- +-- Name: COLUMN dialog_messages.dialog_id; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN dialog_messages.dialog_id IS 'Диалог, к которому принадлежит это сообщение (денормализация)'; + + +-- +-- Name: COLUMN dialog_messages.dialog_participant_id; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN dialog_messages.dialog_participant_id IS 'Сторона диалога, которая написала это сообщение'; + + +-- +-- Name: COLUMN dialog_messages.content; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN dialog_messages.content IS 'Содержмое сообщения'; + + +-- +-- Name: COLUMN dialog_messages.state; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN dialog_messages.state IS 'Статус сообщения (state machine)'; + + +-- +-- Name: COLUMN dialog_messages.user_id; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN dialog_messages.user_id IS 'id пользователя, кто физически написал это сообщения (скрываясь за стороной диалога)'; + + +-- +-- Name: COLUMN dialog_messages.recipient_participant_id; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN dialog_messages.recipient_participant_id IS 'Сторона диалога, адресат сообщения (денормализация)'; + + +-- +-- Name: dialog_messages_backup; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE dialog_messages_backup ( + id integer, + dialog_id integer, + dialog_participant_id integer, + content text, + state character varying(32), + user_id integer, + recipient_participant_id integer, + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: dialog_messages_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE dialog_messages_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: dialog_messages_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE dialog_messages_id_seq OWNED BY dialog_messages.id; + + +-- +-- Name: dialog_participants; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE dialog_participants ( + id integer NOT NULL, + dialog_id integer NOT NULL, + company_id integer, + user_id integer, + state character varying(32) DEFAULT 'active'::character varying NOT NULL, + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: TABLE dialog_participants; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE dialog_participants IS 'Список участников диалога'; + + +-- +-- Name: COLUMN dialog_participants.dialog_id; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN dialog_participants.dialog_id IS 'Ссылка на диалог'; + + +-- +-- Name: COLUMN dialog_participants.company_id; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN dialog_participants.company_id IS 'Ссылка на компанию'; + + +-- +-- Name: COLUMN dialog_participants.user_id; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN dialog_participants.user_id IS 'Ссылка на пользователя'; + + +-- +-- Name: COLUMN dialog_participants.state; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN dialog_participants.state IS 'Статус этого участника для этой переписки'; + + +-- +-- Name: dialog_participants_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE dialog_participants_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: dialog_participants_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE dialog_participants_id_seq OWNED BY dialog_participants.id; + + +-- +-- Name: dialogs; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE dialogs ( + id integer NOT NULL, + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: dialogs_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE dialogs_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: dialogs_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE dialogs_id_seq OWNED BY dialogs.id; + + +-- +-- Name: dirty_company_industries; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE dirty_company_industries ( + id integer DEFAULT nextval('company_industries_id_seq'::regclass) NOT NULL, + company_id integer, + industry_id integer, + industry_level integer, + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: TABLE dirty_company_industries; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE dirty_company_industries IS 'Связки компаний с отраслевым рубрикатором (версия для редактирования)'; + + +-- +-- Name: dirty_industries; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE dirty_industries ( + id integer NOT NULL, + title character varying(255), + parent_id integer, + slug character varying(255), + lft integer, + rgt integer, + joined_path text, + cached_level integer, + is_visible boolean, + created_at timestamp without time zone, + updated_at timestamp without time zone, + keywords text, + title_short character varying(255) +); + + +-- +-- Name: TABLE dirty_industries; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE dirty_industries IS 'Отраслевой рубрикатор (версия для редактирования)'; + + +-- +-- Name: dirty_industries_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE dirty_industries_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: dirty_industries_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE dirty_industries_id_seq OWNED BY dirty_industries.id; + + +-- +-- Name: dirty_rubric_log_entries; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE dirty_rubric_log_entries ( + id integer NOT NULL, + rubric_id integer NOT NULL, + event_type character varying(255) NOT NULL, + event_param character varying(255), + created_at timestamp without time zone NOT NULL, + updated_at timestamp without time zone NOT NULL +); + + +-- +-- Name: dirty_rubric_log_entries_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE dirty_rubric_log_entries_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: dirty_rubric_log_entries_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE dirty_rubric_log_entries_id_seq OWNED BY dirty_rubric_log_entries.id; + + +-- +-- Name: dirty_rubrics; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE dirty_rubrics ( + id integer NOT NULL, + parent_id integer, + depth integer, + target_id integer, + title character varying(255) NOT NULL, + prefix character varying(255), + synonym character varying(255), + slug character varying(255), + public boolean DEFAULT true NOT NULL, + symlink boolean DEFAULT false NOT NULL, + service boolean DEFAULT false NOT NULL, + elaborated boolean DEFAULT false NOT NULL, + tiny_schema boolean DEFAULT false NOT NULL, + settings text, + genitive character varying(255), + dative character varying(255), + accusative character varying(255), + instrumentative character varying(255), + preposition character varying(255), + plural boolean DEFAULT false NOT NULL, + created_at timestamp without time zone NOT NULL, + updated_at timestamp without time zone NOT NULL, + slug_number integer, + "position" integer, + cached_children_count integer DEFAULT 0, + referenceable boolean DEFAULT false NOT NULL, + CONSTRAINT dirty_rubrics_symlink_check CHECK (((symlink AND (target_id IS NOT NULL)) OR (NOT symlink))) +); + + +-- +-- Name: dirty_rubric_paths; Type: VIEW; Schema: public; Owner: - +-- + +CREATE VIEW dirty_rubric_paths AS + WITH RECURSIVE rubrics_paths(id, joined_path, parent_path, tiny_path, tiny_schema) AS (SELECT dirty_rubrics.id, dirty_rubrics.slug AS joined_path, CASE WHEN ((dirty_rubrics.depth > 1) AND (dirty_rubrics.depth < 5)) THEN lpad(((dirty_rubrics.slug_number)::character varying(255))::text, 2, '0'::text) ELSE ''::text END AS parent_path, ((dirty_rubrics.slug)::text || '/'::text) AS tiny_path, dirty_rubrics.tiny_schema FROM dirty_rubrics WHERE (dirty_rubrics.parent_id IS NULL) UNION ALL SELECT r.id, ((((rp.joined_path)::text || '/'::text) || (r.slug)::text))::character varying(255) AS "varchar", CASE WHEN (r.depth > 4) THEN rp.parent_path WHEN (r.depth > 1) THEN (rp.parent_path || lpad(((r.slug_number)::character varying(255))::text, 2, '0'::text)) ELSE rp.tiny_path END AS parent_path, CASE WHEN (r.depth > 4) THEN ((rp.parent_path || '-'::text) || (r.slug)::text) WHEN (r.depth > 1) THEN (((rp.parent_path || lpad(((r.slug_number)::character varying(255))::text, 2, '0'::text)) || '-'::text) || (r.slug)::text) ELSE (rp.tiny_path || (r.slug)::text) END AS "case", r.tiny_schema FROM (dirty_rubrics r JOIN rubrics_paths rp ON ((r.parent_id = rp.id))) WHERE (r.symlink = false)), symlink_paths(id, path) AS (SELECT r.id, (CASE WHEN rp.tiny_schema THEN (rp.tiny_path)::character varying ELSE rp.joined_path END)::character varying(255) AS path FROM (dirty_rubrics r JOIN rubrics_paths rp ON ((r.target_id = rp.id))) WHERE (r.symlink = true)) SELECT rubrics_paths.id, (CASE WHEN rubrics_paths.tiny_schema THEN (rubrics_paths.tiny_path)::character varying ELSE rubrics_paths.joined_path END)::character varying(255) AS path FROM rubrics_paths UNION ALL SELECT symlink_paths.id, symlink_paths.path FROM symlink_paths; + + +-- +-- Name: dirty_rubric_redirects; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE dirty_rubric_redirects ( + id integer NOT NULL, + rubric_id integer NOT NULL, + redirect_from character varying(255) NOT NULL, + created_at timestamp without time zone NOT NULL, + updated_at timestamp without time zone NOT NULL +); + + +-- +-- Name: dirty_rubric_redirects_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE dirty_rubric_redirects_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: dirty_rubric_redirects_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE dirty_rubric_redirects_id_seq OWNED BY dirty_rubric_redirects.id; + + +-- +-- Name: dirty_rubrics_nested_set; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE dirty_rubrics_nested_set ( + id integer NOT NULL, + parent_id integer, + "position" integer, + lft integer, + rgt integer +); + + +-- +-- Name: dirty_rubric_snapshot; Type: VIEW; Schema: public; Owner: - +-- + +CREATE VIEW dirty_rubric_snapshot AS + SELECT dirty_rubrics.id, dirty_rubrics.parent_id, dirty_rubrics.depth, dirty_rubrics.target_id, dirty_rubrics.title, dirty_rubrics.prefix, dirty_rubrics.synonym, dirty_rubrics.slug, dirty_rubrics.public, dirty_rubrics.symlink, dirty_rubrics.service, dirty_rubrics.elaborated, dirty_rubrics.tiny_schema, dirty_rubrics.settings, dirty_rubrics.genitive, dirty_rubrics.dative, dirty_rubrics.accusative, dirty_rubrics.instrumentative, dirty_rubrics.preposition, dirty_rubrics.plural, dirty_rubrics.created_at, dirty_rubrics.updated_at, dirty_rubrics.slug_number, dirty_rubrics."position", dirty_rubrics.cached_children_count, dirty_rubrics.referenceable, dirty_rubric_paths.path, (NOT (EXISTS (SELECT 1 FROM (dirty_rubrics rp LEFT JOIN dirty_rubrics rc ON ((rc.parent_id = rp.id))) WHERE ((rp.parent_id = dirty_rubrics.id) AND (rc.id IS NOT NULL))))) AS next_level_leafs, dirty_rubrics_nested_set.lft, dirty_rubrics_nested_set.rgt FROM ((dirty_rubrics JOIN dirty_rubrics_nested_set ON ((dirty_rubrics_nested_set.id = dirty_rubrics.id))) JOIN dirty_rubric_paths ON ((dirty_rubrics.id = dirty_rubric_paths.id))); + + +-- +-- Name: dirty_rubric_trait_value_redirects; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE dirty_rubric_trait_value_redirects ( + id integer NOT NULL, + rubric_id integer, + redirect_from character varying(255), + trait_value_id integer +); + + +-- +-- Name: dirty_rubric_trait_value_redirects_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE dirty_rubric_trait_value_redirects_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: dirty_rubric_trait_value_redirects_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE dirty_rubric_trait_value_redirects_id_seq OWNED BY dirty_rubric_trait_value_redirects.id; + + +-- +-- Name: dirty_rubrics_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE dirty_rubrics_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: dirty_rubrics_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE dirty_rubrics_id_seq OWNED BY dirty_rubrics.id; + + +-- +-- Name: dirty_rubrics_nested_set_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE dirty_rubrics_nested_set_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: dirty_rubrics_nested_set_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE dirty_rubrics_nested_set_id_seq OWNED BY dirty_rubrics_nested_set.id; + + +-- +-- Name: dirty_thematic_rubric_industries; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE dirty_thematic_rubric_industries ( + id integer NOT NULL, + thematic_rubric_id integer, + industry_id integer, + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: TABLE dirty_thematic_rubric_industries; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE dirty_thematic_rubric_industries IS 'Связки тематических рубрикаторов с отраслевым (версия для редактирования)'; + + +-- +-- Name: dirty_thematic_rubric_industries_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE dirty_thematic_rubric_industries_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: dirty_thematic_rubric_industries_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE dirty_thematic_rubric_industries_id_seq OWNED BY dirty_thematic_rubric_industries.id; + + +-- +-- Name: dirty_thematic_rubrics; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE dirty_thematic_rubrics ( + id integer NOT NULL, + thematic_rubricator_id integer, + title character varying(255), + parent_id integer, + slug character varying(255), + lft integer, + rgt integer, + joined_path text, + cached_level integer, + is_visible boolean, + created_at timestamp without time zone, + updated_at timestamp without time zone, + title_short character varying(255), + title_tiny character varying(20), + panel_num integer +); + + +-- +-- Name: TABLE dirty_thematic_rubrics; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE dirty_thematic_rubrics IS 'Тематический рубрикатор (версия для редактирования)'; + + +-- +-- Name: dirty_thematic_rubrics_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE dirty_thematic_rubrics_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: dirty_thematic_rubrics_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE dirty_thematic_rubrics_id_seq OWNED BY dirty_thematic_rubrics.id; + + +-- +-- Name: district_types; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE district_types ( + id integer NOT NULL, + name character varying(255) NOT NULL, + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: TABLE district_types; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE district_types IS 'Типы районов городов'; + + +-- +-- Name: COLUMN district_types.name; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN district_types.name IS 'Название'; + + +-- +-- Name: district_types_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE district_types_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: district_types_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE district_types_id_seq OWNED BY district_types.id; + + +-- +-- Name: districts; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE districts ( + id integer NOT NULL, + city_id integer NOT NULL, + name character varying(255) NOT NULL, + district_type_id integer NOT NULL, + created_at timestamp without time zone, + updated_at timestamp without time zone, + slug character varying(255) DEFAULT ''::character varying NOT NULL, + map_address_id integer +); + + +-- +-- Name: TABLE districts; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE districts IS 'Районы городов'; + + +-- +-- Name: COLUMN districts.city_id; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN districts.city_id IS 'Город'; + + +-- +-- Name: COLUMN districts.name; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN districts.name IS 'Название'; + + +-- +-- Name: COLUMN districts.district_type_id; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN districts.district_type_id IS 'Тип района'; + + +-- +-- Name: COLUMN districts.slug; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN districts.slug IS 'Название района для URL'; + + +-- +-- Name: COLUMN districts.map_address_id; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN districts.map_address_id IS 'Ссылка на адрес, который надо показывать на странице района'; + + +-- +-- Name: districts_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE districts_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: districts_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE districts_id_seq OWNED BY districts.id; + + +-- +-- Name: event_addresses; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE event_addresses ( + id integer NOT NULL, + name character varying(256), + city_id integer, + street_id integer, + created_at timestamp without time zone, + updated_at timestamp without time zone, + estate character varying(10), + building character varying(40), + literal character varying(200), + comments character varying(256), + map_address_id integer, + office character varying(20), + company_event_id integer +); + + +-- +-- Name: event_addresses_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE event_addresses_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: event_addresses_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE event_addresses_id_seq OWNED BY event_addresses.id; + + +-- +-- Name: event_contacts; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE event_contacts ( + id integer NOT NULL, + contact_type_id integer NOT NULL, + value character varying(255) NOT NULL, + comment character varying(200), + created_at timestamp without time zone, + updated_at timestamp without time zone, + published boolean DEFAULT false, + company_event_id integer +); + + +-- +-- Name: event_contacts_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE event_contacts_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: event_contacts_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE event_contacts_id_seq OWNED BY event_contacts.id; + + +-- +-- Name: event_phones; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE event_phones ( + id integer NOT NULL, + code character varying(9) NOT NULL, + number character varying(9) NOT NULL, + comment character varying(250), + created_at timestamp without time zone, + updated_at timestamp without time zone, + show_in_header boolean, + company_event_id integer NOT NULL +); + + +-- +-- Name: event_phones_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE event_phones_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: event_phones_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE event_phones_id_seq OWNED BY event_phones.id; + + +-- +-- Name: event_thematic_rubrics; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE event_thematic_rubrics ( + id integer NOT NULL, + title character varying(255), + slug character varying(255) +); + + +-- +-- Name: event_thematic_rubrics_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE event_thematic_rubrics_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: event_thematic_rubrics_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE event_thematic_rubrics_id_seq OWNED BY event_thematic_rubrics.id; + + +-- +-- Name: export_log_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE export_log_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + MAXVALUE 2147483647 + CACHE 1; + + +-- +-- Name: external_forms; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE external_forms ( + id integer NOT NULL, + company_title character varying(255), + email character varying(255), + key character varying(255) +); + + +-- +-- Name: external_forms_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE external_forms_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: external_forms_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE external_forms_id_seq OWNED BY external_forms.id; + + +-- +-- Name: feedback_categories; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE feedback_categories ( + id integer NOT NULL, + name character varying(255) +); + + +-- +-- Name: feedback_categories_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE feedback_categories_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: feedback_categories_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE feedback_categories_id_seq OWNED BY feedback_categories.id; + + +-- +-- Name: feedbacks; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE feedbacks ( + id integer NOT NULL, + user_id integer, + company_id integer, + name character varying(50), + email character varying(50), + contacts character varying(50), + message text, + type character varying(20) NOT NULL, + status character varying(20) NOT NULL, + created_at timestamp without time zone, + updated_at timestamp without time zone, + page_url character varying(255), + user_agent character varying(255), + comment text, + feedback_category_id integer +); + + +-- +-- Name: TABLE feedbacks; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE feedbacks IS 'События обратной связи (от пользователей к редакции портала)'; + + +-- +-- Name: COLUMN feedbacks.type; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN feedbacks.type IS 'Тип события (сообщение об ошибке, запрос на владение компанией)'; + + +-- +-- Name: feedbacks_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE feedbacks_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: feedbacks_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE feedbacks_id_seq OWNED BY feedbacks.id; + + +-- +-- Name: franchise_user_regions; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE franchise_user_regions ( + id integer NOT NULL, + user_id integer, + region_id integer +); + + +-- +-- Name: franchise_user_regions_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE franchise_user_regions_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: franchise_user_regions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE franchise_user_regions_id_seq OWNED BY franchise_user_regions.id; + + +-- +-- Name: glossary_log; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE glossary_log ( + id integer NOT NULL, + operation character varying(255), + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: glossary_log_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE glossary_log_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: glossary_log_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE glossary_log_id_seq OWNED BY glossary_log.id; + + +-- +-- Name: images; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE images ( + id integer NOT NULL, + subject_id integer, + "position" integer DEFAULT 0 NOT NULL, + img_file_name character varying(255), + img_content_type character varying(255), + img_file_size integer, + created_at timestamp without time zone, + updated_at timestamp without time zone, + subject_type character varying(255), + comment text, + title character varying(255) DEFAULT NULL::character varying, + author character varying(255), + cover boolean DEFAULT false NOT NULL, + show_dk_copyright boolean DEFAULT false NOT NULL +); + + +-- +-- Name: TABLE images; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE images IS 'Полиморфическое хранилище учеток загружаемых картинок'; + + +-- +-- Name: COLUMN images.subject_id; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN images.subject_id IS 'Идентификатор связанного объекта класса subject_type'; + + +-- +-- Name: COLUMN images."position"; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN images."position" IS 'Порядковый номер изображения внутри связанного объекта'; + + +-- +-- Name: COLUMN images.img_file_name; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN images.img_file_name IS 'Имя файла'; + + +-- +-- Name: COLUMN images.img_content_type; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN images.img_content_type IS 'MIME-тип файла'; + + +-- +-- Name: COLUMN images.img_file_size; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN images.img_file_size IS 'Размер файла'; + + +-- +-- Name: COLUMN images.subject_type; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN images.subject_type IS 'К какому классу относится изображение'; + + +-- +-- Name: COLUMN images.comment; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN images.comment IS 'Комментарий к файлу'; + + +-- +-- Name: images_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE images_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: images_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE images_id_seq OWNED BY images.id; + + +-- +-- Name: industries; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE industries ( + id integer NOT NULL, + title character varying(255), + parent_id integer, + slug character varying(255), + lft integer, + rgt integer, + joined_path text, + cached_level integer, + is_visible boolean, + created_at timestamp without time zone, + updated_at timestamp without time zone, + keywords text, + title_short character varying(255) +); + + +-- +-- Name: industries_backup; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE industries_backup ( + id integer NOT NULL, + parent_id integer, + lft integer, + rgt integer, + title character varying(255), + slug character varying(255), + joined_path character varying(255), + cached_level integer, + link_to integer, + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: TABLE industries_backup; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE industries_backup IS 'Отраслевой рубрикатор, скоро умрет'; + + +-- +-- Name: industries_copy; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE industries_copy ( + id integer, + title character varying(255), + parent_id integer, + slug character varying(255), + lft integer, + rgt integer, + joined_path text, + cached_level integer, + is_visible boolean, + created_at timestamp without time zone, + updated_at timestamp without time zone, + keywords text, + title_short character varying(255) +); + + +-- +-- Name: industries_copy_copy; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE industries_copy_copy ( + id integer, + title character varying(255), + parent_id integer, + slug character varying(255), + lft integer, + rgt integer, + joined_path text, + cached_level integer, + is_visible boolean, + created_at timestamp without time zone, + updated_at timestamp without time zone, + keywords text, + title_short character varying(255) +); + + +-- +-- Name: industries_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE industries_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: industries_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE industries_id_seq OWNED BY industries_backup.id; + + +-- +-- Name: industries_id_seq1; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE industries_id_seq1 + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: industries_id_seq1; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE industries_id_seq1 OWNED BY industries.id; + + +-- +-- Name: industry_redirects; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE industry_redirects ( + id integer NOT NULL, + old_path character varying(255), + new_path character varying(255), + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: industry_redirects_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE industry_redirects_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: industry_redirects_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE industry_redirects_id_seq OWNED BY industry_redirects.id; + + +-- +-- Name: informer_prices; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE informer_prices ( + id integer NOT NULL, + informer_id integer, + date date, + min_price numeric, + max_price numeric, + avg_price numeric, + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: informer_prices_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE informer_prices_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: informer_prices_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE informer_prices_id_seq OWNED BY informer_prices.id; + + +-- +-- Name: informers; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE informers ( + id integer NOT NULL, + title character varying(255), + mini_weeks_amount integer, + big_weeks_amount integer, + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: informers_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE informers_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: informers_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE informers_id_seq OWNED BY informers.id; + + +-- +-- Name: ip_infos; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE ip_infos ( + id integer NOT NULL, + ip_start bigint NOT NULL, + ip_end bigint NOT NULL, + city_id integer NOT NULL +); + + +-- +-- Name: ip_infos_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE ip_infos_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: ip_infos_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE ip_infos_id_seq OWNED BY ip_infos.id; + + +-- +-- Name: last_date; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE last_date ( + updated_at timestamp without time zone +); + + +-- +-- Name: licenses; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE licenses ( + id integer NOT NULL, + company_id integer, + title character varying(255), + text text, + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: TABLE licenses; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE licenses IS 'Лицензии и сертификаты'; + + +-- +-- Name: COLUMN licenses.company_id; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN licenses.company_id IS 'Идентификатор компании'; + + +-- +-- Name: COLUMN licenses.title; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN licenses.title IS 'Заголовок - название документа'; + + +-- +-- Name: COLUMN licenses.text; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN licenses.text IS 'Текст - описание документа'; + + +-- +-- Name: licenses_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE licenses_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: licenses_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE licenses_id_seq OWNED BY licenses.id; + + +-- +-- Name: magazine_subscription_notification_emails; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE magazine_subscription_notification_emails ( + id integer NOT NULL, + city_id integer, + emails character varying(255), + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: magazine_subscription_notification_emails_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE magazine_subscription_notification_emails_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: magazine_subscription_notification_emails_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE magazine_subscription_notification_emails_id_seq OWNED BY magazine_subscription_notification_emails.id; + + +-- +-- Name: map_address_candidates; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE map_address_candidates ( + id integer NOT NULL, + street_id integer NOT NULL, + estate character varying(10) NOT NULL, + building character varying(40), + literal character varying(200), + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: TABLE map_address_candidates; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE map_address_candidates IS 'Кандидаты в адреса на карте'; + + +-- +-- Name: COLUMN map_address_candidates.street_id; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN map_address_candidates.street_id IS 'Улица'; + + +-- +-- Name: COLUMN map_address_candidates.estate; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN map_address_candidates.estate IS 'Номер дома'; + + +-- +-- Name: COLUMN map_address_candidates.building; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN map_address_candidates.building IS 'Корпус'; + + +-- +-- Name: COLUMN map_address_candidates.literal; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN map_address_candidates.literal IS 'Литера'; + + +-- +-- Name: map_address_candidates_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE map_address_candidates_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: map_address_candidates_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE map_address_candidates_id_seq OWNED BY map_address_candidates.id; + + +-- +-- Name: map_addresses; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE map_addresses ( + id integer NOT NULL, + dwelling_district_id integer, + adm_district_id integer, + street_id integer NOT NULL, + estate character varying(10) NOT NULL, + building character varying(40), + literal character varying(200), + created_at timestamp without time zone, + updated_at timestamp without time zone, + slug character varying(255) DEFAULT ''::character varying NOT NULL, + companies_count integer DEFAULT 0 NOT NULL, + "position" integer DEFAULT 0 NOT NULL +); + + +-- +-- Name: TABLE map_addresses; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE map_addresses IS 'Адреса на карте'; + + +-- +-- Name: COLUMN map_addresses.dwelling_district_id; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN map_addresses.dwelling_district_id IS 'Жилой район'; + + +-- +-- Name: COLUMN map_addresses.adm_district_id; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN map_addresses.adm_district_id IS 'Административный район'; + + +-- +-- Name: COLUMN map_addresses.street_id; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN map_addresses.street_id IS 'Улица'; + + +-- +-- Name: COLUMN map_addresses.estate; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN map_addresses.estate IS 'Номер дома'; + + +-- +-- Name: COLUMN map_addresses.building; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN map_addresses.building IS 'Корпус'; + + +-- +-- Name: COLUMN map_addresses.literal; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN map_addresses.literal IS 'Литера'; + + +-- +-- Name: COLUMN map_addresses.slug; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN map_addresses.slug IS 'Адрес дома для URL'; + + +-- +-- Name: COLUMN map_addresses.companies_count; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN map_addresses.companies_count IS 'Количество компаний, привязанных к адресу'; + + +-- +-- Name: map_addresses_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE map_addresses_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: map_addresses_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE map_addresses_id_seq OWNED BY map_addresses.id; + + +-- +-- Name: mappings; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE mappings ( + id integer NOT NULL, + subject_id integer, + subject_type character varying(255), + source_id integer, + external_id integer, + sync_direction integer, + last_sync_direction integer, + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: TABLE mappings; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE mappings IS 'deprecated'; + + +-- +-- Name: mappings_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE mappings_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: mappings_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE mappings_id_seq OWNED BY mappings.id; + + +-- +-- Name: measure_unit_groups; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE measure_unit_groups ( + id integer NOT NULL, + name character varying(255), + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: measure_unit_groups_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE measure_unit_groups_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: measure_unit_groups_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE measure_unit_groups_id_seq OWNED BY measure_unit_groups.id; + + +-- +-- Name: measure_units; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE measure_units ( + id integer NOT NULL, + name character varying(255), + measure_unit_group_id integer, + created_at timestamp without time zone, + updated_at timestamp without time zone, + name_plural_1 character varying(255), + name_plural_2 character varying(255) +); + + +-- +-- Name: measure_units_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE measure_units_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: measure_units_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE measure_units_id_seq OWNED BY measure_units.id; + + +-- +-- Name: migration_errors; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE migration_errors ( + id integer NOT NULL, + migration_id integer, + failure text, + created_at timestamp without time zone, + updated_at timestamp without time zone, + backtrace text, + failed_step integer, + failed_id integer +); + + +-- +-- Name: TABLE migration_errors; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE migration_errors IS 'Ошибки миграций данных'; + + +-- +-- Name: COLUMN migration_errors.failure; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN migration_errors.failure IS 'Текст ошибки'; + + +-- +-- Name: COLUMN migration_errors.backtrace; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN migration_errors.backtrace IS 'Трассировка'; + + +-- +-- Name: COLUMN migration_errors.failed_step; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN migration_errors.failed_step IS 'deprecated'; + + +-- +-- Name: COLUMN migration_errors.failed_id; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN migration_errors.failed_id IS 'deprecated'; + + +-- +-- Name: migration_errors_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE migration_errors_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: migration_errors_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE migration_errors_id_seq OWNED BY migration_errors.id; + + +-- +-- Name: migrations; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE migrations ( + id integer NOT NULL, + source_id integer, + state character varying(255), + external_started_at timestamp without time zone, + external_finished_at timestamp without time zone, + milestone integer, + last_success_id integer, + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: TABLE migrations; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE migrations IS 'Учетки миграций данных между сайтом и внешними источниками'; + + +-- +-- Name: COLUMN migrations.source_id; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN migrations.source_id IS 'ID внешнего источника (Оферта => source_id=7)'; + + +-- +-- Name: COLUMN migrations.state; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN migrations.state IS 'Состояние миграции'; + + +-- +-- Name: COLUMN migrations.external_started_at; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN migrations.external_started_at IS 'Время начала миграции по системному времени внешнего источника'; + + +-- +-- Name: COLUMN migrations.external_finished_at; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN migrations.external_finished_at IS 'deprecated'; + + +-- +-- Name: COLUMN migrations.milestone; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN migrations.milestone IS 'deprecated'; + + +-- +-- Name: COLUMN migrations.last_success_id; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN migrations.last_success_id IS 'deprecated'; + + +-- +-- Name: migrations_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE migrations_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: migrations_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE migrations_id_seq OWNED BY migrations.id; + + +-- +-- Name: native_region_regions; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE native_region_regions ( + id integer NOT NULL, + region_id integer, + native_region_id integer, + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: native_region_regions_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE native_region_regions_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: native_region_regions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE native_region_regions_id_seq OWNED BY native_region_regions.id; + + +-- +-- Name: news; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE news ( + id integer NOT NULL, + title character varying(255) NOT NULL, + lead character varying(200), + content text, + company_id integer, + created_at timestamp without time zone, + updated_at timestamp without time zone, + state character varying(255) DEFAULT 'active'::character varying NOT NULL, + decline_reason text, + hits integer DEFAULT 0, + moderator_comment text, + updated_by integer, + moderated_at timestamp without time zone, + published_at timestamp without time zone, + is_public boolean DEFAULT true, + created_by integer, + news_source_id integer, + region_id integer, + news_thematic_rubric_id integer, + news_type character varying(255) DEFAULT 'text'::character varying NOT NULL, + is_opinion boolean DEFAULT false NOT NULL, + is_editors_choice boolean DEFAULT false NOT NULL, + opinion_fio character varying(255), + opinion_company character varying(255), + comments_count integer DEFAULT 0, + news_aggregator boolean, + slug character varying(255), + company_news_rubric_id integer, + seo_content text, + in_twitter boolean DEFAULT false NOT NULL, + is_teaser boolean DEFAULT false NOT NULL, + yellow_title character varying(90), + delta boolean DEFAULT true NOT NULL, + import_from_old_dk boolean DEFAULT false NOT NULL, + import_from_blog boolean DEFAULT false NOT NULL, + vkontakte_rss boolean DEFAULT false NOT NULL, + facebook_rss boolean DEFAULT false NOT NULL, + is_video_news boolean DEFAULT false, + is_seo_request boolean DEFAULT false NOT NULL, + is_main_in_thematic_rubric boolean DEFAULT false, + wysiwyg_images_urls text, + seo_text text, + is_interview boolean DEFAULT false NOT NULL, + is_accented boolean DEFAULT false NOT NULL, + banner character varying(255) +); + + +-- +-- Name: TABLE news; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE news IS 'Новости компаний'; + + +-- +-- Name: COLUMN news.title; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN news.title IS 'Название новости'; + + +-- +-- Name: COLUMN news.lead; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN news.lead IS 'Вводка'; + + +-- +-- Name: COLUMN news.content; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN news.content IS 'Текст новости'; + + +-- +-- Name: COLUMN news.state; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN news.state IS 'Состояние новости'; + + +-- +-- Name: COLUMN news.decline_reason; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN news.decline_reason IS 'Причина отклонения новости модератором'; + + +-- +-- Name: COLUMN news.hits; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN news.hits IS 'Количество просмотров'; + + +-- +-- Name: COLUMN news.moderator_comment; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN news.moderator_comment IS 'Похоже, deprecated'; + + +-- +-- Name: COLUMN news.updated_by; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN news.updated_by IS 'Кто последний редактировал новость'; + + +-- +-- Name: COLUMN news.published_at; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN news.published_at IS 'Дата публикации'; + + +-- +-- Name: COLUMN news.is_public; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN news.is_public IS 'Новость видна'; + + +-- +-- Name: COLUMN news.is_video_news; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN news.is_video_news IS 'true = видео-новость (выставляется редактором в админке)'; + + +-- +-- Name: COLUMN news.is_seo_request; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN news.is_seo_request IS 'true = новость по сео-запросу (выставляется редактором в админке)'; + + +-- +-- Name: COLUMN news.is_main_in_thematic_rubric; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN news.is_main_in_thematic_rubric IS 'Главная (true) новость в тематической рубрике или нет (false)'; + + +-- +-- Name: COLUMN news.is_interview; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN news.is_interview IS 'true - новость с типом ''Рекламное интервью'''; + + +-- +-- Name: COLUMN news.banner; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN news.banner IS 'Поле "Флаг" - текстовый баннер для акцента на новости ("Исследование" и т.п.)'; + + +-- +-- Name: news_wiki_pages; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE news_wiki_pages ( + news_id integer, + wiki_page_id integer, + created_at timestamp without time zone, + updated_at timestamp without time zone, + id integer NOT NULL, + news_type character varying(255) NOT NULL, + text_with_tag text +); + + +-- +-- Name: COLUMN news_wiki_pages.text_with_tag; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN news_wiki_pages.text_with_tag IS 'Часть текста новости, в которой содержится тег (ссылка на вики)'; + + +-- +-- Name: news_editorials_wiki_pages_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE news_editorials_wiki_pages_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: news_editorials_wiki_pages_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE news_editorials_wiki_pages_id_seq OWNED BY news_wiki_pages.id; + + +-- +-- Name: news_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE news_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: news_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE news_id_seq OWNED BY news.id; + + +-- +-- Name: news_paid_placements; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE news_paid_placements ( + id integer NOT NULL, + news_id integer, + region_id integer, + news_thematic_rubric_id integer, + company_news_rubric_id integer, + news_type integer, + from_date timestamp without time zone, + till_date timestamp without time zone, + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: news_paid_placements_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE news_paid_placements_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: news_paid_placements_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE news_paid_placements_id_seq OWNED BY news_paid_placements.id; + + +-- +-- Name: news_regions; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE news_regions ( + id integer NOT NULL, + news_id integer, + region_id integer, + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: TABLE news_regions; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE news_regions IS 'Привязки новостей к регионам публикации'; + + +-- +-- Name: news_regions_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE news_regions_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: news_regions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE news_regions_id_seq OWNED BY news_regions.id; + + +-- +-- Name: news_regions_zones; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE news_regions_zones ( + id integer NOT NULL, + news_region_id integer, + news_zone_id integer, + from_date timestamp without time zone, + till_date timestamp without time zone, + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: news_regions_zones_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE news_regions_zones_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: news_regions_zones_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE news_regions_zones_id_seq OWNED BY news_regions_zones.id; + + +-- +-- Name: news_rubrics; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE news_rubrics ( + id integer NOT NULL, + news_id integer, + rubric_id integer, + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: TABLE news_rubrics; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE news_rubrics IS 'Привязки новостей к товарному рубрикатору'; + + +-- +-- Name: news_rubrics_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE news_rubrics_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: news_rubrics_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE news_rubrics_id_seq OWNED BY news_rubrics.id; + + +-- +-- Name: news_sources; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE news_sources ( + id integer NOT NULL, + name character varying(250) NOT NULL, + url character varying(1000) NOT NULL +); + + +-- +-- Name: news_sources_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE news_sources_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: news_sources_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE news_sources_id_seq OWNED BY news_sources.id; + + +-- +-- Name: news_thematic_news; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE news_thematic_news ( + id integer NOT NULL, + news_id integer, + thematic_news_id integer, + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: TABLE news_thematic_news; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE news_thematic_news IS 'Связки для блока "Новости по теме" на странице редакционной новости'; + + +-- +-- Name: COLUMN news_thematic_news.news_id; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN news_thematic_news.news_id IS 'ID главной новости, для которой строится блок "Новости по теме"'; + + +-- +-- Name: COLUMN news_thematic_news.thematic_news_id; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN news_thematic_news.thematic_news_id IS 'ID новости, выводимой в блок "Новости по теме"'; + + +-- +-- Name: news_thematic_news_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE news_thematic_news_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: news_thematic_news_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE news_thematic_news_id_seq OWNED BY news_thematic_news.id; + + +-- +-- Name: news_thematic_rubrics; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE news_thematic_rubrics ( + id integer NOT NULL, + slug character varying(255), + name character varying(255), + parent_id integer, + lft integer, + rgt integer, + sort_order integer, + cached_level integer, + created_at timestamp without time zone, + updated_at timestamp without time zone, + sort_on_root integer DEFAULT 0 +); + + +-- +-- Name: COLUMN news_thematic_rubrics.sort_on_root; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN news_thematic_rubrics.sort_on_root IS 'Сортировка рубрик на главной странице'; + + +-- +-- Name: news_thematic_rubrics_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE news_thematic_rubrics_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: news_thematic_rubrics_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE news_thematic_rubrics_id_seq OWNED BY news_thematic_rubrics.id; + + +-- +-- Name: news_zones; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE news_zones ( + id integer NOT NULL, + name character varying(50) NOT NULL +); + + +-- +-- Name: news_zones_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE news_zones_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: news_zones_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE news_zones_id_seq OWNED BY news_zones.id; + + +-- +-- Name: offline_regions; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE offline_regions ( + id integer NOT NULL, + region_id integer NOT NULL, + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: offline_regions_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE offline_regions_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: offline_regions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE offline_regions_id_seq OWNED BY offline_regions.id; + + +-- +-- Name: old_online_store_categories; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE old_online_store_categories ( + id integer NOT NULL, + online_store_id integer NOT NULL, + yml_id bigint NOT NULL, + title character varying(1000) NOT NULL, + created_at timestamp without time zone, + updated_at timestamp without time zone, + full_path character varying(1000), + rubric_id integer, + parent_yml_id integer +); + + +-- +-- Name: old_online_store_category_rubrics; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE old_online_store_category_rubrics ( + id integer NOT NULL, + online_store_id integer, + title character varying(1000) NOT NULL, + rubric_id integer, + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: old_online_store_import_logs; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE old_online_store_import_logs ( + id integer NOT NULL, + online_store_id integer, + imported_at timestamp without time zone NOT NULL, + status character varying(255), + exception text, + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: old_online_store_product_regions; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE old_online_store_product_regions ( + id integer NOT NULL, + online_store_product_id integer NOT NULL, + region_id integer NOT NULL, + is_printable boolean DEFAULT false NOT NULL, + price numeric(10,2), + price_max numeric(10,2), + is_exact_price boolean DEFAULT false NOT NULL, + currency integer, + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: old_online_store_products; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE old_online_store_products ( + id integer NOT NULL, + yml_id character varying(32), + online_store_id integer NOT NULL, + category_id integer, + rubric_id integer, + product_id integer, + name character varying(255) NOT NULL, + price numeric(10,2), + currency integer DEFAULT 3, + order_url character varying(1000), + paid_conditions character varying(255), + image_url character varying(1000), + image_url_crc bigint, + description text, + created_at timestamp without time zone, + updated_at timestamp without time zone, + oferta_sync_id integer, + delivery boolean, + pickup boolean, + available boolean, + local_delivery_cost integer, + is_exact_price boolean DEFAULT true, + price_max numeric(10,2), + is_last boolean DEFAULT false, + for_print boolean DEFAULT false NOT NULL, + announce character varying(255) DEFAULT ''::character varying, + tags character varying(255), + delivery_field character varying(75) +); + + +-- +-- Name: COLUMN old_online_store_products.price; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN old_online_store_products.price IS 'точная цена или цена "от" ценового диапазона'; + + +-- +-- Name: COLUMN old_online_store_products.is_exact_price; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN old_online_store_products.is_exact_price IS 'признак точной цены'; + + +-- +-- Name: COLUMN old_online_store_products.price_max; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN old_online_store_products.price_max IS 'цена "до" ценового диапазона'; + + +-- +-- Name: COLUMN old_online_store_products.is_last; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN old_online_store_products.is_last IS 'признак товара из последней загрузки'; + + +-- +-- Name: old_online_store_products_merge_errors; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE old_online_store_products_merge_errors ( + id integer NOT NULL, + online_store_product_id integer, + error_message text, + created_at timestamp without time zone, + updated_at timestamp without time zone, + online_store_id integer NOT NULL +); + + +-- +-- Name: old_online_store_schedules; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE old_online_store_schedules ( + id integer NOT NULL, + online_store_id integer NOT NULL, + day_of_week integer NOT NULL, + hour integer NOT NULL, + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: old_online_stores; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE old_online_stores ( + id integer NOT NULL, + company_id integer NOT NULL, + store_url character varying(255), + yml_url character varying(255), + is_prefix_used boolean DEFAULT false, + updated_by integer, + imported_at timestamp without time zone, + published_at timestamp without time zone, + state character varying(255) DEFAULT 'published'::character varying NOT NULL, + merge_result character varying(255), + created_at timestamp without time zone, + updated_at timestamp without time zone, + store_type character varying(255) DEFAULT 'online'::character varying NOT NULL, + is_extended_store boolean DEFAULT false, + parse_errors text, + parse_warnings text, + is_vendor_used boolean DEFAULT true, + copy_price_from_yml boolean DEFAULT false NOT NULL, + CONSTRAINT check_online_stores_store_type CHECK (((store_type)::text = ANY (ARRAY[('client'::character varying)::text, ('redaction'::character varying)::text, ('online'::character varying)::text]))) +); + + +-- +-- Name: COLUMN old_online_stores.store_type; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN old_online_stores.store_type IS 'Тип интернет-магазина (клиентский, редакторский)'; + + +-- +-- Name: COLUMN old_online_stores.is_extended_store; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN old_online_stores.is_extended_store IS 'метка "Добавлять товары"'; + + +-- +-- Name: COLUMN old_online_stores.is_vendor_used; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN old_online_stores.is_vendor_used IS 'Признак использовать имя вендора в названии товара'; + + +-- +-- Name: online_store_categories_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE online_store_categories_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: online_store_categories_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE online_store_categories_id_seq OWNED BY old_online_store_categories.id; + + +-- +-- Name: online_store_category_rubrics_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE online_store_category_rubrics_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: online_store_category_rubrics_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE online_store_category_rubrics_id_seq OWNED BY old_online_store_category_rubrics.id; + + +-- +-- Name: online_store_import_logs_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE online_store_import_logs_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: online_store_import_logs_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE online_store_import_logs_id_seq OWNED BY old_online_store_import_logs.id; + + +-- +-- Name: online_store_product_regions_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE online_store_product_regions_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: online_store_product_regions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE online_store_product_regions_id_seq OWNED BY old_online_store_product_regions.id; + + +-- +-- Name: online_store_products_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE online_store_products_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: online_store_products_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE online_store_products_id_seq OWNED BY old_online_store_products.id; + + +-- +-- Name: online_store_products_merge_errors_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE online_store_products_merge_errors_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: online_store_products_merge_errors_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE online_store_products_merge_errors_id_seq OWNED BY old_online_store_products_merge_errors.id; + + +-- +-- Name: online_store_schedules_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE online_store_schedules_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: online_store_schedules_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE online_store_schedules_id_seq OWNED BY old_online_store_schedules.id; + + +-- +-- Name: online_stores_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE online_stores_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: online_stores_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE online_stores_id_seq OWNED BY old_online_stores.id; + + +-- +-- Name: online_users; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE online_users ( + user_id integer NOT NULL, + last_seen timestamp without time zone, + last_seen_date date NOT NULL +); + + +-- +-- Name: TABLE online_users; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE online_users IS 'Таблица пользователей online'; + + +-- +-- Name: COLUMN online_users.last_seen; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN online_users.last_seen IS 'Когда последний раз был'; + + +-- +-- Name: COLUMN online_users.last_seen_date; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN online_users.last_seen_date IS 'last_seen округленный до дня (дата последнего присутствия онлайн)'; + + +-- +-- Name: online_users_stat_by_days; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE online_users_stat_by_days ( + id integer NOT NULL, + date date, + users_count integer, + ppc_count integer, + total integer, + users_with_company_count integer DEFAULT 0, + users_without_company_count integer DEFAULT 0 +); + + +-- +-- Name: online_users_stat_by_days_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE online_users_stat_by_days_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: online_users_stat_by_days_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE online_users_stat_by_days_id_seq OWNED BY online_users_stat_by_days.id; + + +-- +-- Name: online_users_stat_by_hours; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE online_users_stat_by_hours ( + id integer NOT NULL, + hour integer, + date date, + users_count integer, + ppc_count integer, + total integer, + users_with_company_count integer DEFAULT 0, + users_without_company_count integer DEFAULT 0 +); + + +-- +-- Name: online_users_stat_by_hours_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE online_users_stat_by_hours_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: online_users_stat_by_hours_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE online_users_stat_by_hours_id_seq OWNED BY online_users_stat_by_hours.id; + + +-- +-- Name: online_users_stat_by_mins; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE online_users_stat_by_mins ( + id integer NOT NULL, + dt timestamp without time zone, + users_count integer, + ppc_count integer, + users_with_company_count integer, + users_without_company_count integer, + total integer +); + + +-- +-- Name: online_users_stat_by_mins_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE online_users_stat_by_mins_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: online_users_stat_by_mins_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE online_users_stat_by_mins_id_seq OWNED BY online_users_stat_by_mins.id; + + +-- +-- Name: online_users_stat_by_months; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE online_users_stat_by_months ( + id integer NOT NULL, + date date, + users_count integer, + ppc_count integer, + total integer, + users_with_company_count integer DEFAULT 0, + users_without_company_count integer DEFAULT 0 +); + + +-- +-- Name: online_users_stat_by_months_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE online_users_stat_by_months_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: online_users_stat_by_months_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE online_users_stat_by_months_id_seq OWNED BY online_users_stat_by_months.id; + + +-- +-- Name: packet_discounts; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE packet_discounts ( + id integer NOT NULL, + packet_id integer NOT NULL, + cost integer NOT NULL, + description text, + state character varying(10) DEFAULT 'normal'::character varying NOT NULL, + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: TABLE packet_discounts; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE packet_discounts IS 'Скидки на пакеты'; + + +-- +-- Name: packet_discounts_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE packet_discounts_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: packet_discounts_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE packet_discounts_id_seq OWNED BY packet_discounts.id; + + +-- +-- Name: packet_region_settings; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE packet_region_settings ( + id integer NOT NULL, + packet_id integer NOT NULL, + region_id integer NOT NULL, + "limit" integer, + price integer, + cnt integer DEFAULT 1 NOT NULL, + portal_listing_is_phone_visible boolean DEFAULT false NOT NULL, + company_site_is_template_editable boolean DEFAULT false NOT NULL, + company_site_is_extended_text_formating boolean DEFAULT false NOT NULL, + company_site_product_images_count integer DEFAULT 1 NOT NULL, + company_site_price_list_files_count integer DEFAULT 1 NOT NULL, + company_site_docs_files_count integer DEFAULT 1 NOT NULL, + company_site_is_bottom_yandex_direct boolean DEFAULT true NOT NULL, + company_site_is_side_yandex_direct boolean DEFAULT true NOT NULL, + company_site_is_reviews_deletable boolean DEFAULT true NOT NULL, + common_is_online_billing boolean DEFAULT true NOT NULL, + created_at timestamp without time zone, + updated_at timestamp without time zone, + company_site_messenger_is_visible boolean DEFAULT false NOT NULL, + company_site_messenger_code text, + sms_informing boolean DEFAULT false NOT NULL +); + + +-- +-- Name: TABLE packet_region_settings; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE packet_region_settings IS 'Свойства пакетов в регионах'; + + +-- +-- Name: packet_region_settings_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE packet_region_settings_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: packet_region_settings_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE packet_region_settings_id_seq OWNED BY packet_region_settings.id; + + +-- +-- Name: packets; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE packets ( + id integer NOT NULL, + title character varying(128), + slug character varying(128), + sort_priority integer NOT NULL, + stars_count integer NOT NULL, + created_at timestamp without time zone, + updated_at timestamp without time zone, + title_short character varying(32) +); + + +-- +-- Name: TABLE packets; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE packets IS 'Пакеты'; + + +-- +-- Name: packets_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE packets_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: packets_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE packets_id_seq OWNED BY packets.id; + + +-- +-- Name: page_descriptions; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE page_descriptions ( + id integer NOT NULL, + region_id integer, + url character varying(255) NOT NULL, + title text, + description text, + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: TABLE page_descriptions; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE page_descriptions IS 'Заголовки и описания для страниц на портале'; + + +-- +-- Name: page_descriptions_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE page_descriptions_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: page_descriptions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE page_descriptions_id_seq OWNED BY page_descriptions.id; + + +-- +-- Name: payment_systems; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE payment_systems ( + id integer NOT NULL, + title character varying(128) NOT NULL, + system_type character varying(128) +); + + +-- +-- Name: TABLE payment_systems; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE payment_systems IS 'Справочник платежных систем'; + + +-- +-- Name: COLUMN payment_systems.title; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN payment_systems.title IS 'Название'; + + +-- +-- Name: COLUMN payment_systems.system_type; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN payment_systems.system_type IS 'Тип'; + + +-- +-- Name: payment_systems_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE payment_systems_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: payment_systems_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE payment_systems_id_seq OWNED BY payment_systems.id; + + +-- +-- Name: phone_types; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE phone_types ( + id integer NOT NULL, + name character varying(128) NOT NULL, + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: TABLE phone_types; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE phone_types IS 'Справочник типов телефонов'; + + +-- +-- Name: phone_types_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE phone_types_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: phone_types_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE phone_types_id_seq OWNED BY phone_types.id; + + +-- +-- Name: phones; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE phones ( + id integer NOT NULL, + code character varying(9) NOT NULL, + number character varying(9) NOT NULL, + address_id integer NOT NULL, + type_id integer NOT NULL, + comment character varying(250), + created_at timestamp without time zone, + updated_at timestamp without time zone, + "position" integer NOT NULL, + show_in_header boolean, + CONSTRAINT chk_phones_code_numericality CHECK (((code)::text ~ '^[0-9]+$'::text)), + CONSTRAINT chk_phones_number_numericality CHECK (((number)::text ~ '^[0-9]+$'::text)), + CONSTRAINT chk_phones_phone_len CHECK (((length(((code)::text || (number)::text)) >= 8) AND (length(((code)::text || (number)::text)) <= 11))) +); + + +-- +-- Name: TABLE phones; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE phones IS 'Телефоны усадеб компаний'; + + +-- +-- Name: COLUMN phones.code; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN phones.code IS 'Код'; + + +-- +-- Name: COLUMN phones.number; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN phones.number IS 'Номер'; + + +-- +-- Name: COLUMN phones.comment; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN phones.comment IS 'Комментарий'; + + +-- +-- Name: COLUMN phones."position"; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN phones."position" IS 'Порядковый номер телефона внутри усадьбы'; + + +-- +-- Name: COLUMN phones.show_in_header; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN phones.show_in_header IS 'Показывать этот номер в шапке сайта компании'; + + +-- +-- Name: phones_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE phones_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: phones_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE phones_id_seq OWNED BY phones.id; + + +-- +-- Name: poll_answers; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE poll_answers ( + id integer NOT NULL, + poll_question_id integer, + title character varying(255), + "position" integer, + stop_poll boolean DEFAULT false, + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: poll_answers_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE poll_answers_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: poll_answers_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE poll_answers_id_seq OWNED BY poll_answers.id; + + +-- +-- Name: poll_questions; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE poll_questions ( + id integer NOT NULL, + poll_step_id integer, + title text, + "position" integer, + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: poll_questions_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE poll_questions_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: poll_questions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE poll_questions_id_seq OWNED BY poll_questions.id; + + +-- +-- Name: poll_steps; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE poll_steps ( + id integer NOT NULL, + poll_id integer, + description text, + "position" integer, + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: poll_steps_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE poll_steps_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: poll_steps_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE poll_steps_id_seq OWNED BY poll_steps.id; + + +-- +-- Name: poll_votes; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE poll_votes ( + id integer NOT NULL, + poll_id integer, + poll_question_id integer, + poll_answer_id integer, + user_id integer +); + + +-- +-- Name: poll_votes_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE poll_votes_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: poll_votes_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE poll_votes_id_seq OWNED BY poll_votes.id; + + +-- +-- Name: polls; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE polls ( + id integer NOT NULL, + title character varying(255), + slug character varying(255), + steps integer, + finish_text text, + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: polls_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE polls_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: polls_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE polls_id_seq OWNED BY polls.id; + + +-- +-- Name: prerendered_rubricators; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE prerendered_rubricators ( + id integer NOT NULL, + rubric_id integer NOT NULL, + region_id integer NOT NULL, + prerendered classes.catalogue_rubric[] +); + + +-- +-- Name: TABLE prerendered_rubricators; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE prerendered_rubricators IS 'Заранее вычисленные страницы товарного рубрикатора для сайта'; + + +-- +-- Name: prerendered_rubricators_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE prerendered_rubricators_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: prerendered_rubricators_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE prerendered_rubricators_id_seq OWNED BY prerendered_rubricators.id; + + +-- +-- Name: price_list_rows; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE price_list_rows ( + id integer NOT NULL, + company_id integer, + rubric_id integer, + is_empty boolean, + currency integer, + is_deleted boolean, + title character varying(255) NOT NULL, + is_demand boolean, + title_full character varying(255), + is_exact boolean, + regions character varying(4000) NOT NULL, + "position" integer, + created_at timestamp without time zone, + updated_at timestamp without time zone, + rubric_l1_id integer, + rubric_l2_id integer, + rubric_l3_id integer, + rubric_l4_id integer, + price double precision, + price_max double precision, + price_uni double precision, + product_id integer, + sort_level integer, + actualization_date timestamp without time zone +); + + +-- +-- Name: TABLE price_list_rows; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE price_list_rows IS 'Лоты'; + + +-- +-- Name: COLUMN price_list_rows.is_empty; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN price_list_rows.is_empty IS 'deprecated'; + + +-- +-- Name: COLUMN price_list_rows.currency; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN price_list_rows.currency IS 'Код валюты (модель Currency)'; + + +-- +-- Name: COLUMN price_list_rows.is_deleted; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN price_list_rows.is_deleted IS 'Удален ли лот'; + + +-- +-- Name: COLUMN price_list_rows.title; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN price_list_rows.title IS 'Название лота'; + + +-- +-- Name: COLUMN price_list_rows.is_demand; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN price_list_rows.is_demand IS 'Признак того, что это спрос'; + + +-- +-- Name: COLUMN price_list_rows.title_full; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN price_list_rows.title_full IS 'Полное название, сейчас не используется'; + + +-- +-- Name: COLUMN price_list_rows.is_exact; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN price_list_rows.is_exact IS 'Признак, что указана точная цена'; + + +-- +-- Name: COLUMN price_list_rows.regions; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN price_list_rows.regions IS 'В каких регионах публикуется лот'; + + +-- +-- Name: COLUMN price_list_rows."position"; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN price_list_rows."position" IS 'Порядковый номер лота, сейчас не используется'; + + +-- +-- Name: COLUMN price_list_rows.rubric_l1_id; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN price_list_rows.rubric_l1_id IS 'Денормализация: привязка к рубрике 1 уровня'; + + +-- +-- Name: COLUMN price_list_rows.rubric_l2_id; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN price_list_rows.rubric_l2_id IS 'Денормализация: привязка к рубрике 2 уровня'; + + +-- +-- Name: COLUMN price_list_rows.rubric_l3_id; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN price_list_rows.rubric_l3_id IS 'Денормализация: привязка к рубрике 3 уровня'; + + +-- +-- Name: COLUMN price_list_rows.rubric_l4_id; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN price_list_rows.rubric_l4_id IS 'Денормализация: привязка к рубрике 4 уровня'; + + +-- +-- Name: COLUMN price_list_rows.price; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN price_list_rows.price IS 'Цена от'; + + +-- +-- Name: COLUMN price_list_rows.price_max; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN price_list_rows.price_max IS 'Цена до'; + + +-- +-- Name: COLUMN price_list_rows.price_uni; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN price_list_rows.price_uni IS 'Унифицированная цена, переведенная в рубли'; + + +-- +-- Name: COLUMN price_list_rows.product_id; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN price_list_rows.product_id IS 'deprecated'; + + +-- +-- Name: COLUMN price_list_rows.sort_level; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN price_list_rows.sort_level IS 'Уровень сортировки лота'; + + +-- +-- Name: COLUMN price_list_rows.actualization_date; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN price_list_rows.actualization_date IS 'Дата акутализации'; + + +-- +-- Name: price_list_rows_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE price_list_rows_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: price_list_rows_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE price_list_rows_id_seq OWNED BY price_list_rows.id; + + +-- +-- Name: product_announce_categories; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE product_announce_categories ( + id integer NOT NULL, + name character varying(255), + kind character varying(255), + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: TABLE product_announce_categories; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE product_announce_categories IS 'признаки для товаров и услуг'; + + +-- +-- Name: product_announce_categories_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE product_announce_categories_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: product_announce_categories_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE product_announce_categories_id_seq OWNED BY product_announce_categories.id; + + +-- +-- Name: product_announce_patterns; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE product_announce_patterns ( + id integer NOT NULL, + product_announce_category_id integer, + value text, + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: TABLE product_announce_patterns; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE product_announce_patterns IS 'шаблоны для описания товаров и услуг'; + + +-- +-- Name: product_announce_patterns_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE product_announce_patterns_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: product_announce_patterns_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE product_announce_patterns_id_seq OWNED BY product_announce_patterns.id; + + +-- +-- Name: product_deltas; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE product_deltas ( + id integer NOT NULL, + company_id integer NOT NULL, + product_id integer NOT NULL, + is_new boolean DEFAULT false NOT NULL, + in_process boolean DEFAULT false, + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: product_deltas_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE product_deltas_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: product_deltas_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE product_deltas_id_seq OWNED BY product_deltas.id; + + +-- +-- Name: product_description_stats; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE product_description_stats ( + id integer NOT NULL, + product_id integer, + company_id integer, + length integer +); + + +-- +-- Name: product_description_stats_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE product_description_stats_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: product_description_stats_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE product_description_stats_id_seq OWNED BY product_description_stats.id; + + +-- +-- Name: product_group_images; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE product_group_images ( + id integer NOT NULL, + product_group_id integer, + image_file_name character varying(255), + image_content_type character varying(255), + image_file_size integer, + image_updated_at timestamp without time zone +); + + +-- +-- Name: product_group_images_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE product_group_images_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: product_group_images_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE product_group_images_id_seq OWNED BY product_group_images.id; + + +-- +-- Name: product_groups; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE product_groups ( + id integer NOT NULL, + company_id integer, + name character varying(255), + description text, + "position" integer, + created_at timestamp without time zone, + updated_at timestamp without time zone, + page_title character varying(255), + url_name character varying(255), + parent_id integer, + depth integer DEFAULT 0 NOT NULL, + CONSTRAINT valid_parent_id CHECK ((COALESCE(parent_id, 0) <> id)) +); + + +-- +-- Name: TABLE product_groups; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE product_groups IS 'Пользовательские группы товаров (упрощённый аналог рубрикатора ПЦ)'; + + +-- +-- Name: product_groups_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE product_groups_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: product_groups_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE product_groups_id_seq OWNED BY product_groups.id; + + +-- +-- Name: product_images; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE product_images ( + id integer NOT NULL, + product_id integer, + "position" integer DEFAULT 1 NOT NULL, + img_file_name character varying(255), + img_content_type character varying(255), + img_file_size integer, + comment character varying(255), + created_at timestamp without time zone, + updated_at timestamp without time zone, + processing boolean DEFAULT false, + img_fingerprint character varying(32), + img_url text +); + + +-- +-- Name: product_images_1; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE product_images_1 ( + id integer, + product_id integer, + "position" integer +); + + +-- +-- Name: product_images_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE product_images_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: product_images_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE product_images_id_seq OWNED BY product_images.id; + + +-- +-- Name: product_price_list_rows; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE product_price_list_rows ( + id integer NOT NULL, + product_id integer, + price_list_row_id integer, + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: TABLE product_price_list_rows; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE product_price_list_rows IS 'Привязки лотов к товарам'; + + +-- +-- Name: product_price_list_rows_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE product_price_list_rows_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: product_price_list_rows_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE product_price_list_rows_id_seq OWNED BY product_price_list_rows.id; + + +-- +-- Name: product_properties; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE product_properties ( + id integer NOT NULL, + product_id integer, + price numeric, + price_max numeric, + is_exact_price boolean DEFAULT true NOT NULL, + currency integer DEFAULT 3, + "exists" boolean, + updated_at timestamp without time zone, + actualized_at timestamp without time zone, + rate integer +); + + +-- +-- Name: product_properties_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE product_properties_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: product_properties_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE product_properties_id_seq OWNED BY product_properties.id; + + +-- +-- Name: product_regions_backup; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE product_regions_backup ( + id integer NOT NULL, + product_id integer NOT NULL, + region_id integer NOT NULL, + is_printable boolean DEFAULT false, + is_public boolean DEFAULT false, + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: product_regions_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE product_regions_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: product_regions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE product_regions_id_seq OWNED BY product_regions_backup.id; + + +-- +-- Name: product_regions; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE product_regions ( + id integer DEFAULT nextval('product_regions_id_seq'::regclass) NOT NULL, + product_id integer, + region_id integer, + is_printable boolean, + is_public boolean, + created_at timestamp without time zone, + updated_at timestamp without time zone, + price numeric, + price_max numeric, + is_exact_price boolean DEFAULT true NOT NULL, + currency integer DEFAULT 3, + deleted_at timestamp without time zone, + is_deleted boolean DEFAULT false NOT NULL +); + + +-- +-- Name: product_url_names; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE product_url_names ( + id integer NOT NULL, + product_id integer, + url_name character varying(255), + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: product_url_names_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE product_url_names_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: product_url_names_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE product_url_names_id_seq OWNED BY product_url_names.id; + + +-- +-- Name: products_221_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE products_221_id_seq + START WITH 4607029 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: products_222_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE products_222_id_seq + START WITH 4628718 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: products_223_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE products_223_id_seq + START WITH 4633627 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: products_224_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE products_224_id_seq + START WITH 4638198 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: products_225_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE products_225_id_seq + START WITH 4645085 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: products_226_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE products_226_id_seq + START WITH 4653550 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: products_227_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE products_227_id_seq + START WITH 4669749 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: products_228_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE products_228_id_seq + START WITH 4672534 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: products_229_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE products_229_id_seq + START WITH 4698009 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: products_230_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE products_230_id_seq + START WITH 4703533 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: products_231_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE products_231_id_seq + START WITH 4709942 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: products_232_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE products_232_id_seq + START WITH 4723282 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: products_233_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE products_233_id_seq + START WITH 4727066 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: products_234_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE products_234_id_seq + START WITH 4732883 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: products_236_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE products_236_id_seq + START WITH 4742789 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: products_237_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE products_237_id_seq + START WITH 4763196 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: products_238_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE products_238_id_seq + START WITH 4766499 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: products_239_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE products_239_id_seq + START WITH 4772409 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: products_240_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE products_240_id_seq + START WITH 4774574 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: products_241_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE products_241_id_seq + START WITH 4787780 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: products_243_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE products_243_id_seq + START WITH 4800807 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: products_244_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE products_244_id_seq + START WITH 4810052 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: products_246_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE products_246_id_seq + START WITH 4828184 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: products_247_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE products_247_id_seq + START WITH 4830342 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: products_248_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE products_248_id_seq + START WITH 4841583 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: products_249_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE products_249_id_seq + START WITH 4853156 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: products_250_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE products_250_id_seq + START WITH 4858125 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: products_251_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE products_251_id_seq + START WITH 4863175 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: products_252_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE products_252_id_seq + START WITH 4864309 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: products_253_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE products_253_id_seq + START WITH 4868019 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: products_254_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE products_254_id_seq + START WITH 4875850 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: products_255_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE products_255_id_seq + START WITH 4880948 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: products_256_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE products_256_id_seq + START WITH 4885355 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: products_257_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE products_257_id_seq + START WITH 4893538 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: products_258_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE products_258_id_seq + START WITH 4909589 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: products_259_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE products_259_id_seq + START WITH 4919164 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: products_260_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE products_260_id_seq + START WITH 4932261 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: products_261_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE products_261_id_seq + START WITH 4936126 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: products_262_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE products_262_id_seq + START WITH 4940602 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: products_263_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE products_263_id_seq + START WITH 4951024 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: products_264_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE products_264_id_seq + START WITH 4959950 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: products_265_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE products_265_id_seq + START WITH 4981828 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: products_266_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE products_266_id_seq + START WITH 4984585 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: products_267_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE products_267_id_seq + START WITH 4986029 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: products_268_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE products_268_id_seq + START WITH 4994335 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: products_269_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE products_269_id_seq + START WITH 5000981 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: products_270_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE products_270_id_seq + START WITH 5015218 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: products_271_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE products_271_id_seq + START WITH 5017997 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: products_272_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE products_272_id_seq + START WITH 5023548 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: products_273_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE products_273_id_seq + START WITH 5029877 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: products_274_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE products_274_id_seq + START WITH 5039964 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: products_275_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE products_275_id_seq + START WITH 5045452 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: products_276_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE products_276_id_seq + START WITH 5062164 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: products_277_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE products_277_id_seq + START WITH 5069140 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: products_278_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE products_278_id_seq + START WITH 5076032 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: products_279_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE products_279_id_seq + START WITH 5093403 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: products_280_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE products_280_id_seq + START WITH 5102008 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: products_281_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE products_281_id_seq + START WITH 5105281 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: products_282_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE products_282_id_seq + START WITH 5110477 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: products_283_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE products_283_id_seq + START WITH 5120125 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: products_284_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE products_284_id_seq + START WITH 5129030 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: products_285_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE products_285_id_seq + START WITH 5133463 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: products_286_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE products_286_id_seq + START WITH 5135724 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: products_287_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE products_287_id_seq + START WITH 5138125 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: products_288_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE products_288_id_seq + START WITH 5139474 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: products_289_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE products_289_id_seq + START WITH 5147418 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: products_290_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE products_290_id_seq + START WITH 5152068 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: products_291_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE products_291_id_seq + START WITH 5153093 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: products_292_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE products_292_id_seq + START WITH 5154020 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: products_293_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE products_293_id_seq + START WITH 5154547 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: products_294_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE products_294_id_seq + START WITH 5155189 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: products_295_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE products_295_id_seq + START WITH 5156168 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: products_296_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE products_296_id_seq + START WITH 5156607 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: products_297_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE products_297_id_seq + START WITH 5158904 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: products_298_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE products_298_id_seq + START WITH 5159981 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: products_299_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE products_299_id_seq + START WITH 5168325 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: products_300_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE products_300_id_seq + START WITH 5170983 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: products_301_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE products_301_id_seq + START WITH 5175826 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: products_302_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE products_302_id_seq + START WITH 5180230 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: products_303_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE products_303_id_seq + START WITH 5193133 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: products_304_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE products_304_id_seq + START WITH 5194683 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: products_305_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE products_305_id_seq + START WITH 5218410 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: products_306_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE products_306_id_seq + START WITH 5223422 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: products_307_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE products_307_id_seq + START WITH 5231520 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: products_308_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE products_308_id_seq + START WITH 5239539 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: products_309_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE products_309_id_seq + START WITH 5255743 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: products_310_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE products_310_id_seq + START WITH 5261355 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: products_311_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE products_311_id_seq + START WITH 5271132 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: products_312_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE products_312_id_seq + START WITH 5285792 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: products_313_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE products_313_id_seq + START WITH 5298666 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: products_314_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE products_314_id_seq + START WITH 5302816 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: products_315_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE products_315_id_seq + START WITH 5316705 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: products_316_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE products_316_id_seq + START WITH 5326741 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: products_317_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE products_317_id_seq + START WITH 5339266 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: products_318_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE products_318_id_seq + START WITH 5353285 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: products_319_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE products_319_id_seq + START WITH 5366845 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: products_320_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE products_320_id_seq + START WITH 5375710 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: products_321_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE products_321_id_seq + START WITH 5379596 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: products_322_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE products_322_id_seq + START WITH 5389661 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: products_323_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE products_323_id_seq + START WITH 5398122 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: products_324_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE products_324_id_seq + START WITH 5426565 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: products_325_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE products_325_id_seq + START WITH 5427278 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: products_326_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE products_326_id_seq + START WITH 5434340 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: products_327_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE products_327_id_seq + START WITH 5459657 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: products_328_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE products_328_id_seq + START WITH 5466780 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: products_329_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE products_329_id_seq + START WITH 5477557 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: products_330_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE products_330_id_seq + START WITH 5485062 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: products_331_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE products_331_id_seq + START WITH 5494465 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: products_332_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE products_332_id_seq + START WITH 5504514 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: products_333_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE products_333_id_seq + START WITH 5517325 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: products_334_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE products_334_id_seq + START WITH 5526657 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: products_aa; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE products_aa ( + id integer, + state product_state DEFAULT 'pending'::product_state NOT NULL +); + + +-- +-- Name: provinces; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE provinces ( + id integer NOT NULL, + name character varying(128) NOT NULL, + region_id integer, + country_id integer, + created_at timestamp without time zone, + updated_at timestamp without time zone, + name_genitive character varying(255), + name_rest character varying(255), + name_rest_genitive character varying(255) +); + + +-- +-- Name: TABLE provinces; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE provinces IS 'Справочник областей'; + + +-- +-- Name: COLUMN provinces.name; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN provinces.name IS 'Название области'; + + +-- +-- Name: provinces_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE provinces_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: provinces_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE provinces_id_seq OWNED BY provinces.id; + + +-- +-- Name: pul_ru_sites_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE pul_ru_sites_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: redactor_images; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE redactor_images ( + id integer NOT NULL, + image_file_name character varying(255), + image_content_type character varying(255), + image_file_size integer, + image_updated_at timestamp without time zone, + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: redactor_images_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE redactor_images_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: redactor_images_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE redactor_images_id_seq OWNED BY redactor_images.id; + + +-- +-- Name: redirects; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE redirects ( + id integer NOT NULL, + from_url text NOT NULL, + to_url text NOT NULL, + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: redirects_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE redirects_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: redirects_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE redirects_id_seq OWNED BY redirects.id; + + +-- +-- Name: region_contacts; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE region_contacts ( + id integer NOT NULL, + region_id integer NOT NULL, + user_id integer NOT NULL, + created_at timestamp without time zone, + updated_at timestamp without time zone, + job character varying(255) +); + + +-- +-- Name: region_contacts_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE region_contacts_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: region_contacts_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE region_contacts_id_seq OWNED BY region_contacts.id; + + +-- +-- Name: region_footer_contacts; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE region_footer_contacts ( + id integer NOT NULL, + region_id integer, + html text, + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: region_footer_contacts_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE region_footer_contacts_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: region_footer_contacts_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE region_footer_contacts_id_seq OWNED BY region_footer_contacts.id; + + +-- +-- Name: region_packets; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE region_packets ( + id integer NOT NULL, + region_id integer NOT NULL, + packet integer NOT NULL, + "limit" integer, + price integer, + created_at timestamp without time zone, + updated_at timestamp without time zone, + cnt integer DEFAULT 1 NOT NULL +); + + +-- +-- Name: COLUMN region_packets.cnt; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN region_packets.cnt IS 'Кол-во (для онлайн-выписки счета)'; + + +-- +-- Name: region_packets_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE region_packets_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: region_packets_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE region_packets_id_seq OWNED BY region_packets.id; + + +-- +-- Name: regions; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE regions ( + id integer NOT NULL, + name character varying(128) NOT NULL, + name_lat character varying(128) NOT NULL, + created_at timestamp without time zone, + updated_at timestamp without time zone, + parent_id integer, + name_genitive character varying(255), + capital_id integer, + paid boolean, + lft integer, + rgt integer, + timezone character varying(255), + abbrev character varying(255), + firms_statistics integer, + products_statistics integer, + spros_statistics integer, + providers_statistics integer, + name_prepositional character varying(255), + old_name character varying(255), + domain character varying(255), + region_type character varying(20), + name_accusative character varying(255), + name_adjective_masculine character varying(255), + name_adjective_feminine character varying(255), + name_adjective_neuter character varying(255), + name_adjective_plural character varying(255), + province_name_prepositional character varying(255), + residents_name character varying(255), + unique_name_prepositional character varying(255), + full_name_lat character varying(255), + use_test_packet boolean DEFAULT false, + use_in_domains boolean DEFAULT true, + footer_link_1_title character varying(255), + footer_link_1_href character varying(255), + footer_link_2_title character varying(255), + footer_link_2_href character varying(255), + footer_link_3_title character varying(255), + footer_link_3_href character varying(255), + products_count_for_test_packet integer, + show_regional_price boolean DEFAULT false NOT NULL, + name_genitive_with_preposition character varying(255), + is_printable boolean DEFAULT false +); + + +-- +-- Name: TABLE regions; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE regions IS 'Справочник регионов'; + + +-- +-- Name: COLUMN regions.name; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN regions.name IS 'Название региона по-русски'; + + +-- +-- Name: COLUMN regions.name_lat; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN regions.name_lat IS 'Адрес на сайте'; + + +-- +-- Name: COLUMN regions.name_genitive; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN regions.name_genitive IS 'Название в родительском падеже'; + + +-- +-- Name: COLUMN regions.capital_id; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN regions.capital_id IS 'Главный город'; + + +-- +-- Name: COLUMN regions.paid; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN regions.paid IS 'Признак, что регион - редакционный'; + + +-- +-- Name: COLUMN regions.lft; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN regions.lft IS 'Левый идентификатор в дереве nested sets'; + + +-- +-- Name: COLUMN regions.rgt; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN regions.rgt IS 'Правый идентификатор в дереве nested sets'; + + +-- +-- Name: COLUMN regions.timezone; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN regions.timezone IS 'Часовой пояс региона'; + + +-- +-- Name: COLUMN regions.abbrev; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN regions.abbrev IS 'Аббревиатура'; + + +-- +-- Name: COLUMN regions.firms_statistics; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN regions.firms_statistics IS 'Статистика по фирмам'; + + +-- +-- Name: COLUMN regions.products_statistics; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN regions.products_statistics IS 'Статистика по товарам'; + + +-- +-- Name: COLUMN regions.spros_statistics; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN regions.spros_statistics IS 'Статистика по спросу'; + + +-- +-- Name: COLUMN regions.providers_statistics; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN regions.providers_statistics IS 'Количество поставщиков лотов и товаров'; + + +-- +-- Name: COLUMN regions.region_type; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN regions.region_type IS 'Тип региона (страна, область, город)'; + + +-- +-- Name: COLUMN regions.name_adjective_masculine; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN regions.name_adjective_masculine IS 'Региональное прилагательное мужского рода'; + + +-- +-- Name: COLUMN regions.name_adjective_feminine; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN regions.name_adjective_feminine IS 'Региональное прилагательное женского рода'; + + +-- +-- Name: COLUMN regions.name_adjective_neuter; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN regions.name_adjective_neuter IS 'Региональное прилагательное среднего рода'; + + +-- +-- Name: COLUMN regions.name_adjective_plural; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN regions.name_adjective_plural IS 'Региональное прилагательное во множественном числе'; + + +-- +-- Name: COLUMN regions.province_name_prepositional; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN regions.province_name_prepositional IS 'Название области в предложном падеже'; + + +-- +-- Name: COLUMN regions.residents_name; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN regions.residents_name IS 'Географическое название местных жителей (например, екатеринбуржцы)'; + + +-- +-- Name: COLUMN regions.unique_name_prepositional; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN regions.unique_name_prepositional IS 'Уникальное название региона в предложном падеже'; + + +-- +-- Name: COLUMN regions.show_regional_price; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN regions.show_regional_price IS 'Показывать ли для региона региональный прайс-лист'; + + +-- +-- Name: regions_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE regions_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: regions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE regions_id_seq OWNED BY regions.id; + + +-- +-- Name: roles; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE roles ( + id integer NOT NULL, + name character varying(255) NOT NULL, + title character varying(255), + priority integer NOT NULL, + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: TABLE roles; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE roles IS 'Справочник ролей пользователей'; + + +-- +-- Name: roles_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE roles_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: roles_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE roles_id_seq OWNED BY roles.id; + + +-- +-- Name: rss_channels; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE rss_channels ( + id integer NOT NULL, + slug character varying(255) NOT NULL, + title character varying(255) NOT NULL, + link character varying(255) NOT NULL, + description text NOT NULL, + img_url character varying(255), + img_title character varying(255), + img_link character varying(255), + publisher character varying(255) NOT NULL, + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: rss_channels_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE rss_channels_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: rss_channels_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE rss_channels_id_seq OWNED BY rss_channels.id; + + +-- +-- Name: rubric_industries_backup; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE rubric_industries_backup ( + id integer NOT NULL, + rubric_id integer, + industry_id integer, + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: TABLE rubric_industries_backup; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE rubric_industries_backup IS 'Связь отраслевого и товарного рубрикаторов'; + + +-- +-- Name: rubric_industries_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE rubric_industries_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: rubric_industries_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE rubric_industries_id_seq OWNED BY rubric_industries_backup.id; + + +-- +-- Name: rubric_normal_stats; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE rubric_normal_stats ( + id integer NOT NULL, + rubric_id integer, + region_id integer, + packet integer, + week_stat integer, + month_stat integer +); + + +-- +-- Name: rubric_normal_stats_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE rubric_normal_stats_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: rubric_normal_stats_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE rubric_normal_stats_id_seq OWNED BY rubric_normal_stats.id; + + +-- +-- Name: rubric_redirects; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE rubric_redirects ( + id integer NOT NULL, + rubric_id integer NOT NULL, + redirect_from character varying(255) NOT NULL +); + + +-- +-- Name: rubric_redirects_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE rubric_redirects_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: rubric_redirects_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE rubric_redirects_id_seq OWNED BY rubric_redirects.id; + + +-- +-- Name: rubric_statistics; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE rubric_statistics ( + id integer NOT NULL, + rubric_id integer, + region_id integer, + products_stat integer +); + + +-- +-- Name: TABLE rubric_statistics; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE rubric_statistics IS 'Статистика по рубрикам-регионам'; + + +-- +-- Name: COLUMN rubric_statistics.products_stat; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN rubric_statistics.products_stat IS 'Количество пользовательских товаров'; + + +-- +-- Name: rubric_statistics_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE rubric_statistics_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: rubric_statistics_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE rubric_statistics_id_seq OWNED BY rubric_statistics.id; + + +-- +-- Name: rubric_statistics_paid; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE rubric_statistics_paid ( + id integer NOT NULL, + rubric_id integer, + region_id integer, + products_stat integer, + providers_stat integer +); + + +-- +-- Name: TABLE rubric_statistics_paid; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE rubric_statistics_paid IS 'Статистика по рубрикам-регионам для платных компаний'; + + +-- +-- Name: COLUMN rubric_statistics_paid.products_stat; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN rubric_statistics_paid.products_stat IS 'Количество пользовательских товаров'; + + +-- +-- Name: rubric_statistics_paid_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE rubric_statistics_paid_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: rubric_statistics_paid_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE rubric_statistics_paid_id_seq OWNED BY rubric_statistics_paid.id; + + +-- +-- Name: rubric_tags; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE rubric_tags ( + id integer NOT NULL, + rubric_id integer NOT NULL, + tag_id integer NOT NULL +); + + +-- +-- Name: rubric_tags_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE rubric_tags_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: rubric_tags_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE rubric_tags_id_seq OWNED BY rubric_tags.id; + + +-- +-- Name: rubrics; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE rubrics ( + id integer NOT NULL, + title character varying(255), + parent_id integer, + lft integer, + rgt integer, + created_at timestamp without time zone, + updated_at timestamp without time zone, + slug character varying(255), + joined_path character varying(255), + old_path character varying(255), + comment character varying(255), + is_normativka boolean DEFAULT false NOT NULL, + next_level_normativka boolean DEFAULT false NOT NULL, + prefix_normativka character varying(255), + cached_level integer, + synonym character varying(255), + is_published boolean, + is_symlink boolean DEFAULT false, + symlink_target_id integer, + old_id integer, + genitive character varying(255), + dative character varying(255), + accusative character varying(255), + instrumentative character varying(255), + preposition character varying(255), + lcase_title character varying(255), + is_service boolean DEFAULT false, + is_plural boolean DEFAULT false, + project_list character varying(255), + is_tree_bindable boolean DEFAULT false, + use_new_url boolean DEFAULT false, + is_elaborated boolean DEFAULT false NOT NULL, + url_name character varying(255), + short_title character varying(255), + is_target boolean DEFAULT false NOT NULL +) +WITH (autovacuum_vacuum_threshold=100, autovacuum_analyze_threshold=200, autovacuum_vacuum_cost_delay=50, autovacuum_vacuum_cost_limit=400, autovacuum_vacuum_scale_factor=0.01, autovacuum_analyze_scale_factor=0.007); +ALTER TABLE ONLY rubrics ALTER COLUMN lft SET STATISTICS 1000; +ALTER TABLE ONLY rubrics ALTER COLUMN rgt SET STATISTICS 1000; + + +-- +-- Name: TABLE rubrics; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE rubrics IS 'Товарный рубрикатор'; + + +-- +-- Name: COLUMN rubrics.title; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN rubrics.title IS 'Название рубрики'; + + +-- +-- Name: COLUMN rubrics.lft; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN rubrics.lft IS 'Левый узел nested sets'; + + +-- +-- Name: COLUMN rubrics.rgt; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN rubrics.rgt IS 'Правый узел nested sets'; + + +-- +-- Name: COLUMN rubrics.slug; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN rubrics.slug IS 'Часть URI'; + + +-- +-- Name: COLUMN rubrics.joined_path; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN rubrics.joined_path IS 'Полный URI'; + + +-- +-- Name: COLUMN rubrics.old_path; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN rubrics.old_path IS 'Старый путь рубрики'; + + +-- +-- Name: COLUMN rubrics.comment; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN rubrics.comment IS 'deprecated'; + + +-- +-- Name: COLUMN rubrics.is_normativka; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN rubrics.is_normativka IS 'Признак, что это нормативка'; + + +-- +-- Name: COLUMN rubrics.next_level_normativka; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN rubrics.next_level_normativka IS 'Признак, что дочерние рубрики - нормативки'; + + +-- +-- Name: COLUMN rubrics.prefix_normativka; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN rubrics.prefix_normativka IS 'Название товарной группы для нормативки'; + + +-- +-- Name: COLUMN rubrics.cached_level; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN rubrics.cached_level IS 'Уровень рубрики внутри дерева'; + + +-- +-- Name: COLUMN rubrics.synonym; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN rubrics.synonym IS 'Синоним рубрики'; + + +-- +-- Name: COLUMN rubrics.is_published; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN rubrics.is_published IS 'Признак публикуемости рубрики'; + + +-- +-- Name: COLUMN rubrics.is_symlink; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN rubrics.is_symlink IS 'Признак того, что рубрика является ссылкой на другую рубрику'; + + +-- +-- Name: COLUMN rubrics.symlink_target_id; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN rubrics.symlink_target_id IS 'ID рубрики, на которую ссылается данная рубрика в случае если она является ссылкой'; + + +-- +-- Name: COLUMN rubrics.lcase_title; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN rubrics.lcase_title IS 'Титл для сниппетов'; + + +-- +-- Name: COLUMN rubrics.is_service; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN rubrics.is_service IS 'Признак услуги'; + + +-- +-- Name: COLUMN rubrics.is_plural; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN rubrics.is_plural IS 'Название рубрики представлено во множественном числе'; + + +-- +-- Name: COLUMN rubrics.is_elaborated; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN rubrics.is_elaborated IS 'Признак товарной группы - проработана'; + + +-- +-- Name: rubrics_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE rubrics_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: rubrics_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE rubrics_id_seq OWNED BY rubrics.id; + + +-- +-- Name: rubrics_total_statistics; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE rubrics_total_statistics ( + id integer NOT NULL, + rubric_id integer, + products_stat integer +); + + +-- +-- Name: TABLE rubrics_total_statistics; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE rubrics_total_statistics IS 'Суммарная статистика товаров по рубрикам'; + + +-- +-- Name: COLUMN rubrics_total_statistics.rubric_id; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN rubrics_total_statistics.rubric_id IS 'ID рубрики'; + + +-- +-- Name: COLUMN rubrics_total_statistics.products_stat; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN rubrics_total_statistics.products_stat IS 'Суммарное кол-во товаров в рубрике'; + + +-- +-- Name: rubrics_total_statistics_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE rubrics_total_statistics_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: rubrics_total_statistics_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE rubrics_total_statistics_id_seq OWNED BY rubrics_total_statistics.id; + + +-- +-- Name: schedule_brakes; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE schedule_brakes ( + id integer NOT NULL, + name character varying(100) NOT NULL +); + + +-- +-- Name: TABLE schedule_brakes; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE schedule_brakes IS 'Время перерыва'; + + +-- +-- Name: COLUMN schedule_brakes.name; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN schedule_brakes.name IS 'Текст времени перерыва'; + + +-- +-- Name: schedule_brakes_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE schedule_brakes_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: schedule_brakes_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE schedule_brakes_id_seq OWNED BY schedule_brakes.id; + + +-- +-- Name: schedule_days; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE schedule_days ( + id integer NOT NULL, + name character varying(100) NOT NULL +); + + +-- +-- Name: TABLE schedule_days; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE schedule_days IS 'Дни работы'; + + +-- +-- Name: COLUMN schedule_days.name; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN schedule_days.name IS 'Текст дней работы'; + + +-- +-- Name: schedule_days_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE schedule_days_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: schedule_days_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE schedule_days_id_seq OWNED BY schedule_days.id; + + +-- +-- Name: schedule_times; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE schedule_times ( + id integer NOT NULL, + name character varying(100) NOT NULL +); + + +-- +-- Name: TABLE schedule_times; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE schedule_times IS 'Время работы'; + + +-- +-- Name: COLUMN schedule_times.name; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN schedule_times.name IS 'Текст времени работы'; + + +-- +-- Name: schedule_times_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE schedule_times_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: schedule_times_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE schedule_times_id_seq OWNED BY schedule_times.id; + + +-- +-- Name: schema_migrations; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE schema_migrations ( + version character varying(255) NOT NULL +); + + +-- +-- Name: TABLE schema_migrations; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE schema_migrations IS 'Системная таблица Rails, миграции схемы БД'; + + +-- +-- Name: search_index_companies; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE search_index_companies ( + id integer NOT NULL, + company_id integer, + w1 character varying(255), + w2 character varying(255), + w3 character varying(255), + w4 character varying(255), + created_at timestamp without time zone, + updated_at timestamp without time zone, + w5 character varying(255), + w6 character varying(255), + w7 character varying(255), + w8 character varying(255), + w9 character varying(255) +); + + +-- +-- Name: TABLE search_index_companies; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE search_index_companies IS 'Подготовленный для Сфинкса индекс по компаниям'; + + +-- +-- Name: COLUMN search_index_companies.w1; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN search_index_companies.w1 IS '1-й терм названия'; + + +-- +-- Name: COLUMN search_index_companies.w2; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN search_index_companies.w2 IS '2-й терм названия'; + + +-- +-- Name: COLUMN search_index_companies.w3; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN search_index_companies.w3 IS '3-й терм названия'; + + +-- +-- Name: COLUMN search_index_companies.w4; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN search_index_companies.w4 IS '4-й и последующие термы названия'; + + +-- +-- Name: COLUMN search_index_companies.w5; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN search_index_companies.w5 IS 'синонимы названия'; + + +-- +-- Name: COLUMN search_index_companies.w6; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN search_index_companies.w6 IS 'все телефоны + сайты'; + + +-- +-- Name: COLUMN search_index_companies.w7; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN search_index_companies.w7 IS 'все адреса компании'; + + +-- +-- Name: COLUMN search_index_companies.w8; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN search_index_companies.w8 IS 'названия рубрик, к которым привязана компания'; + + +-- +-- Name: COLUMN search_index_companies.w9; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN search_index_companies.w9 IS 'краткое описание'; + + +-- +-- Name: search_index_companies_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE search_index_companies_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: search_index_companies_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE search_index_companies_id_seq OWNED BY search_index_companies.id; + + +-- +-- Name: search_index_demands; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE search_index_demands ( + id integer NOT NULL, + demand_id integer NOT NULL, + w1 text, + w2 text +); + + +-- +-- Name: search_index_demands_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE search_index_demands_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: search_index_demands_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE search_index_demands_id_seq OWNED BY search_index_demands.id; + + +-- +-- Name: search_index_price_list_rows; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE search_index_price_list_rows ( + id integer NOT NULL, + price_list_row_id integer, + w1 character varying(300), + w2 character varying(300), + w3 character varying(300), + w4 character varying(300), + w5 character varying(300), + w6 character varying(300), + created_at timestamp without time zone, + updated_at timestamp without time zone, + terms_index tsvector +); + + +-- +-- Name: TABLE search_index_price_list_rows; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE search_index_price_list_rows IS 'Подготовленный для Сфинкса индекс по лотам'; + + +-- +-- Name: COLUMN search_index_price_list_rows.w1; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN search_index_price_list_rows.w1 IS 'Первое слово названия'; + + +-- +-- Name: COLUMN search_index_price_list_rows.w2; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN search_index_price_list_rows.w2 IS 'Синонимы'; + + +-- +-- Name: COLUMN search_index_price_list_rows.w3; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN search_index_price_list_rows.w3 IS 'Второе слово названия'; + + +-- +-- Name: COLUMN search_index_price_list_rows.w4; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN search_index_price_list_rows.w4 IS 'Третье слово названия'; + + +-- +-- Name: COLUMN search_index_price_list_rows.w5; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN search_index_price_list_rows.w5 IS 'Четвертое слово названия'; + + +-- +-- Name: COLUMN search_index_price_list_rows.w6; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN search_index_price_list_rows.w6 IS 'Все слова названия дальше четвертого'; + + +-- +-- Name: search_index_price_list_rows_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE search_index_price_list_rows_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: search_index_price_list_rows_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE search_index_price_list_rows_id_seq OWNED BY search_index_price_list_rows.id; + + +-- +-- Name: search_index_products; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE search_index_products ( + id integer NOT NULL, + product_id integer, + w1 character varying(255), + w2 character varying(255), + w3 character varying(255), + w4 character varying(255), + w5 character varying(255), + w6 text, + created_at timestamp without time zone, + updated_at timestamp without time zone, + terms_index tsvector, + name_ord_1 integer, + name_ord_2 integer, + name_ord_3 integer, + tags character varying(1024) DEFAULT ''::character varying, + traits character varying(1024), + rate integer DEFAULT 0, + trait_values character varying(1024), + name character varying(2048), + announce character varying(2048), + synonyms character varying(2048), + full_terms character varying(4096) +); + + +-- +-- Name: TABLE search_index_products; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE search_index_products IS 'Подготовленный для Сфинкса индекс по товарам'; + + +-- +-- Name: COLUMN search_index_products.w1; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN search_index_products.w1 IS 'Первое слово названия'; + + +-- +-- Name: COLUMN search_index_products.w2; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN search_index_products.w2 IS 'Второе слово названия'; + + +-- +-- Name: COLUMN search_index_products.w3; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN search_index_products.w3 IS 'Третье слово названия'; + + +-- +-- Name: COLUMN search_index_products.w4; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN search_index_products.w4 IS 'Четвертое слово названия'; + + +-- +-- Name: COLUMN search_index_products.w5; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN search_index_products.w5 IS 'Пятое слово названия'; + + +-- +-- Name: COLUMN search_index_products.w6; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN search_index_products.w6 IS 'Все слова названия дальше пятого + краткое описание'; + + +-- +-- Name: COLUMN search_index_products.name_ord_1; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN search_index_products.name_ord_1 IS 'числовое представление названия для сортировки для каждых 8 символов'; + + +-- +-- Name: COLUMN search_index_products.name_ord_2; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN search_index_products.name_ord_2 IS 'числовое представление названия для сортировки для каждых 8 символов'; + + +-- +-- Name: COLUMN search_index_products.name_ord_3; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN search_index_products.name_ord_3 IS 'числовое представление названия для сортировки для каждых 8 символов'; + + +-- +-- Name: search_index_products_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE search_index_products_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: search_index_products_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE search_index_products_id_seq OWNED BY search_index_products.id; + + +-- +-- Name: search_index_queue; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE search_index_queue ( + id integer NOT NULL, + class_name character varying(255), + obj_id integer, + error integer DEFAULT 0, + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: TABLE search_index_queue; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE search_index_queue IS 'Очередь на индексирование объектов'; + + +-- +-- Name: COLUMN search_index_queue.class_name; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN search_index_queue.class_name IS 'Класс объекта'; + + +-- +-- Name: COLUMN search_index_queue.obj_id; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN search_index_queue.obj_id IS 'ID объекта'; + + +-- +-- Name: COLUMN search_index_queue.error; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN search_index_queue.error IS 'deprecated'; + + +-- +-- Name: search_index_queue_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE search_index_queue_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: search_index_queue_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE search_index_queue_id_seq OWNED BY search_index_queue.id; + + +-- +-- Name: search_index_rubrics; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE search_index_rubrics ( + id integer NOT NULL, + rubric_id integer NOT NULL, + w1 character varying(1024), + terms_hash character varying(32) +); + + +-- +-- Name: search_index_rubrics_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE search_index_rubrics_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: search_index_rubrics_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE search_index_rubrics_id_seq OWNED BY search_index_rubrics.id; + + +-- +-- Name: search_specwords; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE search_specwords ( + id integer NOT NULL, + word character varying(255), + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: TABLE search_specwords; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE search_specwords IS 'Специальный слова, которые не выкидываются при индексировании из токенов'; + + +-- +-- Name: search_specwords_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE search_specwords_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: search_specwords_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE search_specwords_id_seq OWNED BY search_specwords.id; + + +-- +-- Name: search_stopwords; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE search_stopwords ( + id integer NOT NULL, + word character varying(255), + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: TABLE search_stopwords; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE search_stopwords IS 'Слова, выкидывающиеся из индекса'; + + +-- +-- Name: search_stopwords_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE search_stopwords_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: search_stopwords_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE search_stopwords_id_seq OWNED BY search_stopwords.id; + + +-- +-- Name: search_unitnames; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE search_unitnames ( + id integer NOT NULL, + word character varying(255), + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: TABLE search_unitnames; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE search_unitnames IS 'Единицы измерения (выкидываются)'; + + +-- +-- Name: search_unitnames_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE search_unitnames_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: search_unitnames_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE search_unitnames_id_seq OWNED BY search_unitnames.id; + + +-- +-- Name: search_wordforms; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE search_wordforms ( + id integer NOT NULL, + word character varying(255), + form character varying(255), + created_at timestamp without time zone, + updated_at timestamp without time zone, + is_deleted boolean DEFAULT false NOT NULL +); + + +-- +-- Name: TABLE search_wordforms; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE search_wordforms IS 'Словарь словоформ ISpell'; + + +-- +-- Name: COLUMN search_wordforms.word; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN search_wordforms.word IS 'Базовая форма слова'; + + +-- +-- Name: COLUMN search_wordforms.form; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN search_wordforms.form IS 'Словоформа'; + + +-- +-- Name: search_wordforms_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE search_wordforms_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: search_wordforms_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE search_wordforms_id_seq OWNED BY search_wordforms.id; + + +-- +-- Name: see_also_stats; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE see_also_stats ( + id integer NOT NULL, + rubric_id integer, + target_rubric_id integer, + count integer, + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: see_also_stats_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE see_also_stats_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: see_also_stats_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE see_also_stats_id_seq OWNED BY see_also_stats.id; + + +-- +-- Name: seo_anchors; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE seo_anchors ( + id integer NOT NULL, + content character varying(255), + ltype integer, + chance integer +); + + +-- +-- Name: TABLE seo_anchors; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE seo_anchors IS 'SEO анкоры'; + + +-- +-- Name: COLUMN seo_anchors.ltype; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN seo_anchors.ltype IS 'Тип анкора'; + + +-- +-- Name: COLUMN seo_anchors.chance; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN seo_anchors.chance IS 'Процент показов'; + + +-- +-- Name: seo_anchors_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE seo_anchors_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: seo_anchors_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE seo_anchors_id_seq OWNED BY seo_anchors.id; + + +-- +-- Name: seo_block_links_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE seo_block_links_id_seq + START WITH 10 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: seo_block_links; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE seo_block_links ( + id integer DEFAULT nextval('seo_block_links_id_seq'::regclass) NOT NULL, + block_id integer NOT NULL, + rubric_id integer NOT NULL, + title character varying(255) DEFAULT NULL::character varying NOT NULL, + created_at timestamp(6) without time zone DEFAULT NULL::timestamp without time zone, + updated_at timestamp(6) without time zone DEFAULT NULL::timestamp without time zone +); + + +-- +-- Name: seo_block_rubric_regions_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE seo_block_rubric_regions_id_seq + START WITH 224 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: seo_block_rubric_regions; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE seo_block_rubric_regions ( + id integer DEFAULT nextval('seo_block_rubric_regions_id_seq'::regclass) NOT NULL, + block_id integer NOT NULL, + keyword_id integer, + rubric_id integer NOT NULL, + region_id integer NOT NULL +); + + +-- +-- Name: seo_blocks_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE seo_blocks_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: seo_blocks; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE seo_blocks ( + id integer DEFAULT nextval('seo_blocks_id_seq'::regclass) NOT NULL, + rubric_id integer NOT NULL, + created_at timestamp(6) without time zone DEFAULT NULL::timestamp without time zone, + updated_at timestamp(6) without time zone DEFAULT NULL::timestamp without time zone +); + + +-- +-- Name: seo_entities; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE seo_entities ( + id integer NOT NULL, + name character varying(255) NOT NULL, + region_id integer, + created_at timestamp without time zone, + updated_at timestamp without time zone, + total integer DEFAULT 0, + wiki_type_id integer DEFAULT 0, + morpher boolean DEFAULT false, + state character varying(255) DEFAULT 'new'::character varying NOT NULL, + moderator_comment text, + moderated_at timestamp without time zone, + moderated_by integer, + rubric_id integer +); + + +-- +-- Name: TABLE seo_entities; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE seo_entities IS 'Редакционные понятия'; + + +-- +-- Name: COLUMN seo_entities.moderator_comment; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN seo_entities.moderator_comment IS 'Сообщение модератора (причина отклонения и т.п.)'; + + +-- +-- Name: seo_entities_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE seo_entities_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: seo_entities_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE seo_entities_id_seq OWNED BY seo_entities.id; + + +-- +-- Name: seo_entity_modifications; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE seo_entity_modifications ( + id integer NOT NULL, + seo_entity_id integer NOT NULL, + user_id integer NOT NULL, + diff text, + message character varying(255), + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: TABLE seo_entity_modifications; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE seo_entity_modifications IS 'Лог изменений ред. понятий'; + + +-- +-- Name: COLUMN seo_entity_modifications.diff; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN seo_entity_modifications.diff IS 'Изменения в виде старое-новое значения'; + + +-- +-- Name: COLUMN seo_entity_modifications.message; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN seo_entity_modifications.message IS 'Человеко понятное сообщение, к данным изменениям'; + + +-- +-- Name: seo_entity_modifications_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE seo_entity_modifications_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: seo_entity_modifications_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE seo_entity_modifications_id_seq OWNED BY seo_entity_modifications.id; + + +-- +-- Name: seo_entity_stopwords; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE seo_entity_stopwords ( + id integer NOT NULL, + word character varying(255) +); + + +-- +-- Name: seo_entity_stopwords_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE seo_entity_stopwords_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: seo_entity_stopwords_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE seo_entity_stopwords_id_seq OWNED BY seo_entity_stopwords.id; + + +-- +-- Name: seo_entity_wordforms; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE seo_entity_wordforms ( + id integer NOT NULL, + seo_entity_id integer, + word character varying(255), + form character varying(255), + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: seo_entity_wordforms_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE seo_entity_wordforms_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: seo_entity_wordforms_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE seo_entity_wordforms_id_seq OWNED BY seo_entity_wordforms.id; + + +-- +-- Name: seo_keywords_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE seo_keywords_id_seq + START WITH 2 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: seo_keywords; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE seo_keywords ( + id integer DEFAULT nextval('seo_keywords_id_seq'::regclass) NOT NULL, + title character varying(255) DEFAULT NULL::character varying NOT NULL, + created_at timestamp(6) without time zone DEFAULT NULL::timestamp without time zone, + updated_at timestamp(6) without time zone DEFAULT NULL::timestamp without time zone +); + + +-- +-- Name: sessions; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE sessions ( + id integer NOT NULL, + session_id character varying(255) NOT NULL, + data text, + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: sessions_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE sessions_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: sessions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE sessions_id_seq OWNED BY sessions.id; + + +-- +-- Name: showcase_images; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE showcase_images ( + id integer NOT NULL, + showcase_id integer, + size integer, + content_type character varying(255), + filename character varying(255), + height integer, + width integer, + parent_id integer, + thumbnail character varying(255), + created_at timestamp without time zone, + updated_at timestamp without time zone, + img_file_name character varying(255), + img_content_type character varying(255), + img_file_size integer, + img_updated_at timestamp without time zone +); + + +-- +-- Name: TABLE showcase_images; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE showcase_images IS 'Картинки витрин'; + + +-- +-- Name: COLUMN showcase_images.size; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN showcase_images.size IS 'Размер файла'; + + +-- +-- Name: COLUMN showcase_images.content_type; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN showcase_images.content_type IS 'MIME-тип файла'; + + +-- +-- Name: COLUMN showcase_images.filename; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN showcase_images.filename IS 'Имя файла'; + + +-- +-- Name: COLUMN showcase_images.height; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN showcase_images.height IS 'Высота картинки (в пискелях)'; + + +-- +-- Name: COLUMN showcase_images.width; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN showcase_images.width IS 'Ширина картинки (в пикселях)'; + + +-- +-- Name: COLUMN showcase_images.parent_id; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN showcase_images.parent_id IS 'Ссылка на родительский логотип, если файл является чьей-то уменьшенной копией'; + + +-- +-- Name: COLUMN showcase_images.thumbnail; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN showcase_images.thumbnail IS 'Тип уменьшенной копии'; + + +-- +-- Name: showcase_images_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE showcase_images_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: showcase_images_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE showcase_images_id_seq OWNED BY showcase_images.id; + + +-- +-- Name: showcase_order_periods; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE showcase_order_periods ( + id integer NOT NULL, + showcase_order_id integer NOT NULL, + month integer NOT NULL, + year integer NOT NULL +); + + +-- +-- Name: TABLE showcase_order_periods; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE showcase_order_periods IS 'Месяцы показа заказов витрин'; + + +-- +-- Name: COLUMN showcase_order_periods.showcase_order_id; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN showcase_order_periods.showcase_order_id IS 'Ссылка на заказ'; + + +-- +-- Name: COLUMN showcase_order_periods.month; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN showcase_order_periods.month IS 'Месяц показа'; + + +-- +-- Name: COLUMN showcase_order_periods.year; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN showcase_order_periods.year IS 'Год показа'; + + +-- +-- Name: showcase_order_periods_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE showcase_order_periods_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: showcase_order_periods_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE showcase_order_periods_id_seq OWNED BY showcase_order_periods.id; + + +-- +-- Name: showcase_order_regions; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE showcase_order_regions ( + id integer NOT NULL, + showcase_order_id integer, + region_id integer +); + + +-- +-- Name: TABLE showcase_order_regions; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE showcase_order_regions IS 'Регионы показа заказов витрин'; + + +-- +-- Name: COLUMN showcase_order_regions.showcase_order_id; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN showcase_order_regions.showcase_order_id IS 'Ссылка на заказ'; + + +-- +-- Name: COLUMN showcase_order_regions.region_id; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN showcase_order_regions.region_id IS 'Ссылка на регион'; + + +-- +-- Name: showcase_order_regions_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE showcase_order_regions_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: showcase_order_regions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE showcase_order_regions_id_seq OWNED BY showcase_order_regions.id; + + +-- +-- Name: showcase_order_stats; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE showcase_order_stats ( + id integer NOT NULL, + showcase_order_id integer NOT NULL, + date date NOT NULL, + clicks integer DEFAULT 0 NOT NULL, + hits integer DEFAULT 0 NOT NULL +); + + +-- +-- Name: TABLE showcase_order_stats; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE showcase_order_stats IS 'Статистика показов заказов витрин'; + + +-- +-- Name: COLUMN showcase_order_stats.showcase_order_id; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN showcase_order_stats.showcase_order_id IS 'Ссылка на заказ'; + + +-- +-- Name: COLUMN showcase_order_stats.clicks; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN showcase_order_stats.clicks IS 'Количество кликов'; + + +-- +-- Name: COLUMN showcase_order_stats.hits; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN showcase_order_stats.hits IS 'Количество показов'; + + +-- +-- Name: showcase_order_stats_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE showcase_order_stats_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: showcase_order_stats_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE showcase_order_stats_id_seq OWNED BY showcase_order_stats.id; + + +-- +-- Name: showcase_orders; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE showcase_orders ( + id integer NOT NULL, + showcase_id integer NOT NULL, + rubric_id integer, + status character varying(30) DEFAULT 'submitted'::character varying NOT NULL, + fio character varying(255) DEFAULT ''::character varying NOT NULL, + contacts character varying(1000) DEFAULT ''::character varying NOT NULL, + type character varying(255) NOT NULL, + total_hits integer DEFAULT 0 NOT NULL, + total_clicks integer DEFAULT 0 NOT NULL, + created_at timestamp without time zone, + updated_at timestamp without time zone, + rubric_type character varying(255) +); + + +-- +-- Name: TABLE showcase_orders; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE showcase_orders IS 'Заказы на показ витрин в каталоге'; + + +-- +-- Name: COLUMN showcase_orders.showcase_id; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN showcase_orders.showcase_id IS 'Ссылка на витрину'; + + +-- +-- Name: COLUMN showcase_orders.rubric_id; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN showcase_orders.rubric_id IS 'Рубрика показа'; + + +-- +-- Name: COLUMN showcase_orders.status; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN showcase_orders.status IS 'Статус оплаты'; + + +-- +-- Name: COLUMN showcase_orders.fio; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN showcase_orders.fio IS 'Имя заказавшего юзера'; + + +-- +-- Name: COLUMN showcase_orders.contacts; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN showcase_orders.contacts IS 'Контакты заказавшего юзера'; + + +-- +-- Name: COLUMN showcase_orders.type; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN showcase_orders.type IS 'Тип витрины'; + + +-- +-- Name: COLUMN showcase_orders.total_hits; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN showcase_orders.total_hits IS 'Общее число показов'; + + +-- +-- Name: COLUMN showcase_orders.total_clicks; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN showcase_orders.total_clicks IS 'Общее число кликов'; + + +-- +-- Name: COLUMN showcase_orders.rubric_type; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN showcase_orders.rubric_type IS 'Тип рубрики'; + + +-- +-- Name: showcase_orders_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE showcase_orders_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: showcase_orders_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE showcase_orders_id_seq OWNED BY showcase_orders.id; + + +-- +-- Name: showcases; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE showcases ( + id integer NOT NULL, + company_id integer NOT NULL, + title character varying(50), + content character varying(70), + url character varying(255), + show_at_homepage boolean NOT NULL, + created_at timestamp without time zone, + updated_at timestamp without time zone, + state character varying(255) DEFAULT 'pending'::character varying NOT NULL, + moderator_comment character varying(255), + user_id integer, + original_showcase_id integer, + phone character varying(255), + start_date date, + end_date date, + description text, + custom_company_name character varying(255) +); + + +-- +-- Name: TABLE showcases; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE showcases IS 'Витрины'; + + +-- +-- Name: COLUMN showcases.company_id; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN showcases.company_id IS 'Идентификатор компании'; + + +-- +-- Name: COLUMN showcases.title; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN showcases.title IS 'Название'; + + +-- +-- Name: COLUMN showcases.content; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN showcases.content IS 'Контент'; + + +-- +-- Name: COLUMN showcases.url; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN showcases.url IS 'Ссылка для клика'; + + +-- +-- Name: COLUMN showcases.show_at_homepage; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN showcases.show_at_homepage IS 'Показывать на карточке'; + + +-- +-- Name: COLUMN showcases.state; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN showcases.state IS 'Статус модерации'; + + +-- +-- Name: COLUMN showcases.moderator_comment; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN showcases.moderator_comment IS 'Комментарий модератора'; + + +-- +-- Name: COLUMN showcases.user_id; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN showcases.user_id IS 'Изменивший юзер'; + + +-- +-- Name: COLUMN showcases.original_showcase_id; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN showcases.original_showcase_id IS 'Ссылка на оригинал витрины при премодерации'; + + +-- +-- Name: COLUMN showcases.start_date; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN showcases.start_date IS 'Дата начала'; + + +-- +-- Name: COLUMN showcases.end_date; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN showcases.end_date IS 'Дата окончания'; + + +-- +-- Name: COLUMN showcases.description; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN showcases.description IS 'Текст-описание'; + + +-- +-- Name: showcases_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE showcases_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: showcases_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE showcases_id_seq OWNED BY showcases.id; + + +-- +-- Name: sitemap; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE sitemap ( + id integer NOT NULL, + element_id character varying(255), + url text, + region integer, + element_type character varying(255), + updated_at timestamp without time zone, + real_id integer +); + + +-- +-- Name: sitemap_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE sitemap_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: sitemap_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE sitemap_id_seq OWNED BY sitemap.id; + + +-- +-- Name: snippet_rubrics; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE snippet_rubrics ( + snippet_id integer, + created_at timestamp without time zone, + updated_at timestamp without time zone, + rubric_id integer NOT NULL, + id integer NOT NULL +); + + +-- +-- Name: TABLE snippet_rubrics; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE snippet_rubrics IS 'Связь рубрики - сниппет'; + + +-- +-- Name: snippet_rubrics_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE snippet_rubrics_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: snippet_rubrics_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE snippet_rubrics_id_seq OWNED BY snippet_rubrics.id; + + +-- +-- Name: snippet_text_regions; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE snippet_text_regions ( + id integer NOT NULL, + snippet_id integer NOT NULL, + snippet_text_id integer NOT NULL, + region_id integer NOT NULL, + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: snippet_text_regions_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE snippet_text_regions_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: snippet_text_regions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE snippet_text_regions_id_seq OWNED BY snippet_text_regions.id; + + +-- +-- Name: snippet_texts; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE snippet_texts ( + id integer NOT NULL, + snippet_id integer NOT NULL, + content character varying(10000) NOT NULL, + created_at timestamp without time zone, + updated_at timestamp without time zone, + "position" character varying(255) DEFAULT 'list'::character varying NOT NULL +); + + +-- +-- Name: snippet_texts_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE snippet_texts_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: snippet_texts_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE snippet_texts_id_seq OWNED BY snippet_texts.id; + + +-- +-- Name: snippets; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE snippets ( + id integer NOT NULL, + content text, + created_at timestamp without time zone, + updated_at timestamp without time zone, + title character varying(255), + name character varying(255), + keywords character varying(255) +); + + +-- +-- Name: TABLE snippets; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE snippets IS 'Сниппеты для рубрик'; + + +-- +-- Name: snippets_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE snippets_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: snippets_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE snippets_id_seq OWNED BY snippets.id; + + +-- +-- Name: social_surveys; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE social_surveys ( + id integer NOT NULL, + region_id integer, + content text, + is_shown boolean DEFAULT false NOT NULL, + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: social_surveys_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE social_surveys_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: social_surveys_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE social_surveys_id_seq OWNED BY social_surveys.id; + + +-- +-- Name: sources; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE sources ( + id integer NOT NULL, + name character varying(255), + type character varying(255), + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: TABLE sources; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE sources IS 'Внешние источники данных, deprecated'; + + +-- +-- Name: sources_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE sources_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: sources_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE sources_id_seq OWNED BY sources.id; + + +-- +-- Name: sphinx_delete_queue_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE sphinx_delete_queue_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + MAXVALUE 2147483647 + CACHE 1; + + +-- +-- Name: static_links_by_products; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE static_links_by_products ( + id integer NOT NULL, + product_id integer NOT NULL, + target_region_id integer NOT NULL, + target_rubric_id integer NOT NULL, + anchor character varying(255) +); + + +-- +-- Name: static_links_by_products_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE static_links_by_products_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: static_links_by_products_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE static_links_by_products_id_seq OWNED BY static_links_by_products.id; + + +-- +-- Name: static_links_by_rubrics; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE static_links_by_rubrics ( + id integer NOT NULL, + region_id integer NOT NULL, + rubric_id integer NOT NULL, + target_region_id integer NOT NULL, + target_rubric_id integer NOT NULL, + anchor character varying(255) +); + + +-- +-- Name: static_links_by_rubrics_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE static_links_by_rubrics_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: static_links_by_rubrics_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE static_links_by_rubrics_id_seq OWNED BY static_links_by_rubrics.id; + + +-- +-- Name: static_links_for_predls; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE static_links_for_predls ( + id integer NOT NULL, + content character varying(255), + type character varying(255), + chance integer +); + + +-- +-- Name: TABLE static_links_for_predls; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE static_links_for_predls IS 'Анкоры для predl'; + + +-- +-- Name: static_links_for_predls_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE static_links_for_predls_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: static_links_for_predls_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE static_links_for_predls_id_seq OWNED BY static_links_for_predls.id; + + +-- +-- Name: street_types; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE street_types ( + id integer NOT NULL, + name character varying(255), + created_at timestamp without time zone, + updated_at timestamp without time zone, + full_name character varying(255) +); + + +-- +-- Name: TABLE street_types; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE street_types IS 'Справочник типов улиц'; + + +-- +-- Name: street_types_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE street_types_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: street_types_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE street_types_id_seq OWNED BY street_types.id; + + +-- +-- Name: streets; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE streets ( + id integer NOT NULL, + name character varying(256) NOT NULL, + type_id integer, + city_id integer, + created_at timestamp without time zone, + updated_at timestamp without time zone, + village_id integer, + slug character varying(255) DEFAULT ''::character varying NOT NULL +); + + +-- +-- Name: TABLE streets; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE streets IS 'Справочник улиц'; + + +-- +-- Name: COLUMN streets.village_id; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN streets.village_id IS 'Посёлок'; + + +-- +-- Name: COLUMN streets.slug; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN streets.slug IS 'Название улицы для url'; + + +-- +-- Name: streets_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE streets_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: streets_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE streets_id_seq OWNED BY streets.id; + + +-- +-- Name: subscribe_popups; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE subscribe_popups ( + id integer NOT NULL, + region_id integer NOT NULL, + popup_img_file_name character varying(255), + popup_img_content_type character varying(255), + popup_img_file_size integer, + popup_img_updated_at timestamp without time zone, + show_popup boolean DEFAULT false +); + + +-- +-- Name: subscribe_popups_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE subscribe_popups_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: subscribe_popups_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE subscribe_popups_id_seq OWNED BY subscribe_popups.id; + + +-- +-- Name: subscriptions; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE subscriptions ( + id integer NOT NULL, + user_id integer, + news_id integer, + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: TABLE subscriptions; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE subscriptions IS 'deprecated'; + + +-- +-- Name: subscriptions_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE subscriptions_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: subscriptions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE subscriptions_id_seq OWNED BY subscriptions.id; + + +-- +-- Name: synonyms; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE synonyms ( + id integer NOT NULL, + base_id integer, + synonym_id integer, + rubric_id integer, + state character varying(5) DEFAULT 'all'::character varying NOT NULL, + is_changed boolean DEFAULT false NOT NULL, + is_deleted boolean DEFAULT false, + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: synonyms_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE synonyms_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: synonyms_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE synonyms_id_seq OWNED BY synonyms.id; + + +-- +-- Name: system_params; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE system_params ( + id integer NOT NULL, + name character varying(512) NOT NULL, + value character varying(2000) NOT NULL, + comment character varying(2000) NOT NULL, + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: TABLE system_params; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE system_params IS 'Таблица системных параметров'; + + +-- +-- Name: system_params_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE system_params_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: system_params_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE system_params_id_seq OWNED BY system_params.id; + + +-- +-- Name: taggings; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE taggings ( + id integer NOT NULL, + tag_id integer, + taggable_id integer, + tagger_id integer, + tagger_type character varying(255), + taggable_type character varying(255), + context character varying(255), + created_at timestamp without time zone +); + + +-- +-- Name: taggings_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE taggings_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: taggings_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE taggings_id_seq OWNED BY taggings.id; + + +-- +-- Name: tags; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE tags ( + id integer NOT NULL, + name character varying(50), + terms_hash character varying(32) +); + + +-- +-- Name: tags_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE tags_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: tags_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE tags_id_seq OWNED BY tags.id; + + +-- +-- Name: template_categories; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE template_categories ( + id integer NOT NULL, + title character varying(255) NOT NULL, + "position" integer, + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: template_categories_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE template_categories_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: template_categories_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE template_categories_id_seq OWNED BY template_categories.id; + + +-- +-- Name: template_schemes; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE template_schemes ( + id integer NOT NULL, + title character varying(255) NOT NULL, + template_category_id integer NOT NULL, + settings text NOT NULL, + state character varying(10) DEFAULT 'pending'::character varying NOT NULL, + preview_image_file_name character varying(255), + preview_image_content_type character varying(255), + preview_image_file_size integer, + header_image_file_name character varying(255), + header_image_content_type character varying(255), + header_image_file_size integer, + bg_image_file_name character varying(255), + bg_image_content_type character varying(255), + bg_image_file_size integer, + "position" integer, + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: template_schemes_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE template_schemes_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: template_schemes_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE template_schemes_id_seq OWNED BY template_schemes.id; + + +-- +-- Name: test_packets; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE test_packets ( + id integer NOT NULL, + company_id integer, + packet integer, + valid_till date, + created_at timestamp without time zone, + updated_at timestamp without time zone, + source character varying(255) +); + + +-- +-- Name: TABLE test_packets; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE test_packets IS 'Тестовые размещения'; + + +-- +-- Name: COLUMN test_packets.packet; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN test_packets.packet IS 'Пакет'; + + +-- +-- Name: COLUMN test_packets.valid_till; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN test_packets.valid_till IS 'Активно до'; + + +-- +-- Name: test_packets_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE test_packets_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: test_packets_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE test_packets_id_seq OWNED BY test_packets.id; + + +-- +-- Name: text_zone_rubrics; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE text_zone_rubrics ( + id integer NOT NULL, + name character varying(255) +); + + +-- +-- Name: text_zone_rubrics_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE text_zone_rubrics_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: text_zone_rubrics_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE text_zone_rubrics_id_seq OWNED BY text_zone_rubrics.id; + + +-- +-- Name: text_zones; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE text_zones ( + id integer NOT NULL, + slug character varying(255), + title character varying(255), + content text, + roles character varying(255), + created_at timestamp without time zone, + updated_at timestamp without time zone, + rotation_tag character varying(255), + text_zone_rubric_id integer, + image_file_name character varying(255), + image_content_type character varying(255), + image_file_size integer +); + + +-- +-- Name: TABLE text_zones; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE text_zones IS 'Текстовые зоны на сайте'; + + +-- +-- Name: COLUMN text_zones.slug; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN text_zones.slug IS 'Текстовый идентификатор зоны'; + + +-- +-- Name: COLUMN text_zones.title; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN text_zones.title IS 'Название зоны'; + + +-- +-- Name: COLUMN text_zones.content; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN text_zones.content IS 'Содержание зоны'; + + +-- +-- Name: COLUMN text_zones.roles; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN text_zones.roles IS 'deprecated'; + + +-- +-- Name: COLUMN text_zones.rotation_tag; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN text_zones.rotation_tag IS 'Текст, по которому группируются зоны для ротации'; + + +-- +-- Name: text_zones_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE text_zones_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: text_zones_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE text_zones_id_seq OWNED BY text_zones.id; + + +-- +-- Name: thematic_rubric_industries; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE thematic_rubric_industries ( + id integer NOT NULL, + thematic_rubric_id integer, + industry_id integer, + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: thematic_rubric_industries_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE thematic_rubric_industries_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: thematic_rubric_industries_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE thematic_rubric_industries_id_seq OWNED BY thematic_rubric_industries.id; + + +-- +-- Name: thematic_rubric_links; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE thematic_rubric_links ( + id integer NOT NULL, + thematic_rubric_id integer, + target_id integer, + title character varying(255), + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: TABLE thematic_rubric_links; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE thematic_rubric_links IS 'Таблица связывающих ссылок между рубриками тематических рубрикаторов'; + + +-- +-- Name: thematic_rubric_links_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE thematic_rubric_links_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: thematic_rubric_links_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE thematic_rubric_links_id_seq OWNED BY thematic_rubric_links.id; + + +-- +-- Name: thematic_rubricators; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE thematic_rubricators ( + id integer NOT NULL, + title character varying(255), + url_name character varying(255), + is_atlas boolean DEFAULT false NOT NULL +); + + +-- +-- Name: COLUMN thematic_rubricators.url_name; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN thematic_rubricators.url_name IS 'Название рубрикатора для формирования url страниц листингов'; + + +-- +-- Name: COLUMN thematic_rubricators.is_atlas; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN thematic_rubricators.is_atlas IS 'Флаг рубрикатора для атласа'; + + +-- +-- Name: thematic_rubricators_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE thematic_rubricators_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: thematic_rubricators_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE thematic_rubricators_id_seq OWNED BY thematic_rubricators.id; + + +-- +-- Name: thematic_rubrics; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE thematic_rubrics ( + id integer NOT NULL, + thematic_rubricator_id integer, + title character varying(255), + parent_id integer, + slug character varying(255), + lft integer, + rgt integer, + joined_path text, + cached_level integer, + is_visible boolean NOT NULL, + created_at timestamp without time zone, + updated_at timestamp without time zone, + title_short character varying(255), + title_tiny character varying(20), + panel_num integer +); + + +-- +-- Name: COLUMN thematic_rubrics.panel_num; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN thematic_rubrics.panel_num IS 'Порядок рубрики для верхней плашки на Главной странице'; + + +-- +-- Name: thematic_rubrics_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE thematic_rubrics_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: thematic_rubrics_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE thematic_rubrics_id_seq OWNED BY thematic_rubrics.id; + + +-- +-- Name: tmp_seo_entities_id; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE tmp_seo_entities_id + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: tmp_seo_entities_slugs; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE tmp_seo_entities_slugs ( + id integer DEFAULT nextval('tmp_seo_entities_id'::regclass) NOT NULL, + seo_entity_id integer, + slug character varying(255) +); + + +-- +-- Name: tmp_yandex_regions; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE tmp_yandex_regions ( + yandex_region_id integer NOT NULL, + yandex_region_name character varying(255) NOT NULL, + city_id integer NOT NULL +); + + +-- +-- Name: trait_products; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE trait_products ( + id integer NOT NULL, + trait_id integer, + product_id integer, + trait_value_id integer, + is_auto boolean DEFAULT false +); + + +-- +-- Name: trait_products_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE trait_products_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: trait_products_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE trait_products_id_seq OWNED BY trait_products.id; + + +-- +-- Name: trait_rubrics; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE trait_rubrics ( + id integer NOT NULL, + trait_id integer, + rubric_id integer, + is_editable boolean DEFAULT true, + "default" character varying(45) +); + + +-- +-- Name: trait_rubrics_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE trait_rubrics_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: trait_rubrics_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE trait_rubrics_id_seq OWNED BY trait_rubrics.id; + + +-- +-- Name: trait_value_redirects; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE trait_value_redirects ( + id integer NOT NULL, + trait_value_id integer NOT NULL, + trait_rubric_id integer NOT NULL, + redirect_from character varying(512) NOT NULL, + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: TABLE trait_value_redirects; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE trait_value_redirects IS 'Редиректы с рубрики на значение характеристики'; + + +-- +-- Name: trait_value_redirects_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE trait_value_redirects_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: trait_value_redirects_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE trait_value_redirects_id_seq OWNED BY trait_value_redirects.id; + + +-- +-- Name: trait_values; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE trait_values ( + id integer NOT NULL, + trait_id integer, + value character varying(45), + state character varying(255) DEFAULT 'pending'::character varying, + created_at timestamp without time zone, + created_by integer, + moderator integer, + moderator_comment text, + slug character varying(255), + value_plural character varying(255), + is_auto_bind boolean DEFAULT true, + "position" integer DEFAULT 0 NOT NULL +); + + +-- +-- Name: COLUMN trait_values.value_plural; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN trait_values.value_plural IS 'Значение во множественном числе'; + + +-- +-- Name: COLUMN trait_values."position"; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN trait_values."position" IS 'Позиция значения внутри характеристики при формировании ссылки'; + + +-- +-- Name: trait_values_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE trait_values_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: trait_values_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE trait_values_id_seq OWNED BY trait_values.id; + + +-- +-- Name: traits; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE traits ( + id integer NOT NULL, + name character varying(20), + name_plural character varying(20), + created_at timestamp without time zone, + updated_at timestamp without time zone, + comment character varying(255), + is_multivalue boolean DEFAULT false NOT NULL, + priority integer DEFAULT 100 NOT NULL, + sort_by traits_sort_type DEFAULT 'popularity'::traits_sort_type, + inside boolean DEFAULT false NOT NULL +); + + +-- +-- Name: COLUMN traits.is_multivalue; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN traits.is_multivalue IS 'Может иметь множественное значение'; + + +-- +-- Name: COLUMN traits.priority; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN traits.priority IS 'Приоритет характеристики'; + + +-- +-- Name: COLUMN traits.sort_by; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN traits.sort_by IS 'Тип сортировки значений характеристики'; + + +-- +-- Name: traits_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE traits_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: traits_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE traits_id_seq OWNED BY traits.id; + + +-- +-- Name: ugc_stats; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE ugc_stats ( + id integer NOT NULL, + total_products_count integer, + user_products_count integer, + total_company_count integer, + online_company_count integer, + date date, + button_show_count integer, + unpublished_products_count integer +); + + +-- +-- Name: TABLE ugc_stats; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE ugc_stats IS 'UGC статистика'; + + +-- +-- Name: COLUMN ugc_stats.total_products_count; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN ugc_stats.total_products_count IS 'Всего товаров создано'; + + +-- +-- Name: COLUMN ugc_stats.user_products_count; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN ugc_stats.user_products_count IS 'Товаров создано не ПЦ'; + + +-- +-- Name: COLUMN ugc_stats.total_company_count; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN ugc_stats.total_company_count IS 'Всего компаний создано'; + + +-- +-- Name: COLUMN ugc_stats.online_company_count; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN ugc_stats.online_company_count IS 'Кол-во компаний, ставших онлайн'; + + +-- +-- Name: COLUMN ugc_stats.date; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN ugc_stats.date IS 'Дата'; + + +-- +-- Name: COLUMN ugc_stats.unpublished_products_count; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN ugc_stats.unpublished_products_count IS 'Количество товаров, не публикуемых на портале'; + + +-- +-- Name: ugc_stats_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE ugc_stats_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: ugc_stats_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE ugc_stats_id_seq OWNED BY ugc_stats.id; + + +-- +-- Name: useful_link_categories; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE useful_link_categories ( + id integer NOT NULL, + title character varying(255) NOT NULL +); + + +-- +-- Name: TABLE useful_link_categories; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE useful_link_categories IS 'Категории полезный ссылок'; + + +-- +-- Name: COLUMN useful_link_categories.title; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN useful_link_categories.title IS 'Название'; + + +-- +-- Name: useful_link_categories_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE useful_link_categories_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: useful_link_categories_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE useful_link_categories_id_seq OWNED BY useful_link_categories.id; + + +-- +-- Name: useful_link_categories_industries; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE useful_link_categories_industries ( + id integer NOT NULL, + useful_link_category_id integer NOT NULL, + industry_id integer NOT NULL, + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: TABLE useful_link_categories_industries; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE useful_link_categories_industries IS 'Связь категорий полезных ссылок и тематических рубрик'; + + +-- +-- Name: COLUMN useful_link_categories_industries.useful_link_category_id; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN useful_link_categories_industries.useful_link_category_id IS 'Категория полезных ссылок'; + + +-- +-- Name: COLUMN useful_link_categories_industries.industry_id; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN useful_link_categories_industries.industry_id IS 'Отраслевая рубрика'; + + +-- +-- Name: useful_link_categories_industries_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE useful_link_categories_industries_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: useful_link_categories_industries_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE useful_link_categories_industries_id_seq OWNED BY useful_link_categories_industries.id; + + +-- +-- Name: useful_link_categories_thematic_rubrics; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE useful_link_categories_thematic_rubrics ( + useful_link_category_id integer NOT NULL, + thematic_rubric_id integer NOT NULL, + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: TABLE useful_link_categories_thematic_rubrics; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE useful_link_categories_thematic_rubrics IS 'Связь категорий полезных ссылок и тематических рубрик'; + + +-- +-- Name: COLUMN useful_link_categories_thematic_rubrics.useful_link_category_id; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN useful_link_categories_thematic_rubrics.useful_link_category_id IS 'Категория полезных ссылок'; + + +-- +-- Name: COLUMN useful_link_categories_thematic_rubrics.thematic_rubric_id; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN useful_link_categories_thematic_rubrics.thematic_rubric_id IS 'Тематическая рубрика'; + + +-- +-- Name: useful_link_statistics; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE useful_link_statistics ( + id integer NOT NULL, + useful_link_id integer NOT NULL, + clicks integer DEFAULT 0, + stat_day date +); + + +-- +-- Name: TABLE useful_link_statistics; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE useful_link_statistics IS 'Статистика кликов по полезным ссылкам'; + + +-- +-- Name: COLUMN useful_link_statistics.useful_link_id; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN useful_link_statistics.useful_link_id IS 'Полезная ссылка'; + + +-- +-- Name: COLUMN useful_link_statistics.clicks; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN useful_link_statistics.clicks IS 'Кликов за день'; + + +-- +-- Name: COLUMN useful_link_statistics.stat_day; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN useful_link_statistics.stat_day IS 'День статистики'; + + +-- +-- Name: useful_link_statistics_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE useful_link_statistics_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: useful_link_statistics_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE useful_link_statistics_id_seq OWNED BY useful_link_statistics.id; + + +-- +-- Name: useful_links; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE useful_links ( + id integer NOT NULL, + useful_link_category_id integer NOT NULL, + title character varying(255) NOT NULL, + description text, + url text NOT NULL, + ord integer DEFAULT 0, + direct_jump boolean NOT NULL, + clicks integer DEFAULT 0 NOT NULL, + description_is_link boolean NOT NULL, + created_at timestamp without time zone, + updated_at timestamp without time zone, + img_file_name character varying(255), + img_content_type character varying(255), + img_file_size integer +); + + +-- +-- Name: TABLE useful_links; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE useful_links IS 'Полезные ссылки'; + + +-- +-- Name: COLUMN useful_links.useful_link_category_id; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN useful_links.useful_link_category_id IS 'Категория полезных ссылок'; + + +-- +-- Name: COLUMN useful_links.title; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN useful_links.title IS 'Текст ссылки'; + + +-- +-- Name: COLUMN useful_links.description; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN useful_links.description IS 'Описание'; + + +-- +-- Name: COLUMN useful_links.url; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN useful_links.url IS 'Целевая ссылка'; + + +-- +-- Name: COLUMN useful_links.ord; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN useful_links.ord IS 'Порядок ссылки'; + + +-- +-- Name: COLUMN useful_links.direct_jump; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN useful_links.direct_jump IS 'Флаг прямого перехода'; + + +-- +-- Name: COLUMN useful_links.clicks; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN useful_links.clicks IS 'Суммарное количество кликов по ссылке'; + + +-- +-- Name: COLUMN useful_links.description_is_link; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN useful_links.description_is_link IS 'Флаг того, что описание является ссылкой'; + + +-- +-- Name: useful_links_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE useful_links_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: useful_links_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE useful_links_id_seq OWNED BY useful_links.id; + + +-- +-- Name: user_blog_statistics_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE user_blog_statistics_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: user_blog_statistics_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE user_blog_statistics_id_seq OWNED BY blog_user_statistics.id; + + +-- +-- Name: user_emails; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE user_emails ( + user_id integer, + email character varying(255) NOT NULL +); + + +-- +-- Name: user_profiles; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE user_profiles ( + id integer NOT NULL, + user_id integer NOT NULL, + name character varying(200), + gender boolean, + birthday date, + city_id integer, + about text, + created_at timestamp without time zone, + updated_at timestamp without time zone, + contacts text, + "position" character varying(255), + additional_contacts text, + show_email boolean, + surname character varying(255) +); + + +-- +-- Name: TABLE user_profiles; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE user_profiles IS 'Профайлы пользователей'; + + +-- +-- Name: COLUMN user_profiles.name; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN user_profiles.name IS 'ФИО'; + + +-- +-- Name: COLUMN user_profiles.gender; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN user_profiles.gender IS 'Пол'; + + +-- +-- Name: COLUMN user_profiles.birthday; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN user_profiles.birthday IS 'Дата рождения'; + + +-- +-- Name: COLUMN user_profiles.city_id; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN user_profiles.city_id IS 'Город'; + + +-- +-- Name: COLUMN user_profiles.about; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN user_profiles.about IS 'Кратко о себе'; + + +-- +-- Name: COLUMN user_profiles.contacts; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN user_profiles.contacts IS 'Контактная информация'; + + +-- +-- Name: COLUMN user_profiles."position"; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN user_profiles."position" IS 'Должность'; + + +-- +-- Name: COLUMN user_profiles.additional_contacts; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN user_profiles.additional_contacts IS 'Дополнительный телефон / ICQ / Skype'; + + +-- +-- Name: COLUMN user_profiles.show_email; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN user_profiles.show_email IS 'Публиковать электропочту на визитке'; + + +-- +-- Name: user_profiles_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE user_profiles_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: user_profiles_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE user_profiles_id_seq OWNED BY user_profiles.id; + + +-- +-- Name: user_roles; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE user_roles ( + id integer NOT NULL, + user_id integer NOT NULL, + name character varying(20) NOT NULL, + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: TABLE user_roles; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE user_roles IS 'Роли пользователей (в данный момент - только администраторы сайта)'; + + +-- +-- Name: COLUMN user_roles.name; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN user_roles.name IS 'Название роли'; + + +-- +-- Name: user_roles_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE user_roles_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: user_roles_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE user_roles_id_seq OWNED BY user_roles.id; + + +-- +-- Name: user_settings; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE user_settings ( + id integer NOT NULL, + user_id integer, + messages_notifications boolean, + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: TABLE user_settings; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE user_settings IS 'Пользовательские настройки'; + + +-- +-- Name: COLUMN user_settings.messages_notifications; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN user_settings.messages_notifications IS 'Галка отправлять уведомления о сообщениях'; + + +-- +-- Name: user_settings_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE user_settings_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: user_settings_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE user_settings_id_seq OWNED BY user_settings.id; + + +-- +-- Name: users; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE users ( + id integer NOT NULL, + email character varying(255) NOT NULL, + created_at timestamp without time zone, + updated_at timestamp without time zone, + encrypted_password character varying(128), + salt character varying(128), + persistence_token character varying(128), + remember_token_expires_at timestamp without time zone, + email_confirmed boolean DEFAULT false NOT NULL, + perishable_token character varying(128), + state character varying(255) DEFAULT 'active'::character varying NOT NULL, + is_pcim_user boolean DEFAULT false NOT NULL, + url_auth_token character varying(128) DEFAULT md5(((random())::character varying)::text) NOT NULL, + spam_complaints_count integer DEFAULT 0 NOT NULL, + spam_state character varying(255) DEFAULT 'clean'::character varying NOT NULL, + terms_agree boolean DEFAULT true, + last_signed_in timestamp without time zone, + sso_token character varying(128), + sso_token_updated_at timestamp without time zone, + email_is_unreachable boolean DEFAULT false, + email_is_unreachable_at timestamp without time zone +); + + +-- +-- Name: TABLE users; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE users IS 'Пользователи сайта'; + + +-- +-- Name: COLUMN users.email; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN users.email IS 'E-mail, логин'; + + +-- +-- Name: COLUMN users.encrypted_password; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN users.encrypted_password IS 'Зашифрованный пароль'; + + +-- +-- Name: COLUMN users.salt; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN users.salt IS 'Соль (используется для шифрования)'; + + +-- +-- Name: COLUMN users.persistence_token; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN users.persistence_token IS 'Строчка, используемая в cookies для идентификации'; + + +-- +-- Name: COLUMN users.remember_token_expires_at; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN users.remember_token_expires_at IS 'Срок истечения срока действия cookies'; + + +-- +-- Name: COLUMN users.email_confirmed; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN users.email_confirmed IS 'Подтверждена ли электронная почта'; + + +-- +-- Name: COLUMN users.perishable_token; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN users.perishable_token IS 'Строчка, используемая для смены пароля'; + + +-- +-- Name: COLUMN users.state; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN users.state IS 'Статус пользователя'; + + +-- +-- Name: COLUMN users.is_pcim_user; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN users.is_pcim_user IS 'Является ли пользователь пользователем переговорщика'; + + +-- +-- Name: COLUMN users.url_auth_token; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN users.url_auth_token IS 'Вечный токен, по которому можно авторизоваться по ссылке (он же уходит в переговорщика)'; + + +-- +-- Name: COLUMN users.email_is_unreachable; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN users.email_is_unreachable IS 'Email пользователя недоступен (отлуп)'; + + +-- +-- Name: COLUMN users.email_is_unreachable_at; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN users.email_is_unreachable_at IS 'Дата регистрации отлупа по email пользователя'; + + +-- +-- Name: users_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE users_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: users_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE users_id_seq OWNED BY users.id; + + +-- +-- Name: villages; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE villages ( + id integer NOT NULL, + city_id integer NOT NULL, + name character varying(255) NOT NULL, + city_type_id integer NOT NULL, + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: TABLE villages; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE villages IS 'Посёлки'; + + +-- +-- Name: COLUMN villages.city_id; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN villages.city_id IS 'Город'; + + +-- +-- Name: COLUMN villages.name; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN villages.name IS 'Название'; + + +-- +-- Name: COLUMN villages.city_type_id; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN villages.city_type_id IS 'Тип города'; + + +-- +-- Name: villages_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE villages_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: villages_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE villages_id_seq OWNED BY villages.id; + + +-- +-- Name: visit_cards; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE visit_cards ( + id integer NOT NULL, + subject_id integer NOT NULL, + subject_type character varying(255) NOT NULL, + fio character varying(255), + "position" character varying(255), + contacts character varying(255), + is_company_logo_as_photo boolean DEFAULT false NOT NULL, + created_at timestamp without time zone, + updated_at timestamp without time zone, + additional_contacts text, + show_email boolean, + email character varying(255) +); + + +-- +-- Name: TABLE visit_cards; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE visit_cards IS 'Учетки сгенерированных визитных карточек'; + + +-- +-- Name: COLUMN visit_cards.subject_id; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN visit_cards.subject_id IS 'FK объекта-владельца визитки (CompanyUser или User)'; + + +-- +-- Name: COLUMN visit_cards.subject_type; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN visit_cards.subject_type IS 'Тип объекта-владельца визитки для polymorphic association (CompanyUser или User)'; + + +-- +-- Name: COLUMN visit_cards.fio; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN visit_cards.fio IS 'ФИО владельца визитки. NULL если брать из профиля пользователя'; + + +-- +-- Name: COLUMN visit_cards."position"; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN visit_cards."position" IS 'Должность владельца визитки. NULL если брать из профиля пользователя'; + + +-- +-- Name: COLUMN visit_cards.contacts; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN visit_cards.contacts IS 'Телефон владельца визитки. NULL если брать из профиля пользователя'; + + +-- +-- Name: COLUMN visit_cards.is_company_logo_as_photo; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN visit_cards.is_company_logo_as_photo IS 'Какую картинку рисовать на визитке. Только если визитка принадлежит CompanyUser. true - логотип компании, false - аватар пользователя'; + + +-- +-- Name: COLUMN visit_cards.additional_contacts; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN visit_cards.additional_contacts IS 'Дополнительный телефон / ICQ / Skype'; + + +-- +-- Name: COLUMN visit_cards.show_email; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN visit_cards.show_email IS 'Публиковать электропочту на визитке'; + + +-- +-- Name: COLUMN visit_cards.email; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN visit_cards.email IS 'Электропочта'; + + +-- +-- Name: visit_cards_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE visit_cards_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: visit_cards_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE visit_cards_id_seq OWNED BY visit_cards.id; + + +-- +-- Name: vw_products_with_properties; Type: VIEW; Schema: public; Owner: - +-- + +CREATE VIEW vw_products_with_properties AS + SELECT p.id, p.name, p.announce, p.description, p.company_id, p.created_at, p.rubric_id, p.is_public, p.regions, p.moderator_comment, p."position", p.moderated_at, p.moderated_by, p.state AS product_state, p.oferta_sync_id, p.url_name, p.rubric_l4_priority, p.rubric_l5_priority, p.delta, p.paid_conditions, p.delivery_time, p.rand_sort, p.mainpage_position, p.product_group_id, p.article, p.order_url, p.yml_id, p.yml_image_url_crc, p.deleted_at, p.measure_unit_id, p.page_title, p.total_order_clicks, p.min_qty, p.qty_measure_unit_id, p.announce_valid, p.archived_at, pp.price, pp.price_max, pp.is_exact_price, pp."exists", pp.currency, pp.updated_at, pp.actualized_at FROM (products p JOIN product_properties pp ON ((pp.product_id = p.id))); + + +-- +-- Name: wiki_page_versions; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE wiki_page_versions ( + id integer NOT NULL, + wiki_page_id integer, + created_by integer NOT NULL, + text text, + version integer DEFAULT 1 NOT NULL, + state character varying(255) DEFAULT 'pending'::character varying, + moderated_by integer, + moderator_comment character varying(255), + created_at timestamp without time zone, + updated_at timestamp without time zone, + title character varying(255), + lead character varying(200) +); + + +-- +-- Name: COLUMN wiki_page_versions.lead; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN wiki_page_versions.lead IS 'Анонс вики-страницы'; + + +-- +-- Name: wiki_page_versions_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE wiki_page_versions_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: wiki_page_versions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE wiki_page_versions_id_seq OWNED BY wiki_page_versions.id; + + +-- +-- Name: wiki_pages; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE wiki_pages ( + id integer NOT NULL, + title character varying(255) NOT NULL, + text text, + seo_entity_id integer, + created_at timestamp without time zone, + updated_at timestamp without time zone, + region_id integer NOT NULL, + slug character varying(255) NOT NULL, + delta boolean DEFAULT true NOT NULL, + title_changed boolean DEFAULT false, + lead character varying(200) +); + + +-- +-- Name: COLUMN wiki_pages.lead; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN wiki_pages.lead IS 'Анонс вики-страницы'; + + +-- +-- Name: wiki_pages_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE wiki_pages_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: wiki_pages_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE wiki_pages_id_seq OWNED BY wiki_pages.id; + + +-- +-- Name: wiki_pages_to_wiki_pages; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE wiki_pages_to_wiki_pages ( + id integer NOT NULL, + wiki_page_id integer, + other_page_id integer, + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: wiki_pages_to_wiki_pages_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE wiki_pages_to_wiki_pages_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: wiki_pages_to_wiki_pages_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE wiki_pages_to_wiki_pages_id_seq OWNED BY wiki_pages_to_wiki_pages.id; + + +-- +-- Name: wiki_types; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE wiki_types ( + id integer NOT NULL, + name character varying(255), + text text, + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: wiki_types_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE wiki_types_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: wiki_types_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE wiki_types_id_seq OWNED BY wiki_types.id; + + +-- +-- Name: wordstat_rubrics; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE wordstat_rubrics ( + id integer NOT NULL, + rubric_id integer, + state character varying(10) DEFAULT 'new'::character varying +); + + +-- +-- Name: wordstat_rubrics_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE wordstat_rubrics_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: wordstat_rubrics_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE wordstat_rubrics_id_seq OWNED BY wordstat_rubrics.id; + + +-- +-- Name: xml_clients; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE xml_clients ( + id integer NOT NULL, + name character varying(255), + ip_address character varying(15) NOT NULL, + url character varying(255), + state character varying(20) DEFAULT 'pending'::character varying +); + + +-- +-- Name: xml_clients_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE xml_clients_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: xml_clients_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE xml_clients_id_seq OWNED BY xml_clients.id; + + +-- +-- Name: yandex_direct_banner_rubrics; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE yandex_direct_banner_rubrics ( + id integer NOT NULL, + yandex_direct_banner_id integer NOT NULL, + rubric_id integer NOT NULL +); + + +-- +-- Name: yandex_direct_banner_rubrics_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE yandex_direct_banner_rubrics_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: yandex_direct_banner_rubrics_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE yandex_direct_banner_rubrics_id_seq OWNED BY yandex_direct_banner_rubrics.id; + + +-- +-- Name: yandex_direct_banners; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE yandex_direct_banners ( + id integer NOT NULL, + yandex_direct_campaign_id integer, + ya_id integer, + title character varying(255), + text character varying(255), + rubric_id integer, + region_id integer, + state character varying(255) DEFAULT 'new'::character varying NOT NULL, + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: yandex_direct_banners_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE yandex_direct_banners_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: yandex_direct_banners_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE yandex_direct_banners_id_seq OWNED BY yandex_direct_banners.id; + + +-- +-- Name: yandex_direct_campaigns; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE yandex_direct_campaigns ( + id integer NOT NULL, + login character varying(255), + ya_id integer, + name character varying(255), + auto_optimization boolean DEFAULT true, + email character varying(255), + fio character varying(255), + money_warning_value integer DEFAULT 20, + send_warn boolean DEFAULT true, + start_date date, + status_behavior boolean DEFAULT true, + context_limit_sum integer DEFAULT 254, + context_price_percent integer DEFAULT 100, + count_banners integer DEFAULT 0, + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: yandex_direct_campaigns_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE yandex_direct_campaigns_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: yandex_direct_campaigns_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE yandex_direct_campaigns_id_seq OWNED BY yandex_direct_campaigns.id; + + +-- +-- Name: yandex_ips; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE yandex_ips ( + id integer NOT NULL, + lr integer, + ip bigint, + visits_count integer DEFAULT 1, + unacted boolean DEFAULT true, + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: TABLE yandex_ips; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE yandex_ips IS 'IP-регионы Яндекса'; + + +-- +-- Name: COLUMN yandex_ips.lr; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN yandex_ips.lr IS 'Идентификатор яндекс региона'; + + +-- +-- Name: COLUMN yandex_ips.ip; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN yandex_ips.ip IS 'IP в числовом представлении'; + + +-- +-- Name: COLUMN yandex_ips.visits_count; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN yandex_ips.visits_count IS 'Количество переходов'; + + +-- +-- Name: COLUMN yandex_ips.unacted; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN yandex_ips.unacted IS 'Новая еще не загруженная в ip_infos'; + + +-- +-- Name: yandex_ips_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE yandex_ips_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: yandex_ips_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE yandex_ips_id_seq OWNED BY yandex_ips.id; + + +-- +-- Name: yandex_map_coordinates; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE yandex_map_coordinates ( + id integer NOT NULL, + address_id integer, + longitude double precision DEFAULT 0.0 NOT NULL, + latitude double precision DEFAULT 0.0 NOT NULL, + manual boolean DEFAULT false NOT NULL, + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: TABLE yandex_map_coordinates; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE yandex_map_coordinates IS 'Координаты усадеб компаний на yandex.maps'; + + +-- +-- Name: COLUMN yandex_map_coordinates.longitude; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN yandex_map_coordinates.longitude IS 'Долгота'; + + +-- +-- Name: COLUMN yandex_map_coordinates.latitude; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN yandex_map_coordinates.latitude IS 'Широта'; + + +-- +-- Name: COLUMN yandex_map_coordinates.manual; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN yandex_map_coordinates.manual IS 'Неизвестно'; + + +-- +-- Name: yandex_map_coordinates_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE yandex_map_coordinates_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: yandex_map_coordinates_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE yandex_map_coordinates_id_seq OWNED BY yandex_map_coordinates.id; + + +-- +-- Name: yandex_region_regions; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE yandex_region_regions ( + id integer NOT NULL, + yandex_region_id integer, + region_id integer +); + + +-- +-- Name: yandex_region_regions_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE yandex_region_regions_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: yandex_region_regions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE yandex_region_regions_id_seq OWNED BY yandex_region_regions.id; + + +-- +-- Name: yandex_regions; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE yandex_regions ( + id integer NOT NULL, + region_id integer, + name character varying(255), + parent_id integer, + visits_count integer, + city_id integer +); + + +-- +-- Name: TABLE yandex_regions; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE yandex_regions IS 'ID города Пульс Цен'; + + +-- +-- Name: COLUMN yandex_regions.region_id; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN yandex_regions.region_id IS 'Регион яндекса'; + + +-- +-- Name: COLUMN yandex_regions.parent_id; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN yandex_regions.parent_id IS 'Родительский регион яндекса'; + + +-- +-- Name: COLUMN yandex_regions.city_id; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN yandex_regions.city_id IS 'ИД города(нашего)'; + + +-- +-- Name: yandex_regions_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE yandex_regions_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: yandex_regions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE yandex_regions_id_seq OWNED BY yandex_regions.id; + + +-- +-- Name: yandex_rubrics; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE yandex_rubrics ( + id integer NOT NULL, + title character varying(255), + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: yandex_rubrics_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE yandex_rubrics_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: yandex_rubrics_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE yandex_rubrics_id_seq OWNED BY yandex_rubrics.id; + + +-- +-- Name: yandex_rubrics_pc_rubrics; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE yandex_rubrics_pc_rubrics ( + id integer NOT NULL, + yandex_rubric_id integer, + rubric_id integer, + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: yandex_rubrics_pc_rubrics_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE yandex_rubrics_pc_rubrics_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: yandex_rubrics_pc_rubrics_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE yandex_rubrics_pc_rubrics_id_seq OWNED BY yandex_rubrics_pc_rubrics.id; + + +-- +-- Name: yandex_search_widgets; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE yandex_search_widgets ( + id integer NOT NULL, + title character varying(255), + description character varying(255), + url character varying(255), + region_id integer, + content text, + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: yandex_search_widgets_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE yandex_search_widgets_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: yandex_search_widgets_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE yandex_search_widgets_id_seq OWNED BY yandex_search_widgets.id; + + +-- +-- Name: zombie_rows; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE zombie_rows ( + id integer NOT NULL, + company_id integer, + rubric_id integer, + is_empty boolean, + currency integer, + is_deleted boolean, + title character varying(255) NOT NULL, + is_demand boolean, + title_full character varying(255), + is_exact boolean, + regions character varying(4000) NOT NULL, + "position" integer, + created_at timestamp without time zone, + updated_at timestamp without time zone, + rubric_l1_id integer, + rubric_l2_id integer, + rubric_l3_id integer, + rubric_l4_id integer, + price double precision, + price_max double precision, + price_uni double precision, + product_id integer, + sort_level integer, + actualization_date timestamp without time zone +); + + +-- +-- Name: TABLE zombie_rows; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE zombie_rows IS 'Лоты-зомби, после импорта не прошедшие проверку на целостность'; + + +-- +-- Name: zombie_rows_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE zombie_rows_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: zombie_rows_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE zombie_rows_id_seq OWNED BY zombie_rows.id; + + +SET search_path = search, pg_catalog; + +-- +-- Name: demands_sphinx_prepared; Type: VIEW; Schema: search; Owner: - +-- + +CREATE VIEW demands_sphinx_prepared AS + SELECT demands.id, ((((((((('rubric_l1_id_'::text || COALESCE((tree.rubric_l1_id)::text, ''::text)) || ' rubric_l2_id_'::text) || COALESCE((tree.rubric_l2_id)::text, ''::text)) || ' rubric_l3_id_'::text) || COALESCE((tree.rubric_l3_id)::text, ''::text)) || ' rubric_l4_id_'::text) || COALESCE((tree.rubric_l4_id)::text, ''::text)) || ' rubric_id_'::text) || COALESCE((tree.rubric_id)::text, ''::text)) AS w0, search_index_demands.w1, search_index_demands.w2, tree.rubric_id, tree.rubric_l1_id, tree.rubric_l2_id, tree.rubric_l3_id, tree.rubric_l4_id, demands.company_id, ((regions.id || ','::text) || root_regions.id) AS regions, (demands.state)::integer AS state, COALESCE((round(date_part('epoch'::text, abstime(demands.created_at))))::integer, 0) AS created_at, COALESCE((round(date_part('epoch'::text, abstime(demands.updated_at))))::integer, 0) AS updated_at, COALESCE((round(date_part('epoch'::text, abstime(demands.actualized_at))))::integer, 0) AS actualized_at, COALESCE((round(date_part('epoch'::text, abstime(demands.valid_till))))::integer, 0) AS valid_till, (demands.is_published)::integer AS is_published FROM (((((public.demand_items JOIN public.demands ON ((demand_items.demand_id = demands.id))) JOIN public.search_index_demands ON ((demands.id = search_index_demands.demand_id))) JOIN public.regions ON ((demands.region_id = regions.id))) JOIN (SELECT regions.id, (SELECT array_agg(r.id) AS array_agg FROM public.regions r WHERE (((r.lft > regions.lft) AND (r.rgt < regions.rgt)) AND ((r.rgt - r.lft) = 1))) AS leaves FROM public.regions WHERE (regions.parent_id IS NULL)) root_regions ON ((regions.id = ANY (root_regions.leaves)))) LEFT JOIN public.rubrics_denormalization_tree tree ON ((demand_items.rubric_id = tree.rubric_id))); + + +SET search_path = search_hints, pg_catalog; + +-- +-- Name: form_frequency; Type: TABLE; Schema: search_hints; Owner: -; Tablespace: +-- + +CREATE TABLE form_frequency ( + id integer NOT NULL, + form_id integer NOT NULL, + value integer DEFAULT 0 NOT NULL, + loaded timestamp without time zone NOT NULL +); + + +-- +-- Name: TABLE form_frequency; Type: COMMENT; Schema: search_hints; Owner: - +-- + +COMMENT ON TABLE form_frequency IS 'Частотность поисковых форм в разрезе загрузок'; + + +-- +-- Name: COLUMN form_frequency.form_id; Type: COMMENT; Schema: search_hints; Owner: - +-- + +COMMENT ON COLUMN form_frequency.form_id IS 'Ссылка на форму (forms.id)'; + + +-- +-- Name: COLUMN form_frequency.value; Type: COMMENT; Schema: search_hints; Owner: - +-- + +COMMENT ON COLUMN form_frequency.value IS 'Значение частоты'; + + +-- +-- Name: COLUMN form_frequency.loaded; Type: COMMENT; Schema: search_hints; Owner: - +-- + +COMMENT ON COLUMN form_frequency.loaded IS 'Время загрузки'; + + +-- +-- Name: form_frequency_id_seq; Type: SEQUENCE; Schema: search_hints; Owner: - +-- + +CREATE SEQUENCE form_frequency_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: form_frequency_id_seq; Type: SEQUENCE OWNED BY; Schema: search_hints; Owner: - +-- + +ALTER SEQUENCE form_frequency_id_seq OWNED BY form_frequency.id; + + +-- +-- Name: form_rubrics; Type: TABLE; Schema: search_hints; Owner: -; Tablespace: +-- + +CREATE TABLE form_rubrics ( + id integer NOT NULL, + form_id integer NOT NULL, + rubric_id integer NOT NULL, + oid integer DEFAULT 0 NOT NULL, + trait_value_id integer +); + + +-- +-- Name: TABLE form_rubrics; Type: COMMENT; Schema: search_hints; Owner: - +-- + +COMMENT ON TABLE form_rubrics IS 'Связка поисковых форм и рубрик'; + + +-- +-- Name: COLUMN form_rubrics.form_id; Type: COMMENT; Schema: search_hints; Owner: - +-- + +COMMENT ON COLUMN form_rubrics.form_id IS 'Ссылка на форму (forms.id)'; + + +-- +-- Name: COLUMN form_rubrics.rubric_id; Type: COMMENT; Schema: search_hints; Owner: - +-- + +COMMENT ON COLUMN form_rubrics.rubric_id IS 'Ссылка на рубрик (rubrics.id)'; + + +-- +-- Name: COLUMN form_rubrics.oid; Type: COMMENT; Schema: search_hints; Owner: - +-- + +COMMENT ON COLUMN form_rubrics.oid IS 'Порядок привязки'; + + +-- +-- Name: form_rubrics_id_seq; Type: SEQUENCE; Schema: search_hints; Owner: - +-- + +CREATE SEQUENCE form_rubrics_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: form_rubrics_id_seq; Type: SEQUENCE OWNED BY; Schema: search_hints; Owner: - +-- + +ALTER SEQUENCE form_rubrics_id_seq OWNED BY form_rubrics.id; + + +-- +-- Name: forms; Type: TABLE; Schema: search_hints; Owner: -; Tablespace: +-- + +CREATE TABLE forms ( + id integer NOT NULL, + value character varying(2000) NOT NULL, + main_form_id integer, + used boolean DEFAULT true NOT NULL, + request_id integer NOT NULL, + frequency integer DEFAULT 0 NOT NULL +); + + +-- +-- Name: TABLE forms; Type: COMMENT; Schema: search_hints; Owner: - +-- + +COMMENT ON TABLE forms IS 'Поисковая форма'; + + +-- +-- Name: COLUMN forms.value; Type: COMMENT; Schema: search_hints; Owner: - +-- + +COMMENT ON COLUMN forms.value IS 'Флаг - используется'; + + +-- +-- Name: COLUMN forms.main_form_id; Type: COMMENT; Schema: search_hints; Owner: - +-- + +COMMENT ON COLUMN forms.main_form_id IS 'Ссылка на основную форму (forms.id)'; + + +-- +-- Name: COLUMN forms.request_id; Type: COMMENT; Schema: search_hints; Owner: - +-- + +COMMENT ON COLUMN forms.request_id IS 'Ссылка на запрос (requests.id)'; + + +-- +-- Name: COLUMN forms.frequency; Type: COMMENT; Schema: search_hints; Owner: - +-- + +COMMENT ON COLUMN forms.frequency IS 'Накопленная частота (суммарная за период)'; + + +-- +-- Name: forms_for_load; Type: TABLE; Schema: search_hints; Owner: -; Tablespace: +-- + +CREATE TABLE forms_for_load ( + form_id integer NOT NULL, + used boolean NOT NULL, + main_request character varying(2000), + rubric_url character varying(2000), + oid integer DEFAULT 0 NOT NULL, + trait_id integer, + trait_value_slug character varying(45) +); + + +-- +-- Name: forms_id_seq; Type: SEQUENCE; Schema: search_hints; Owner: - +-- + +CREATE SEQUENCE forms_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: forms_id_seq; Type: SEQUENCE OWNED BY; Schema: search_hints; Owner: - +-- + +ALTER SEQUENCE forms_id_seq OWNED BY forms.id; + + +-- +-- Name: requests; Type: TABLE; Schema: search_hints; Owner: -; Tablespace: +-- + +CREATE TABLE requests ( + id integer NOT NULL, + value character varying(2000) NOT NULL +); + + +-- +-- Name: TABLE requests; Type: COMMENT; Schema: search_hints; Owner: - +-- + +COMMENT ON TABLE requests IS 'Поисковые запросы'; + + +-- +-- Name: COLUMN requests.value; Type: COMMENT; Schema: search_hints; Owner: - +-- + +COMMENT ON COLUMN requests.value IS 'Запрос'; + + +-- +-- Name: requests_for_load; Type: TABLE; Schema: search_hints; Owner: -; Tablespace: +-- + +CREATE TABLE requests_for_load ( + id integer NOT NULL, + request character varying(2000) NOT NULL, + search_form character varying(2000), + frequency_current integer DEFAULT 0 NOT NULL +); + + +-- +-- Name: TABLE requests_for_load; Type: COMMENT; Schema: search_hints; Owner: - +-- + +COMMENT ON TABLE requests_for_load IS 'Поисковые запросы для загрузки'; + + +-- +-- Name: COLUMN requests_for_load.request; Type: COMMENT; Schema: search_hints; Owner: - +-- + +COMMENT ON COLUMN requests_for_load.request IS 'Запрос'; + + +-- +-- Name: COLUMN requests_for_load.search_form; Type: COMMENT; Schema: search_hints; Owner: - +-- + +COMMENT ON COLUMN requests_for_load.search_form IS 'Форма (рассчитываемое поле)'; + + +-- +-- Name: COLUMN requests_for_load.frequency_current; Type: COMMENT; Schema: search_hints; Owner: - +-- + +COMMENT ON COLUMN requests_for_load.frequency_current IS 'Часто запроса'; + + +-- +-- Name: requests_for_load_id_seq; Type: SEQUENCE; Schema: search_hints; Owner: - +-- + +CREATE SEQUENCE requests_for_load_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: requests_for_load_id_seq; Type: SEQUENCE OWNED BY; Schema: search_hints; Owner: - +-- + +ALTER SEQUENCE requests_for_load_id_seq OWNED BY requests_for_load.id; + + +-- +-- Name: requests_id_seq; Type: SEQUENCE; Schema: search_hints; Owner: - +-- + +CREATE SEQUENCE requests_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: requests_id_seq; Type: SEQUENCE OWNED BY; Schema: search_hints; Owner: - +-- + +ALTER SEQUENCE requests_id_seq OWNED BY requests.id; + + +SET search_path = service_box, pg_catalog; + +-- +-- Name: web_searchers; Type: TABLE; Schema: service_box; Owner: -; Tablespace: +-- + +CREATE TABLE web_searchers ( + id integer NOT NULL, + name character varying(255) +); + + +-- +-- Name: TABLE web_searchers; Type: COMMENT; Schema: service_box; Owner: - +-- + +COMMENT ON TABLE web_searchers IS 'Веб поисковики'; + + +-- +-- Name: COLUMN web_searchers.name; Type: COMMENT; Schema: service_box; Owner: - +-- + +COMMENT ON COLUMN web_searchers.name IS 'Название поисковика'; + + +-- +-- Name: web_searchers_codes_stats; Type: TABLE; Schema: service_box; Owner: -; Tablespace: +-- + +CREATE TABLE web_searchers_codes_stats ( + id integer NOT NULL, + web_searcher_id integer, + code integer, + count integer, + date date, + domain character varying(255) +); + + +-- +-- Name: TABLE web_searchers_codes_stats; Type: COMMENT; Schema: service_box; Owner: - +-- + +COMMENT ON TABLE web_searchers_codes_stats IS 'Коды ответов поисковиков'; + + +-- +-- Name: COLUMN web_searchers_codes_stats.web_searcher_id; Type: COMMENT; Schema: service_box; Owner: - +-- + +COMMENT ON COLUMN web_searchers_codes_stats.web_searcher_id IS 'Идентификатор поисковика'; + + +-- +-- Name: COLUMN web_searchers_codes_stats.code; Type: COMMENT; Schema: service_box; Owner: - +-- + +COMMENT ON COLUMN web_searchers_codes_stats.code IS 'Код ответа'; + + +-- +-- Name: COLUMN web_searchers_codes_stats.count; Type: COMMENT; Schema: service_box; Owner: - +-- + +COMMENT ON COLUMN web_searchers_codes_stats.count IS 'Количество ответов'; + + +-- +-- Name: COLUMN web_searchers_codes_stats.date; Type: COMMENT; Schema: service_box; Owner: - +-- + +COMMENT ON COLUMN web_searchers_codes_stats.date IS 'Дата'; + + +-- +-- Name: COLUMN web_searchers_codes_stats.domain; Type: COMMENT; Schema: service_box; Owner: - +-- + +COMMENT ON COLUMN web_searchers_codes_stats.domain IS 'Домен'; + + +-- +-- Name: web_searchers_codes_stats_id_seq; Type: SEQUENCE; Schema: service_box; Owner: - +-- + +CREATE SEQUENCE web_searchers_codes_stats_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: web_searchers_codes_stats_id_seq; Type: SEQUENCE OWNED BY; Schema: service_box; Owner: - +-- + +ALTER SEQUENCE web_searchers_codes_stats_id_seq OWNED BY web_searchers_codes_stats.id; + + +-- +-- Name: web_searchers_id_seq; Type: SEQUENCE; Schema: service_box; Owner: - +-- + +CREATE SEQUENCE web_searchers_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: web_searchers_id_seq; Type: SEQUENCE OWNED BY; Schema: service_box; Owner: - +-- + +ALTER SEQUENCE web_searchers_id_seq OWNED BY web_searchers.id; + + +SET search_path = statistics, pg_catalog; + +-- +-- Name: blog_post_statistic_total_by_days; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE blog_post_statistic_total_by_days ( + id integer NOT NULL, + blog_post_id integer NOT NULL, + date date NOT NULL, + hits integer DEFAULT 0 +); + + +-- +-- Name: TABLE blog_post_statistic_total_by_days; Type: COMMENT; Schema: statistics; Owner: - +-- + +COMMENT ON TABLE blog_post_statistic_total_by_days IS 'Подневаня статистика просмотров постов блогов'; + + +-- +-- Name: blog_post_statistic_total_by_days_14_07; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE blog_post_statistic_total_by_days_14_07 ( + CONSTRAINT blog_post_statistic_total_by_days_14_07_date_check CHECK (((date >= '2014-07-01 00:00:00'::timestamp without time zone) AND (date < '2014-08-01 00:00:00'::timestamp without time zone))) +) +INHERITS (blog_post_statistic_total_by_days); + + +-- +-- Name: blog_post_statistic_total_by_days_14_08; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE blog_post_statistic_total_by_days_14_08 ( + CONSTRAINT blog_post_statistic_total_by_days_14_08_date_check CHECK (((date >= '2014-08-01 00:00:00'::timestamp without time zone) AND (date < '2014-09-01 00:00:00'::timestamp without time zone))) +) +INHERITS (blog_post_statistic_total_by_days); + + +-- +-- Name: blog_post_statistic_total_by_days_14_09; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE blog_post_statistic_total_by_days_14_09 ( + CONSTRAINT blog_post_statistic_total_by_days_14_09_date_check CHECK (((date >= '2014-09-01 00:00:00'::timestamp without time zone) AND (date < '2014-10-01 00:00:00'::timestamp without time zone))) +) +INHERITS (blog_post_statistic_total_by_days); + + +-- +-- Name: blog_post_statistic_total_by_days_14_10; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE blog_post_statistic_total_by_days_14_10 ( + CONSTRAINT blog_post_statistic_total_by_days_14_10_date_check CHECK (((date >= '2014-10-01 00:00:00'::timestamp without time zone) AND (date < '2014-11-01 00:00:00'::timestamp without time zone))) +) +INHERITS (blog_post_statistic_total_by_days); + + +-- +-- Name: blog_post_statistic_total_by_days_14_11; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE blog_post_statistic_total_by_days_14_11 ( + CONSTRAINT blog_post_statistic_total_by_days_14_11_date_check CHECK (((date >= '2014-11-01 00:00:00'::timestamp without time zone) AND (date < '2014-12-01 00:00:00'::timestamp without time zone))) +) +INHERITS (blog_post_statistic_total_by_days); + + +-- +-- Name: blog_post_statistic_total_by_days_14_12; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE blog_post_statistic_total_by_days_14_12 ( + CONSTRAINT blog_post_statistic_total_by_days_14_12_date_check CHECK (((date >= '2014-12-01 00:00:00'::timestamp without time zone) AND (date < '2015-01-01 00:00:00'::timestamp without time zone))) +) +INHERITS (blog_post_statistic_total_by_days); + + +-- +-- Name: blog_post_statistic_total_by_days_15_01; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE blog_post_statistic_total_by_days_15_01 ( + CONSTRAINT blog_post_statistic_total_by_days_15_01_date_check CHECK (((date >= '2015-01-01 00:00:00'::timestamp without time zone) AND (date < '2015-02-01 00:00:00'::timestamp without time zone))) +) +INHERITS (blog_post_statistic_total_by_days); + + +-- +-- Name: blog_post_statistic_total_by_days_id_seq; Type: SEQUENCE; Schema: statistics; Owner: - +-- + +CREATE SEQUENCE blog_post_statistic_total_by_days_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: blog_post_statistic_total_by_days_id_seq; Type: SEQUENCE OWNED BY; Schema: statistics; Owner: - +-- + +ALTER SEQUENCE blog_post_statistic_total_by_days_id_seq OWNED BY blog_post_statistic_total_by_days.id; + + +-- +-- Name: blog_post_statistic_totals; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE blog_post_statistic_totals ( + id integer NOT NULL, + blog_post_id integer NOT NULL, + hits integer DEFAULT 0 +); + + +-- +-- Name: TABLE blog_post_statistic_totals; Type: COMMENT; Schema: statistics; Owner: - +-- + +COMMENT ON TABLE blog_post_statistic_totals IS 'Суммарная статистика просомтра постов блогов'; + + +-- +-- Name: blog_post_statistic_totals_id_seq; Type: SEQUENCE; Schema: statistics; Owner: - +-- + +CREATE SEQUENCE blog_post_statistic_totals_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: blog_post_statistic_totals_id_seq; Type: SEQUENCE OWNED BY; Schema: statistics; Owner: - +-- + +ALTER SEQUENCE blog_post_statistic_totals_id_seq OWNED BY blog_post_statistic_totals.id; + + +-- +-- Name: company_statistic_activities_by_days; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_activities_by_days ( + id integer NOT NULL, + company_id integer NOT NULL, + date date NOT NULL, + action activities_action NOT NULL, + value integer DEFAULT 0 NOT NULL +); + + +-- +-- Name: company_statistic_activities_by_days_15_09; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_activities_by_days_15_09 ( + CONSTRAINT company_statistic_activities_by_days_15_09_date_check CHECK (((date >= '2015-09-01 00:00:00'::timestamp without time zone) AND (date < '2015-10-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_activities_by_days); + + +-- +-- Name: company_statistic_activities_by_days_id_seq; Type: SEQUENCE; Schema: statistics; Owner: - +-- + +CREATE SEQUENCE company_statistic_activities_by_days_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: company_statistic_activities_by_days_id_seq; Type: SEQUENCE OWNED BY; Schema: statistics; Owner: - +-- + +ALTER SEQUENCE company_statistic_activities_by_days_id_seq OWNED BY company_statistic_activities_by_days.id; + + +-- +-- Name: company_statistic_activities_by_months; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_activities_by_months ( + id integer NOT NULL, + company_id integer NOT NULL, + date date NOT NULL, + action activities_action NOT NULL, + value integer DEFAULT 0 NOT NULL +); + + +-- +-- Name: company_statistic_activities_by_months_15_09; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_activities_by_months_15_09 ( + CONSTRAINT company_statistic_activities_by_months_15_09_date_check CHECK (((date >= '2015-09-01 00:00:00'::timestamp without time zone) AND (date < '2015-10-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_activities_by_months); + + +-- +-- Name: company_statistic_activities_by_months_id_seq; Type: SEQUENCE; Schema: statistics; Owner: - +-- + +CREATE SEQUENCE company_statistic_activities_by_months_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: company_statistic_activities_by_months_id_seq; Type: SEQUENCE OWNED BY; Schema: statistics; Owner: - +-- + +ALTER SEQUENCE company_statistic_activities_by_months_id_seq OWNED BY company_statistic_activities_by_months.id; + + +-- +-- Name: company_statistic_activities_by_weeks; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_activities_by_weeks ( + id integer NOT NULL, + company_id integer NOT NULL, + first_week_day date NOT NULL, + last_week_day date NOT NULL, + year integer NOT NULL, + week integer NOT NULL, + action activities_action NOT NULL, + value integer DEFAULT 0 NOT NULL +); + + +-- +-- Name: company_statistic_activities_by_weeks_15_09; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_activities_by_weeks_15_09 ( + CONSTRAINT company_statistic_activities_by_weeks_15_0_first_week_day_check CHECK (((first_week_day >= '2015-09-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2015-10-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_activities_by_weeks); + + +-- +-- Name: company_statistic_activities_by_weeks_id_seq; Type: SEQUENCE; Schema: statistics; Owner: - +-- + +CREATE SEQUENCE company_statistic_activities_by_weeks_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: company_statistic_activities_by_weeks_id_seq; Type: SEQUENCE OWNED BY; Schema: statistics; Owner: - +-- + +ALTER SEQUENCE company_statistic_activities_by_weeks_id_seq OWNED BY company_statistic_activities_by_weeks.id; + + +-- +-- Name: company_statistic_activities_totals; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_activities_totals ( + id integer NOT NULL, + company_id integer NOT NULL, + action activities_action NOT NULL, + value integer DEFAULT 0 NOT NULL +); + + +-- +-- Name: company_statistic_activities_totals_id_seq; Type: SEQUENCE; Schema: statistics; Owner: - +-- + +CREATE SEQUENCE company_statistic_activities_totals_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: company_statistic_activities_totals_id_seq; Type: SEQUENCE OWNED BY; Schema: statistics; Owner: - +-- + +ALTER SEQUENCE company_statistic_activities_totals_id_seq OWNED BY company_statistic_activities_totals.id; + + +-- +-- Name: company_statistic_geo_by_months; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_geo_by_months ( + id integer NOT NULL, + company_id integer, + date date NOT NULL, + city_id integer, + pages integer DEFAULT 0 NOT NULL, + visits integer DEFAULT 0 NOT NULL +); + + +-- +-- Name: company_statistic_geo_by_months_09_04; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_geo_by_months_09_04 ( + CONSTRAINT company_statistic_geo_by_months_09_04_date_check CHECK (((date >= '2009-04-01 00:00:00'::timestamp without time zone) AND (date < '2009-05-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_geo_by_months); + + +-- +-- Name: company_statistic_geo_by_months_09_05; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_geo_by_months_09_05 ( + CONSTRAINT company_statistic_geo_by_months_09_05_date_check CHECK (((date >= '2009-05-01 00:00:00'::timestamp without time zone) AND (date < '2009-06-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_geo_by_months); + + +-- +-- Name: company_statistic_geo_by_months_09_06; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_geo_by_months_09_06 ( + CONSTRAINT company_statistic_geo_by_months_09_06_date_check CHECK (((date >= '2009-06-01 00:00:00'::timestamp without time zone) AND (date < '2009-07-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_geo_by_months); + + +-- +-- Name: company_statistic_geo_by_months_09_07; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_geo_by_months_09_07 ( + CONSTRAINT company_statistic_geo_by_months_09_07_date_check CHECK (((date >= '2009-07-01 00:00:00'::timestamp without time zone) AND (date < '2009-08-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_geo_by_months); + + +-- +-- Name: company_statistic_geo_by_months_09_08; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_geo_by_months_09_08 ( + CONSTRAINT company_statistic_geo_by_months_09_08_date_check CHECK (((date >= '2009-08-01 00:00:00'::timestamp without time zone) AND (date < '2009-09-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_geo_by_months); + + +-- +-- Name: company_statistic_geo_by_months_09_09; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_geo_by_months_09_09 ( + CONSTRAINT company_statistic_geo_by_months_09_09_date_check CHECK (((date >= '2009-09-01 00:00:00'::timestamp without time zone) AND (date < '2009-10-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_geo_by_months); + + +-- +-- Name: company_statistic_geo_by_months_09_10; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_geo_by_months_09_10 ( + CONSTRAINT company_statistic_geo_by_months_09_10_date_check CHECK (((date >= '2009-10-01 00:00:00'::timestamp without time zone) AND (date < '2009-11-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_geo_by_months); + + +-- +-- Name: company_statistic_geo_by_months_09_11; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_geo_by_months_09_11 ( + CONSTRAINT company_statistic_geo_by_months_09_11_date_check CHECK (((date >= '2009-11-01 00:00:00'::timestamp without time zone) AND (date < '2009-12-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_geo_by_months); + + +-- +-- Name: company_statistic_geo_by_months_09_12; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_geo_by_months_09_12 ( + CONSTRAINT company_statistic_geo_by_months_09_12_date_check CHECK (((date >= '2009-12-01 00:00:00'::timestamp without time zone) AND (date < '2010-01-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_geo_by_months); + + +-- +-- Name: company_statistic_geo_by_months_10_01; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_geo_by_months_10_01 ( + CONSTRAINT company_statistic_geo_by_months_10_01_date_check CHECK (((date >= '2010-01-01 00:00:00'::timestamp without time zone) AND (date < '2010-02-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_geo_by_months); + + +-- +-- Name: company_statistic_geo_by_months_10_02; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_geo_by_months_10_02 ( + CONSTRAINT company_statistic_geo_by_months_10_02_date_check CHECK (((date >= '2010-02-01 00:00:00'::timestamp without time zone) AND (date < '2010-03-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_geo_by_months); + + +-- +-- Name: company_statistic_geo_by_months_10_03; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_geo_by_months_10_03 ( + CONSTRAINT company_statistic_geo_by_months_10_03_date_check CHECK (((date >= '2010-03-01 00:00:00'::timestamp without time zone) AND (date < '2010-04-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_geo_by_months); + + +-- +-- Name: company_statistic_geo_by_months_10_04; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_geo_by_months_10_04 ( + CONSTRAINT company_statistic_geo_by_months_10_04_date_check CHECK (((date >= '2010-04-01 00:00:00'::timestamp without time zone) AND (date < '2010-05-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_geo_by_months); + + +-- +-- Name: company_statistic_geo_by_months_10_05; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_geo_by_months_10_05 ( + CONSTRAINT company_statistic_geo_by_months_10_05_date_check CHECK (((date >= '2010-05-01 00:00:00'::timestamp without time zone) AND (date < '2010-06-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_geo_by_months); + + +-- +-- Name: company_statistic_geo_by_months_10_06; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_geo_by_months_10_06 ( + CONSTRAINT company_statistic_geo_by_months_10_06_date_check CHECK (((date >= '2010-06-01 00:00:00'::timestamp without time zone) AND (date < '2010-07-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_geo_by_months); + + +-- +-- Name: company_statistic_geo_by_months_10_07; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_geo_by_months_10_07 ( + CONSTRAINT company_statistic_geo_by_months_10_07_date_check CHECK (((date >= '2010-07-01 00:00:00'::timestamp without time zone) AND (date < '2010-08-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_geo_by_months); + + +-- +-- Name: company_statistic_geo_by_months_10_08; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_geo_by_months_10_08 ( + CONSTRAINT company_statistic_geo_by_months_10_08_date_check CHECK (((date >= '2010-08-01 00:00:00'::timestamp without time zone) AND (date < '2010-09-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_geo_by_months); + + +-- +-- Name: company_statistic_geo_by_months_10_09; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_geo_by_months_10_09 ( + CONSTRAINT company_statistic_geo_by_months_10_09_date_check CHECK (((date >= '2010-09-01 00:00:00'::timestamp without time zone) AND (date < '2010-10-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_geo_by_months); + + +-- +-- Name: company_statistic_geo_by_months_10_10; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_geo_by_months_10_10 ( + CONSTRAINT company_statistic_geo_by_months_10_10_date_check CHECK (((date >= '2010-10-01 00:00:00'::timestamp without time zone) AND (date < '2010-11-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_geo_by_months); + + +-- +-- Name: company_statistic_geo_by_months_10_11; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_geo_by_months_10_11 ( + CONSTRAINT company_statistic_geo_by_months_10_11_date_check CHECK (((date >= '2010-11-01 00:00:00'::timestamp without time zone) AND (date < '2010-12-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_geo_by_months); + + +-- +-- Name: company_statistic_geo_by_months_10_12; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_geo_by_months_10_12 ( + CONSTRAINT company_statistic_geo_by_months_10_12_date_check CHECK (((date >= '2010-12-01 00:00:00'::timestamp without time zone) AND (date < '2011-01-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_geo_by_months); + + +-- +-- Name: company_statistic_geo_by_months_11_11; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_geo_by_months_11_11 ( + CONSTRAINT company_statistic_geo_by_months_11_11_date_check CHECK (((date >= '2011-11-01 00:00:00'::timestamp without time zone) AND (date < '2011-12-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_geo_by_months); + + +-- +-- Name: company_statistic_geo_by_months_11_12; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_geo_by_months_11_12 ( + CONSTRAINT company_statistic_geo_by_months_11_12_date_check CHECK (((date >= '2011-12-01 00:00:00'::timestamp without time zone) AND (date < '2012-01-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_geo_by_months); + + +-- +-- Name: company_statistic_geo_by_months_12_01; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_geo_by_months_12_01 ( + CONSTRAINT company_statistic_geo_by_months_12_01_date_check CHECK (((date >= '2012-01-01 00:00:00'::timestamp without time zone) AND (date < '2012-02-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_geo_by_months); + + +-- +-- Name: company_statistic_geo_by_months_12_02; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_geo_by_months_12_02 ( + CONSTRAINT company_statistic_geo_by_months_12_02_date_check CHECK (((date >= '2012-02-01 00:00:00'::timestamp without time zone) AND (date < '2012-03-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_geo_by_months); + + +-- +-- Name: company_statistic_geo_by_months_12_03; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_geo_by_months_12_03 ( + CONSTRAINT company_statistic_geo_by_months_12_03_date_check CHECK (((date >= '2012-03-01 00:00:00'::timestamp without time zone) AND (date < '2012-04-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_geo_by_months); + + +-- +-- Name: company_statistic_geo_by_months_12_04; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_geo_by_months_12_04 ( + CONSTRAINT company_statistic_geo_by_months_12_04_date_check CHECK (((date >= '2012-04-01 00:00:00'::timestamp without time zone) AND (date < '2012-05-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_geo_by_months); + + +-- +-- Name: company_statistic_geo_by_months_12_05; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_geo_by_months_12_05 ( + CONSTRAINT company_statistic_geo_by_months_12_05_date_check CHECK (((date >= '2012-05-01 00:00:00'::timestamp without time zone) AND (date < '2012-06-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_geo_by_months); + + +-- +-- Name: company_statistic_geo_by_months_12_06; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_geo_by_months_12_06 ( + CONSTRAINT company_statistic_geo_by_months_12_06_date_check CHECK (((date >= '2012-06-01 00:00:00'::timestamp without time zone) AND (date < '2012-07-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_geo_by_months); + + +-- +-- Name: company_statistic_geo_by_months_12_07; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_geo_by_months_12_07 ( + CONSTRAINT company_statistic_geo_by_months_12_07_date_check CHECK (((date >= '2012-07-01 00:00:00'::timestamp without time zone) AND (date < '2012-08-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_geo_by_months); + + +-- +-- Name: company_statistic_geo_by_months_12_08; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_geo_by_months_12_08 ( + CONSTRAINT company_statistic_geo_by_months_12_08_date_check CHECK (((date >= '2012-08-01 00:00:00'::timestamp without time zone) AND (date < '2012-09-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_geo_by_months); + + +-- +-- Name: company_statistic_geo_by_months_12_09; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_geo_by_months_12_09 ( + CONSTRAINT company_statistic_geo_by_months_12_09_date_check CHECK (((date >= '2012-09-01 00:00:00'::timestamp without time zone) AND (date < '2012-10-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_geo_by_months); + + +-- +-- Name: company_statistic_geo_by_months_12_10; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_geo_by_months_12_10 ( + CONSTRAINT company_statistic_geo_by_months_12_10_date_check CHECK (((date >= '2012-10-01 00:00:00'::timestamp without time zone) AND (date < '2012-11-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_geo_by_months); + + +-- +-- Name: company_statistic_geo_by_months_12_11; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_geo_by_months_12_11 ( + CONSTRAINT company_statistic_geo_by_months_12_11_date_check CHECK (((date >= '2012-11-01 00:00:00'::timestamp without time zone) AND (date < '2012-12-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_geo_by_months); + + +-- +-- Name: company_statistic_geo_by_months_12_12; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_geo_by_months_12_12 ( + CONSTRAINT company_statistic_geo_by_months_12_12_date_check CHECK (((date >= '2012-12-01 00:00:00'::timestamp without time zone) AND (date < '2013-01-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_geo_by_months); + + +-- +-- Name: company_statistic_geo_by_months_13_01; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_geo_by_months_13_01 ( + CONSTRAINT company_statistic_geo_by_months_13_01_date_check CHECK (((date >= '2013-01-01 00:00:00'::timestamp without time zone) AND (date < '2013-02-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_geo_by_months); + + +-- +-- Name: company_statistic_geo_by_months_13_02; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_geo_by_months_13_02 ( + CONSTRAINT company_statistic_geo_by_months_13_02_date_check CHECK (((date >= '2013-02-01 00:00:00'::timestamp without time zone) AND (date < '2013-03-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_geo_by_months); + + +-- +-- Name: company_statistic_geo_by_months_13_03; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_geo_by_months_13_03 ( + CONSTRAINT company_statistic_geo_by_months_13_03_date_check CHECK (((date >= '2013-03-01 00:00:00'::timestamp without time zone) AND (date < '2013-04-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_geo_by_months); + + +-- +-- Name: company_statistic_geo_by_months_13_04; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_geo_by_months_13_04 ( + CONSTRAINT company_statistic_geo_by_months_13_04_date_check CHECK (((date >= '2013-04-01 00:00:00'::timestamp without time zone) AND (date < '2013-05-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_geo_by_months); + + +-- +-- Name: company_statistic_geo_by_months_13_05; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_geo_by_months_13_05 ( + CONSTRAINT company_statistic_geo_by_months_13_05_date_check CHECK (((date >= '2013-05-01 00:00:00'::timestamp without time zone) AND (date < '2013-06-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_geo_by_months); + + +-- +-- Name: company_statistic_geo_by_months_13_06; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_geo_by_months_13_06 ( + CONSTRAINT company_statistic_geo_by_months_13_06_date_check CHECK (((date >= '2013-06-01 00:00:00'::timestamp without time zone) AND (date < '2013-07-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_geo_by_months); + + +-- +-- Name: company_statistic_geo_by_months_13_07; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_geo_by_months_13_07 ( + CONSTRAINT company_statistic_geo_by_months_13_07_date_check CHECK (((date >= '2013-07-01 00:00:00'::timestamp without time zone) AND (date < '2013-08-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_geo_by_months); + + +-- +-- Name: company_statistic_geo_by_months_13_08; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_geo_by_months_13_08 ( + CONSTRAINT company_statistic_geo_by_months_13_08_date_check CHECK (((date >= '2013-08-01 00:00:00'::timestamp without time zone) AND (date < '2013-09-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_geo_by_months); + + +-- +-- Name: company_statistic_geo_by_months_13_09; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_geo_by_months_13_09 ( + CONSTRAINT company_statistic_geo_by_months_13_09_date_check CHECK (((date >= '2013-09-01 00:00:00'::timestamp without time zone) AND (date < '2013-10-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_geo_by_months); + + +-- +-- Name: company_statistic_geo_by_months_13_10; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_geo_by_months_13_10 ( + CONSTRAINT company_statistic_geo_by_months_13_10_date_check CHECK (((date >= '2013-10-01 00:00:00'::timestamp without time zone) AND (date < '2013-11-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_geo_by_months); + + +-- +-- Name: company_statistic_geo_by_months_13_11; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_geo_by_months_13_11 ( + CONSTRAINT company_statistic_geo_by_months_13_11_date_check CHECK (((date >= '2013-11-01 00:00:00'::timestamp without time zone) AND (date < '2013-12-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_geo_by_months); + + +-- +-- Name: company_statistic_geo_by_months_13_12; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_geo_by_months_13_12 ( + CONSTRAINT company_statistic_geo_by_months_13_12_date_check CHECK (((date >= '2013-12-01 00:00:00'::timestamp without time zone) AND (date < '2014-01-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_geo_by_months); + + +-- +-- Name: company_statistic_geo_by_months_14_01; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_geo_by_months_14_01 ( + CONSTRAINT company_statistic_geo_by_months_14_01_date_check CHECK (((date >= '2014-01-01 00:00:00'::timestamp without time zone) AND (date < '2014-02-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_geo_by_months); + + +-- +-- Name: company_statistic_geo_by_months_14_02; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_geo_by_months_14_02 ( + CONSTRAINT company_statistic_geo_by_months_14_02_date_check CHECK (((date >= '2014-02-01 00:00:00'::timestamp without time zone) AND (date < '2014-03-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_geo_by_months); + + +-- +-- Name: company_statistic_geo_by_months_14_03; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_geo_by_months_14_03 ( + CONSTRAINT company_statistic_geo_by_months_14_03_date_check CHECK (((date >= '2014-03-01 00:00:00'::timestamp without time zone) AND (date < '2014-04-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_geo_by_months); + + +-- +-- Name: company_statistic_geo_by_months_14_04; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_geo_by_months_14_04 ( + CONSTRAINT company_statistic_geo_by_months_14_04_date_check CHECK (((date >= '2014-04-01 00:00:00'::timestamp without time zone) AND (date < '2014-05-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_geo_by_months); + + +-- +-- Name: company_statistic_geo_by_months_14_05; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_geo_by_months_14_05 ( + CONSTRAINT company_statistic_geo_by_months_14_05_date_check CHECK (((date >= '2014-05-01 00:00:00'::timestamp without time zone) AND (date < '2014-06-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_geo_by_months); + + +-- +-- Name: company_statistic_geo_by_months_14_06; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_geo_by_months_14_06 ( + CONSTRAINT company_statistic_geo_by_months_14_06_date_check CHECK (((date >= '2014-06-01 00:00:00'::timestamp without time zone) AND (date < '2014-07-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_geo_by_months); + + +-- +-- Name: company_statistic_geo_by_months_14_07; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_geo_by_months_14_07 ( + CONSTRAINT company_statistic_geo_by_months_14_07_date_check CHECK (((date >= '2014-07-01 00:00:00'::timestamp without time zone) AND (date < '2014-08-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_geo_by_months); + + +-- +-- Name: company_statistic_geo_by_months_14_08; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_geo_by_months_14_08 ( + CONSTRAINT company_statistic_geo_by_months_14_08_date_check CHECK (((date >= '2014-08-01 00:00:00'::timestamp without time zone) AND (date < '2014-09-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_geo_by_months); + + +-- +-- Name: company_statistic_geo_by_months_14_09; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_geo_by_months_14_09 ( + CONSTRAINT company_statistic_geo_by_months_14_09_date_check CHECK (((date >= '2014-09-01 00:00:00'::timestamp without time zone) AND (date < '2014-10-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_geo_by_months); + + +-- +-- Name: company_statistic_geo_by_months_14_10; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_geo_by_months_14_10 ( + CONSTRAINT company_statistic_geo_by_months_14_10_date_check CHECK (((date >= '2014-10-01 00:00:00'::timestamp without time zone) AND (date < '2014-11-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_geo_by_months); + + +-- +-- Name: company_statistic_geo_by_months_14_11; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_geo_by_months_14_11 ( + CONSTRAINT company_statistic_geo_by_months_14_11_date_check CHECK (((date >= '2014-11-01 00:00:00'::timestamp without time zone) AND (date < '2014-12-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_geo_by_months); + + +-- +-- Name: company_statistic_geo_by_months_14_12; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_geo_by_months_14_12 ( + CONSTRAINT company_statistic_geo_by_months_14_12_date_check CHECK (((date >= '2014-12-01 00:00:00'::timestamp without time zone) AND (date < '2015-01-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_geo_by_months); + + +-- +-- Name: company_statistic_geo_by_months_15_01; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_geo_by_months_15_01 ( + CONSTRAINT company_statistic_geo_by_months_15_01_date_check CHECK (((date >= '2015-01-01 00:00:00'::timestamp without time zone) AND (date < '2015-02-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_geo_by_months); + + +-- +-- Name: company_statistic_geo_by_months_15_09; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_geo_by_months_15_09 ( + CONSTRAINT company_statistic_geo_by_months_15_09_date_check CHECK (((date >= '2015-09-01 00:00:00'::timestamp without time zone) AND (date < '2015-10-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_geo_by_months); + + +-- +-- Name: company_statistic_geo_by_months_id_seq; Type: SEQUENCE; Schema: statistics; Owner: - +-- + +CREATE SEQUENCE company_statistic_geo_by_months_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: company_statistic_geo_by_months_id_seq; Type: SEQUENCE OWNED BY; Schema: statistics; Owner: - +-- + +ALTER SEQUENCE company_statistic_geo_by_months_id_seq OWNED BY company_statistic_geo_by_months.id; + + +-- +-- Name: company_statistic_geo_by_weeks; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_geo_by_weeks ( + id integer NOT NULL, + company_id integer, + first_week_day date NOT NULL, + last_week_day date NOT NULL, + year integer NOT NULL, + week integer NOT NULL, + city_id integer, + pages integer DEFAULT 0 NOT NULL, + visits integer DEFAULT 0 NOT NULL +); + + +-- +-- Name: company_statistic_geo_by_weeks_09_04; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_geo_by_weeks_09_04 ( + CONSTRAINT company_statistic_geo_by_weeks_09_04_first_week_day_check CHECK (((first_week_day >= '2009-04-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2009-05-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_geo_by_weeks); + + +-- +-- Name: company_statistic_geo_by_weeks_09_05; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_geo_by_weeks_09_05 ( + CONSTRAINT company_statistic_geo_by_weeks_09_05_first_week_day_check CHECK (((first_week_day >= '2009-05-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2009-06-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_geo_by_weeks); + + +-- +-- Name: company_statistic_geo_by_weeks_09_06; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_geo_by_weeks_09_06 ( + CONSTRAINT company_statistic_geo_by_weeks_09_06_first_week_day_check CHECK (((first_week_day >= '2009-06-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2009-07-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_geo_by_weeks); + + +-- +-- Name: company_statistic_geo_by_weeks_09_07; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_geo_by_weeks_09_07 ( + CONSTRAINT company_statistic_geo_by_weeks_09_07_first_week_day_check CHECK (((first_week_day >= '2009-07-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2009-08-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_geo_by_weeks); + + +-- +-- Name: company_statistic_geo_by_weeks_09_08; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_geo_by_weeks_09_08 ( + CONSTRAINT company_statistic_geo_by_weeks_09_08_first_week_day_check CHECK (((first_week_day >= '2009-08-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2009-09-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_geo_by_weeks); + + +-- +-- Name: company_statistic_geo_by_weeks_09_09; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_geo_by_weeks_09_09 ( + CONSTRAINT company_statistic_geo_by_weeks_09_09_first_week_day_check CHECK (((first_week_day >= '2009-09-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2009-10-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_geo_by_weeks); + + +-- +-- Name: company_statistic_geo_by_weeks_09_10; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_geo_by_weeks_09_10 ( + CONSTRAINT company_statistic_geo_by_weeks_09_10_first_week_day_check CHECK (((first_week_day >= '2009-10-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2009-11-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_geo_by_weeks); + + +-- +-- Name: company_statistic_geo_by_weeks_09_11; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_geo_by_weeks_09_11 ( + CONSTRAINT company_statistic_geo_by_weeks_09_11_first_week_day_check CHECK (((first_week_day >= '2009-11-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2009-12-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_geo_by_weeks); + + +-- +-- Name: company_statistic_geo_by_weeks_09_12; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_geo_by_weeks_09_12 ( + CONSTRAINT company_statistic_geo_by_weeks_09_12_first_week_day_check CHECK (((first_week_day >= '2009-12-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2010-01-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_geo_by_weeks); + + +-- +-- Name: company_statistic_geo_by_weeks_10_01; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_geo_by_weeks_10_01 ( + CONSTRAINT company_statistic_geo_by_weeks_10_01_first_week_day_check CHECK (((first_week_day >= '2010-01-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2010-02-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_geo_by_weeks); + + +-- +-- Name: company_statistic_geo_by_weeks_10_02; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_geo_by_weeks_10_02 ( + CONSTRAINT company_statistic_geo_by_weeks_10_02_first_week_day_check CHECK (((first_week_day >= '2010-02-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2010-03-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_geo_by_weeks); + + +-- +-- Name: company_statistic_geo_by_weeks_10_03; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_geo_by_weeks_10_03 ( + CONSTRAINT company_statistic_geo_by_weeks_10_03_first_week_day_check CHECK (((first_week_day >= '2010-03-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2010-04-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_geo_by_weeks); + + +-- +-- Name: company_statistic_geo_by_weeks_10_04; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_geo_by_weeks_10_04 ( + CONSTRAINT company_statistic_geo_by_weeks_10_04_first_week_day_check CHECK (((first_week_day >= '2010-04-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2010-05-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_geo_by_weeks); + + +-- +-- Name: company_statistic_geo_by_weeks_10_05; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_geo_by_weeks_10_05 ( + CONSTRAINT company_statistic_geo_by_weeks_10_05_first_week_day_check CHECK (((first_week_day >= '2010-05-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2010-06-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_geo_by_weeks); + + +-- +-- Name: company_statistic_geo_by_weeks_10_06; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_geo_by_weeks_10_06 ( + CONSTRAINT company_statistic_geo_by_weeks_10_06_first_week_day_check CHECK (((first_week_day >= '2010-06-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2010-07-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_geo_by_weeks); + + +-- +-- Name: company_statistic_geo_by_weeks_10_07; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_geo_by_weeks_10_07 ( + CONSTRAINT company_statistic_geo_by_weeks_10_07_first_week_day_check CHECK (((first_week_day >= '2010-07-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2010-08-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_geo_by_weeks); + + +-- +-- Name: company_statistic_geo_by_weeks_10_08; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_geo_by_weeks_10_08 ( + CONSTRAINT company_statistic_geo_by_weeks_10_08_first_week_day_check CHECK (((first_week_day >= '2010-08-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2010-09-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_geo_by_weeks); + + +-- +-- Name: company_statistic_geo_by_weeks_10_09; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_geo_by_weeks_10_09 ( + CONSTRAINT company_statistic_geo_by_weeks_10_09_first_week_day_check CHECK (((first_week_day >= '2010-09-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2010-10-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_geo_by_weeks); + + +-- +-- Name: company_statistic_geo_by_weeks_10_10; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_geo_by_weeks_10_10 ( + CONSTRAINT company_statistic_geo_by_weeks_10_10_first_week_day_check CHECK (((first_week_day >= '2010-10-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2010-11-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_geo_by_weeks); + + +-- +-- Name: company_statistic_geo_by_weeks_10_11; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_geo_by_weeks_10_11 ( + CONSTRAINT company_statistic_geo_by_weeks_10_11_first_week_day_check CHECK (((first_week_day >= '2010-11-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2010-12-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_geo_by_weeks); + + +-- +-- Name: company_statistic_geo_by_weeks_10_12; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_geo_by_weeks_10_12 ( + CONSTRAINT company_statistic_geo_by_weeks_10_12_first_week_day_check CHECK (((first_week_day >= '2010-12-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2011-01-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_geo_by_weeks); + + +-- +-- Name: company_statistic_geo_by_weeks_11_11; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_geo_by_weeks_11_11 ( + CONSTRAINT company_statistic_geo_by_weeks_11_11_first_week_day_check CHECK (((first_week_day >= '2011-11-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2011-12-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_geo_by_weeks); + + +-- +-- Name: company_statistic_geo_by_weeks_11_12; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_geo_by_weeks_11_12 ( + CONSTRAINT company_statistic_geo_by_weeks_11_12_first_week_day_check CHECK (((first_week_day >= '2011-12-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2012-01-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_geo_by_weeks); + + +-- +-- Name: company_statistic_geo_by_weeks_12_01; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_geo_by_weeks_12_01 ( + CONSTRAINT company_statistic_geo_by_weeks_12_01_first_week_day_check CHECK (((first_week_day >= '2012-01-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2012-02-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_geo_by_weeks); + + +-- +-- Name: company_statistic_geo_by_weeks_12_02; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_geo_by_weeks_12_02 ( + CONSTRAINT company_statistic_geo_by_weeks_12_02_first_week_day_check CHECK (((first_week_day >= '2012-02-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2012-03-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_geo_by_weeks); + + +-- +-- Name: company_statistic_geo_by_weeks_12_03; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_geo_by_weeks_12_03 ( + CONSTRAINT company_statistic_geo_by_weeks_12_03_first_week_day_check CHECK (((first_week_day >= '2012-03-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2012-04-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_geo_by_weeks); + + +-- +-- Name: company_statistic_geo_by_weeks_12_04; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_geo_by_weeks_12_04 ( + CONSTRAINT company_statistic_geo_by_weeks_12_04_first_week_day_check CHECK (((first_week_day >= '2012-04-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2012-05-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_geo_by_weeks); + + +-- +-- Name: company_statistic_geo_by_weeks_12_05; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_geo_by_weeks_12_05 ( + CONSTRAINT company_statistic_geo_by_weeks_12_05_first_week_day_check CHECK (((first_week_day >= '2012-05-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2012-06-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_geo_by_weeks); + + +-- +-- Name: company_statistic_geo_by_weeks_12_06; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_geo_by_weeks_12_06 ( + CONSTRAINT company_statistic_geo_by_weeks_12_06_first_week_day_check CHECK (((first_week_day >= '2012-06-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2012-07-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_geo_by_weeks); + + +-- +-- Name: company_statistic_geo_by_weeks_12_07; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_geo_by_weeks_12_07 ( + CONSTRAINT company_statistic_geo_by_weeks_12_07_first_week_day_check CHECK (((first_week_day >= '2012-07-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2012-08-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_geo_by_weeks); + + +-- +-- Name: company_statistic_geo_by_weeks_12_08; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_geo_by_weeks_12_08 ( + CONSTRAINT company_statistic_geo_by_weeks_12_08_first_week_day_check CHECK (((first_week_day >= '2012-08-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2012-09-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_geo_by_weeks); + + +-- +-- Name: company_statistic_geo_by_weeks_12_09; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_geo_by_weeks_12_09 ( + CONSTRAINT company_statistic_geo_by_weeks_12_09_first_week_day_check CHECK (((first_week_day >= '2012-09-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2012-10-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_geo_by_weeks); + + +-- +-- Name: company_statistic_geo_by_weeks_12_10; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_geo_by_weeks_12_10 ( + CONSTRAINT company_statistic_geo_by_weeks_12_10_first_week_day_check CHECK (((first_week_day >= '2012-10-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2012-11-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_geo_by_weeks); + + +-- +-- Name: company_statistic_geo_by_weeks_12_11; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_geo_by_weeks_12_11 ( + CONSTRAINT company_statistic_geo_by_weeks_12_11_first_week_day_check CHECK (((first_week_day >= '2012-11-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2012-12-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_geo_by_weeks); + + +-- +-- Name: company_statistic_geo_by_weeks_12_12; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_geo_by_weeks_12_12 ( + CONSTRAINT company_statistic_geo_by_weeks_12_12_first_week_day_check CHECK (((first_week_day >= '2012-12-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2013-01-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_geo_by_weeks); + + +-- +-- Name: company_statistic_geo_by_weeks_13_01; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_geo_by_weeks_13_01 ( + CONSTRAINT company_statistic_geo_by_weeks_13_01_first_week_day_check CHECK (((first_week_day >= '2013-01-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2013-02-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_geo_by_weeks); + + +-- +-- Name: company_statistic_geo_by_weeks_13_02; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_geo_by_weeks_13_02 ( + CONSTRAINT company_statistic_geo_by_weeks_13_02_first_week_day_check CHECK (((first_week_day >= '2013-02-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2013-03-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_geo_by_weeks); + + +-- +-- Name: company_statistic_geo_by_weeks_13_03; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_geo_by_weeks_13_03 ( + CONSTRAINT company_statistic_geo_by_weeks_13_03_first_week_day_check CHECK (((first_week_day >= '2013-03-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2013-04-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_geo_by_weeks); + + +-- +-- Name: company_statistic_geo_by_weeks_13_04; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_geo_by_weeks_13_04 ( + CONSTRAINT company_statistic_geo_by_weeks_13_04_first_week_day_check CHECK (((first_week_day >= '2013-04-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2013-05-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_geo_by_weeks); + + +-- +-- Name: company_statistic_geo_by_weeks_13_05; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_geo_by_weeks_13_05 ( + CONSTRAINT company_statistic_geo_by_weeks_13_05_first_week_day_check CHECK (((first_week_day >= '2013-05-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2013-06-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_geo_by_weeks); + + +-- +-- Name: company_statistic_geo_by_weeks_13_06; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_geo_by_weeks_13_06 ( + CONSTRAINT company_statistic_geo_by_weeks_13_06_first_week_day_check CHECK (((first_week_day >= '2013-06-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2013-07-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_geo_by_weeks); + + +-- +-- Name: company_statistic_geo_by_weeks_13_07; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_geo_by_weeks_13_07 ( + CONSTRAINT company_statistic_geo_by_weeks_13_07_first_week_day_check CHECK (((first_week_day >= '2013-07-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2013-08-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_geo_by_weeks); + + +-- +-- Name: company_statistic_geo_by_weeks_13_08; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_geo_by_weeks_13_08 ( + CONSTRAINT company_statistic_geo_by_weeks_13_08_first_week_day_check CHECK (((first_week_day >= '2013-08-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2013-09-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_geo_by_weeks); + + +-- +-- Name: company_statistic_geo_by_weeks_13_09; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_geo_by_weeks_13_09 ( + CONSTRAINT company_statistic_geo_by_weeks_13_09_first_week_day_check CHECK (((first_week_day >= '2013-09-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2013-10-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_geo_by_weeks); + + +-- +-- Name: company_statistic_geo_by_weeks_13_10; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_geo_by_weeks_13_10 ( + CONSTRAINT company_statistic_geo_by_weeks_13_10_first_week_day_check CHECK (((first_week_day >= '2013-10-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2013-11-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_geo_by_weeks); + + +-- +-- Name: company_statistic_geo_by_weeks_13_11; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_geo_by_weeks_13_11 ( + CONSTRAINT company_statistic_geo_by_weeks_13_11_first_week_day_check CHECK (((first_week_day >= '2013-11-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2013-12-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_geo_by_weeks); + + +-- +-- Name: company_statistic_geo_by_weeks_13_12; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_geo_by_weeks_13_12 ( + CONSTRAINT company_statistic_geo_by_weeks_13_12_first_week_day_check CHECK (((first_week_day >= '2013-12-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2014-01-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_geo_by_weeks); + + +-- +-- Name: company_statistic_geo_by_weeks_14_01; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_geo_by_weeks_14_01 ( + CONSTRAINT company_statistic_geo_by_weeks_14_01_first_week_day_check CHECK (((first_week_day >= '2014-01-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2014-02-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_geo_by_weeks); + + +-- +-- Name: company_statistic_geo_by_weeks_14_02; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_geo_by_weeks_14_02 ( + CONSTRAINT company_statistic_geo_by_weeks_14_02_first_week_day_check CHECK (((first_week_day >= '2014-02-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2014-03-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_geo_by_weeks); + + +-- +-- Name: company_statistic_geo_by_weeks_14_03; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_geo_by_weeks_14_03 ( + CONSTRAINT company_statistic_geo_by_weeks_14_03_first_week_day_check CHECK (((first_week_day >= '2014-03-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2014-04-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_geo_by_weeks); + + +-- +-- Name: company_statistic_geo_by_weeks_14_04; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_geo_by_weeks_14_04 ( + CONSTRAINT company_statistic_geo_by_weeks_14_04_first_week_day_check CHECK (((first_week_day >= '2014-04-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2014-05-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_geo_by_weeks); + + +-- +-- Name: company_statistic_geo_by_weeks_14_05; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_geo_by_weeks_14_05 ( + CONSTRAINT company_statistic_geo_by_weeks_14_05_first_week_day_check CHECK (((first_week_day >= '2014-05-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2014-06-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_geo_by_weeks); + + +-- +-- Name: company_statistic_geo_by_weeks_14_06; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_geo_by_weeks_14_06 ( + CONSTRAINT company_statistic_geo_by_weeks_14_06_first_week_day_check CHECK (((first_week_day >= '2014-06-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2014-07-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_geo_by_weeks); + + +-- +-- Name: company_statistic_geo_by_weeks_14_07; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_geo_by_weeks_14_07 ( + CONSTRAINT company_statistic_geo_by_weeks_14_07_first_week_day_check CHECK (((first_week_day >= '2014-07-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2014-08-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_geo_by_weeks); + + +-- +-- Name: company_statistic_geo_by_weeks_14_08; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_geo_by_weeks_14_08 ( + CONSTRAINT company_statistic_geo_by_weeks_14_08_first_week_day_check CHECK (((first_week_day >= '2014-08-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2014-09-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_geo_by_weeks); + + +-- +-- Name: company_statistic_geo_by_weeks_14_09; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_geo_by_weeks_14_09 ( + CONSTRAINT company_statistic_geo_by_weeks_14_09_first_week_day_check CHECK (((first_week_day >= '2014-09-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2014-10-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_geo_by_weeks); + + +-- +-- Name: company_statistic_geo_by_weeks_14_10; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_geo_by_weeks_14_10 ( + CONSTRAINT company_statistic_geo_by_weeks_14_10_first_week_day_check CHECK (((first_week_day >= '2014-10-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2014-11-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_geo_by_weeks); + + +-- +-- Name: company_statistic_geo_by_weeks_14_11; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_geo_by_weeks_14_11 ( + CONSTRAINT company_statistic_geo_by_weeks_14_11_first_week_day_check CHECK (((first_week_day >= '2014-11-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2014-12-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_geo_by_weeks); + + +-- +-- Name: company_statistic_geo_by_weeks_14_12; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_geo_by_weeks_14_12 ( + CONSTRAINT company_statistic_geo_by_weeks_14_12_first_week_day_check CHECK (((first_week_day >= '2014-12-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2015-01-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_geo_by_weeks); + + +-- +-- Name: company_statistic_geo_by_weeks_15_01; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_geo_by_weeks_15_01 ( + CONSTRAINT company_statistic_geo_by_weeks_15_01_first_week_day_check CHECK (((first_week_day >= '2015-01-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2015-02-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_geo_by_weeks); + + +-- +-- Name: company_statistic_geo_by_weeks_15_09; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_geo_by_weeks_15_09 ( + CONSTRAINT company_statistic_geo_by_weeks_15_09_first_week_day_check CHECK (((first_week_day >= '2015-09-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2015-10-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_geo_by_weeks); + + +-- +-- Name: company_statistic_geo_by_weeks_id_seq; Type: SEQUENCE; Schema: statistics; Owner: - +-- + +CREATE SEQUENCE company_statistic_geo_by_weeks_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: company_statistic_geo_by_weeks_id_seq; Type: SEQUENCE OWNED BY; Schema: statistics; Owner: - +-- + +ALTER SEQUENCE company_statistic_geo_by_weeks_id_seq OWNED BY company_statistic_geo_by_weeks.id; + + +-- +-- Name: company_statistic_pages_by_months; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_pages_by_months ( + id integer NOT NULL, + company_id integer, + date date NOT NULL, + page character varying(100) NOT NULL, + pages integer DEFAULT 0 NOT NULL +); + + +-- +-- Name: company_statistic_pages_by_months_09_04; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_pages_by_months_09_04 ( + CONSTRAINT company_statistic_pages_by_months_09_04_date_check CHECK (((date >= '2009-04-01 00:00:00'::timestamp without time zone) AND (date < '2009-05-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_pages_by_months); + + +-- +-- Name: company_statistic_pages_by_months_09_05; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_pages_by_months_09_05 ( + CONSTRAINT company_statistic_pages_by_months_09_05_date_check CHECK (((date >= '2009-05-01 00:00:00'::timestamp without time zone) AND (date < '2009-06-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_pages_by_months); + + +-- +-- Name: company_statistic_pages_by_months_09_06; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_pages_by_months_09_06 ( + CONSTRAINT company_statistic_pages_by_months_09_06_date_check CHECK (((date >= '2009-06-01 00:00:00'::timestamp without time zone) AND (date < '2009-07-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_pages_by_months); + + +-- +-- Name: company_statistic_pages_by_months_09_07; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_pages_by_months_09_07 ( + CONSTRAINT company_statistic_pages_by_months_09_07_date_check CHECK (((date >= '2009-07-01 00:00:00'::timestamp without time zone) AND (date < '2009-08-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_pages_by_months); + + +-- +-- Name: company_statistic_pages_by_months_09_08; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_pages_by_months_09_08 ( + CONSTRAINT company_statistic_pages_by_months_09_08_date_check CHECK (((date >= '2009-08-01 00:00:00'::timestamp without time zone) AND (date < '2009-09-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_pages_by_months); + + +-- +-- Name: company_statistic_pages_by_months_09_09; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_pages_by_months_09_09 ( + CONSTRAINT company_statistic_pages_by_months_09_09_date_check CHECK (((date >= '2009-09-01 00:00:00'::timestamp without time zone) AND (date < '2009-10-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_pages_by_months); + + +-- +-- Name: company_statistic_pages_by_months_09_10; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_pages_by_months_09_10 ( + CONSTRAINT company_statistic_pages_by_months_09_10_date_check CHECK (((date >= '2009-10-01 00:00:00'::timestamp without time zone) AND (date < '2009-11-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_pages_by_months); + + +-- +-- Name: company_statistic_pages_by_months_09_11; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_pages_by_months_09_11 ( + CONSTRAINT company_statistic_pages_by_months_09_11_date_check CHECK (((date >= '2009-11-01 00:00:00'::timestamp without time zone) AND (date < '2009-12-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_pages_by_months); + + +-- +-- Name: company_statistic_pages_by_months_09_12; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_pages_by_months_09_12 ( + CONSTRAINT company_statistic_pages_by_months_09_12_date_check CHECK (((date >= '2009-12-01 00:00:00'::timestamp without time zone) AND (date < '2010-01-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_pages_by_months); + + +-- +-- Name: company_statistic_pages_by_months_10_01; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_pages_by_months_10_01 ( + CONSTRAINT company_statistic_pages_by_months_10_01_date_check CHECK (((date >= '2010-01-01 00:00:00'::timestamp without time zone) AND (date < '2010-02-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_pages_by_months); + + +-- +-- Name: company_statistic_pages_by_months_10_02; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_pages_by_months_10_02 ( + CONSTRAINT company_statistic_pages_by_months_10_02_date_check CHECK (((date >= '2010-02-01 00:00:00'::timestamp without time zone) AND (date < '2010-03-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_pages_by_months); + + +-- +-- Name: company_statistic_pages_by_months_10_03; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_pages_by_months_10_03 ( + CONSTRAINT company_statistic_pages_by_months_10_03_date_check CHECK (((date >= '2010-03-01 00:00:00'::timestamp without time zone) AND (date < '2010-04-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_pages_by_months); + + +-- +-- Name: company_statistic_pages_by_months_10_04; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_pages_by_months_10_04 ( + CONSTRAINT company_statistic_pages_by_months_10_04_date_check CHECK (((date >= '2010-04-01 00:00:00'::timestamp without time zone) AND (date < '2010-05-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_pages_by_months); + + +-- +-- Name: company_statistic_pages_by_months_10_05; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_pages_by_months_10_05 ( + CONSTRAINT company_statistic_pages_by_months_10_05_date_check CHECK (((date >= '2010-05-01 00:00:00'::timestamp without time zone) AND (date < '2010-06-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_pages_by_months); + + +-- +-- Name: company_statistic_pages_by_months_10_06; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_pages_by_months_10_06 ( + CONSTRAINT company_statistic_pages_by_months_10_06_date_check CHECK (((date >= '2010-06-01 00:00:00'::timestamp without time zone) AND (date < '2010-07-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_pages_by_months); + + +-- +-- Name: company_statistic_pages_by_months_10_07; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_pages_by_months_10_07 ( + CONSTRAINT company_statistic_pages_by_months_10_07_date_check CHECK (((date >= '2010-07-01 00:00:00'::timestamp without time zone) AND (date < '2010-08-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_pages_by_months); + + +-- +-- Name: company_statistic_pages_by_months_10_08; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_pages_by_months_10_08 ( + CONSTRAINT company_statistic_pages_by_months_10_08_date_check CHECK (((date >= '2010-08-01 00:00:00'::timestamp without time zone) AND (date < '2010-09-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_pages_by_months); + + +-- +-- Name: company_statistic_pages_by_months_10_09; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_pages_by_months_10_09 ( + CONSTRAINT company_statistic_pages_by_months_10_09_date_check CHECK (((date >= '2010-09-01 00:00:00'::timestamp without time zone) AND (date < '2010-10-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_pages_by_months); + + +-- +-- Name: company_statistic_pages_by_months_10_10; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_pages_by_months_10_10 ( + CONSTRAINT company_statistic_pages_by_months_10_10_date_check CHECK (((date >= '2010-10-01 00:00:00'::timestamp without time zone) AND (date < '2010-11-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_pages_by_months); + + +-- +-- Name: company_statistic_pages_by_months_10_11; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_pages_by_months_10_11 ( + CONSTRAINT company_statistic_pages_by_months_10_11_date_check CHECK (((date >= '2010-11-01 00:00:00'::timestamp without time zone) AND (date < '2010-12-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_pages_by_months); + + +-- +-- Name: company_statistic_pages_by_months_10_12; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_pages_by_months_10_12 ( + CONSTRAINT company_statistic_pages_by_months_10_12_date_check CHECK (((date >= '2010-12-01 00:00:00'::timestamp without time zone) AND (date < '2011-01-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_pages_by_months); + + +-- +-- Name: company_statistic_pages_by_months_11_11; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_pages_by_months_11_11 ( + CONSTRAINT company_statistic_pages_by_months_11_11_date_check CHECK (((date >= '2011-11-01 00:00:00'::timestamp without time zone) AND (date < '2011-12-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_pages_by_months); + + +-- +-- Name: company_statistic_pages_by_months_11_12; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_pages_by_months_11_12 ( + CONSTRAINT company_statistic_pages_by_months_11_12_date_check CHECK (((date >= '2011-12-01 00:00:00'::timestamp without time zone) AND (date < '2012-01-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_pages_by_months); + + +-- +-- Name: company_statistic_pages_by_months_12_01; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_pages_by_months_12_01 ( + CONSTRAINT company_statistic_pages_by_months_12_01_date_check CHECK (((date >= '2012-01-01 00:00:00'::timestamp without time zone) AND (date < '2012-02-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_pages_by_months); + + +-- +-- Name: company_statistic_pages_by_months_12_02; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_pages_by_months_12_02 ( + CONSTRAINT company_statistic_pages_by_months_12_02_date_check CHECK (((date >= '2012-02-01 00:00:00'::timestamp without time zone) AND (date < '2012-03-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_pages_by_months); + + +-- +-- Name: company_statistic_pages_by_months_12_03; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_pages_by_months_12_03 ( + CONSTRAINT company_statistic_pages_by_months_12_03_date_check CHECK (((date >= '2012-03-01 00:00:00'::timestamp without time zone) AND (date < '2012-04-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_pages_by_months); + + +-- +-- Name: company_statistic_pages_by_months_12_04; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_pages_by_months_12_04 ( + CONSTRAINT company_statistic_pages_by_months_12_04_date_check CHECK (((date >= '2012-04-01 00:00:00'::timestamp without time zone) AND (date < '2012-05-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_pages_by_months); + + +-- +-- Name: company_statistic_pages_by_months_12_05; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_pages_by_months_12_05 ( + CONSTRAINT company_statistic_pages_by_months_12_05_date_check CHECK (((date >= '2012-05-01 00:00:00'::timestamp without time zone) AND (date < '2012-06-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_pages_by_months); + + +-- +-- Name: company_statistic_pages_by_months_12_06; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_pages_by_months_12_06 ( + CONSTRAINT company_statistic_pages_by_months_12_06_date_check CHECK (((date >= '2012-06-01 00:00:00'::timestamp without time zone) AND (date < '2012-07-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_pages_by_months); + + +-- +-- Name: company_statistic_pages_by_months_12_07; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_pages_by_months_12_07 ( + CONSTRAINT company_statistic_pages_by_months_12_07_date_check CHECK (((date >= '2012-07-01 00:00:00'::timestamp without time zone) AND (date < '2012-08-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_pages_by_months); + + +-- +-- Name: company_statistic_pages_by_months_12_08; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_pages_by_months_12_08 ( + CONSTRAINT company_statistic_pages_by_months_12_08_date_check CHECK (((date >= '2012-08-01 00:00:00'::timestamp without time zone) AND (date < '2012-09-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_pages_by_months); + + +-- +-- Name: company_statistic_pages_by_months_12_09; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_pages_by_months_12_09 ( + CONSTRAINT company_statistic_pages_by_months_12_09_date_check CHECK (((date >= '2012-09-01 00:00:00'::timestamp without time zone) AND (date < '2012-10-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_pages_by_months); + + +-- +-- Name: company_statistic_pages_by_months_12_10; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_pages_by_months_12_10 ( + CONSTRAINT company_statistic_pages_by_months_12_10_date_check CHECK (((date >= '2012-10-01 00:00:00'::timestamp without time zone) AND (date < '2012-11-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_pages_by_months); + + +-- +-- Name: company_statistic_pages_by_months_12_11; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_pages_by_months_12_11 ( + CONSTRAINT company_statistic_pages_by_months_12_11_date_check CHECK (((date >= '2012-11-01 00:00:00'::timestamp without time zone) AND (date < '2012-12-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_pages_by_months); + + +-- +-- Name: company_statistic_pages_by_months_12_12; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_pages_by_months_12_12 ( + CONSTRAINT company_statistic_pages_by_months_12_12_date_check CHECK (((date >= '2012-12-01 00:00:00'::timestamp without time zone) AND (date < '2013-01-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_pages_by_months); + + +-- +-- Name: company_statistic_pages_by_months_13_01; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_pages_by_months_13_01 ( + CONSTRAINT company_statistic_pages_by_months_13_01_date_check CHECK (((date >= '2013-01-01 00:00:00'::timestamp without time zone) AND (date < '2013-02-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_pages_by_months); + + +-- +-- Name: company_statistic_pages_by_months_13_02; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_pages_by_months_13_02 ( + CONSTRAINT company_statistic_pages_by_months_13_02_date_check CHECK (((date >= '2013-02-01 00:00:00'::timestamp without time zone) AND (date < '2013-03-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_pages_by_months); + + +-- +-- Name: company_statistic_pages_by_months_13_03; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_pages_by_months_13_03 ( + CONSTRAINT company_statistic_pages_by_months_13_03_date_check CHECK (((date >= '2013-03-01 00:00:00'::timestamp without time zone) AND (date < '2013-04-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_pages_by_months); + + +-- +-- Name: company_statistic_pages_by_months_13_04; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_pages_by_months_13_04 ( + CONSTRAINT company_statistic_pages_by_months_13_04_date_check CHECK (((date >= '2013-04-01 00:00:00'::timestamp without time zone) AND (date < '2013-05-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_pages_by_months); + + +-- +-- Name: company_statistic_pages_by_months_13_05; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_pages_by_months_13_05 ( + CONSTRAINT company_statistic_pages_by_months_13_05_date_check CHECK (((date >= '2013-05-01 00:00:00'::timestamp without time zone) AND (date < '2013-06-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_pages_by_months); + + +-- +-- Name: company_statistic_pages_by_months_13_06; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_pages_by_months_13_06 ( + CONSTRAINT company_statistic_pages_by_months_13_06_date_check CHECK (((date >= '2013-06-01 00:00:00'::timestamp without time zone) AND (date < '2013-07-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_pages_by_months); + + +-- +-- Name: company_statistic_pages_by_months_13_07; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_pages_by_months_13_07 ( + CONSTRAINT company_statistic_pages_by_months_13_07_date_check CHECK (((date >= '2013-07-01 00:00:00'::timestamp without time zone) AND (date < '2013-08-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_pages_by_months); + + +-- +-- Name: company_statistic_pages_by_months_13_08; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_pages_by_months_13_08 ( + CONSTRAINT company_statistic_pages_by_months_13_08_date_check CHECK (((date >= '2013-08-01 00:00:00'::timestamp without time zone) AND (date < '2013-09-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_pages_by_months); + + +-- +-- Name: company_statistic_pages_by_months_13_09; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_pages_by_months_13_09 ( + CONSTRAINT company_statistic_pages_by_months_13_09_date_check CHECK (((date >= '2013-09-01 00:00:00'::timestamp without time zone) AND (date < '2013-10-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_pages_by_months); + + +-- +-- Name: company_statistic_pages_by_months_13_10; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_pages_by_months_13_10 ( + CONSTRAINT company_statistic_pages_by_months_13_10_date_check CHECK (((date >= '2013-10-01 00:00:00'::timestamp without time zone) AND (date < '2013-11-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_pages_by_months); + + +-- +-- Name: company_statistic_pages_by_months_13_11; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_pages_by_months_13_11 ( + CONSTRAINT company_statistic_pages_by_months_13_11_date_check CHECK (((date >= '2013-11-01 00:00:00'::timestamp without time zone) AND (date < '2013-12-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_pages_by_months); + + +-- +-- Name: company_statistic_pages_by_months_13_12; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_pages_by_months_13_12 ( + CONSTRAINT company_statistic_pages_by_months_13_12_date_check CHECK (((date >= '2013-12-01 00:00:00'::timestamp without time zone) AND (date < '2014-01-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_pages_by_months); + + +-- +-- Name: company_statistic_pages_by_months_14_01; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_pages_by_months_14_01 ( + CONSTRAINT company_statistic_pages_by_months_14_01_date_check CHECK (((date >= '2014-01-01 00:00:00'::timestamp without time zone) AND (date < '2014-02-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_pages_by_months); + + +-- +-- Name: company_statistic_pages_by_months_14_02; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_pages_by_months_14_02 ( + CONSTRAINT company_statistic_pages_by_months_14_02_date_check CHECK (((date >= '2014-02-01 00:00:00'::timestamp without time zone) AND (date < '2014-03-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_pages_by_months); + + +-- +-- Name: company_statistic_pages_by_months_14_03; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_pages_by_months_14_03 ( + CONSTRAINT company_statistic_pages_by_months_14_03_date_check CHECK (((date >= '2014-03-01 00:00:00'::timestamp without time zone) AND (date < '2014-04-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_pages_by_months); + + +-- +-- Name: company_statistic_pages_by_months_14_04; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_pages_by_months_14_04 ( + CONSTRAINT company_statistic_pages_by_months_14_04_date_check CHECK (((date >= '2014-04-01 00:00:00'::timestamp without time zone) AND (date < '2014-05-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_pages_by_months); + + +-- +-- Name: company_statistic_pages_by_months_14_05; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_pages_by_months_14_05 ( + CONSTRAINT company_statistic_pages_by_months_14_05_date_check CHECK (((date >= '2014-05-01 00:00:00'::timestamp without time zone) AND (date < '2014-06-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_pages_by_months); + + +-- +-- Name: company_statistic_pages_by_months_14_06; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_pages_by_months_14_06 ( + CONSTRAINT company_statistic_pages_by_months_14_06_date_check CHECK (((date >= '2014-06-01 00:00:00'::timestamp without time zone) AND (date < '2014-07-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_pages_by_months); + + +-- +-- Name: company_statistic_pages_by_months_14_07; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_pages_by_months_14_07 ( + CONSTRAINT company_statistic_pages_by_months_14_07_date_check CHECK (((date >= '2014-07-01 00:00:00'::timestamp without time zone) AND (date < '2014-08-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_pages_by_months); + + +-- +-- Name: company_statistic_pages_by_months_14_08; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_pages_by_months_14_08 ( + CONSTRAINT company_statistic_pages_by_months_14_08_date_check CHECK (((date >= '2014-08-01 00:00:00'::timestamp without time zone) AND (date < '2014-09-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_pages_by_months); + + +-- +-- Name: company_statistic_pages_by_months_14_09; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_pages_by_months_14_09 ( + CONSTRAINT company_statistic_pages_by_months_14_09_date_check CHECK (((date >= '2014-09-01 00:00:00'::timestamp without time zone) AND (date < '2014-10-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_pages_by_months); + + +-- +-- Name: company_statistic_pages_by_months_14_10; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_pages_by_months_14_10 ( + CONSTRAINT company_statistic_pages_by_months_14_10_date_check CHECK (((date >= '2014-10-01 00:00:00'::timestamp without time zone) AND (date < '2014-11-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_pages_by_months); + + +-- +-- Name: company_statistic_pages_by_months_14_11; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_pages_by_months_14_11 ( + CONSTRAINT company_statistic_pages_by_months_14_11_date_check CHECK (((date >= '2014-11-01 00:00:00'::timestamp without time zone) AND (date < '2014-12-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_pages_by_months); + + +-- +-- Name: company_statistic_pages_by_months_14_12; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_pages_by_months_14_12 ( + CONSTRAINT company_statistic_pages_by_months_14_12_date_check CHECK (((date >= '2014-12-01 00:00:00'::timestamp without time zone) AND (date < '2015-01-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_pages_by_months); + + +-- +-- Name: company_statistic_pages_by_months_15_01; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_pages_by_months_15_01 ( + CONSTRAINT company_statistic_pages_by_months_15_01_date_check CHECK (((date >= '2015-01-01 00:00:00'::timestamp without time zone) AND (date < '2015-02-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_pages_by_months); + + +-- +-- Name: company_statistic_pages_by_months_15_09; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_pages_by_months_15_09 ( + CONSTRAINT company_statistic_pages_by_months_15_09_date_check CHECK (((date >= '2015-09-01 00:00:00'::timestamp without time zone) AND (date < '2015-10-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_pages_by_months); + + +-- +-- Name: company_statistic_pages_by_months_id_seq; Type: SEQUENCE; Schema: statistics; Owner: - +-- + +CREATE SEQUENCE company_statistic_pages_by_months_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: company_statistic_pages_by_months_id_seq; Type: SEQUENCE OWNED BY; Schema: statistics; Owner: - +-- + +ALTER SEQUENCE company_statistic_pages_by_months_id_seq OWNED BY company_statistic_pages_by_months.id; + + +-- +-- Name: company_statistic_pages_by_weeks; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_pages_by_weeks ( + id integer NOT NULL, + company_id integer, + first_week_day date NOT NULL, + last_week_day date NOT NULL, + year integer NOT NULL, + week integer NOT NULL, + page character varying(100) NOT NULL, + pages integer DEFAULT 0 NOT NULL +); + + +-- +-- Name: company_statistic_pages_by_weeks_09_04; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_pages_by_weeks_09_04 ( + CONSTRAINT company_statistic_pages_by_weeks_09_04_first_week_day_check CHECK (((first_week_day >= '2009-04-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2009-05-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_pages_by_weeks); + + +-- +-- Name: company_statistic_pages_by_weeks_09_05; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_pages_by_weeks_09_05 ( + CONSTRAINT company_statistic_pages_by_weeks_09_05_first_week_day_check CHECK (((first_week_day >= '2009-05-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2009-06-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_pages_by_weeks); + + +-- +-- Name: company_statistic_pages_by_weeks_09_06; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_pages_by_weeks_09_06 ( + CONSTRAINT company_statistic_pages_by_weeks_09_06_first_week_day_check CHECK (((first_week_day >= '2009-06-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2009-07-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_pages_by_weeks); + + +-- +-- Name: company_statistic_pages_by_weeks_09_07; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_pages_by_weeks_09_07 ( + CONSTRAINT company_statistic_pages_by_weeks_09_07_first_week_day_check CHECK (((first_week_day >= '2009-07-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2009-08-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_pages_by_weeks); + + +-- +-- Name: company_statistic_pages_by_weeks_09_08; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_pages_by_weeks_09_08 ( + CONSTRAINT company_statistic_pages_by_weeks_09_08_first_week_day_check CHECK (((first_week_day >= '2009-08-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2009-09-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_pages_by_weeks); + + +-- +-- Name: company_statistic_pages_by_weeks_09_09; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_pages_by_weeks_09_09 ( + CONSTRAINT company_statistic_pages_by_weeks_09_09_first_week_day_check CHECK (((first_week_day >= '2009-09-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2009-10-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_pages_by_weeks); + + +-- +-- Name: company_statistic_pages_by_weeks_09_10; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_pages_by_weeks_09_10 ( + CONSTRAINT company_statistic_pages_by_weeks_09_10_first_week_day_check CHECK (((first_week_day >= '2009-10-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2009-11-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_pages_by_weeks); + + +-- +-- Name: company_statistic_pages_by_weeks_09_11; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_pages_by_weeks_09_11 ( + CONSTRAINT company_statistic_pages_by_weeks_09_11_first_week_day_check CHECK (((first_week_day >= '2009-11-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2009-12-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_pages_by_weeks); + + +-- +-- Name: company_statistic_pages_by_weeks_09_12; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_pages_by_weeks_09_12 ( + CONSTRAINT company_statistic_pages_by_weeks_09_12_first_week_day_check CHECK (((first_week_day >= '2009-12-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2010-01-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_pages_by_weeks); + + +-- +-- Name: company_statistic_pages_by_weeks_10_01; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_pages_by_weeks_10_01 ( + CONSTRAINT company_statistic_pages_by_weeks_10_01_first_week_day_check CHECK (((first_week_day >= '2010-01-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2010-02-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_pages_by_weeks); + + +-- +-- Name: company_statistic_pages_by_weeks_10_02; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_pages_by_weeks_10_02 ( + CONSTRAINT company_statistic_pages_by_weeks_10_02_first_week_day_check CHECK (((first_week_day >= '2010-02-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2010-03-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_pages_by_weeks); + + +-- +-- Name: company_statistic_pages_by_weeks_10_03; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_pages_by_weeks_10_03 ( + CONSTRAINT company_statistic_pages_by_weeks_10_03_first_week_day_check CHECK (((first_week_day >= '2010-03-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2010-04-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_pages_by_weeks); + + +-- +-- Name: company_statistic_pages_by_weeks_10_04; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_pages_by_weeks_10_04 ( + CONSTRAINT company_statistic_pages_by_weeks_10_04_first_week_day_check CHECK (((first_week_day >= '2010-04-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2010-05-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_pages_by_weeks); + + +-- +-- Name: company_statistic_pages_by_weeks_10_05; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_pages_by_weeks_10_05 ( + CONSTRAINT company_statistic_pages_by_weeks_10_05_first_week_day_check CHECK (((first_week_day >= '2010-05-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2010-06-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_pages_by_weeks); + + +-- +-- Name: company_statistic_pages_by_weeks_10_06; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_pages_by_weeks_10_06 ( + CONSTRAINT company_statistic_pages_by_weeks_10_06_first_week_day_check CHECK (((first_week_day >= '2010-06-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2010-07-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_pages_by_weeks); + + +-- +-- Name: company_statistic_pages_by_weeks_10_07; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_pages_by_weeks_10_07 ( + CONSTRAINT company_statistic_pages_by_weeks_10_07_first_week_day_check CHECK (((first_week_day >= '2010-07-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2010-08-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_pages_by_weeks); + + +-- +-- Name: company_statistic_pages_by_weeks_10_08; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_pages_by_weeks_10_08 ( + CONSTRAINT company_statistic_pages_by_weeks_10_08_first_week_day_check CHECK (((first_week_day >= '2010-08-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2010-09-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_pages_by_weeks); + + +-- +-- Name: company_statistic_pages_by_weeks_10_09; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_pages_by_weeks_10_09 ( + CONSTRAINT company_statistic_pages_by_weeks_10_09_first_week_day_check CHECK (((first_week_day >= '2010-09-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2010-10-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_pages_by_weeks); + + +-- +-- Name: company_statistic_pages_by_weeks_10_10; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_pages_by_weeks_10_10 ( + CONSTRAINT company_statistic_pages_by_weeks_10_10_first_week_day_check CHECK (((first_week_day >= '2010-10-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2010-11-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_pages_by_weeks); + + +-- +-- Name: company_statistic_pages_by_weeks_10_11; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_pages_by_weeks_10_11 ( + CONSTRAINT company_statistic_pages_by_weeks_10_11_first_week_day_check CHECK (((first_week_day >= '2010-11-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2010-12-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_pages_by_weeks); + + +-- +-- Name: company_statistic_pages_by_weeks_10_12; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_pages_by_weeks_10_12 ( + CONSTRAINT company_statistic_pages_by_weeks_10_12_first_week_day_check CHECK (((first_week_day >= '2010-12-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2011-01-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_pages_by_weeks); + + +-- +-- Name: company_statistic_pages_by_weeks_11_11; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_pages_by_weeks_11_11 ( + CONSTRAINT company_statistic_pages_by_weeks_11_11_first_week_day_check CHECK (((first_week_day >= '2011-11-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2011-12-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_pages_by_weeks); + + +-- +-- Name: company_statistic_pages_by_weeks_11_12; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_pages_by_weeks_11_12 ( + CONSTRAINT company_statistic_pages_by_weeks_11_12_first_week_day_check CHECK (((first_week_day >= '2011-12-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2012-01-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_pages_by_weeks); + + +-- +-- Name: company_statistic_pages_by_weeks_12_01; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_pages_by_weeks_12_01 ( + CONSTRAINT company_statistic_pages_by_weeks_12_01_first_week_day_check CHECK (((first_week_day >= '2012-01-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2012-02-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_pages_by_weeks); + + +-- +-- Name: company_statistic_pages_by_weeks_12_02; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_pages_by_weeks_12_02 ( + CONSTRAINT company_statistic_pages_by_weeks_12_02_first_week_day_check CHECK (((first_week_day >= '2012-02-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2012-03-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_pages_by_weeks); + + +-- +-- Name: company_statistic_pages_by_weeks_12_03; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_pages_by_weeks_12_03 ( + CONSTRAINT company_statistic_pages_by_weeks_12_03_first_week_day_check CHECK (((first_week_day >= '2012-03-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2012-04-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_pages_by_weeks); + + +-- +-- Name: company_statistic_pages_by_weeks_12_04; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_pages_by_weeks_12_04 ( + CONSTRAINT company_statistic_pages_by_weeks_12_04_first_week_day_check CHECK (((first_week_day >= '2012-04-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2012-05-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_pages_by_weeks); + + +-- +-- Name: company_statistic_pages_by_weeks_12_05; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_pages_by_weeks_12_05 ( + CONSTRAINT company_statistic_pages_by_weeks_12_05_first_week_day_check CHECK (((first_week_day >= '2012-05-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2012-06-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_pages_by_weeks); + + +-- +-- Name: company_statistic_pages_by_weeks_12_06; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_pages_by_weeks_12_06 ( + CONSTRAINT company_statistic_pages_by_weeks_12_06_first_week_day_check CHECK (((first_week_day >= '2012-06-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2012-07-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_pages_by_weeks); + + +-- +-- Name: company_statistic_pages_by_weeks_12_07; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_pages_by_weeks_12_07 ( + CONSTRAINT company_statistic_pages_by_weeks_12_07_first_week_day_check CHECK (((first_week_day >= '2012-07-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2012-08-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_pages_by_weeks); + + +-- +-- Name: company_statistic_pages_by_weeks_12_08; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_pages_by_weeks_12_08 ( + CONSTRAINT company_statistic_pages_by_weeks_12_08_first_week_day_check CHECK (((first_week_day >= '2012-08-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2012-09-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_pages_by_weeks); + + +-- +-- Name: company_statistic_pages_by_weeks_12_09; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_pages_by_weeks_12_09 ( + CONSTRAINT company_statistic_pages_by_weeks_12_09_first_week_day_check CHECK (((first_week_day >= '2012-09-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2012-10-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_pages_by_weeks); + + +-- +-- Name: company_statistic_pages_by_weeks_12_10; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_pages_by_weeks_12_10 ( + CONSTRAINT company_statistic_pages_by_weeks_12_10_first_week_day_check CHECK (((first_week_day >= '2012-10-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2012-11-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_pages_by_weeks); + + +-- +-- Name: company_statistic_pages_by_weeks_12_11; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_pages_by_weeks_12_11 ( + CONSTRAINT company_statistic_pages_by_weeks_12_11_first_week_day_check CHECK (((first_week_day >= '2012-11-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2012-12-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_pages_by_weeks); + + +-- +-- Name: company_statistic_pages_by_weeks_12_12; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_pages_by_weeks_12_12 ( + CONSTRAINT company_statistic_pages_by_weeks_12_12_first_week_day_check CHECK (((first_week_day >= '2012-12-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2013-01-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_pages_by_weeks); + + +-- +-- Name: company_statistic_pages_by_weeks_13_01; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_pages_by_weeks_13_01 ( + CONSTRAINT company_statistic_pages_by_weeks_13_01_first_week_day_check CHECK (((first_week_day >= '2013-01-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2013-02-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_pages_by_weeks); + + +-- +-- Name: company_statistic_pages_by_weeks_13_02; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_pages_by_weeks_13_02 ( + CONSTRAINT company_statistic_pages_by_weeks_13_02_first_week_day_check CHECK (((first_week_day >= '2013-02-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2013-03-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_pages_by_weeks); + + +-- +-- Name: company_statistic_pages_by_weeks_13_03; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_pages_by_weeks_13_03 ( + CONSTRAINT company_statistic_pages_by_weeks_13_03_first_week_day_check CHECK (((first_week_day >= '2013-03-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2013-04-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_pages_by_weeks); + + +-- +-- Name: company_statistic_pages_by_weeks_13_04; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_pages_by_weeks_13_04 ( + CONSTRAINT company_statistic_pages_by_weeks_13_04_first_week_day_check CHECK (((first_week_day >= '2013-04-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2013-05-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_pages_by_weeks); + + +-- +-- Name: company_statistic_pages_by_weeks_13_05; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_pages_by_weeks_13_05 ( + CONSTRAINT company_statistic_pages_by_weeks_13_05_first_week_day_check CHECK (((first_week_day >= '2013-05-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2013-06-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_pages_by_weeks); + + +-- +-- Name: company_statistic_pages_by_weeks_13_06; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_pages_by_weeks_13_06 ( + CONSTRAINT company_statistic_pages_by_weeks_13_06_first_week_day_check CHECK (((first_week_day >= '2013-06-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2013-07-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_pages_by_weeks); + + +-- +-- Name: company_statistic_pages_by_weeks_13_07; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_pages_by_weeks_13_07 ( + CONSTRAINT company_statistic_pages_by_weeks_13_07_first_week_day_check CHECK (((first_week_day >= '2013-07-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2013-08-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_pages_by_weeks); + + +-- +-- Name: company_statistic_pages_by_weeks_13_08; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_pages_by_weeks_13_08 ( + CONSTRAINT company_statistic_pages_by_weeks_13_08_first_week_day_check CHECK (((first_week_day >= '2013-08-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2013-09-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_pages_by_weeks); + + +-- +-- Name: company_statistic_pages_by_weeks_13_09; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_pages_by_weeks_13_09 ( + CONSTRAINT company_statistic_pages_by_weeks_13_09_first_week_day_check CHECK (((first_week_day >= '2013-09-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2013-10-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_pages_by_weeks); + + +-- +-- Name: company_statistic_pages_by_weeks_13_10; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_pages_by_weeks_13_10 ( + CONSTRAINT company_statistic_pages_by_weeks_13_10_first_week_day_check CHECK (((first_week_day >= '2013-10-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2013-11-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_pages_by_weeks); + + +-- +-- Name: company_statistic_pages_by_weeks_13_11; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_pages_by_weeks_13_11 ( + CONSTRAINT company_statistic_pages_by_weeks_13_11_first_week_day_check CHECK (((first_week_day >= '2013-11-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2013-12-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_pages_by_weeks); + + +-- +-- Name: company_statistic_pages_by_weeks_13_12; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_pages_by_weeks_13_12 ( + CONSTRAINT company_statistic_pages_by_weeks_13_12_first_week_day_check CHECK (((first_week_day >= '2013-12-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2014-01-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_pages_by_weeks); + + +-- +-- Name: company_statistic_pages_by_weeks_14_01; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_pages_by_weeks_14_01 ( + CONSTRAINT company_statistic_pages_by_weeks_14_01_first_week_day_check CHECK (((first_week_day >= '2014-01-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2014-02-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_pages_by_weeks); + + +-- +-- Name: company_statistic_pages_by_weeks_14_02; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_pages_by_weeks_14_02 ( + CONSTRAINT company_statistic_pages_by_weeks_14_02_first_week_day_check CHECK (((first_week_day >= '2014-02-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2014-03-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_pages_by_weeks); + + +-- +-- Name: company_statistic_pages_by_weeks_14_03; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_pages_by_weeks_14_03 ( + CONSTRAINT company_statistic_pages_by_weeks_14_03_first_week_day_check CHECK (((first_week_day >= '2014-03-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2014-04-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_pages_by_weeks); + + +-- +-- Name: company_statistic_pages_by_weeks_14_04; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_pages_by_weeks_14_04 ( + CONSTRAINT company_statistic_pages_by_weeks_14_04_first_week_day_check CHECK (((first_week_day >= '2014-04-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2014-05-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_pages_by_weeks); + + +-- +-- Name: company_statistic_pages_by_weeks_14_05; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_pages_by_weeks_14_05 ( + CONSTRAINT company_statistic_pages_by_weeks_14_05_first_week_day_check CHECK (((first_week_day >= '2014-05-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2014-06-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_pages_by_weeks); + + +-- +-- Name: company_statistic_pages_by_weeks_14_06; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_pages_by_weeks_14_06 ( + CONSTRAINT company_statistic_pages_by_weeks_14_06_first_week_day_check CHECK (((first_week_day >= '2014-06-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2014-07-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_pages_by_weeks); + + +-- +-- Name: company_statistic_pages_by_weeks_14_07; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_pages_by_weeks_14_07 ( + CONSTRAINT company_statistic_pages_by_weeks_14_07_first_week_day_check CHECK (((first_week_day >= '2014-07-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2014-08-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_pages_by_weeks); + + +-- +-- Name: company_statistic_pages_by_weeks_14_08; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_pages_by_weeks_14_08 ( + CONSTRAINT company_statistic_pages_by_weeks_14_08_first_week_day_check CHECK (((first_week_day >= '2014-08-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2014-09-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_pages_by_weeks); + + +-- +-- Name: company_statistic_pages_by_weeks_14_09; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_pages_by_weeks_14_09 ( + CONSTRAINT company_statistic_pages_by_weeks_14_09_first_week_day_check CHECK (((first_week_day >= '2014-09-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2014-10-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_pages_by_weeks); + + +-- +-- Name: company_statistic_pages_by_weeks_14_10; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_pages_by_weeks_14_10 ( + CONSTRAINT company_statistic_pages_by_weeks_14_10_first_week_day_check CHECK (((first_week_day >= '2014-10-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2014-11-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_pages_by_weeks); + + +-- +-- Name: company_statistic_pages_by_weeks_14_11; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_pages_by_weeks_14_11 ( + CONSTRAINT company_statistic_pages_by_weeks_14_11_first_week_day_check CHECK (((first_week_day >= '2014-11-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2014-12-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_pages_by_weeks); + + +-- +-- Name: company_statistic_pages_by_weeks_14_12; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_pages_by_weeks_14_12 ( + CONSTRAINT company_statistic_pages_by_weeks_14_12_first_week_day_check CHECK (((first_week_day >= '2014-12-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2015-01-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_pages_by_weeks); + + +-- +-- Name: company_statistic_pages_by_weeks_15_01; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_pages_by_weeks_15_01 ( + CONSTRAINT company_statistic_pages_by_weeks_15_01_first_week_day_check CHECK (((first_week_day >= '2015-01-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2015-02-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_pages_by_weeks); + + +-- +-- Name: company_statistic_pages_by_weeks_15_09; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_pages_by_weeks_15_09 ( + CONSTRAINT company_statistic_pages_by_weeks_15_09_first_week_day_check CHECK (((first_week_day >= '2015-09-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2015-10-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_pages_by_weeks); + + +-- +-- Name: company_statistic_pages_by_weeks_id_seq; Type: SEQUENCE; Schema: statistics; Owner: - +-- + +CREATE SEQUENCE company_statistic_pages_by_weeks_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: company_statistic_pages_by_weeks_id_seq; Type: SEQUENCE OWNED BY; Schema: statistics; Owner: - +-- + +ALTER SEQUENCE company_statistic_pages_by_weeks_id_seq OWNED BY company_statistic_pages_by_weeks.id; + + +-- +-- Name: company_statistic_referers_by_months; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_referers_by_months ( + id integer NOT NULL, + company_id integer, + date date NOT NULL, + referer character varying(1024) NOT NULL, + pages integer DEFAULT 0 NOT NULL, + source_id integer, + is_internal boolean +); + + +-- +-- Name: COLUMN company_statistic_referers_by_months.source_id; Type: COMMENT; Schema: statistics; Owner: - +-- + +COMMENT ON COLUMN company_statistic_referers_by_months.source_id IS 'Источник перехода (пульс, гугл, яндекс, маил)'; + + +-- +-- Name: company_statistic_referers_by_months_09_07; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_referers_by_months_09_07 ( + CONSTRAINT company_statistic_referers_by_months_09_07_date_check CHECK (((date >= '2009-07-01 00:00:00'::timestamp without time zone) AND (date < '2009-08-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_referers_by_months); + + +-- +-- Name: company_statistic_referers_by_months_09_08; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_referers_by_months_09_08 ( + CONSTRAINT company_statistic_referers_by_months_09_08_date_check CHECK (((date >= '2009-08-01 00:00:00'::timestamp without time zone) AND (date < '2009-09-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_referers_by_months); + + +-- +-- Name: company_statistic_referers_by_months_09_09; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_referers_by_months_09_09 ( + CONSTRAINT company_statistic_referers_by_months_09_09_date_check CHECK (((date >= '2009-09-01 00:00:00'::timestamp without time zone) AND (date < '2009-10-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_referers_by_months); + + +-- +-- Name: company_statistic_referers_by_months_09_10; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_referers_by_months_09_10 ( + CONSTRAINT company_statistic_referers_by_months_09_10_date_check CHECK (((date >= '2009-10-01 00:00:00'::timestamp without time zone) AND (date < '2009-11-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_referers_by_months); + + +-- +-- Name: company_statistic_referers_by_months_09_11; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_referers_by_months_09_11 ( + CONSTRAINT company_statistic_referers_by_months_09_11_date_check CHECK (((date >= '2009-11-01 00:00:00'::timestamp without time zone) AND (date < '2009-12-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_referers_by_months); + + +-- +-- Name: company_statistic_referers_by_months_09_12; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_referers_by_months_09_12 ( + CONSTRAINT company_statistic_referers_by_months_09_12_date_check CHECK (((date >= '2009-12-01 00:00:00'::timestamp without time zone) AND (date < '2010-01-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_referers_by_months); + + +-- +-- Name: company_statistic_referers_by_months_10_01; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_referers_by_months_10_01 ( + CONSTRAINT company_statistic_referers_by_months_10_01_date_check CHECK (((date >= '2010-01-01 00:00:00'::timestamp without time zone) AND (date < '2010-02-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_referers_by_months); + + +-- +-- Name: company_statistic_referers_by_months_10_02; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_referers_by_months_10_02 ( + CONSTRAINT company_statistic_referers_by_months_10_02_date_check CHECK (((date >= '2010-02-01 00:00:00'::timestamp without time zone) AND (date < '2010-03-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_referers_by_months); + + +-- +-- Name: company_statistic_referers_by_months_10_03; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_referers_by_months_10_03 ( + CONSTRAINT company_statistic_referers_by_months_10_03_date_check CHECK (((date >= '2010-03-01 00:00:00'::timestamp without time zone) AND (date < '2010-04-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_referers_by_months); + + +-- +-- Name: company_statistic_referers_by_months_10_04; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_referers_by_months_10_04 ( + CONSTRAINT company_statistic_referers_by_months_10_04_date_check CHECK (((date >= '2010-04-01 00:00:00'::timestamp without time zone) AND (date < '2010-05-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_referers_by_months); + + +-- +-- Name: company_statistic_referers_by_months_10_05; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_referers_by_months_10_05 ( + CONSTRAINT company_statistic_referers_by_months_10_05_date_check CHECK (((date >= '2010-05-01 00:00:00'::timestamp without time zone) AND (date < '2010-06-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_referers_by_months); + + +-- +-- Name: company_statistic_referers_by_months_10_06; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_referers_by_months_10_06 ( + CONSTRAINT company_statistic_referers_by_months_10_06_date_check CHECK (((date >= '2010-06-01 00:00:00'::timestamp without time zone) AND (date < '2010-07-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_referers_by_months); + + +-- +-- Name: company_statistic_referers_by_months_10_07; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_referers_by_months_10_07 ( + CONSTRAINT company_statistic_referers_by_months_10_07_date_check CHECK (((date >= '2010-07-01 00:00:00'::timestamp without time zone) AND (date < '2010-08-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_referers_by_months); + + +-- +-- Name: company_statistic_referers_by_months_10_08; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_referers_by_months_10_08 ( + CONSTRAINT company_statistic_referers_by_months_10_08_date_check CHECK (((date >= '2010-08-01 00:00:00'::timestamp without time zone) AND (date < '2010-09-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_referers_by_months); + + +-- +-- Name: company_statistic_referers_by_months_10_09; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_referers_by_months_10_09 ( + CONSTRAINT company_statistic_referers_by_months_10_09_date_check CHECK (((date >= '2010-09-01 00:00:00'::timestamp without time zone) AND (date < '2010-10-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_referers_by_months); + + +-- +-- Name: company_statistic_referers_by_months_10_10; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_referers_by_months_10_10 ( + CONSTRAINT company_statistic_referers_by_months_10_10_date_check CHECK (((date >= '2010-10-01 00:00:00'::timestamp without time zone) AND (date < '2010-11-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_referers_by_months); + + +-- +-- Name: company_statistic_referers_by_months_10_11; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_referers_by_months_10_11 ( + CONSTRAINT company_statistic_referers_by_months_10_11_date_check CHECK (((date >= '2010-11-01 00:00:00'::timestamp without time zone) AND (date < '2010-12-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_referers_by_months); + + +-- +-- Name: company_statistic_referers_by_months_10_12; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_referers_by_months_10_12 ( + CONSTRAINT company_statistic_referers_by_months_10_12_date_check CHECK (((date >= '2010-12-01 00:00:00'::timestamp without time zone) AND (date < '2011-01-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_referers_by_months); + + +-- +-- Name: company_statistic_referers_by_months_11_11; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_referers_by_months_11_11 ( + CONSTRAINT company_statistic_referers_by_months_11_11_date_check CHECK (((date >= '2011-11-01 00:00:00'::timestamp without time zone) AND (date < '2011-12-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_referers_by_months); + + +-- +-- Name: company_statistic_referers_by_months_11_12; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_referers_by_months_11_12 ( + CONSTRAINT company_statistic_referers_by_months_11_12_date_check CHECK (((date >= '2011-12-01 00:00:00'::timestamp without time zone) AND (date < '2012-01-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_referers_by_months); + + +-- +-- Name: company_statistic_referers_by_months_12_01; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_referers_by_months_12_01 ( + CONSTRAINT company_statistic_referers_by_months_12_01_date_check CHECK (((date >= '2012-01-01 00:00:00'::timestamp without time zone) AND (date < '2012-02-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_referers_by_months); + + +-- +-- Name: company_statistic_referers_by_months_12_02; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_referers_by_months_12_02 ( + CONSTRAINT company_statistic_referers_by_months_12_02_date_check CHECK (((date >= '2012-02-01 00:00:00'::timestamp without time zone) AND (date < '2012-03-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_referers_by_months); + + +-- +-- Name: company_statistic_referers_by_months_12_03; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_referers_by_months_12_03 ( + CONSTRAINT company_statistic_referers_by_months_12_03_date_check CHECK (((date >= '2012-03-01 00:00:00'::timestamp without time zone) AND (date < '2012-04-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_referers_by_months); + + +-- +-- Name: company_statistic_referers_by_months_12_04; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_referers_by_months_12_04 ( + CONSTRAINT company_statistic_referers_by_months_12_04_date_check CHECK (((date >= '2012-04-01 00:00:00'::timestamp without time zone) AND (date < '2012-05-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_referers_by_months); + + +-- +-- Name: company_statistic_referers_by_months_12_05; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_referers_by_months_12_05 ( + CONSTRAINT company_statistic_referers_by_months_12_05_date_check CHECK (((date >= '2012-05-01 00:00:00'::timestamp without time zone) AND (date < '2012-06-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_referers_by_months); + + +-- +-- Name: company_statistic_referers_by_months_12_06; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_referers_by_months_12_06 ( + CONSTRAINT company_statistic_referers_by_months_12_06_date_check CHECK (((date >= '2012-06-01 00:00:00'::timestamp without time zone) AND (date < '2012-07-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_referers_by_months); + + +-- +-- Name: company_statistic_referers_by_months_12_07; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_referers_by_months_12_07 ( + CONSTRAINT company_statistic_referers_by_months_12_07_date_check CHECK (((date >= '2012-07-01 00:00:00'::timestamp without time zone) AND (date < '2012-08-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_referers_by_months); + + +-- +-- Name: company_statistic_referers_by_months_12_08; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_referers_by_months_12_08 ( + CONSTRAINT company_statistic_referers_by_months_12_08_date_check CHECK (((date >= '2012-08-01 00:00:00'::timestamp without time zone) AND (date < '2012-09-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_referers_by_months); + + +-- +-- Name: company_statistic_referers_by_months_12_09; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_referers_by_months_12_09 ( + CONSTRAINT company_statistic_referers_by_months_12_09_date_check CHECK (((date >= '2012-09-01 00:00:00'::timestamp without time zone) AND (date < '2012-10-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_referers_by_months); + + +-- +-- Name: company_statistic_referers_by_months_12_10; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_referers_by_months_12_10 ( + CONSTRAINT company_statistic_referers_by_months_12_10_date_check CHECK (((date >= '2012-10-01 00:00:00'::timestamp without time zone) AND (date < '2012-11-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_referers_by_months); + + +-- +-- Name: company_statistic_referers_by_months_12_11; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_referers_by_months_12_11 ( + CONSTRAINT company_statistic_referers_by_months_12_11_date_check CHECK (((date >= '2012-11-01 00:00:00'::timestamp without time zone) AND (date < '2012-12-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_referers_by_months); + + +-- +-- Name: company_statistic_referers_by_months_12_12; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_referers_by_months_12_12 ( + CONSTRAINT company_statistic_referers_by_months_12_12_date_check CHECK (((date >= '2012-12-01 00:00:00'::timestamp without time zone) AND (date < '2013-01-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_referers_by_months); + + +-- +-- Name: company_statistic_referers_by_months_13_01; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_referers_by_months_13_01 ( + CONSTRAINT company_statistic_referers_by_months_13_01_date_check CHECK (((date >= '2013-01-01 00:00:00'::timestamp without time zone) AND (date < '2013-02-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_referers_by_months); + + +-- +-- Name: company_statistic_referers_by_months_13_02; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_referers_by_months_13_02 ( + CONSTRAINT company_statistic_referers_by_months_13_02_date_check CHECK (((date >= '2013-02-01 00:00:00'::timestamp without time zone) AND (date < '2013-03-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_referers_by_months); + + +-- +-- Name: company_statistic_referers_by_months_13_03; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_referers_by_months_13_03 ( + CONSTRAINT company_statistic_referers_by_months_13_03_date_check CHECK (((date >= '2013-03-01 00:00:00'::timestamp without time zone) AND (date < '2013-04-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_referers_by_months); + + +-- +-- Name: company_statistic_referers_by_months_13_04; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_referers_by_months_13_04 ( + CONSTRAINT company_statistic_referers_by_months_13_04_date_check CHECK (((date >= '2013-04-01 00:00:00'::timestamp without time zone) AND (date < '2013-05-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_referers_by_months); + + +-- +-- Name: company_statistic_referers_by_months_13_05; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_referers_by_months_13_05 ( + CONSTRAINT company_statistic_referers_by_months_13_05_date_check CHECK (((date >= '2013-05-01 00:00:00'::timestamp without time zone) AND (date < '2013-06-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_referers_by_months); + + +-- +-- Name: company_statistic_referers_by_months_13_06; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_referers_by_months_13_06 ( + CONSTRAINT company_statistic_referers_by_months_13_06_date_check CHECK (((date >= '2013-06-01 00:00:00'::timestamp without time zone) AND (date < '2013-07-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_referers_by_months); + + +-- +-- Name: company_statistic_referers_by_months_13_07; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_referers_by_months_13_07 ( + CONSTRAINT company_statistic_referers_by_months_13_07_date_check CHECK (((date >= '2013-07-01 00:00:00'::timestamp without time zone) AND (date < '2013-08-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_referers_by_months); + + +-- +-- Name: company_statistic_referers_by_months_13_08; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_referers_by_months_13_08 ( + CONSTRAINT company_statistic_referers_by_months_13_08_date_check CHECK (((date >= '2013-08-01 00:00:00'::timestamp without time zone) AND (date < '2013-09-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_referers_by_months); + + +-- +-- Name: company_statistic_referers_by_months_13_09; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_referers_by_months_13_09 ( + CONSTRAINT company_statistic_referers_by_months_13_09_date_check CHECK (((date >= '2013-09-01 00:00:00'::timestamp without time zone) AND (date < '2013-10-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_referers_by_months); + + +-- +-- Name: company_statistic_referers_by_months_13_10; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_referers_by_months_13_10 ( + CONSTRAINT company_statistic_referers_by_months_13_10_date_check CHECK (((date >= '2013-10-01 00:00:00'::timestamp without time zone) AND (date < '2013-11-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_referers_by_months); + + +-- +-- Name: company_statistic_referers_by_months_13_11; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_referers_by_months_13_11 ( + CONSTRAINT company_statistic_referers_by_months_13_11_date_check CHECK (((date >= '2013-11-01 00:00:00'::timestamp without time zone) AND (date < '2013-12-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_referers_by_months); + + +-- +-- Name: company_statistic_referers_by_months_13_12; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_referers_by_months_13_12 ( + CONSTRAINT company_statistic_referers_by_months_13_12_date_check CHECK (((date >= '2013-12-01 00:00:00'::timestamp without time zone) AND (date < '2014-01-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_referers_by_months); + + +-- +-- Name: company_statistic_referers_by_months_14_01; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_referers_by_months_14_01 ( + CONSTRAINT company_statistic_referers_by_months_14_01_date_check CHECK (((date >= '2014-01-01 00:00:00'::timestamp without time zone) AND (date < '2014-02-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_referers_by_months); + + +-- +-- Name: company_statistic_referers_by_months_14_02; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_referers_by_months_14_02 ( + CONSTRAINT company_statistic_referers_by_months_14_02_date_check CHECK (((date >= '2014-02-01 00:00:00'::timestamp without time zone) AND (date < '2014-03-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_referers_by_months); + + +-- +-- Name: company_statistic_referers_by_months_14_03; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_referers_by_months_14_03 ( + CONSTRAINT company_statistic_referers_by_months_14_03_date_check CHECK (((date >= '2014-03-01 00:00:00'::timestamp without time zone) AND (date < '2014-04-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_referers_by_months); + + +-- +-- Name: company_statistic_referers_by_months_14_04; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_referers_by_months_14_04 ( + CONSTRAINT company_statistic_referers_by_months_14_04_date_check CHECK (((date >= '2014-04-01 00:00:00'::timestamp without time zone) AND (date < '2014-05-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_referers_by_months); + + +-- +-- Name: company_statistic_referers_by_months_14_05; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_referers_by_months_14_05 ( + CONSTRAINT company_statistic_referers_by_months_14_05_date_check CHECK (((date >= '2014-05-01 00:00:00'::timestamp without time zone) AND (date < '2014-06-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_referers_by_months); + + +-- +-- Name: company_statistic_referers_by_months_14_06; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_referers_by_months_14_06 ( + CONSTRAINT company_statistic_referers_by_months_14_06_date_check CHECK (((date >= '2014-06-01 00:00:00'::timestamp without time zone) AND (date < '2014-07-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_referers_by_months); + + +-- +-- Name: company_statistic_referers_by_months_14_07; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_referers_by_months_14_07 ( + CONSTRAINT company_statistic_referers_by_months_14_07_date_check CHECK (((date >= '2014-07-01 00:00:00'::timestamp without time zone) AND (date < '2014-08-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_referers_by_months); + + +-- +-- Name: company_statistic_referers_by_months_14_08; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_referers_by_months_14_08 ( + CONSTRAINT company_statistic_referers_by_months_14_08_date_check CHECK (((date >= '2014-08-01 00:00:00'::timestamp without time zone) AND (date < '2014-09-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_referers_by_months); + + +-- +-- Name: company_statistic_referers_by_months_14_09; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_referers_by_months_14_09 ( + CONSTRAINT company_statistic_referers_by_months_14_09_date_check CHECK (((date >= '2014-09-01 00:00:00'::timestamp without time zone) AND (date < '2014-10-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_referers_by_months); + + +-- +-- Name: company_statistic_referers_by_months_14_10; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_referers_by_months_14_10 ( + CONSTRAINT company_statistic_referers_by_months_14_10_date_check CHECK (((date >= '2014-10-01 00:00:00'::timestamp without time zone) AND (date < '2014-11-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_referers_by_months); + + +-- +-- Name: company_statistic_referers_by_months_14_11; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_referers_by_months_14_11 ( + CONSTRAINT company_statistic_referers_by_months_14_11_date_check CHECK (((date >= '2014-11-01 00:00:00'::timestamp without time zone) AND (date < '2014-12-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_referers_by_months); + + +-- +-- Name: company_statistic_referers_by_months_14_12; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_referers_by_months_14_12 ( + CONSTRAINT company_statistic_referers_by_months_14_12_date_check CHECK (((date >= '2014-12-01 00:00:00'::timestamp without time zone) AND (date < '2015-01-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_referers_by_months); + + +-- +-- Name: company_statistic_referers_by_months_15_01; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_referers_by_months_15_01 ( + CONSTRAINT company_statistic_referers_by_months_15_01_date_check CHECK (((date >= '2015-01-01 00:00:00'::timestamp without time zone) AND (date < '2015-02-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_referers_by_months); + + +-- +-- Name: company_statistic_referers_by_months_15_08; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_referers_by_months_15_08 ( + CONSTRAINT company_statistic_referers_by_months_15_08_date_check CHECK (((date >= '2015-08-01 00:00:00'::timestamp without time zone) AND (date < '2015-09-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_referers_by_months); + + +-- +-- Name: company_statistic_referers_by_months_15_09; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_referers_by_months_15_09 ( + CONSTRAINT company_statistic_referers_by_months_15_09_date_check CHECK (((date >= '2015-09-01 00:00:00'::timestamp without time zone) AND (date < '2015-10-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_referers_by_months); + + +-- +-- Name: company_statistic_referers_by_months_id_seq; Type: SEQUENCE; Schema: statistics; Owner: - +-- + +CREATE SEQUENCE company_statistic_referers_by_months_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: company_statistic_referers_by_months_id_seq; Type: SEQUENCE OWNED BY; Schema: statistics; Owner: - +-- + +ALTER SEQUENCE company_statistic_referers_by_months_id_seq OWNED BY company_statistic_referers_by_months.id; + + +-- +-- Name: company_statistic_referers_by_weeks; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_referers_by_weeks ( + id integer NOT NULL, + company_id integer, + first_week_day date NOT NULL, + last_week_day date NOT NULL, + year integer NOT NULL, + week integer NOT NULL, + referer character varying(1024) NOT NULL, + pages integer DEFAULT 0 NOT NULL, + source_id integer, + is_internal boolean +); + + +-- +-- Name: COLUMN company_statistic_referers_by_weeks.source_id; Type: COMMENT; Schema: statistics; Owner: - +-- + +COMMENT ON COLUMN company_statistic_referers_by_weeks.source_id IS 'Источник перехода (пульс, гугл, яндекс, маил)'; + + +-- +-- Name: company_statistic_referers_by_weeks_09_06; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_referers_by_weeks_09_06 ( + CONSTRAINT company_statistic_referers_by_weeks_09_06_first_week_day_check CHECK (((first_week_day >= '2009-06-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2009-07-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_referers_by_weeks); + + +-- +-- Name: company_statistic_referers_by_weeks_09_07; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_referers_by_weeks_09_07 ( + CONSTRAINT company_statistic_referers_by_weeks_09_07_first_week_day_check CHECK (((first_week_day >= '2009-07-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2009-08-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_referers_by_weeks); + + +-- +-- Name: company_statistic_referers_by_weeks_09_08; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_referers_by_weeks_09_08 ( + CONSTRAINT company_statistic_referers_by_weeks_09_08_first_week_day_check CHECK (((first_week_day >= '2009-08-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2009-09-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_referers_by_weeks); + + +-- +-- Name: company_statistic_referers_by_weeks_09_09; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_referers_by_weeks_09_09 ( + CONSTRAINT company_statistic_referers_by_weeks_09_09_first_week_day_check CHECK (((first_week_day >= '2009-09-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2009-10-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_referers_by_weeks); + + +-- +-- Name: company_statistic_referers_by_weeks_09_10; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_referers_by_weeks_09_10 ( + CONSTRAINT company_statistic_referers_by_weeks_09_10_first_week_day_check CHECK (((first_week_day >= '2009-10-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2009-11-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_referers_by_weeks); + + +-- +-- Name: company_statistic_referers_by_weeks_09_11; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_referers_by_weeks_09_11 ( + CONSTRAINT company_statistic_referers_by_weeks_09_11_first_week_day_check CHECK (((first_week_day >= '2009-11-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2009-12-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_referers_by_weeks); + + +-- +-- Name: company_statistic_referers_by_weeks_09_12; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_referers_by_weeks_09_12 ( + CONSTRAINT company_statistic_referers_by_weeks_09_12_first_week_day_check CHECK (((first_week_day >= '2009-12-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2010-01-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_referers_by_weeks); + + +-- +-- Name: company_statistic_referers_by_weeks_10_01; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_referers_by_weeks_10_01 ( + CONSTRAINT company_statistic_referers_by_weeks_10_01_first_week_day_check CHECK (((first_week_day >= '2010-01-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2010-02-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_referers_by_weeks); + + +-- +-- Name: company_statistic_referers_by_weeks_10_02; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_referers_by_weeks_10_02 ( + CONSTRAINT company_statistic_referers_by_weeks_10_02_first_week_day_check CHECK (((first_week_day >= '2010-02-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2010-03-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_referers_by_weeks); + + +-- +-- Name: company_statistic_referers_by_weeks_10_03; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_referers_by_weeks_10_03 ( + CONSTRAINT company_statistic_referers_by_weeks_10_03_first_week_day_check CHECK (((first_week_day >= '2010-03-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2010-04-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_referers_by_weeks); + + +-- +-- Name: company_statistic_referers_by_weeks_10_04; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_referers_by_weeks_10_04 ( + CONSTRAINT company_statistic_referers_by_weeks_10_04_first_week_day_check CHECK (((first_week_day >= '2010-04-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2010-05-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_referers_by_weeks); + + +-- +-- Name: company_statistic_referers_by_weeks_10_05; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_referers_by_weeks_10_05 ( + CONSTRAINT company_statistic_referers_by_weeks_10_05_first_week_day_check CHECK (((first_week_day >= '2010-05-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2010-06-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_referers_by_weeks); + + +-- +-- Name: company_statistic_referers_by_weeks_10_06; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_referers_by_weeks_10_06 ( + CONSTRAINT company_statistic_referers_by_weeks_10_06_first_week_day_check CHECK (((first_week_day >= '2010-06-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2010-07-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_referers_by_weeks); + + +-- +-- Name: company_statistic_referers_by_weeks_10_07; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_referers_by_weeks_10_07 ( + CONSTRAINT company_statistic_referers_by_weeks_10_07_first_week_day_check CHECK (((first_week_day >= '2010-07-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2010-08-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_referers_by_weeks); + + +-- +-- Name: company_statistic_referers_by_weeks_10_08; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_referers_by_weeks_10_08 ( + CONSTRAINT company_statistic_referers_by_weeks_10_08_first_week_day_check CHECK (((first_week_day >= '2010-08-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2010-09-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_referers_by_weeks); + + +-- +-- Name: company_statistic_referers_by_weeks_10_09; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_referers_by_weeks_10_09 ( + CONSTRAINT company_statistic_referers_by_weeks_10_09_first_week_day_check CHECK (((first_week_day >= '2010-09-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2010-10-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_referers_by_weeks); + + +-- +-- Name: company_statistic_referers_by_weeks_10_10; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_referers_by_weeks_10_10 ( + CONSTRAINT company_statistic_referers_by_weeks_10_10_first_week_day_check CHECK (((first_week_day >= '2010-10-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2010-11-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_referers_by_weeks); + + +-- +-- Name: company_statistic_referers_by_weeks_10_11; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_referers_by_weeks_10_11 ( + CONSTRAINT company_statistic_referers_by_weeks_10_11_first_week_day_check CHECK (((first_week_day >= '2010-11-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2010-12-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_referers_by_weeks); + + +-- +-- Name: company_statistic_referers_by_weeks_10_12; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_referers_by_weeks_10_12 ( + CONSTRAINT company_statistic_referers_by_weeks_10_12_first_week_day_check CHECK (((first_week_day >= '2010-12-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2011-01-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_referers_by_weeks); + + +-- +-- Name: company_statistic_referers_by_weeks_11_11; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_referers_by_weeks_11_11 ( + CONSTRAINT company_statistic_referers_by_weeks_11_11_first_week_day_check CHECK (((first_week_day >= '2011-11-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2011-12-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_referers_by_weeks); + + +-- +-- Name: company_statistic_referers_by_weeks_11_12; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_referers_by_weeks_11_12 ( + CONSTRAINT company_statistic_referers_by_weeks_11_12_first_week_day_check CHECK (((first_week_day >= '2011-12-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2012-01-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_referers_by_weeks); + + +-- +-- Name: company_statistic_referers_by_weeks_12_01; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_referers_by_weeks_12_01 ( + CONSTRAINT company_statistic_referers_by_weeks_12_01_first_week_day_check CHECK (((first_week_day >= '2012-01-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2012-02-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_referers_by_weeks); + + +-- +-- Name: company_statistic_referers_by_weeks_12_02; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_referers_by_weeks_12_02 ( + CONSTRAINT company_statistic_referers_by_weeks_12_02_first_week_day_check CHECK (((first_week_day >= '2012-02-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2012-03-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_referers_by_weeks); + + +-- +-- Name: company_statistic_referers_by_weeks_12_03; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_referers_by_weeks_12_03 ( + CONSTRAINT company_statistic_referers_by_weeks_12_03_first_week_day_check CHECK (((first_week_day >= '2012-03-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2012-04-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_referers_by_weeks); + + +-- +-- Name: company_statistic_referers_by_weeks_12_04; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_referers_by_weeks_12_04 ( + CONSTRAINT company_statistic_referers_by_weeks_12_04_first_week_day_check CHECK (((first_week_day >= '2012-04-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2012-05-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_referers_by_weeks); + + +-- +-- Name: company_statistic_referers_by_weeks_12_05; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_referers_by_weeks_12_05 ( + CONSTRAINT company_statistic_referers_by_weeks_12_05_first_week_day_check CHECK (((first_week_day >= '2012-05-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2012-06-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_referers_by_weeks); + + +-- +-- Name: company_statistic_referers_by_weeks_12_06; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_referers_by_weeks_12_06 ( + CONSTRAINT company_statistic_referers_by_weeks_12_06_first_week_day_check CHECK (((first_week_day >= '2012-06-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2012-07-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_referers_by_weeks); + + +-- +-- Name: company_statistic_referers_by_weeks_12_07; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_referers_by_weeks_12_07 ( + CONSTRAINT company_statistic_referers_by_weeks_12_07_first_week_day_check CHECK (((first_week_day >= '2012-07-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2012-08-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_referers_by_weeks); + + +-- +-- Name: company_statistic_referers_by_weeks_12_08; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_referers_by_weeks_12_08 ( + CONSTRAINT company_statistic_referers_by_weeks_12_08_first_week_day_check CHECK (((first_week_day >= '2012-08-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2012-09-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_referers_by_weeks); + + +-- +-- Name: company_statistic_referers_by_weeks_12_09; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_referers_by_weeks_12_09 ( + CONSTRAINT company_statistic_referers_by_weeks_12_09_first_week_day_check CHECK (((first_week_day >= '2012-09-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2012-10-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_referers_by_weeks); + + +-- +-- Name: company_statistic_referers_by_weeks_12_10; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_referers_by_weeks_12_10 ( + CONSTRAINT company_statistic_referers_by_weeks_12_10_first_week_day_check CHECK (((first_week_day >= '2012-10-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2012-11-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_referers_by_weeks); + + +-- +-- Name: company_statistic_referers_by_weeks_12_11; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_referers_by_weeks_12_11 ( + CONSTRAINT company_statistic_referers_by_weeks_12_11_first_week_day_check CHECK (((first_week_day >= '2012-11-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2012-12-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_referers_by_weeks); + + +-- +-- Name: company_statistic_referers_by_weeks_12_12; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_referers_by_weeks_12_12 ( + CONSTRAINT company_statistic_referers_by_weeks_12_12_first_week_day_check CHECK (((first_week_day >= '2012-12-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2013-01-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_referers_by_weeks); + + +-- +-- Name: company_statistic_referers_by_weeks_13_01; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_referers_by_weeks_13_01 ( + CONSTRAINT company_statistic_referers_by_weeks_13_01_first_week_day_check CHECK (((first_week_day >= '2013-01-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2013-02-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_referers_by_weeks); + + +-- +-- Name: company_statistic_referers_by_weeks_13_02; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_referers_by_weeks_13_02 ( + CONSTRAINT company_statistic_referers_by_weeks_13_02_first_week_day_check CHECK (((first_week_day >= '2013-02-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2013-03-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_referers_by_weeks); + + +-- +-- Name: company_statistic_referers_by_weeks_13_03; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_referers_by_weeks_13_03 ( + CONSTRAINT company_statistic_referers_by_weeks_13_03_first_week_day_check CHECK (((first_week_day >= '2013-03-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2013-04-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_referers_by_weeks); + + +-- +-- Name: company_statistic_referers_by_weeks_13_04; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_referers_by_weeks_13_04 ( + CONSTRAINT company_statistic_referers_by_weeks_13_04_first_week_day_check CHECK (((first_week_day >= '2013-04-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2013-05-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_referers_by_weeks); + + +-- +-- Name: company_statistic_referers_by_weeks_13_05; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_referers_by_weeks_13_05 ( + CONSTRAINT company_statistic_referers_by_weeks_13_05_first_week_day_check CHECK (((first_week_day >= '2013-05-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2013-06-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_referers_by_weeks); + + +-- +-- Name: company_statistic_referers_by_weeks_13_06; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_referers_by_weeks_13_06 ( + CONSTRAINT company_statistic_referers_by_weeks_13_06_first_week_day_check CHECK (((first_week_day >= '2013-06-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2013-07-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_referers_by_weeks); + + +-- +-- Name: company_statistic_referers_by_weeks_13_07; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_referers_by_weeks_13_07 ( + CONSTRAINT company_statistic_referers_by_weeks_13_07_first_week_day_check CHECK (((first_week_day >= '2013-07-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2013-08-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_referers_by_weeks); + + +-- +-- Name: company_statistic_referers_by_weeks_13_08; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_referers_by_weeks_13_08 ( + CONSTRAINT company_statistic_referers_by_weeks_13_08_first_week_day_check CHECK (((first_week_day >= '2013-08-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2013-09-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_referers_by_weeks); + + +-- +-- Name: company_statistic_referers_by_weeks_13_09; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_referers_by_weeks_13_09 ( + CONSTRAINT company_statistic_referers_by_weeks_13_09_first_week_day_check CHECK (((first_week_day >= '2013-09-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2013-10-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_referers_by_weeks); + + +-- +-- Name: company_statistic_referers_by_weeks_13_10; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_referers_by_weeks_13_10 ( + CONSTRAINT company_statistic_referers_by_weeks_13_10_first_week_day_check CHECK (((first_week_day >= '2013-10-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2013-11-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_referers_by_weeks); + + +-- +-- Name: company_statistic_referers_by_weeks_13_11; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_referers_by_weeks_13_11 ( + CONSTRAINT company_statistic_referers_by_weeks_13_11_first_week_day_check CHECK (((first_week_day >= '2013-11-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2013-12-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_referers_by_weeks); + + +-- +-- Name: company_statistic_referers_by_weeks_13_12; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_referers_by_weeks_13_12 ( + CONSTRAINT company_statistic_referers_by_weeks_13_12_first_week_day_check CHECK (((first_week_day >= '2013-12-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2014-01-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_referers_by_weeks); + + +-- +-- Name: company_statistic_referers_by_weeks_14_01; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_referers_by_weeks_14_01 ( + CONSTRAINT company_statistic_referers_by_weeks_14_01_first_week_day_check CHECK (((first_week_day >= '2014-01-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2014-02-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_referers_by_weeks); + + +-- +-- Name: company_statistic_referers_by_weeks_14_02; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_referers_by_weeks_14_02 ( + CONSTRAINT company_statistic_referers_by_weeks_14_02_first_week_day_check CHECK (((first_week_day >= '2014-02-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2014-03-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_referers_by_weeks); + + +-- +-- Name: company_statistic_referers_by_weeks_14_03; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_referers_by_weeks_14_03 ( + CONSTRAINT company_statistic_referers_by_weeks_14_03_first_week_day_check CHECK (((first_week_day >= '2014-03-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2014-04-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_referers_by_weeks); + + +-- +-- Name: company_statistic_referers_by_weeks_14_04; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_referers_by_weeks_14_04 ( + CONSTRAINT company_statistic_referers_by_weeks_14_04_first_week_day_check CHECK (((first_week_day >= '2014-04-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2014-05-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_referers_by_weeks); + + +-- +-- Name: company_statistic_referers_by_weeks_14_05; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_referers_by_weeks_14_05 ( + CONSTRAINT company_statistic_referers_by_weeks_14_05_first_week_day_check CHECK (((first_week_day >= '2014-05-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2014-06-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_referers_by_weeks); + + +-- +-- Name: company_statistic_referers_by_weeks_14_06; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_referers_by_weeks_14_06 ( + CONSTRAINT company_statistic_referers_by_weeks_14_06_first_week_day_check CHECK (((first_week_day >= '2014-06-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2014-07-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_referers_by_weeks); + + +-- +-- Name: company_statistic_referers_by_weeks_14_07; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_referers_by_weeks_14_07 ( + CONSTRAINT company_statistic_referers_by_weeks_14_07_first_week_day_check CHECK (((first_week_day >= '2014-07-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2014-08-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_referers_by_weeks); + + +-- +-- Name: company_statistic_referers_by_weeks_14_08; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_referers_by_weeks_14_08 ( + CONSTRAINT company_statistic_referers_by_weeks_14_08_first_week_day_check CHECK (((first_week_day >= '2014-08-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2014-09-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_referers_by_weeks); + + +-- +-- Name: company_statistic_referers_by_weeks_14_09; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_referers_by_weeks_14_09 ( + CONSTRAINT company_statistic_referers_by_weeks_14_09_first_week_day_check CHECK (((first_week_day >= '2014-09-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2014-10-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_referers_by_weeks); + + +-- +-- Name: company_statistic_referers_by_weeks_14_10; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_referers_by_weeks_14_10 ( + CONSTRAINT company_statistic_referers_by_weeks_14_10_first_week_day_check CHECK (((first_week_day >= '2014-10-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2014-11-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_referers_by_weeks); + + +-- +-- Name: company_statistic_referers_by_weeks_14_11; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_referers_by_weeks_14_11 ( + CONSTRAINT company_statistic_referers_by_weeks_14_11_first_week_day_check CHECK (((first_week_day >= '2014-11-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2014-12-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_referers_by_weeks); + + +-- +-- Name: company_statistic_referers_by_weeks_14_12; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_referers_by_weeks_14_12 ( + CONSTRAINT company_statistic_referers_by_weeks_14_12_first_week_day_check CHECK (((first_week_day >= '2014-12-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2015-01-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_referers_by_weeks); + + +-- +-- Name: company_statistic_referers_by_weeks_15_01; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_referers_by_weeks_15_01 ( + CONSTRAINT company_statistic_referers_by_weeks_15_01_first_week_day_check CHECK (((first_week_day >= '2015-01-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2015-02-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_referers_by_weeks); + + +-- +-- Name: company_statistic_referers_by_weeks_15_08; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_referers_by_weeks_15_08 ( + CONSTRAINT company_statistic_referers_by_weeks_15_08_first_week_day_check CHECK (((first_week_day >= '2015-08-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2015-09-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_referers_by_weeks); + + +-- +-- Name: company_statistic_referers_by_weeks_15_09; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_referers_by_weeks_15_09 ( + CONSTRAINT company_statistic_referers_by_weeks_15_09_first_week_day_check CHECK (((first_week_day >= '2015-09-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2015-10-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_referers_by_weeks); + + +-- +-- Name: company_statistic_referers_by_weeks_id_seq; Type: SEQUENCE; Schema: statistics; Owner: - +-- + +CREATE SEQUENCE company_statistic_referers_by_weeks_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: company_statistic_referers_by_weeks_id_seq; Type: SEQUENCE OWNED BY; Schema: statistics; Owner: - +-- + +ALTER SEQUENCE company_statistic_referers_by_weeks_id_seq OWNED BY company_statistic_referers_by_weeks.id; + + +-- +-- Name: company_statistic_total_by_days; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_days ( + id integer NOT NULL, + company_id integer, + date date NOT NULL, + pages integer DEFAULT 0 NOT NULL, + visits integer DEFAULT 0 NOT NULL, + yml_hits integer +); + + +-- +-- Name: COLUMN company_statistic_total_by_days.yml_hits; Type: COMMENT; Schema: statistics; Owner: - +-- + +COMMENT ON COLUMN company_statistic_total_by_days.yml_hits IS 'Кол-во переходов на сайт интернет-магазина'; + + +-- +-- Name: company_statistic_total_by_days_09_11; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_days_09_11 ( + CONSTRAINT company_statistic_total_by_days_09_11_date_check CHECK (((date >= '2009-11-01 00:00:00'::timestamp without time zone) AND (date < '2009-12-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_days); + + +-- +-- Name: company_statistic_total_by_days_09_12; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_days_09_12 ( + CONSTRAINT company_statistic_total_by_days_09_12_date_check CHECK (((date >= '2009-12-01 00:00:00'::timestamp without time zone) AND (date < '2010-01-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_days); + + +-- +-- Name: company_statistic_total_by_days_10_01; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_days_10_01 ( + CONSTRAINT company_statistic_total_by_days_10_01_date_check CHECK (((date >= '2010-01-01 00:00:00'::timestamp without time zone) AND (date < '2010-02-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_days); + + +-- +-- Name: company_statistic_total_by_days_10_02; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_days_10_02 ( + CONSTRAINT company_statistic_total_by_days_10_02_date_check CHECK (((date >= '2010-02-01 00:00:00'::timestamp without time zone) AND (date < '2010-03-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_days); + + +-- +-- Name: company_statistic_total_by_days_10_03; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_days_10_03 ( + CONSTRAINT company_statistic_total_by_days_10_03_date_check CHECK (((date >= '2010-03-01 00:00:00'::timestamp without time zone) AND (date < '2010-04-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_days); + + +-- +-- Name: company_statistic_total_by_days_10_04; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_days_10_04 ( + CONSTRAINT company_statistic_total_by_days_10_04_date_check CHECK (((date >= '2010-04-01 00:00:00'::timestamp without time zone) AND (date < '2010-05-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_days); + + +-- +-- Name: company_statistic_total_by_days_10_05; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_days_10_05 ( + CONSTRAINT company_statistic_total_by_days_10_05_date_check CHECK (((date >= '2010-05-01 00:00:00'::timestamp without time zone) AND (date < '2010-06-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_days); + + +-- +-- Name: company_statistic_total_by_days_10_06; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_days_10_06 ( + CONSTRAINT company_statistic_total_by_days_10_06_date_check CHECK (((date >= '2010-06-01 00:00:00'::timestamp without time zone) AND (date < '2010-07-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_days); + + +-- +-- Name: company_statistic_total_by_days_10_07; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_days_10_07 ( + CONSTRAINT company_statistic_total_by_days_10_07_date_check CHECK (((date >= '2010-07-01 00:00:00'::timestamp without time zone) AND (date < '2010-08-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_days); + + +-- +-- Name: company_statistic_total_by_days_10_08; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_days_10_08 ( + CONSTRAINT company_statistic_total_by_days_10_08_date_check CHECK (((date >= '2010-08-01 00:00:00'::timestamp without time zone) AND (date < '2010-09-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_days); + + +-- +-- Name: company_statistic_total_by_days_10_09; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_days_10_09 ( + CONSTRAINT company_statistic_total_by_days_10_09_date_check CHECK (((date >= '2010-09-01 00:00:00'::timestamp without time zone) AND (date < '2010-10-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_days); + + +-- +-- Name: company_statistic_total_by_days_10_10; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_days_10_10 ( + CONSTRAINT company_statistic_total_by_days_10_10_date_check CHECK (((date >= '2010-10-01 00:00:00'::timestamp without time zone) AND (date < '2010-11-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_days); + + +-- +-- Name: company_statistic_total_by_days_10_11; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_days_10_11 ( + CONSTRAINT company_statistic_total_by_days_10_11_date_check CHECK (((date >= '2010-11-01 00:00:00'::timestamp without time zone) AND (date < '2010-12-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_days); + + +-- +-- Name: company_statistic_total_by_days_10_12; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_days_10_12 ( + CONSTRAINT company_statistic_total_by_days_10_12_date_check CHECK (((date >= '2010-12-01 00:00:00'::timestamp without time zone) AND (date < '2011-01-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_days); + + +-- +-- Name: company_statistic_total_by_days_11_11; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_days_11_11 ( + CONSTRAINT company_statistic_total_by_days_11_11_date_check CHECK (((date >= '2011-11-01 00:00:00'::timestamp without time zone) AND (date < '2011-12-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_days); + + +-- +-- Name: company_statistic_total_by_days_11_12; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_days_11_12 ( + CONSTRAINT company_statistic_total_by_days_11_12_date_check CHECK (((date >= '2011-12-01 00:00:00'::timestamp without time zone) AND (date < '2012-01-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_days); + + +-- +-- Name: company_statistic_total_by_days_12_01; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_days_12_01 ( + CONSTRAINT company_statistic_total_by_days_12_01_date_check CHECK (((date >= '2012-01-01 00:00:00'::timestamp without time zone) AND (date < '2012-02-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_days); + + +-- +-- Name: company_statistic_total_by_days_12_02; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_days_12_02 ( + CONSTRAINT company_statistic_total_by_days_12_02_date_check CHECK (((date >= '2012-02-01 00:00:00'::timestamp without time zone) AND (date < '2012-03-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_days); + + +-- +-- Name: company_statistic_total_by_days_12_03; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_days_12_03 ( + CONSTRAINT company_statistic_total_by_days_12_03_date_check CHECK (((date >= '2012-03-01 00:00:00'::timestamp without time zone) AND (date < '2012-04-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_days); + + +-- +-- Name: company_statistic_total_by_days_12_04; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_days_12_04 ( + CONSTRAINT company_statistic_total_by_days_12_04_date_check CHECK (((date >= '2012-04-01 00:00:00'::timestamp without time zone) AND (date < '2012-05-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_days); + + +-- +-- Name: company_statistic_total_by_days_12_05; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_days_12_05 ( + CONSTRAINT company_statistic_total_by_days_12_05_date_check CHECK (((date >= '2012-05-01 00:00:00'::timestamp without time zone) AND (date < '2012-06-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_days); + + +-- +-- Name: company_statistic_total_by_days_12_06; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_days_12_06 ( + CONSTRAINT company_statistic_total_by_days_12_06_date_check CHECK (((date >= '2012-06-01 00:00:00'::timestamp without time zone) AND (date < '2012-07-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_days); + + +-- +-- Name: company_statistic_total_by_days_12_07; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_days_12_07 ( + CONSTRAINT company_statistic_total_by_days_12_07_date_check CHECK (((date >= '2012-07-01 00:00:00'::timestamp without time zone) AND (date < '2012-08-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_days); + + +-- +-- Name: company_statistic_total_by_days_12_08; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_days_12_08 ( + CONSTRAINT company_statistic_total_by_days_12_08_date_check CHECK (((date >= '2012-08-01 00:00:00'::timestamp without time zone) AND (date < '2012-09-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_days); + + +-- +-- Name: company_statistic_total_by_days_12_09; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_days_12_09 ( + CONSTRAINT company_statistic_total_by_days_12_09_date_check CHECK (((date >= '2012-09-01 00:00:00'::timestamp without time zone) AND (date < '2012-10-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_days); + + +-- +-- Name: company_statistic_total_by_days_12_10; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_days_12_10 ( + CONSTRAINT company_statistic_total_by_days_12_10_date_check CHECK (((date >= '2012-10-01 00:00:00'::timestamp without time zone) AND (date < '2012-11-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_days); + + +-- +-- Name: company_statistic_total_by_days_12_11; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_days_12_11 ( + CONSTRAINT company_statistic_total_by_days_12_11_date_check CHECK (((date >= '2012-11-01 00:00:00'::timestamp without time zone) AND (date < '2012-12-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_days); + + +-- +-- Name: company_statistic_total_by_days_12_12; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_days_12_12 ( + CONSTRAINT company_statistic_total_by_days_12_12_date_check CHECK (((date >= '2012-12-01 00:00:00'::timestamp without time zone) AND (date < '2013-01-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_days); + + +-- +-- Name: company_statistic_total_by_days_13_01; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_days_13_01 ( + CONSTRAINT company_statistic_total_by_days_13_01_date_check CHECK (((date >= '2013-01-01 00:00:00'::timestamp without time zone) AND (date < '2013-02-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_days); + + +-- +-- Name: company_statistic_total_by_days_13_02; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_days_13_02 ( + CONSTRAINT company_statistic_total_by_days_13_02_date_check CHECK (((date >= '2013-02-01 00:00:00'::timestamp without time zone) AND (date < '2013-03-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_days); + + +-- +-- Name: company_statistic_total_by_days_13_03; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_days_13_03 ( + CONSTRAINT company_statistic_total_by_days_13_03_date_check CHECK (((date >= '2013-03-01 00:00:00'::timestamp without time zone) AND (date < '2013-04-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_days); + + +-- +-- Name: company_statistic_total_by_days_13_04; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_days_13_04 ( + CONSTRAINT company_statistic_total_by_days_13_04_date_check CHECK (((date >= '2013-04-01 00:00:00'::timestamp without time zone) AND (date < '2013-05-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_days); + + +-- +-- Name: company_statistic_total_by_days_13_05; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_days_13_05 ( + CONSTRAINT company_statistic_total_by_days_13_05_date_check CHECK (((date >= '2013-05-01 00:00:00'::timestamp without time zone) AND (date < '2013-06-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_days); + + +-- +-- Name: company_statistic_total_by_days_13_06; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_days_13_06 ( + CONSTRAINT company_statistic_total_by_days_13_06_date_check CHECK (((date >= '2013-06-01 00:00:00'::timestamp without time zone) AND (date < '2013-07-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_days); + + +-- +-- Name: company_statistic_total_by_days_13_07; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_days_13_07 ( + CONSTRAINT company_statistic_total_by_days_13_07_date_check CHECK (((date >= '2013-07-01 00:00:00'::timestamp without time zone) AND (date < '2013-08-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_days); + + +-- +-- Name: company_statistic_total_by_days_13_08; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_days_13_08 ( + CONSTRAINT company_statistic_total_by_days_13_08_date_check CHECK (((date >= '2013-08-01 00:00:00'::timestamp without time zone) AND (date < '2013-09-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_days); + + +-- +-- Name: company_statistic_total_by_days_13_09; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_days_13_09 ( + CONSTRAINT company_statistic_total_by_days_13_09_date_check CHECK (((date >= '2013-09-01 00:00:00'::timestamp without time zone) AND (date < '2013-10-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_days); + + +-- +-- Name: company_statistic_total_by_days_13_10; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_days_13_10 ( + CONSTRAINT company_statistic_total_by_days_13_10_date_check CHECK (((date >= '2013-10-01 00:00:00'::timestamp without time zone) AND (date < '2013-11-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_days); + + +-- +-- Name: company_statistic_total_by_days_13_11; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_days_13_11 ( + CONSTRAINT company_statistic_total_by_days_13_11_date_check CHECK (((date >= '2013-11-01 00:00:00'::timestamp without time zone) AND (date < '2013-12-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_days); + + +-- +-- Name: company_statistic_total_by_days_13_12; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_days_13_12 ( + CONSTRAINT company_statistic_total_by_days_13_12_date_check CHECK (((date >= '2013-12-01 00:00:00'::timestamp without time zone) AND (date < '2014-01-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_days); + + +-- +-- Name: company_statistic_total_by_days_14_01; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_days_14_01 ( + CONSTRAINT company_statistic_total_by_days_14_01_date_check CHECK (((date >= '2014-01-01 00:00:00'::timestamp without time zone) AND (date < '2014-02-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_days); + + +-- +-- Name: company_statistic_total_by_days_14_02; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_days_14_02 ( + CONSTRAINT company_statistic_total_by_days_14_02_date_check CHECK (((date >= '2014-02-01 00:00:00'::timestamp without time zone) AND (date < '2014-03-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_days); + + +-- +-- Name: company_statistic_total_by_days_14_03; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_days_14_03 ( + CONSTRAINT company_statistic_total_by_days_14_03_date_check CHECK (((date >= '2014-03-01 00:00:00'::timestamp without time zone) AND (date < '2014-04-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_days); + + +-- +-- Name: company_statistic_total_by_days_14_04; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_days_14_04 ( + CONSTRAINT company_statistic_total_by_days_14_04_date_check CHECK (((date >= '2014-04-01 00:00:00'::timestamp without time zone) AND (date < '2014-05-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_days); + + +-- +-- Name: company_statistic_total_by_days_14_05; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_days_14_05 ( + CONSTRAINT company_statistic_total_by_days_14_05_date_check CHECK (((date >= '2014-05-01 00:00:00'::timestamp without time zone) AND (date < '2014-06-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_days); + + +-- +-- Name: company_statistic_total_by_days_14_06; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_days_14_06 ( + CONSTRAINT company_statistic_total_by_days_14_06_date_check CHECK (((date >= '2014-06-01 00:00:00'::timestamp without time zone) AND (date < '2014-07-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_days); + + +-- +-- Name: company_statistic_total_by_days_14_07; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_days_14_07 ( + CONSTRAINT company_statistic_total_by_days_14_07_date_check CHECK (((date >= '2014-07-01 00:00:00'::timestamp without time zone) AND (date < '2014-08-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_days); + + +-- +-- Name: company_statistic_total_by_days_14_08; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_days_14_08 ( + CONSTRAINT company_statistic_total_by_days_14_08_date_check CHECK (((date >= '2014-08-01 00:00:00'::timestamp without time zone) AND (date < '2014-09-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_days); + + +-- +-- Name: company_statistic_total_by_days_14_09; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_days_14_09 ( + CONSTRAINT company_statistic_total_by_days_14_09_date_check CHECK (((date >= '2014-09-01 00:00:00'::timestamp without time zone) AND (date < '2014-10-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_days); + + +-- +-- Name: company_statistic_total_by_days_14_10; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_days_14_10 ( + CONSTRAINT company_statistic_total_by_days_14_10_date_check CHECK (((date >= '2014-10-01 00:00:00'::timestamp without time zone) AND (date < '2014-11-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_days); + + +-- +-- Name: company_statistic_total_by_days_14_11; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_days_14_11 ( + CONSTRAINT company_statistic_total_by_days_14_11_date_check CHECK (((date >= '2014-11-01 00:00:00'::timestamp without time zone) AND (date < '2014-12-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_days); + + +-- +-- Name: company_statistic_total_by_days_14_12; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_days_14_12 ( + CONSTRAINT company_statistic_total_by_days_14_12_date_check CHECK (((date >= '2014-12-01 00:00:00'::timestamp without time zone) AND (date < '2015-01-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_days); + + +-- +-- Name: company_statistic_total_by_days_15_01; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_days_15_01 ( + CONSTRAINT company_statistic_total_by_days_15_01_date_check CHECK (((date >= '2015-01-01 00:00:00'::timestamp without time zone) AND (date < '2015-02-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_days); + + +-- +-- Name: company_statistic_total_by_days_15_08; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_days_15_08 ( + CONSTRAINT company_statistic_total_by_days_15_08_date_check CHECK (((date >= '2015-08-01 00:00:00'::timestamp without time zone) AND (date < '2015-09-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_days); + + +-- +-- Name: company_statistic_total_by_days_15_09; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_days_15_09 ( + CONSTRAINT company_statistic_total_by_days_15_09_date_check CHECK (((date >= '2015-09-01 00:00:00'::timestamp without time zone) AND (date < '2015-10-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_days); + + +-- +-- Name: company_statistic_total_by_days_id_seq; Type: SEQUENCE; Schema: statistics; Owner: - +-- + +CREATE SEQUENCE company_statistic_total_by_days_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: company_statistic_total_by_days_id_seq; Type: SEQUENCE OWNED BY; Schema: statistics; Owner: - +-- + +ALTER SEQUENCE company_statistic_total_by_days_id_seq OWNED BY company_statistic_total_by_days.id; + + +-- +-- Name: company_statistic_total_by_months; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_months ( + id integer NOT NULL, + company_id integer, + date date NOT NULL, + pages integer DEFAULT 0 NOT NULL, + visits integer DEFAULT 0 NOT NULL, + yml_hits integer +); + + +-- +-- Name: COLUMN company_statistic_total_by_months.yml_hits; Type: COMMENT; Schema: statistics; Owner: - +-- + +COMMENT ON COLUMN company_statistic_total_by_months.yml_hits IS 'Кол-во переходов на сайт интернет-магазина'; + + +-- +-- Name: company_statistic_total_by_months_09_04; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_months_09_04 ( + CONSTRAINT company_statistic_total_by_months_09_04_date_check CHECK (((date >= '2009-04-01 00:00:00'::timestamp without time zone) AND (date < '2009-05-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_months); + + +-- +-- Name: company_statistic_total_by_months_09_05; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_months_09_05 ( + CONSTRAINT company_statistic_total_by_months_09_05_date_check CHECK (((date >= '2009-05-01 00:00:00'::timestamp without time zone) AND (date < '2009-06-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_months); + + +-- +-- Name: company_statistic_total_by_months_09_06; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_months_09_06 ( + CONSTRAINT company_statistic_total_by_months_09_06_date_check CHECK (((date >= '2009-06-01 00:00:00'::timestamp without time zone) AND (date < '2009-07-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_months); + + +-- +-- Name: company_statistic_total_by_months_09_07; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_months_09_07 ( + CONSTRAINT company_statistic_total_by_months_09_07_date_check CHECK (((date >= '2009-07-01 00:00:00'::timestamp without time zone) AND (date < '2009-08-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_months); + + +-- +-- Name: company_statistic_total_by_months_09_08; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_months_09_08 ( + CONSTRAINT company_statistic_total_by_months_09_08_date_check CHECK (((date >= '2009-08-01 00:00:00'::timestamp without time zone) AND (date < '2009-09-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_months); + + +-- +-- Name: company_statistic_total_by_months_09_09; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_months_09_09 ( + CONSTRAINT company_statistic_total_by_months_09_09_date_check CHECK (((date >= '2009-09-01 00:00:00'::timestamp without time zone) AND (date < '2009-10-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_months); + + +-- +-- Name: company_statistic_total_by_months_09_10; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_months_09_10 ( + CONSTRAINT company_statistic_total_by_months_09_10_date_check CHECK (((date >= '2009-10-01 00:00:00'::timestamp without time zone) AND (date < '2009-11-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_months); + + +-- +-- Name: company_statistic_total_by_months_09_11; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_months_09_11 ( + CONSTRAINT company_statistic_total_by_months_09_11_date_check CHECK (((date >= '2009-11-01 00:00:00'::timestamp without time zone) AND (date < '2009-12-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_months); + + +-- +-- Name: company_statistic_total_by_months_09_12; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_months_09_12 ( + CONSTRAINT company_statistic_total_by_months_09_12_date_check CHECK (((date >= '2009-12-01 00:00:00'::timestamp without time zone) AND (date < '2010-01-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_months); + + +-- +-- Name: company_statistic_total_by_months_10_01; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_months_10_01 ( + CONSTRAINT company_statistic_total_by_months_10_01_date_check CHECK (((date >= '2010-01-01 00:00:00'::timestamp without time zone) AND (date < '2010-02-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_months); + + +-- +-- Name: company_statistic_total_by_months_10_02; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_months_10_02 ( + CONSTRAINT company_statistic_total_by_months_10_02_date_check CHECK (((date >= '2010-02-01 00:00:00'::timestamp without time zone) AND (date < '2010-03-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_months); + + +-- +-- Name: company_statistic_total_by_months_10_03; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_months_10_03 ( + CONSTRAINT company_statistic_total_by_months_10_03_date_check CHECK (((date >= '2010-03-01 00:00:00'::timestamp without time zone) AND (date < '2010-04-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_months); + + +-- +-- Name: company_statistic_total_by_months_10_04; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_months_10_04 ( + CONSTRAINT company_statistic_total_by_months_10_04_date_check CHECK (((date >= '2010-04-01 00:00:00'::timestamp without time zone) AND (date < '2010-05-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_months); + + +-- +-- Name: company_statistic_total_by_months_10_05; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_months_10_05 ( + CONSTRAINT company_statistic_total_by_months_10_05_date_check CHECK (((date >= '2010-05-01 00:00:00'::timestamp without time zone) AND (date < '2010-06-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_months); + + +-- +-- Name: company_statistic_total_by_months_10_06; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_months_10_06 ( + CONSTRAINT company_statistic_total_by_months_10_06_date_check CHECK (((date >= '2010-06-01 00:00:00'::timestamp without time zone) AND (date < '2010-07-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_months); + + +-- +-- Name: company_statistic_total_by_months_10_07; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_months_10_07 ( + CONSTRAINT company_statistic_total_by_months_10_07_date_check CHECK (((date >= '2010-07-01 00:00:00'::timestamp without time zone) AND (date < '2010-08-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_months); + + +-- +-- Name: company_statistic_total_by_months_10_08; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_months_10_08 ( + CONSTRAINT company_statistic_total_by_months_10_08_date_check CHECK (((date >= '2010-08-01 00:00:00'::timestamp without time zone) AND (date < '2010-09-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_months); + + +-- +-- Name: company_statistic_total_by_months_10_09; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_months_10_09 ( + CONSTRAINT company_statistic_total_by_months_10_09_date_check CHECK (((date >= '2010-09-01 00:00:00'::timestamp without time zone) AND (date < '2010-10-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_months); + + +-- +-- Name: company_statistic_total_by_months_10_10; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_months_10_10 ( + CONSTRAINT company_statistic_total_by_months_10_10_date_check CHECK (((date >= '2010-10-01 00:00:00'::timestamp without time zone) AND (date < '2010-11-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_months); + + +-- +-- Name: company_statistic_total_by_months_10_11; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_months_10_11 ( + CONSTRAINT company_statistic_total_by_months_10_11_date_check CHECK (((date >= '2010-11-01 00:00:00'::timestamp without time zone) AND (date < '2010-12-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_months); + + +-- +-- Name: company_statistic_total_by_months_10_12; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_months_10_12 ( + CONSTRAINT company_statistic_total_by_months_10_12_date_check CHECK (((date >= '2010-12-01 00:00:00'::timestamp without time zone) AND (date < '2011-01-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_months); + + +-- +-- Name: company_statistic_total_by_months_11_11; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_months_11_11 ( + CONSTRAINT company_statistic_total_by_months_11_11_date_check CHECK (((date >= '2011-11-01 00:00:00'::timestamp without time zone) AND (date < '2011-12-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_months); + + +-- +-- Name: company_statistic_total_by_months_11_12; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_months_11_12 ( + CONSTRAINT company_statistic_total_by_months_11_12_date_check CHECK (((date >= '2011-12-01 00:00:00'::timestamp without time zone) AND (date < '2012-01-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_months); + + +-- +-- Name: company_statistic_total_by_months_12_01; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_months_12_01 ( + CONSTRAINT company_statistic_total_by_months_12_01_date_check CHECK (((date >= '2012-01-01 00:00:00'::timestamp without time zone) AND (date < '2012-02-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_months); + + +-- +-- Name: company_statistic_total_by_months_12_02; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_months_12_02 ( + CONSTRAINT company_statistic_total_by_months_12_02_date_check CHECK (((date >= '2012-02-01 00:00:00'::timestamp without time zone) AND (date < '2012-03-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_months); + + +-- +-- Name: company_statistic_total_by_months_12_03; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_months_12_03 ( + CONSTRAINT company_statistic_total_by_months_12_03_date_check CHECK (((date >= '2012-03-01 00:00:00'::timestamp without time zone) AND (date < '2012-04-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_months); + + +-- +-- Name: company_statistic_total_by_months_12_04; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_months_12_04 ( + CONSTRAINT company_statistic_total_by_months_12_04_date_check CHECK (((date >= '2012-04-01 00:00:00'::timestamp without time zone) AND (date < '2012-05-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_months); + + +-- +-- Name: company_statistic_total_by_months_12_05; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_months_12_05 ( + CONSTRAINT company_statistic_total_by_months_12_05_date_check CHECK (((date >= '2012-05-01 00:00:00'::timestamp without time zone) AND (date < '2012-06-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_months); + + +-- +-- Name: company_statistic_total_by_months_12_06; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_months_12_06 ( + CONSTRAINT company_statistic_total_by_months_12_06_date_check CHECK (((date >= '2012-06-01 00:00:00'::timestamp without time zone) AND (date < '2012-07-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_months); + + +-- +-- Name: company_statistic_total_by_months_12_07; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_months_12_07 ( + CONSTRAINT company_statistic_total_by_months_12_07_date_check CHECK (((date >= '2012-07-01 00:00:00'::timestamp without time zone) AND (date < '2012-08-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_months); + + +-- +-- Name: company_statistic_total_by_months_12_08; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_months_12_08 ( + CONSTRAINT company_statistic_total_by_months_12_08_date_check CHECK (((date >= '2012-08-01 00:00:00'::timestamp without time zone) AND (date < '2012-09-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_months); + + +-- +-- Name: company_statistic_total_by_months_12_09; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_months_12_09 ( + CONSTRAINT company_statistic_total_by_months_12_09_date_check CHECK (((date >= '2012-09-01 00:00:00'::timestamp without time zone) AND (date < '2012-10-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_months); + + +-- +-- Name: company_statistic_total_by_months_12_10; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_months_12_10 ( + CONSTRAINT company_statistic_total_by_months_12_10_date_check CHECK (((date >= '2012-10-01 00:00:00'::timestamp without time zone) AND (date < '2012-11-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_months); + + +-- +-- Name: company_statistic_total_by_months_12_11; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_months_12_11 ( + CONSTRAINT company_statistic_total_by_months_12_11_date_check CHECK (((date >= '2012-11-01 00:00:00'::timestamp without time zone) AND (date < '2012-12-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_months); + + +-- +-- Name: company_statistic_total_by_months_12_12; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_months_12_12 ( + CONSTRAINT company_statistic_total_by_months_12_12_date_check CHECK (((date >= '2012-12-01 00:00:00'::timestamp without time zone) AND (date < '2013-01-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_months); + + +-- +-- Name: company_statistic_total_by_months_13_01; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_months_13_01 ( + CONSTRAINT company_statistic_total_by_months_13_01_date_check CHECK (((date >= '2013-01-01 00:00:00'::timestamp without time zone) AND (date < '2013-02-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_months); + + +-- +-- Name: company_statistic_total_by_months_13_02; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_months_13_02 ( + CONSTRAINT company_statistic_total_by_months_13_02_date_check CHECK (((date >= '2013-02-01 00:00:00'::timestamp without time zone) AND (date < '2013-03-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_months); + + +-- +-- Name: company_statistic_total_by_months_13_03; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_months_13_03 ( + CONSTRAINT company_statistic_total_by_months_13_03_date_check CHECK (((date >= '2013-03-01 00:00:00'::timestamp without time zone) AND (date < '2013-04-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_months); + + +-- +-- Name: company_statistic_total_by_months_13_04; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_months_13_04 ( + CONSTRAINT company_statistic_total_by_months_13_04_date_check CHECK (((date >= '2013-04-01 00:00:00'::timestamp without time zone) AND (date < '2013-05-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_months); + + +-- +-- Name: company_statistic_total_by_months_13_05; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_months_13_05 ( + CONSTRAINT company_statistic_total_by_months_13_05_date_check CHECK (((date >= '2013-05-01 00:00:00'::timestamp without time zone) AND (date < '2013-06-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_months); + + +-- +-- Name: company_statistic_total_by_months_13_06; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_months_13_06 ( + CONSTRAINT company_statistic_total_by_months_13_06_date_check CHECK (((date >= '2013-06-01 00:00:00'::timestamp without time zone) AND (date < '2013-07-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_months); + + +-- +-- Name: company_statistic_total_by_months_13_07; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_months_13_07 ( + CONSTRAINT company_statistic_total_by_months_13_07_date_check CHECK (((date >= '2013-07-01 00:00:00'::timestamp without time zone) AND (date < '2013-08-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_months); + + +-- +-- Name: company_statistic_total_by_months_13_08; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_months_13_08 ( + CONSTRAINT company_statistic_total_by_months_13_08_date_check CHECK (((date >= '2013-08-01 00:00:00'::timestamp without time zone) AND (date < '2013-09-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_months); + + +-- +-- Name: company_statistic_total_by_months_13_09; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_months_13_09 ( + CONSTRAINT company_statistic_total_by_months_13_09_date_check CHECK (((date >= '2013-09-01 00:00:00'::timestamp without time zone) AND (date < '2013-10-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_months); + + +-- +-- Name: company_statistic_total_by_months_13_10; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_months_13_10 ( + CONSTRAINT company_statistic_total_by_months_13_10_date_check CHECK (((date >= '2013-10-01 00:00:00'::timestamp without time zone) AND (date < '2013-11-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_months); + + +-- +-- Name: company_statistic_total_by_months_13_11; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_months_13_11 ( + CONSTRAINT company_statistic_total_by_months_13_11_date_check CHECK (((date >= '2013-11-01 00:00:00'::timestamp without time zone) AND (date < '2013-12-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_months); + + +-- +-- Name: company_statistic_total_by_months_13_12; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_months_13_12 ( + CONSTRAINT company_statistic_total_by_months_13_12_date_check CHECK (((date >= '2013-12-01 00:00:00'::timestamp without time zone) AND (date < '2014-01-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_months); + + +-- +-- Name: company_statistic_total_by_months_14_01; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_months_14_01 ( + CONSTRAINT company_statistic_total_by_months_14_01_date_check CHECK (((date >= '2014-01-01 00:00:00'::timestamp without time zone) AND (date < '2014-02-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_months); + + +-- +-- Name: company_statistic_total_by_months_14_02; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_months_14_02 ( + CONSTRAINT company_statistic_total_by_months_14_02_date_check CHECK (((date >= '2014-02-01 00:00:00'::timestamp without time zone) AND (date < '2014-03-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_months); + + +-- +-- Name: company_statistic_total_by_months_14_03; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_months_14_03 ( + CONSTRAINT company_statistic_total_by_months_14_03_date_check CHECK (((date >= '2014-03-01 00:00:00'::timestamp without time zone) AND (date < '2014-04-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_months); + + +-- +-- Name: company_statistic_total_by_months_14_04; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_months_14_04 ( + CONSTRAINT company_statistic_total_by_months_14_04_date_check CHECK (((date >= '2014-04-01 00:00:00'::timestamp without time zone) AND (date < '2014-05-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_months); + + +-- +-- Name: company_statistic_total_by_months_14_05; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_months_14_05 ( + CONSTRAINT company_statistic_total_by_months_14_05_date_check CHECK (((date >= '2014-05-01 00:00:00'::timestamp without time zone) AND (date < '2014-06-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_months); + + +-- +-- Name: company_statistic_total_by_months_14_06; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_months_14_06 ( + CONSTRAINT company_statistic_total_by_months_14_06_date_check CHECK (((date >= '2014-06-01 00:00:00'::timestamp without time zone) AND (date < '2014-07-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_months); + + +-- +-- Name: company_statistic_total_by_months_14_07; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_months_14_07 ( + CONSTRAINT company_statistic_total_by_months_14_07_date_check CHECK (((date >= '2014-07-01 00:00:00'::timestamp without time zone) AND (date < '2014-08-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_months); + + +-- +-- Name: company_statistic_total_by_months_14_08; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_months_14_08 ( + CONSTRAINT company_statistic_total_by_months_14_08_date_check CHECK (((date >= '2014-08-01 00:00:00'::timestamp without time zone) AND (date < '2014-09-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_months); + + +-- +-- Name: company_statistic_total_by_months_14_09; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_months_14_09 ( + CONSTRAINT company_statistic_total_by_months_14_09_date_check CHECK (((date >= '2014-09-01 00:00:00'::timestamp without time zone) AND (date < '2014-10-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_months); + + +-- +-- Name: company_statistic_total_by_months_14_10; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_months_14_10 ( + CONSTRAINT company_statistic_total_by_months_14_10_date_check CHECK (((date >= '2014-10-01 00:00:00'::timestamp without time zone) AND (date < '2014-11-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_months); + + +-- +-- Name: company_statistic_total_by_months_14_11; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_months_14_11 ( + CONSTRAINT company_statistic_total_by_months_14_11_date_check CHECK (((date >= '2014-11-01 00:00:00'::timestamp without time zone) AND (date < '2014-12-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_months); + + +-- +-- Name: company_statistic_total_by_months_14_12; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_months_14_12 ( + CONSTRAINT company_statistic_total_by_months_14_12_date_check CHECK (((date >= '2014-12-01 00:00:00'::timestamp without time zone) AND (date < '2015-01-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_months); + + +-- +-- Name: company_statistic_total_by_months_15_01; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_months_15_01 ( + CONSTRAINT company_statistic_total_by_months_15_01_date_check CHECK (((date >= '2015-01-01 00:00:00'::timestamp without time zone) AND (date < '2015-02-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_months); + + +-- +-- Name: company_statistic_total_by_months_15_08; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_months_15_08 ( + CONSTRAINT company_statistic_total_by_months_15_08_date_check CHECK (((date >= '2015-08-01 00:00:00'::timestamp without time zone) AND (date < '2015-09-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_months); + + +-- +-- Name: company_statistic_total_by_months_15_09; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_months_15_09 ( + CONSTRAINT company_statistic_total_by_months_15_09_date_check CHECK (((date >= '2015-09-01 00:00:00'::timestamp without time zone) AND (date < '2015-10-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_months); + + +-- +-- Name: company_statistic_total_by_months_id_seq; Type: SEQUENCE; Schema: statistics; Owner: - +-- + +CREATE SEQUENCE company_statistic_total_by_months_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: company_statistic_total_by_months_id_seq; Type: SEQUENCE OWNED BY; Schema: statistics; Owner: - +-- + +ALTER SEQUENCE company_statistic_total_by_months_id_seq OWNED BY company_statistic_total_by_months.id; + + +-- +-- Name: company_statistic_total_by_weeks; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_weeks ( + id integer NOT NULL, + company_id integer, + first_week_day date NOT NULL, + last_week_day date NOT NULL, + year integer NOT NULL, + week integer NOT NULL, + pages integer DEFAULT 0 NOT NULL, + visits integer DEFAULT 0 NOT NULL, + yml_hits integer +); + + +-- +-- Name: COLUMN company_statistic_total_by_weeks.yml_hits; Type: COMMENT; Schema: statistics; Owner: - +-- + +COMMENT ON COLUMN company_statistic_total_by_weeks.yml_hits IS 'Кол-во переходов на сайт интернет-магазина'; + + +-- +-- Name: company_statistic_total_by_weeks_09_04; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_weeks_09_04 ( + CONSTRAINT company_statistic_total_by_weeks_09_04_first_week_day_check CHECK (((first_week_day >= '2009-04-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2009-05-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_weeks); + + +-- +-- Name: company_statistic_total_by_weeks_09_05; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_weeks_09_05 ( + CONSTRAINT company_statistic_total_by_weeks_09_05_first_week_day_check CHECK (((first_week_day >= '2009-05-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2009-06-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_weeks); + + +-- +-- Name: company_statistic_total_by_weeks_09_06; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_weeks_09_06 ( + CONSTRAINT company_statistic_total_by_weeks_09_06_first_week_day_check CHECK (((first_week_day >= '2009-06-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2009-07-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_weeks); + + +-- +-- Name: company_statistic_total_by_weeks_09_07; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_weeks_09_07 ( + CONSTRAINT company_statistic_total_by_weeks_09_07_first_week_day_check CHECK (((first_week_day >= '2009-07-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2009-08-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_weeks); + + +-- +-- Name: company_statistic_total_by_weeks_09_08; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_weeks_09_08 ( + CONSTRAINT company_statistic_total_by_weeks_09_08_first_week_day_check CHECK (((first_week_day >= '2009-08-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2009-09-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_weeks); + + +-- +-- Name: company_statistic_total_by_weeks_09_09; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_weeks_09_09 ( + CONSTRAINT company_statistic_total_by_weeks_09_09_first_week_day_check CHECK (((first_week_day >= '2009-09-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2009-10-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_weeks); + + +-- +-- Name: company_statistic_total_by_weeks_09_10; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_weeks_09_10 ( + CONSTRAINT company_statistic_total_by_weeks_09_10_first_week_day_check CHECK (((first_week_day >= '2009-10-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2009-11-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_weeks); + + +-- +-- Name: company_statistic_total_by_weeks_09_11; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_weeks_09_11 ( + CONSTRAINT company_statistic_total_by_weeks_09_11_first_week_day_check CHECK (((first_week_day >= '2009-11-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2009-12-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_weeks); + + +-- +-- Name: company_statistic_total_by_weeks_09_12; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_weeks_09_12 ( + CONSTRAINT company_statistic_total_by_weeks_09_12_first_week_day_check CHECK (((first_week_day >= '2009-12-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2010-01-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_weeks); + + +-- +-- Name: company_statistic_total_by_weeks_10_01; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_weeks_10_01 ( + CONSTRAINT company_statistic_total_by_weeks_10_01_first_week_day_check CHECK (((first_week_day >= '2010-01-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2010-02-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_weeks); + + +-- +-- Name: company_statistic_total_by_weeks_10_02; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_weeks_10_02 ( + CONSTRAINT company_statistic_total_by_weeks_10_02_first_week_day_check CHECK (((first_week_day >= '2010-02-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2010-03-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_weeks); + + +-- +-- Name: company_statistic_total_by_weeks_10_03; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_weeks_10_03 ( + CONSTRAINT company_statistic_total_by_weeks_10_03_first_week_day_check CHECK (((first_week_day >= '2010-03-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2010-04-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_weeks); + + +-- +-- Name: company_statistic_total_by_weeks_10_04; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_weeks_10_04 ( + CONSTRAINT company_statistic_total_by_weeks_10_04_first_week_day_check CHECK (((first_week_day >= '2010-04-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2010-05-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_weeks); + + +-- +-- Name: company_statistic_total_by_weeks_10_05; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_weeks_10_05 ( + CONSTRAINT company_statistic_total_by_weeks_10_05_first_week_day_check CHECK (((first_week_day >= '2010-05-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2010-06-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_weeks); + + +-- +-- Name: company_statistic_total_by_weeks_10_06; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_weeks_10_06 ( + CONSTRAINT company_statistic_total_by_weeks_10_06_first_week_day_check CHECK (((first_week_day >= '2010-06-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2010-07-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_weeks); + + +-- +-- Name: company_statistic_total_by_weeks_10_07; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_weeks_10_07 ( + CONSTRAINT company_statistic_total_by_weeks_10_07_first_week_day_check CHECK (((first_week_day >= '2010-07-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2010-08-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_weeks); + + +-- +-- Name: company_statistic_total_by_weeks_10_08; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_weeks_10_08 ( + CONSTRAINT company_statistic_total_by_weeks_10_08_first_week_day_check CHECK (((first_week_day >= '2010-08-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2010-09-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_weeks); + + +-- +-- Name: company_statistic_total_by_weeks_10_09; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_weeks_10_09 ( + CONSTRAINT company_statistic_total_by_weeks_10_09_first_week_day_check CHECK (((first_week_day >= '2010-09-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2010-10-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_weeks); + + +-- +-- Name: company_statistic_total_by_weeks_10_10; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_weeks_10_10 ( + CONSTRAINT company_statistic_total_by_weeks_10_10_first_week_day_check CHECK (((first_week_day >= '2010-10-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2010-11-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_weeks); + + +-- +-- Name: company_statistic_total_by_weeks_10_11; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_weeks_10_11 ( + CONSTRAINT company_statistic_total_by_weeks_10_11_first_week_day_check CHECK (((first_week_day >= '2010-11-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2010-12-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_weeks); + + +-- +-- Name: company_statistic_total_by_weeks_10_12; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_weeks_10_12 ( + CONSTRAINT company_statistic_total_by_weeks_10_12_first_week_day_check CHECK (((first_week_day >= '2010-12-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2011-01-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_weeks); + + +-- +-- Name: company_statistic_total_by_weeks_11_11; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_weeks_11_11 ( + CONSTRAINT company_statistic_total_by_weeks_11_11_first_week_day_check CHECK (((first_week_day >= '2011-11-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2011-12-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_weeks); + + +-- +-- Name: company_statistic_total_by_weeks_11_12; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_weeks_11_12 ( + CONSTRAINT company_statistic_total_by_weeks_11_12_first_week_day_check CHECK (((first_week_day >= '2011-12-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2012-01-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_weeks); + + +-- +-- Name: company_statistic_total_by_weeks_12_01; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_weeks_12_01 ( + CONSTRAINT company_statistic_total_by_weeks_12_01_first_week_day_check CHECK (((first_week_day >= '2012-01-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2012-02-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_weeks); + + +-- +-- Name: company_statistic_total_by_weeks_12_02; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_weeks_12_02 ( + CONSTRAINT company_statistic_total_by_weeks_12_02_first_week_day_check CHECK (((first_week_day >= '2012-02-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2012-03-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_weeks); + + +-- +-- Name: company_statistic_total_by_weeks_12_03; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_weeks_12_03 ( + CONSTRAINT company_statistic_total_by_weeks_12_03_first_week_day_check CHECK (((first_week_day >= '2012-03-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2012-04-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_weeks); + + +-- +-- Name: company_statistic_total_by_weeks_12_04; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_weeks_12_04 ( + CONSTRAINT company_statistic_total_by_weeks_12_04_first_week_day_check CHECK (((first_week_day >= '2012-04-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2012-05-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_weeks); + + +-- +-- Name: company_statistic_total_by_weeks_12_05; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_weeks_12_05 ( + CONSTRAINT company_statistic_total_by_weeks_12_05_first_week_day_check CHECK (((first_week_day >= '2012-05-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2012-06-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_weeks); + + +-- +-- Name: company_statistic_total_by_weeks_12_06; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_weeks_12_06 ( + CONSTRAINT company_statistic_total_by_weeks_12_06_first_week_day_check CHECK (((first_week_day >= '2012-06-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2012-07-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_weeks); + + +-- +-- Name: company_statistic_total_by_weeks_12_07; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_weeks_12_07 ( + CONSTRAINT company_statistic_total_by_weeks_12_07_first_week_day_check CHECK (((first_week_day >= '2012-07-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2012-08-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_weeks); + + +-- +-- Name: company_statistic_total_by_weeks_12_08; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_weeks_12_08 ( + CONSTRAINT company_statistic_total_by_weeks_12_08_first_week_day_check CHECK (((first_week_day >= '2012-08-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2012-09-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_weeks); + + +-- +-- Name: company_statistic_total_by_weeks_12_09; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_weeks_12_09 ( + CONSTRAINT company_statistic_total_by_weeks_12_09_first_week_day_check CHECK (((first_week_day >= '2012-09-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2012-10-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_weeks); + + +-- +-- Name: company_statistic_total_by_weeks_12_10; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_weeks_12_10 ( + CONSTRAINT company_statistic_total_by_weeks_12_10_first_week_day_check CHECK (((first_week_day >= '2012-10-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2012-11-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_weeks); + + +-- +-- Name: company_statistic_total_by_weeks_12_11; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_weeks_12_11 ( + CONSTRAINT company_statistic_total_by_weeks_12_11_first_week_day_check CHECK (((first_week_day >= '2012-11-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2012-12-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_weeks); + + +-- +-- Name: company_statistic_total_by_weeks_12_12; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_weeks_12_12 ( + CONSTRAINT company_statistic_total_by_weeks_12_12_first_week_day_check CHECK (((first_week_day >= '2012-12-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2013-01-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_weeks); + + +-- +-- Name: company_statistic_total_by_weeks_13_01; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_weeks_13_01 ( + CONSTRAINT company_statistic_total_by_weeks_13_01_first_week_day_check CHECK (((first_week_day >= '2013-01-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2013-02-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_weeks); + + +-- +-- Name: company_statistic_total_by_weeks_13_02; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_weeks_13_02 ( + CONSTRAINT company_statistic_total_by_weeks_13_02_first_week_day_check CHECK (((first_week_day >= '2013-02-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2013-03-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_weeks); + + +-- +-- Name: company_statistic_total_by_weeks_13_03; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_weeks_13_03 ( + CONSTRAINT company_statistic_total_by_weeks_13_03_first_week_day_check CHECK (((first_week_day >= '2013-03-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2013-04-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_weeks); + + +-- +-- Name: company_statistic_total_by_weeks_13_04; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_weeks_13_04 ( + CONSTRAINT company_statistic_total_by_weeks_13_04_first_week_day_check CHECK (((first_week_day >= '2013-04-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2013-05-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_weeks); + + +-- +-- Name: company_statistic_total_by_weeks_13_05; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_weeks_13_05 ( + CONSTRAINT company_statistic_total_by_weeks_13_05_first_week_day_check CHECK (((first_week_day >= '2013-05-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2013-06-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_weeks); + + +-- +-- Name: company_statistic_total_by_weeks_13_06; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_weeks_13_06 ( + CONSTRAINT company_statistic_total_by_weeks_13_06_first_week_day_check CHECK (((first_week_day >= '2013-06-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2013-07-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_weeks); + + +-- +-- Name: company_statistic_total_by_weeks_13_07; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_weeks_13_07 ( + CONSTRAINT company_statistic_total_by_weeks_13_07_first_week_day_check CHECK (((first_week_day >= '2013-07-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2013-08-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_weeks); + + +-- +-- Name: company_statistic_total_by_weeks_13_08; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_weeks_13_08 ( + CONSTRAINT company_statistic_total_by_weeks_13_08_first_week_day_check CHECK (((first_week_day >= '2013-08-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2013-09-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_weeks); + + +-- +-- Name: company_statistic_total_by_weeks_13_09; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_weeks_13_09 ( + CONSTRAINT company_statistic_total_by_weeks_13_09_first_week_day_check CHECK (((first_week_day >= '2013-09-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2013-10-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_weeks); + + +-- +-- Name: company_statistic_total_by_weeks_13_10; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_weeks_13_10 ( + CONSTRAINT company_statistic_total_by_weeks_13_10_first_week_day_check CHECK (((first_week_day >= '2013-10-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2013-11-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_weeks); + + +-- +-- Name: company_statistic_total_by_weeks_13_11; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_weeks_13_11 ( + CONSTRAINT company_statistic_total_by_weeks_13_11_first_week_day_check CHECK (((first_week_day >= '2013-11-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2013-12-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_weeks); + + +-- +-- Name: company_statistic_total_by_weeks_13_12; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_weeks_13_12 ( + CONSTRAINT company_statistic_total_by_weeks_13_12_first_week_day_check CHECK (((first_week_day >= '2013-12-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2014-01-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_weeks); + + +-- +-- Name: company_statistic_total_by_weeks_14_01; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_weeks_14_01 ( + CONSTRAINT company_statistic_total_by_weeks_14_01_first_week_day_check CHECK (((first_week_day >= '2014-01-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2014-02-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_weeks); + + +-- +-- Name: company_statistic_total_by_weeks_14_02; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_weeks_14_02 ( + CONSTRAINT company_statistic_total_by_weeks_14_02_first_week_day_check CHECK (((first_week_day >= '2014-02-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2014-03-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_weeks); + + +-- +-- Name: company_statistic_total_by_weeks_14_03; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_weeks_14_03 ( + CONSTRAINT company_statistic_total_by_weeks_14_03_first_week_day_check CHECK (((first_week_day >= '2014-03-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2014-04-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_weeks); + + +-- +-- Name: company_statistic_total_by_weeks_14_04; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_weeks_14_04 ( + CONSTRAINT company_statistic_total_by_weeks_14_04_first_week_day_check CHECK (((first_week_day >= '2014-04-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2014-05-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_weeks); + + +-- +-- Name: company_statistic_total_by_weeks_14_05; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_weeks_14_05 ( + CONSTRAINT company_statistic_total_by_weeks_14_05_first_week_day_check CHECK (((first_week_day >= '2014-05-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2014-06-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_weeks); + + +-- +-- Name: company_statistic_total_by_weeks_14_06; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_weeks_14_06 ( + CONSTRAINT company_statistic_total_by_weeks_14_06_first_week_day_check CHECK (((first_week_day >= '2014-06-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2014-07-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_weeks); + + +-- +-- Name: company_statistic_total_by_weeks_14_07; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_weeks_14_07 ( + CONSTRAINT company_statistic_total_by_weeks_14_07_first_week_day_check CHECK (((first_week_day >= '2014-07-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2014-08-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_weeks); + + +-- +-- Name: company_statistic_total_by_weeks_14_08; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_weeks_14_08 ( + CONSTRAINT company_statistic_total_by_weeks_14_08_first_week_day_check CHECK (((first_week_day >= '2014-08-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2014-09-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_weeks); + + +-- +-- Name: company_statistic_total_by_weeks_14_09; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_weeks_14_09 ( + CONSTRAINT company_statistic_total_by_weeks_14_09_first_week_day_check CHECK (((first_week_day >= '2014-09-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2014-10-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_weeks); + + +-- +-- Name: company_statistic_total_by_weeks_14_10; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_weeks_14_10 ( + CONSTRAINT company_statistic_total_by_weeks_14_10_first_week_day_check CHECK (((first_week_day >= '2014-10-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2014-11-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_weeks); + + +-- +-- Name: company_statistic_total_by_weeks_14_11; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_weeks_14_11 ( + CONSTRAINT company_statistic_total_by_weeks_14_11_first_week_day_check CHECK (((first_week_day >= '2014-11-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2014-12-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_weeks); + + +-- +-- Name: company_statistic_total_by_weeks_14_12; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_weeks_14_12 ( + CONSTRAINT company_statistic_total_by_weeks_14_12_first_week_day_check CHECK (((first_week_day >= '2014-12-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2015-01-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_weeks); + + +-- +-- Name: company_statistic_total_by_weeks_15_01; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_weeks_15_01 ( + CONSTRAINT company_statistic_total_by_weeks_15_01_first_week_day_check CHECK (((first_week_day >= '2015-01-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2015-02-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_weeks); + + +-- +-- Name: company_statistic_total_by_weeks_15_08; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_weeks_15_08 ( + CONSTRAINT company_statistic_total_by_weeks_15_08_first_week_day_check CHECK (((first_week_day >= '2015-08-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2015-09-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_weeks); + + +-- +-- Name: company_statistic_total_by_weeks_15_09; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_total_by_weeks_15_09 ( + CONSTRAINT company_statistic_total_by_weeks_15_09_first_week_day_check CHECK (((first_week_day >= '2015-09-01 00:00:00'::timestamp without time zone) AND (first_week_day < '2015-10-01 00:00:00'::timestamp without time zone))) +) +INHERITS (company_statistic_total_by_weeks); + + +-- +-- Name: company_statistic_total_by_weeks_id_seq; Type: SEQUENCE; Schema: statistics; Owner: - +-- + +CREATE SEQUENCE company_statistic_total_by_weeks_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: company_statistic_total_by_weeks_id_seq; Type: SEQUENCE OWNED BY; Schema: statistics; Owner: - +-- + +ALTER SEQUENCE company_statistic_total_by_weeks_id_seq OWNED BY company_statistic_total_by_weeks.id; + + +-- +-- Name: company_statistic_totals; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE company_statistic_totals ( + id integer NOT NULL, + company_id integer, + pages integer DEFAULT 0 NOT NULL, + visits integer DEFAULT 0 NOT NULL, + yml_hits integer +); + + +-- +-- Name: COLUMN company_statistic_totals.yml_hits; Type: COMMENT; Schema: statistics; Owner: - +-- + +COMMENT ON COLUMN company_statistic_totals.yml_hits IS 'Кол-во переходов на сайт интернет-магазина'; + + +-- +-- Name: company_statistic_totals_id_seq; Type: SEQUENCE; Schema: statistics; Owner: - +-- + +CREATE SEQUENCE company_statistic_totals_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: company_statistic_totals_id_seq; Type: SEQUENCE OWNED BY; Schema: statistics; Owner: - +-- + +ALTER SEQUENCE company_statistic_totals_id_seq OWNED BY company_statistic_totals.id; + + +-- +-- Name: entities_statistic_by_region; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE entities_statistic_by_region ( + id integer NOT NULL, + seo_entity_id integer, + region_id integer, + count integer +); + + +-- +-- Name: entities_statistic_by_region_id_seq; Type: SEQUENCE; Schema: statistics; Owner: - +-- + +CREATE SEQUENCE entities_statistic_by_region_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: entities_statistic_by_region_id_seq; Type: SEQUENCE OWNED BY; Schema: statistics; Owner: - +-- + +ALTER SEQUENCE entities_statistic_by_region_id_seq OWNED BY entities_statistic_by_region.id; + + +-- +-- Name: news_statistic_mainpage_by_days; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE news_statistic_mainpage_by_days ( + id integer NOT NULL, + news_id integer, + date date, + hits integer +); + + +-- +-- Name: news_statistic_mainpage_by_days_11_10; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE news_statistic_mainpage_by_days_11_10 ( + CONSTRAINT news_statistic_mainpage_by_days_11_10_date_check CHECK (((date >= '2011-10-01 00:00:00'::timestamp without time zone) AND (date < '2011-11-01 00:00:00'::timestamp without time zone))) +) +INHERITS (news_statistic_mainpage_by_days); + + +-- +-- Name: news_statistic_mainpage_by_days_11_11; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE news_statistic_mainpage_by_days_11_11 ( + CONSTRAINT news_statistic_mainpage_by_days_11_11_date_check CHECK (((date >= '2011-11-01 00:00:00'::timestamp without time zone) AND (date < '2011-12-01 00:00:00'::timestamp without time zone))) +) +INHERITS (news_statistic_mainpage_by_days); + + +-- +-- Name: news_statistic_mainpage_by_days_11_12; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE news_statistic_mainpage_by_days_11_12 ( + CONSTRAINT news_statistic_mainpage_by_days_11_12_date_check CHECK (((date >= '2011-12-01 00:00:00'::timestamp without time zone) AND (date < '2012-01-01 00:00:00'::timestamp without time zone))) +) +INHERITS (news_statistic_mainpage_by_days); + + +-- +-- Name: news_statistic_mainpage_by_days_12_01; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE news_statistic_mainpage_by_days_12_01 ( + CONSTRAINT news_statistic_mainpage_by_days_12_01_date_check CHECK (((date >= '2012-01-01 00:00:00'::timestamp without time zone) AND (date < '2012-02-01 00:00:00'::timestamp without time zone))) +) +INHERITS (news_statistic_mainpage_by_days); + + +-- +-- Name: news_statistic_mainpage_by_days_12_02; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE news_statistic_mainpage_by_days_12_02 ( + CONSTRAINT news_statistic_mainpage_by_days_12_02_date_check CHECK (((date >= '2012-02-01 00:00:00'::timestamp without time zone) AND (date < '2012-03-01 00:00:00'::timestamp without time zone))) +) +INHERITS (news_statistic_mainpage_by_days); + + +-- +-- Name: news_statistic_mainpage_by_days_12_03; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE news_statistic_mainpage_by_days_12_03 ( + CONSTRAINT news_statistic_mainpage_by_days_12_03_date_check CHECK (((date >= '2012-03-01 00:00:00'::timestamp without time zone) AND (date < '2012-04-01 00:00:00'::timestamp without time zone))) +) +INHERITS (news_statistic_mainpage_by_days); + + +-- +-- Name: news_statistic_mainpage_by_days_12_04; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE news_statistic_mainpage_by_days_12_04 ( + CONSTRAINT news_statistic_mainpage_by_days_12_04_date_check CHECK (((date >= '2012-04-01 00:00:00'::timestamp without time zone) AND (date < '2012-05-01 00:00:00'::timestamp without time zone))) +) +INHERITS (news_statistic_mainpage_by_days); + + +-- +-- Name: news_statistic_mainpage_by_days_12_05; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE news_statistic_mainpage_by_days_12_05 ( + CONSTRAINT news_statistic_mainpage_by_days_12_05_date_check CHECK (((date >= '2012-05-01 00:00:00'::timestamp without time zone) AND (date < '2012-06-01 00:00:00'::timestamp without time zone))) +) +INHERITS (news_statistic_mainpage_by_days); + + +-- +-- Name: news_statistic_mainpage_by_days_12_06; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE news_statistic_mainpage_by_days_12_06 ( + CONSTRAINT news_statistic_mainpage_by_days_12_06_date_check CHECK (((date >= '2012-06-01 00:00:00'::timestamp without time zone) AND (date < '2012-07-01 00:00:00'::timestamp without time zone))) +) +INHERITS (news_statistic_mainpage_by_days); + + +-- +-- Name: news_statistic_mainpage_by_days_12_07; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE news_statistic_mainpage_by_days_12_07 ( + CONSTRAINT news_statistic_mainpage_by_days_12_07_date_check CHECK (((date >= '2012-07-01 00:00:00'::timestamp without time zone) AND (date < '2012-08-01 00:00:00'::timestamp without time zone))) +) +INHERITS (news_statistic_mainpage_by_days); + + +-- +-- Name: news_statistic_mainpage_by_days_12_08; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE news_statistic_mainpage_by_days_12_08 ( + CONSTRAINT news_statistic_mainpage_by_days_12_08_date_check CHECK (((date >= '2012-08-01 00:00:00'::timestamp without time zone) AND (date < '2012-09-01 00:00:00'::timestamp without time zone))) +) +INHERITS (news_statistic_mainpage_by_days); + + +-- +-- Name: news_statistic_mainpage_by_days_12_09; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE news_statistic_mainpage_by_days_12_09 ( + CONSTRAINT news_statistic_mainpage_by_days_12_09_date_check CHECK (((date >= '2012-09-01 00:00:00'::timestamp without time zone) AND (date < '2012-10-01 00:00:00'::timestamp without time zone))) +) +INHERITS (news_statistic_mainpage_by_days); + + +-- +-- Name: news_statistic_mainpage_by_days_12_10; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE news_statistic_mainpage_by_days_12_10 ( + CONSTRAINT news_statistic_mainpage_by_days_12_10_date_check CHECK (((date >= '2012-10-01 00:00:00'::timestamp without time zone) AND (date < '2012-11-01 00:00:00'::timestamp without time zone))) +) +INHERITS (news_statistic_mainpage_by_days); + + +-- +-- Name: news_statistic_mainpage_by_days_12_11; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE news_statistic_mainpage_by_days_12_11 ( + CONSTRAINT news_statistic_mainpage_by_days_12_11_date_check CHECK (((date >= '2012-11-01 00:00:00'::timestamp without time zone) AND (date < '2012-12-01 00:00:00'::timestamp without time zone))) +) +INHERITS (news_statistic_mainpage_by_days); + + +-- +-- Name: news_statistic_mainpage_by_days_12_12; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE news_statistic_mainpage_by_days_12_12 ( + CONSTRAINT news_statistic_mainpage_by_days_12_12_date_check CHECK (((date >= '2012-12-01 00:00:00'::timestamp without time zone) AND (date < '2013-01-01 00:00:00'::timestamp without time zone))) +) +INHERITS (news_statistic_mainpage_by_days); + + +-- +-- Name: news_statistic_mainpage_by_days_13_01; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE news_statistic_mainpage_by_days_13_01 ( + CONSTRAINT news_statistic_mainpage_by_days_13_01_date_check CHECK (((date >= '2013-01-01 00:00:00'::timestamp without time zone) AND (date < '2013-02-01 00:00:00'::timestamp without time zone))) +) +INHERITS (news_statistic_mainpage_by_days); + + +-- +-- Name: news_statistic_mainpage_by_days_13_02; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE news_statistic_mainpage_by_days_13_02 ( + CONSTRAINT news_statistic_mainpage_by_days_13_02_date_check CHECK (((date >= '2013-02-01 00:00:00'::timestamp without time zone) AND (date < '2013-03-01 00:00:00'::timestamp without time zone))) +) +INHERITS (news_statistic_mainpage_by_days); + + +-- +-- Name: news_statistic_mainpage_by_days_13_03; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE news_statistic_mainpage_by_days_13_03 ( + CONSTRAINT news_statistic_mainpage_by_days_13_03_date_check CHECK (((date >= '2013-03-01 00:00:00'::timestamp without time zone) AND (date < '2013-04-01 00:00:00'::timestamp without time zone))) +) +INHERITS (news_statistic_mainpage_by_days); + + +-- +-- Name: news_statistic_mainpage_by_days_13_04; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE news_statistic_mainpage_by_days_13_04 ( + CONSTRAINT news_statistic_mainpage_by_days_13_04_date_check CHECK (((date >= '2013-04-01 00:00:00'::timestamp without time zone) AND (date < '2013-05-01 00:00:00'::timestamp without time zone))) +) +INHERITS (news_statistic_mainpage_by_days); + + +-- +-- Name: news_statistic_mainpage_by_days_13_05; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE news_statistic_mainpage_by_days_13_05 ( + CONSTRAINT news_statistic_mainpage_by_days_13_05_date_check CHECK (((date >= '2013-05-01 00:00:00'::timestamp without time zone) AND (date < '2013-06-01 00:00:00'::timestamp without time zone))) +) +INHERITS (news_statistic_mainpage_by_days); + + +-- +-- Name: news_statistic_mainpage_by_days_13_06; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE news_statistic_mainpage_by_days_13_06 ( + CONSTRAINT news_statistic_mainpage_by_days_13_06_date_check CHECK (((date >= '2013-06-01 00:00:00'::timestamp without time zone) AND (date < '2013-07-01 00:00:00'::timestamp without time zone))) +) +INHERITS (news_statistic_mainpage_by_days); + + +-- +-- Name: news_statistic_mainpage_by_days_13_07; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE news_statistic_mainpage_by_days_13_07 ( + CONSTRAINT news_statistic_mainpage_by_days_13_07_date_check CHECK (((date >= '2013-07-01 00:00:00'::timestamp without time zone) AND (date < '2013-08-01 00:00:00'::timestamp without time zone))) +) +INHERITS (news_statistic_mainpage_by_days); + + +-- +-- Name: news_statistic_mainpage_by_days_13_08; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE news_statistic_mainpage_by_days_13_08 ( + CONSTRAINT news_statistic_mainpage_by_days_13_08_date_check CHECK (((date >= '2013-08-01 00:00:00'::timestamp without time zone) AND (date < '2013-09-01 00:00:00'::timestamp without time zone))) +) +INHERITS (news_statistic_mainpage_by_days); + + +-- +-- Name: news_statistic_mainpage_by_days_13_09; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE news_statistic_mainpage_by_days_13_09 ( + CONSTRAINT news_statistic_mainpage_by_days_13_09_date_check CHECK (((date >= '2013-09-01 00:00:00'::timestamp without time zone) AND (date < '2013-10-01 00:00:00'::timestamp without time zone))) +) +INHERITS (news_statistic_mainpage_by_days); + + +-- +-- Name: news_statistic_mainpage_by_days_13_10; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE news_statistic_mainpage_by_days_13_10 ( + CONSTRAINT news_statistic_mainpage_by_days_13_10_date_check CHECK (((date >= '2013-10-01 00:00:00'::timestamp without time zone) AND (date < '2013-11-01 00:00:00'::timestamp without time zone))) +) +INHERITS (news_statistic_mainpage_by_days); + + +-- +-- Name: news_statistic_mainpage_by_days_13_11; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE news_statistic_mainpage_by_days_13_11 ( + CONSTRAINT news_statistic_mainpage_by_days_13_11_date_check CHECK (((date >= '2013-11-01 00:00:00'::timestamp without time zone) AND (date < '2013-12-01 00:00:00'::timestamp without time zone))) +) +INHERITS (news_statistic_mainpage_by_days); + + +-- +-- Name: news_statistic_mainpage_by_days_13_12; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE news_statistic_mainpage_by_days_13_12 ( + CONSTRAINT news_statistic_mainpage_by_days_13_12_date_check CHECK (((date >= '2013-12-01 00:00:00'::timestamp without time zone) AND (date < '2014-01-01 00:00:00'::timestamp without time zone))) +) +INHERITS (news_statistic_mainpage_by_days); + + +-- +-- Name: news_statistic_mainpage_by_days_14_01; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE news_statistic_mainpage_by_days_14_01 ( + CONSTRAINT news_statistic_mainpage_by_days_14_01_date_check CHECK (((date >= '2014-01-01 00:00:00'::timestamp without time zone) AND (date < '2014-02-01 00:00:00'::timestamp without time zone))) +) +INHERITS (news_statistic_mainpage_by_days); + + +-- +-- Name: news_statistic_mainpage_by_days_14_02; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE news_statistic_mainpage_by_days_14_02 ( + CONSTRAINT news_statistic_mainpage_by_days_14_02_date_check CHECK (((date >= '2014-02-01 00:00:00'::timestamp without time zone) AND (date < '2014-03-01 00:00:00'::timestamp without time zone))) +) +INHERITS (news_statistic_mainpage_by_days); + + +-- +-- Name: news_statistic_mainpage_by_days_14_03; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE news_statistic_mainpage_by_days_14_03 ( + CONSTRAINT news_statistic_mainpage_by_days_14_03_date_check CHECK (((date >= '2014-03-01 00:00:00'::timestamp without time zone) AND (date < '2014-04-01 00:00:00'::timestamp without time zone))) +) +INHERITS (news_statistic_mainpage_by_days); + + +-- +-- Name: news_statistic_mainpage_by_days_14_04; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE news_statistic_mainpage_by_days_14_04 ( + CONSTRAINT news_statistic_mainpage_by_days_14_04_date_check CHECK (((date >= '2014-04-01 00:00:00'::timestamp without time zone) AND (date < '2014-05-01 00:00:00'::timestamp without time zone))) +) +INHERITS (news_statistic_mainpage_by_days); + + +-- +-- Name: news_statistic_mainpage_by_days_14_05; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE news_statistic_mainpage_by_days_14_05 ( + CONSTRAINT news_statistic_mainpage_by_days_14_05_date_check CHECK (((date >= '2014-05-01 00:00:00'::timestamp without time zone) AND (date < '2014-06-01 00:00:00'::timestamp without time zone))) +) +INHERITS (news_statistic_mainpage_by_days); + + +-- +-- Name: news_statistic_mainpage_by_days_14_06; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE news_statistic_mainpage_by_days_14_06 ( + CONSTRAINT news_statistic_mainpage_by_days_14_06_date_check CHECK (((date >= '2014-06-01 00:00:00'::timestamp without time zone) AND (date < '2014-07-01 00:00:00'::timestamp without time zone))) +) +INHERITS (news_statistic_mainpage_by_days); + + +-- +-- Name: news_statistic_mainpage_by_days_14_07; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE news_statistic_mainpage_by_days_14_07 ( + CONSTRAINT news_statistic_mainpage_by_days_14_07_date_check CHECK (((date >= '2014-07-01 00:00:00'::timestamp without time zone) AND (date < '2014-08-01 00:00:00'::timestamp without time zone))) +) +INHERITS (news_statistic_mainpage_by_days); + + +-- +-- Name: news_statistic_mainpage_by_days_14_08; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE news_statistic_mainpage_by_days_14_08 ( + CONSTRAINT news_statistic_mainpage_by_days_14_08_date_check CHECK (((date >= '2014-08-01 00:00:00'::timestamp without time zone) AND (date < '2014-09-01 00:00:00'::timestamp without time zone))) +) +INHERITS (news_statistic_mainpage_by_days); + + +-- +-- Name: news_statistic_mainpage_by_days_14_09; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE news_statistic_mainpage_by_days_14_09 ( + CONSTRAINT news_statistic_mainpage_by_days_14_09_date_check CHECK (((date >= '2014-09-01 00:00:00'::timestamp without time zone) AND (date < '2014-10-01 00:00:00'::timestamp without time zone))) +) +INHERITS (news_statistic_mainpage_by_days); + + +-- +-- Name: news_statistic_mainpage_by_days_14_10; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE news_statistic_mainpage_by_days_14_10 ( + CONSTRAINT news_statistic_mainpage_by_days_14_10_date_check CHECK (((date >= '2014-10-01 00:00:00'::timestamp without time zone) AND (date < '2014-11-01 00:00:00'::timestamp without time zone))) +) +INHERITS (news_statistic_mainpage_by_days); + + +-- +-- Name: news_statistic_mainpage_by_days_14_11; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE news_statistic_mainpage_by_days_14_11 ( + CONSTRAINT news_statistic_mainpage_by_days_14_11_date_check CHECK (((date >= '2014-11-01 00:00:00'::timestamp without time zone) AND (date < '2014-12-01 00:00:00'::timestamp without time zone))) +) +INHERITS (news_statistic_mainpage_by_days); + + +-- +-- Name: news_statistic_mainpage_by_days_14_12; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE news_statistic_mainpage_by_days_14_12 ( + CONSTRAINT news_statistic_mainpage_by_days_14_12_date_check CHECK (((date >= '2014-12-01 00:00:00'::timestamp without time zone) AND (date < '2015-01-01 00:00:00'::timestamp without time zone))) +) +INHERITS (news_statistic_mainpage_by_days); + + +-- +-- Name: news_statistic_mainpage_by_days_15_01; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE news_statistic_mainpage_by_days_15_01 ( + CONSTRAINT news_statistic_mainpage_by_days_15_01_date_check CHECK (((date >= '2015-01-01 00:00:00'::timestamp without time zone) AND (date < '2015-02-01 00:00:00'::timestamp without time zone))) +) +INHERITS (news_statistic_mainpage_by_days); + + +-- +-- Name: news_statistic_mainpage_by_days_id_seq; Type: SEQUENCE; Schema: statistics; Owner: - +-- + +CREATE SEQUENCE news_statistic_mainpage_by_days_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: news_statistic_mainpage_by_days_id_seq; Type: SEQUENCE OWNED BY; Schema: statistics; Owner: - +-- + +ALTER SEQUENCE news_statistic_mainpage_by_days_id_seq OWNED BY news_statistic_mainpage_by_days.id; + + +-- +-- Name: news_statistic_referers_by_months; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE news_statistic_referers_by_months ( + id integer NOT NULL, + news_id integer NOT NULL, + date date NOT NULL, + referer character varying(1024), + referer_source_id integer NOT NULL, + hits integer DEFAULT 0 NOT NULL +); + + +-- +-- Name: TABLE news_statistic_referers_by_months; Type: COMMENT; Schema: statistics; Owner: - +-- + +COMMENT ON TABLE news_statistic_referers_by_months IS 'Статистика новостей по источникам переходов'; + + +-- +-- Name: COLUMN news_statistic_referers_by_months.news_id; Type: COMMENT; Schema: statistics; Owner: - +-- + +COMMENT ON COLUMN news_statistic_referers_by_months.news_id IS 'ID новости'; + + +-- +-- Name: COLUMN news_statistic_referers_by_months.date; Type: COMMENT; Schema: statistics; Owner: - +-- + +COMMENT ON COLUMN news_statistic_referers_by_months.date IS 'Дата начала месяца'; + + +-- +-- Name: COLUMN news_statistic_referers_by_months.referer; Type: COMMENT; Schema: statistics; Owner: - +-- + +COMMENT ON COLUMN news_statistic_referers_by_months.referer IS 'Реферер перехода на новость'; + + +-- +-- Name: COLUMN news_statistic_referers_by_months.referer_source_id; Type: COMMENT; Schema: statistics; Owner: - +-- + +COMMENT ON COLUMN news_statistic_referers_by_months.referer_source_id IS 'Источник перехода на новость'; + + +-- +-- Name: COLUMN news_statistic_referers_by_months.hits; Type: COMMENT; Schema: statistics; Owner: - +-- + +COMMENT ON COLUMN news_statistic_referers_by_months.hits IS 'Просмотры новости за месяц'; + + +-- +-- Name: news_statistic_referers_by_months_15_08; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE news_statistic_referers_by_months_15_08 ( + CONSTRAINT news_statistic_referers_by_months_15_08_date_check CHECK (((date >= '2015-08-01 00:00:00'::timestamp without time zone) AND (date < '2015-09-01 00:00:00'::timestamp without time zone))) +) +INHERITS (news_statistic_referers_by_months); + + +-- +-- Name: news_statistic_referers_by_months_15_09; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE news_statistic_referers_by_months_15_09 ( + CONSTRAINT news_statistic_referers_by_months_15_09_date_check CHECK (((date >= '2015-09-01 00:00:00'::timestamp without time zone) AND (date < '2015-10-01 00:00:00'::timestamp without time zone))) +) +INHERITS (news_statistic_referers_by_months); + + +-- +-- Name: news_statistic_referers_by_months_id_seq; Type: SEQUENCE; Schema: statistics; Owner: - +-- + +CREATE SEQUENCE news_statistic_referers_by_months_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: news_statistic_referers_by_months_id_seq; Type: SEQUENCE OWNED BY; Schema: statistics; Owner: - +-- + +ALTER SEQUENCE news_statistic_referers_by_months_id_seq OWNED BY news_statistic_referers_by_months.id; + + +-- +-- Name: news_statistic_total_by_regions; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE news_statistic_total_by_regions ( + id integer NOT NULL, + news_id integer, + region_id integer, + hits_total integer DEFAULT 0, + hits_from_mainpage integer DEFAULT 0, + hits_from_delivery integer DEFAULT 0, + hits_from_facebook integer DEFAULT 0, + hits_from_vk integer DEFAULT 0, + hits_from_twitter integer DEFAULT 0, + hits_from_yandex_search integer DEFAULT 0, + hits_from_yandex_news integer DEFAULT 0, + hits_from_google_search integer DEFAULT 0, + hits_from_other integer DEFAULT 0 +); + + +-- +-- Name: COLUMN news_statistic_total_by_regions.hits_total; Type: COMMENT; Schema: statistics; Owner: - +-- + +COMMENT ON COLUMN news_statistic_total_by_regions.hits_total IS 'Просмотров всего'; + + +-- +-- Name: COLUMN news_statistic_total_by_regions.hits_from_mainpage; Type: COMMENT; Schema: statistics; Owner: - +-- + +COMMENT ON COLUMN news_statistic_total_by_regions.hits_from_mainpage IS 'Просмотров с главной страницы'; + + +-- +-- Name: COLUMN news_statistic_total_by_regions.hits_from_delivery; Type: COMMENT; Schema: statistics; Owner: - +-- + +COMMENT ON COLUMN news_statistic_total_by_regions.hits_from_delivery IS 'Просмотры из рассылки'; + + +-- +-- Name: COLUMN news_statistic_total_by_regions.hits_from_facebook; Type: COMMENT; Schema: statistics; Owner: - +-- + +COMMENT ON COLUMN news_statistic_total_by_regions.hits_from_facebook IS 'Просмотры из Facebook'; + + +-- +-- Name: COLUMN news_statistic_total_by_regions.hits_from_vk; Type: COMMENT; Schema: statistics; Owner: - +-- + +COMMENT ON COLUMN news_statistic_total_by_regions.hits_from_vk IS 'Просмотры из ВКонтакте'; + + +-- +-- Name: COLUMN news_statistic_total_by_regions.hits_from_twitter; Type: COMMENT; Schema: statistics; Owner: - +-- + +COMMENT ON COLUMN news_statistic_total_by_regions.hits_from_twitter IS 'Просмотры из Twitter'; + + +-- +-- Name: COLUMN news_statistic_total_by_regions.hits_from_yandex_search; Type: COMMENT; Schema: statistics; Owner: - +-- + +COMMENT ON COLUMN news_statistic_total_by_regions.hits_from_yandex_search IS 'Просмотры из Yandex.Поиск'; + + +-- +-- Name: COLUMN news_statistic_total_by_regions.hits_from_yandex_news; Type: COMMENT; Schema: statistics; Owner: - +-- + +COMMENT ON COLUMN news_statistic_total_by_regions.hits_from_yandex_news IS 'Просмотры из Yandex.Новости'; + + +-- +-- Name: COLUMN news_statistic_total_by_regions.hits_from_google_search; Type: COMMENT; Schema: statistics; Owner: - +-- + +COMMENT ON COLUMN news_statistic_total_by_regions.hits_from_google_search IS 'Просмотры из Google.Поиск'; + + +-- +-- Name: COLUMN news_statistic_total_by_regions.hits_from_other; Type: COMMENT; Schema: statistics; Owner: - +-- + +COMMENT ON COLUMN news_statistic_total_by_regions.hits_from_other IS 'Просмотры из прочих источников'; + + +-- +-- Name: news_statistic_total_by_regions_id_seq; Type: SEQUENCE; Schema: statistics; Owner: - +-- + +CREATE SEQUENCE news_statistic_total_by_regions_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: news_statistic_total_by_regions_id_seq; Type: SEQUENCE OWNED BY; Schema: statistics; Owner: - +-- + +ALTER SEQUENCE news_statistic_total_by_regions_id_seq OWNED BY news_statistic_total_by_regions.id; + + +-- +-- Name: news_statistic_totals; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE news_statistic_totals ( + id integer NOT NULL, + news_id integer, + hits_total integer DEFAULT 0, + hits_from_mainpage integer DEFAULT 0, + hits_from_delivery integer DEFAULT 0, + hits_from_facebook integer DEFAULT 0, + hits_from_vk integer DEFAULT 0, + hits_from_twitter integer DEFAULT 0, + hits_from_yandex_search integer DEFAULT 0, + hits_from_yandex_news integer DEFAULT 0, + hits_from_google_search integer DEFAULT 0, + hits_from_other integer DEFAULT 0 +); + + +-- +-- Name: COLUMN news_statistic_totals.hits_total; Type: COMMENT; Schema: statistics; Owner: - +-- + +COMMENT ON COLUMN news_statistic_totals.hits_total IS 'Просмотров всего'; + + +-- +-- Name: COLUMN news_statistic_totals.hits_from_mainpage; Type: COMMENT; Schema: statistics; Owner: - +-- + +COMMENT ON COLUMN news_statistic_totals.hits_from_mainpage IS 'Просмотров с главной страницы'; + + +-- +-- Name: COLUMN news_statistic_totals.hits_from_delivery; Type: COMMENT; Schema: statistics; Owner: - +-- + +COMMENT ON COLUMN news_statistic_totals.hits_from_delivery IS 'Просмотры из рассылки'; + + +-- +-- Name: COLUMN news_statistic_totals.hits_from_facebook; Type: COMMENT; Schema: statistics; Owner: - +-- + +COMMENT ON COLUMN news_statistic_totals.hits_from_facebook IS 'Просмотры из Facebook'; + + +-- +-- Name: COLUMN news_statistic_totals.hits_from_vk; Type: COMMENT; Schema: statistics; Owner: - +-- + +COMMENT ON COLUMN news_statistic_totals.hits_from_vk IS 'Просмотры из ВКонтакте'; + + +-- +-- Name: COLUMN news_statistic_totals.hits_from_twitter; Type: COMMENT; Schema: statistics; Owner: - +-- + +COMMENT ON COLUMN news_statistic_totals.hits_from_twitter IS 'Просмотры из Twitter'; + + +-- +-- Name: COLUMN news_statistic_totals.hits_from_yandex_search; Type: COMMENT; Schema: statistics; Owner: - +-- + +COMMENT ON COLUMN news_statistic_totals.hits_from_yandex_search IS 'Просмотры из Yandex.Поиск'; + + +-- +-- Name: COLUMN news_statistic_totals.hits_from_yandex_news; Type: COMMENT; Schema: statistics; Owner: - +-- + +COMMENT ON COLUMN news_statistic_totals.hits_from_yandex_news IS 'Просмотры из Yandex.Новости'; + + +-- +-- Name: COLUMN news_statistic_totals.hits_from_google_search; Type: COMMENT; Schema: statistics; Owner: - +-- + +COMMENT ON COLUMN news_statistic_totals.hits_from_google_search IS 'Просмотры из Google.Поиск'; + + +-- +-- Name: COLUMN news_statistic_totals.hits_from_other; Type: COMMENT; Schema: statistics; Owner: - +-- + +COMMENT ON COLUMN news_statistic_totals.hits_from_other IS 'Просмотры из прочих источников'; + + +-- +-- Name: news_statistic_totals_id_seq; Type: SEQUENCE; Schema: statistics; Owner: - +-- + +CREATE SEQUENCE news_statistic_totals_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: news_statistic_totals_id_seq; Type: SEQUENCE OWNED BY; Schema: statistics; Owner: - +-- + +ALTER SEQUENCE news_statistic_totals_id_seq OWNED BY news_statistic_totals.id; + + +-- +-- Name: query_log; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE query_log ( + id integer NOT NULL, + session_id character varying(32), + uri character varying(4000), + referer character varying(4000), + remote_addr bigint, + search_scope character varying(25), + query_string character varying(255), + query_prepared character varying(255), + results_count integer, + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: query_log_10_07; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE query_log_10_07 ( + CONSTRAINT query_log_10_07_created_at_check CHECK (((created_at >= '2010-07-01 00:00:00'::timestamp without time zone) AND (created_at < '2010-08-01 00:00:00'::timestamp without time zone))) +) +INHERITS (query_log); + + +-- +-- Name: query_log_10_08; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE query_log_10_08 ( + CONSTRAINT query_log_10_08_created_at_check CHECK (((created_at >= '2010-08-01 00:00:00'::timestamp without time zone) AND (created_at < '2010-09-01 00:00:00'::timestamp without time zone))) +) +INHERITS (query_log); + + +-- +-- Name: query_log_10_09; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE query_log_10_09 ( + CONSTRAINT query_log_10_09_created_at_check CHECK (((created_at >= '2010-09-01 00:00:00'::timestamp without time zone) AND (created_at < '2010-10-01 00:00:00'::timestamp without time zone))) +) +INHERITS (query_log); + + +-- +-- Name: query_log_10_10; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE query_log_10_10 ( + CONSTRAINT query_log_10_10_created_at_check CHECK (((created_at >= '2010-10-01 00:00:00'::timestamp without time zone) AND (created_at < '2010-11-01 00:00:00'::timestamp without time zone))) +) +INHERITS (query_log); + + +-- +-- Name: query_log_10_11; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE query_log_10_11 ( + CONSTRAINT query_log_10_11_created_at_check CHECK (((created_at >= '2010-11-01 00:00:00'::timestamp without time zone) AND (created_at < '2010-12-01 00:00:00'::timestamp without time zone))) +) +INHERITS (query_log); + + +-- +-- Name: query_log_10_12; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE query_log_10_12 ( + CONSTRAINT query_log_10_12_created_at_check CHECK (((created_at >= '2010-12-01 00:00:00'::timestamp without time zone) AND (created_at < '2011-01-01 00:00:00'::timestamp without time zone))) +) +INHERITS (query_log); + + +-- +-- Name: query_log_11_02; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE query_log_11_02 ( + CONSTRAINT query_log_11_02_created_at_check CHECK (((created_at >= '2011-02-01 00:00:00'::timestamp without time zone) AND (created_at < '2011-03-01 00:00:00'::timestamp without time zone))) +) +INHERITS (query_log); + + +-- +-- Name: query_log_id_seq; Type: SEQUENCE; Schema: statistics; Owner: - +-- + +CREATE SEQUENCE query_log_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: query_log_id_seq; Type: SEQUENCE OWNED BY; Schema: statistics; Owner: - +-- + +ALTER SEQUENCE query_log_id_seq OWNED BY query_log.id; + + +-- +-- Name: rubric_region_adds; Type: TABLE; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE TABLE rubric_region_adds ( + id integer NOT NULL, + rubric_id integer, + region_id integer, + visits integer DEFAULT 0, + pages integer DEFAULT 0 +); + + +-- +-- Name: rubric_region_adds_id_seq; Type: SEQUENCE; Schema: statistics; Owner: - +-- + +CREATE SEQUENCE rubric_region_adds_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: rubric_region_adds_id_seq; Type: SEQUENCE OWNED BY; Schema: statistics; Owner: - +-- + +ALTER SEQUENCE rubric_region_adds_id_seq OWNED BY rubric_region_adds.id; + + +SET search_path = system, pg_catalog; + +-- +-- Name: locks; Type: VIEW; Schema: system; Owner: - +-- + +CREATE VIEW locks AS + SELECT db.datname, c.relname, l.transactionid, l.virtualtransaction, l.pid, l.mode, l.granted FROM ((pg_locks l JOIN pg_class c ON ((l.relation = c.oid))) JOIN pg_database db ON ((l.database = db.oid))); + + +-- +-- Name: table_partitions; Type: TABLE; Schema: system; Owner: -; Tablespace: +-- + +CREATE TABLE table_partitions ( + master_table text NOT NULL, + partition_table text NOT NULL, + range_check text NOT NULL, + time_added timestamp without time zone DEFAULT now() NOT NULL +); + + +SET search_path = xls_import, pg_catalog; + +-- +-- Name: deleted_products; Type: TABLE; Schema: xls_import; Owner: -; Tablespace: +-- + +CREATE TABLE deleted_products ( + id integer NOT NULL, + transaction_id integer NOT NULL, + product_id integer NOT NULL, + to_delete boolean DEFAULT true, + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: deleted_products_id_seq; Type: SEQUENCE; Schema: xls_import; Owner: - +-- + +CREATE SEQUENCE deleted_products_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: deleted_products_id_seq; Type: SEQUENCE OWNED BY; Schema: xls_import; Owner: - +-- + +ALTER SEQUENCE deleted_products_id_seq OWNED BY deleted_products.id; + + +-- +-- Name: parsed_rows; Type: TABLE; Schema: xls_import; Owner: -; Tablespace: +-- + +CREATE TABLE parsed_rows ( + id integer NOT NULL, + transaction_id integer NOT NULL, + row_index integer NOT NULL, + product_id integer, + product_name character varying(255), + price_exact_raw character varying(255), + price_exact double precision, + price_min_raw character varying(255), + price_min double precision, + price_max_raw character varying(255), + price_max double precision, + currency character varying(255), + currency_id integer, + exists_raw character varying(255), + "exists" boolean DEFAULT false, + paid_conditions character varying(255), + delivery_time character varying(255), + image_url character varying(1024), + image_id integer, + downloaded_image_file_name character varying(255), + downloaded_image_file_size character varying(255), + downloaded_image_content_type character varying(255), + rubric_url character varying(350), + rubric_id integer, + announce character varying(255), + is_public_raw character varying(255), + is_public boolean DEFAULT false, + errors_serialized text, + warnings_serialized text, + skipped boolean DEFAULT false, + created_at timestamp without time zone, + updated_at timestamp without time zone, + description text, + tag_list character varying(255), + article character varying(50), + is_accepted boolean DEFAULT false, + is_printable_raw character varying(255), + is_printable boolean DEFAULT false +); + + +-- +-- Name: COLUMN parsed_rows.tag_list; Type: COMMENT; Schema: xls_import; Owner: - +-- + +COMMENT ON COLUMN parsed_rows.tag_list IS 'Денормализованное поле с тегами'; + + +-- +-- Name: COLUMN parsed_rows.article; Type: COMMENT; Schema: xls_import; Owner: - +-- + +COMMENT ON COLUMN parsed_rows.article IS 'Артикул. Не отображается на сайте'; + + +-- +-- Name: COLUMN parsed_rows.is_accepted; Type: COMMENT; Schema: xls_import; Owner: - +-- + +COMMENT ON COLUMN parsed_rows.is_accepted IS 'Флаг, является ли товар - подтверждённым (если загружает админ)'; + + +-- +-- Name: COLUMN parsed_rows.is_printable; Type: COMMENT; Schema: xls_import; Owner: - +-- + +COMMENT ON COLUMN parsed_rows.is_printable IS 'Отправлять ли товар в печать'; + + +-- +-- Name: parsed_rows_id_seq; Type: SEQUENCE; Schema: xls_import; Owner: - +-- + +CREATE SEQUENCE parsed_rows_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: parsed_rows_id_seq; Type: SEQUENCE OWNED BY; Schema: xls_import; Owner: - +-- + +ALTER SEQUENCE parsed_rows_id_seq OWNED BY parsed_rows.id; + + +-- +-- Name: transactions; Type: TABLE; Schema: xls_import; Owner: -; Tablespace: +-- + +CREATE TABLE transactions ( + id integer NOT NULL, + company_id integer NOT NULL, + user_id integer NOT NULL, + xls_file_name character varying(255), + xls_file_size integer, + xls_content_type character varying(255), + state character varying(255) DEFAULT 'pending'::character varying NOT NULL, + error text, + created_at timestamp without time zone, + updated_at timestamp without time zone, + is_oferta_safe boolean DEFAULT true NOT NULL +); + + +-- +-- Name: COLUMN transactions.is_oferta_safe; Type: COMMENT; Schema: xls_import; Owner: - +-- + +COMMENT ON COLUMN transactions.is_oferta_safe IS 'Является ли эта транзакция безопасной для оферты'; + + +-- +-- Name: transactions_id_seq; Type: SEQUENCE; Schema: xls_import; Owner: - +-- + +CREATE SEQUENCE transactions_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: transactions_id_seq; Type: SEQUENCE OWNED BY; Schema: xls_import; Owner: - +-- + +ALTER SEQUENCE transactions_id_seq OWNED BY transactions.id; + + +SET search_path = denormalization, pg_catalog; + +-- +-- Name: id; Type: DEFAULT; Schema: denormalization; Owner: - +-- + +ALTER TABLE ONLY events_log ALTER COLUMN id SET DEFAULT nextval('events_log_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: denormalization; Owner: - +-- + +ALTER TABLE ONLY fields ALTER COLUMN id SET DEFAULT nextval('fields_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: denormalization; Owner: - +-- + +ALTER TABLE ONLY processors ALTER COLUMN id SET DEFAULT nextval('processors_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: denormalization; Owner: - +-- + +ALTER TABLE ONLY queues ALTER COLUMN id SET DEFAULT nextval('queues_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: denormalization; Owner: - +-- + +ALTER TABLE ONLY supervisor_status ALTER COLUMN id SET DEFAULT nextval('supervisor_status_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: denormalization; Owner: - +-- + +ALTER TABLE ONLY workers ALTER COLUMN id SET DEFAULT nextval('workers_id_seq'::regclass); + + +SET search_path = import, pg_catalog; + +-- +-- Name: id; Type: DEFAULT; Schema: import; Owner: - +-- + +ALTER TABLE ONLY import_log ALTER COLUMN id SET DEFAULT nextval('import_log_id_seq'::regclass); + + +SET search_path = import_full, pg_catalog; + +-- +-- Name: id; Type: DEFAULT; Schema: import_full; Owner: - +-- + +ALTER TABLE ONLY import_log ALTER COLUMN id SET DEFAULT nextval('import_log_id_seq'::regclass); + + +SET search_path = londiste, pg_catalog; + +-- +-- Name: nr; Type: DEFAULT; Schema: londiste; Owner: - +-- + +ALTER TABLE ONLY seq_info ALTER COLUMN nr SET DEFAULT nextval('seq_info_nr_seq'::regclass); + + +-- +-- Name: nr; Type: DEFAULT; Schema: londiste; Owner: - +-- + +ALTER TABLE ONLY table_info ALTER COLUMN nr SET DEFAULT nextval('table_info_nr_seq'::regclass); + + +SET search_path = mail_deliveries, pg_catalog; + +-- +-- Name: id; Type: DEFAULT; Schema: mail_deliveries; Owner: - +-- + +ALTER TABLE ONLY categories ALTER COLUMN id SET DEFAULT nextval('categories_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: mail_deliveries; Owner: - +-- + +ALTER TABLE ONLY company_sends_log ALTER COLUMN id SET DEFAULT nextval('company_sends_log_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: mail_deliveries; Owner: - +-- + +ALTER TABLE ONLY deliveries ALTER COLUMN id SET DEFAULT nextval('deliveries_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: mail_deliveries; Owner: - +-- + +ALTER TABLE ONLY delivery_company_filters ALTER COLUMN id SET DEFAULT nextval('delivery_company_filters_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: mail_deliveries; Owner: - +-- + +ALTER TABLE ONLY unsubscribed_users ALTER COLUMN id SET DEFAULT nextval('unsubscribed_users_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: mail_deliveries; Owner: - +-- + +ALTER TABLE ONLY user_category_settings ALTER COLUMN id SET DEFAULT nextval('user_category_settings_id_seq'::regclass); + + +SET search_path = mail_delivery, pg_catalog; + +-- +-- Name: id; Type: DEFAULT; Schema: mail_delivery; Owner: - +-- + +ALTER TABLE ONLY attached_blogs ALTER COLUMN id SET DEFAULT nextval('attached_blogs_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: mail_delivery; Owner: - +-- + +ALTER TABLE ONLY attached_company_events ALTER COLUMN id SET DEFAULT nextval('attached_company_events_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: mail_delivery; Owner: - +-- + +ALTER TABLE ONLY attached_partner_projects ALTER COLUMN id SET DEFAULT nextval('attached_partner_projects_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: mail_delivery; Owner: - +-- + +ALTER TABLE ONLY auto_deliveries ALTER COLUMN id SET DEFAULT nextval('auto_deliveries_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: mail_delivery; Owner: - +-- + +ALTER TABLE ONLY companies_data_sets ALTER COLUMN id SET DEFAULT nextval('companies_data_sets_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: mail_delivery; Owner: - +-- + +ALTER TABLE ONLY companies_datasources ALTER COLUMN id SET DEFAULT nextval('companies_datasources_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: mail_delivery; Owner: - +-- + +ALTER TABLE ONLY companies_filters ALTER COLUMN id SET DEFAULT nextval('companies_filters_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: mail_delivery; Owner: - +-- + +ALTER TABLE ONLY deliveries ALTER COLUMN id SET DEFAULT nextval('deliveries_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: mail_delivery; Owner: - +-- + +ALTER TABLE ONLY mail_sets ALTER COLUMN id SET DEFAULT nextval('mail_sets_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: mail_delivery; Owner: - +-- + +ALTER TABLE ONLY mails ALTER COLUMN id SET DEFAULT nextval('mails_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: mail_delivery; Owner: - +-- + +ALTER TABLE ONLY personal_subscription_data_sets ALTER COLUMN id SET DEFAULT nextval('personal_subscription_data_sets_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: mail_delivery; Owner: - +-- + +ALTER TABLE ONLY personal_subscription_deliveries ALTER COLUMN id SET DEFAULT nextval('personal_subscription_deliveries_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: mail_delivery; Owner: - +-- + +ALTER TABLE ONLY personal_subscriptions ALTER COLUMN id SET DEFAULT nextval('personal_subscriptions_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: mail_delivery; Owner: - +-- + +ALTER TABLE ONLY portal_news_subscription_deliveries ALTER COLUMN id SET DEFAULT nextval('portal_news_subscription_deliveries_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: mail_delivery; Owner: - +-- + +ALTER TABLE ONLY portal_news_subscriptions ALTER COLUMN id SET DEFAULT nextval('portal_news_subscriptions_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: mail_delivery; Owner: - +-- + +ALTER TABLE ONLY portal_news_subscriptions_mail_set_content_templates ALTER COLUMN id SET DEFAULT nextval('portal_news_subscriptions_mail_set_content_templates_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: mail_delivery; Owner: - +-- + +ALTER TABLE ONLY portal_subscription_mail_set_news ALTER COLUMN id SET DEFAULT nextval('portal_subscription_mail_set_news_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: mail_delivery; Owner: - +-- + +ALTER TABLE ONLY schedules ALTER COLUMN id SET DEFAULT nextval('schedules_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: mail_delivery; Owner: - +-- + +ALTER TABLE ONLY senders ALTER COLUMN id SET DEFAULT nextval('senders_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: mail_delivery; Owner: - +-- + +ALTER TABLE ONLY subscriptions ALTER COLUMN id SET DEFAULT nextval('subscriptions_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: mail_delivery; Owner: - +-- + +ALTER TABLE ONLY unreachable_emails ALTER COLUMN id SET DEFAULT nextval('unreachable_emails_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: mail_delivery; Owner: - +-- + +ALTER TABLE ONLY unsubscribed_emails ALTER COLUMN id SET DEFAULT nextval('unsubscribed_emails_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: mail_delivery; Owner: - +-- + +ALTER TABLE ONLY variables ALTER COLUMN id SET DEFAULT nextval('variables_id_seq'::regclass); + + +SET search_path = permissions, pg_catalog; + +-- +-- Name: id; Type: DEFAULT; Schema: permissions; Owner: - +-- + +ALTER TABLE ONLY admin_permissions ALTER COLUMN id SET DEFAULT nextval('admin_permissions_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: permissions; Owner: - +-- + +ALTER TABLE ONLY admin_sections ALTER COLUMN id SET DEFAULT nextval('admin_sections_id_seq'::regclass); + + +SET search_path = pgq, pg_catalog; + +-- +-- Name: co_id; Type: DEFAULT; Schema: pgq; Owner: - +-- + +ALTER TABLE ONLY consumer ALTER COLUMN co_id SET DEFAULT nextval('consumer_co_id_seq'::regclass); + + +-- +-- Name: ev_txid; Type: DEFAULT; Schema: pgq; Owner: - +-- + +ALTER TABLE ONLY event_1 ALTER COLUMN ev_txid SET DEFAULT txid_current(); + + +-- +-- Name: ev_txid; Type: DEFAULT; Schema: pgq; Owner: - +-- + +ALTER TABLE ONLY event_10 ALTER COLUMN ev_txid SET DEFAULT txid_current(); + + +-- +-- Name: ev_id; Type: DEFAULT; Schema: pgq; Owner: - +-- + +ALTER TABLE ONLY event_10_0 ALTER COLUMN ev_id SET DEFAULT nextval('event_10_id_seq'::regclass); + + +-- +-- Name: ev_txid; Type: DEFAULT; Schema: pgq; Owner: - +-- + +ALTER TABLE ONLY event_10_0 ALTER COLUMN ev_txid SET DEFAULT txid_current(); + + +-- +-- Name: ev_id; Type: DEFAULT; Schema: pgq; Owner: - +-- + +ALTER TABLE ONLY event_10_1 ALTER COLUMN ev_id SET DEFAULT nextval('event_10_id_seq'::regclass); + + +-- +-- Name: ev_txid; Type: DEFAULT; Schema: pgq; Owner: - +-- + +ALTER TABLE ONLY event_10_1 ALTER COLUMN ev_txid SET DEFAULT txid_current(); + + +-- +-- Name: ev_id; Type: DEFAULT; Schema: pgq; Owner: - +-- + +ALTER TABLE ONLY event_10_2 ALTER COLUMN ev_id SET DEFAULT nextval('event_10_id_seq'::regclass); + + +-- +-- Name: ev_txid; Type: DEFAULT; Schema: pgq; Owner: - +-- + +ALTER TABLE ONLY event_10_2 ALTER COLUMN ev_txid SET DEFAULT txid_current(); + + +-- +-- Name: ev_txid; Type: DEFAULT; Schema: pgq; Owner: - +-- + +ALTER TABLE ONLY event_11 ALTER COLUMN ev_txid SET DEFAULT txid_current(); + + +-- +-- Name: ev_id; Type: DEFAULT; Schema: pgq; Owner: - +-- + +ALTER TABLE ONLY event_11_0 ALTER COLUMN ev_id SET DEFAULT nextval('event_11_id_seq'::regclass); + + +-- +-- Name: ev_txid; Type: DEFAULT; Schema: pgq; Owner: - +-- + +ALTER TABLE ONLY event_11_0 ALTER COLUMN ev_txid SET DEFAULT txid_current(); + + +-- +-- Name: ev_id; Type: DEFAULT; Schema: pgq; Owner: - +-- + +ALTER TABLE ONLY event_11_1 ALTER COLUMN ev_id SET DEFAULT nextval('event_11_id_seq'::regclass); + + +-- +-- Name: ev_txid; Type: DEFAULT; Schema: pgq; Owner: - +-- + +ALTER TABLE ONLY event_11_1 ALTER COLUMN ev_txid SET DEFAULT txid_current(); + + +-- +-- Name: ev_id; Type: DEFAULT; Schema: pgq; Owner: - +-- + +ALTER TABLE ONLY event_11_2 ALTER COLUMN ev_id SET DEFAULT nextval('event_11_id_seq'::regclass); + + +-- +-- Name: ev_txid; Type: DEFAULT; Schema: pgq; Owner: - +-- + +ALTER TABLE ONLY event_11_2 ALTER COLUMN ev_txid SET DEFAULT txid_current(); + + +-- +-- Name: ev_txid; Type: DEFAULT; Schema: pgq; Owner: - +-- + +ALTER TABLE ONLY event_12 ALTER COLUMN ev_txid SET DEFAULT txid_current(); + + +-- +-- Name: ev_id; Type: DEFAULT; Schema: pgq; Owner: - +-- + +ALTER TABLE ONLY event_12_0 ALTER COLUMN ev_id SET DEFAULT nextval('event_12_id_seq'::regclass); + + +-- +-- Name: ev_txid; Type: DEFAULT; Schema: pgq; Owner: - +-- + +ALTER TABLE ONLY event_12_0 ALTER COLUMN ev_txid SET DEFAULT txid_current(); + + +-- +-- Name: ev_id; Type: DEFAULT; Schema: pgq; Owner: - +-- + +ALTER TABLE ONLY event_12_1 ALTER COLUMN ev_id SET DEFAULT nextval('event_12_id_seq'::regclass); + + +-- +-- Name: ev_txid; Type: DEFAULT; Schema: pgq; Owner: - +-- + +ALTER TABLE ONLY event_12_1 ALTER COLUMN ev_txid SET DEFAULT txid_current(); + + +-- +-- Name: ev_id; Type: DEFAULT; Schema: pgq; Owner: - +-- + +ALTER TABLE ONLY event_12_2 ALTER COLUMN ev_id SET DEFAULT nextval('event_12_id_seq'::regclass); + + +-- +-- Name: ev_txid; Type: DEFAULT; Schema: pgq; Owner: - +-- + +ALTER TABLE ONLY event_12_2 ALTER COLUMN ev_txid SET DEFAULT txid_current(); + + +-- +-- Name: ev_txid; Type: DEFAULT; Schema: pgq; Owner: - +-- + +ALTER TABLE ONLY event_13 ALTER COLUMN ev_txid SET DEFAULT txid_current(); + + +-- +-- Name: ev_id; Type: DEFAULT; Schema: pgq; Owner: - +-- + +ALTER TABLE ONLY event_13_0 ALTER COLUMN ev_id SET DEFAULT nextval('event_13_id_seq'::regclass); + + +-- +-- Name: ev_txid; Type: DEFAULT; Schema: pgq; Owner: - +-- + +ALTER TABLE ONLY event_13_0 ALTER COLUMN ev_txid SET DEFAULT txid_current(); + + +-- +-- Name: ev_id; Type: DEFAULT; Schema: pgq; Owner: - +-- + +ALTER TABLE ONLY event_13_1 ALTER COLUMN ev_id SET DEFAULT nextval('event_13_id_seq'::regclass); + + +-- +-- Name: ev_txid; Type: DEFAULT; Schema: pgq; Owner: - +-- + +ALTER TABLE ONLY event_13_1 ALTER COLUMN ev_txid SET DEFAULT txid_current(); + + +-- +-- Name: ev_id; Type: DEFAULT; Schema: pgq; Owner: - +-- + +ALTER TABLE ONLY event_13_2 ALTER COLUMN ev_id SET DEFAULT nextval('event_13_id_seq'::regclass); + + +-- +-- Name: ev_txid; Type: DEFAULT; Schema: pgq; Owner: - +-- + +ALTER TABLE ONLY event_13_2 ALTER COLUMN ev_txid SET DEFAULT txid_current(); + + +-- +-- Name: ev_txid; Type: DEFAULT; Schema: pgq; Owner: - +-- + +ALTER TABLE ONLY event_14 ALTER COLUMN ev_txid SET DEFAULT txid_current(); + + +-- +-- Name: ev_id; Type: DEFAULT; Schema: pgq; Owner: - +-- + +ALTER TABLE ONLY event_14_0 ALTER COLUMN ev_id SET DEFAULT nextval('event_14_id_seq'::regclass); + + +-- +-- Name: ev_txid; Type: DEFAULT; Schema: pgq; Owner: - +-- + +ALTER TABLE ONLY event_14_0 ALTER COLUMN ev_txid SET DEFAULT txid_current(); + + +-- +-- Name: ev_id; Type: DEFAULT; Schema: pgq; Owner: - +-- + +ALTER TABLE ONLY event_14_1 ALTER COLUMN ev_id SET DEFAULT nextval('event_14_id_seq'::regclass); + + +-- +-- Name: ev_txid; Type: DEFAULT; Schema: pgq; Owner: - +-- + +ALTER TABLE ONLY event_14_1 ALTER COLUMN ev_txid SET DEFAULT txid_current(); + + +-- +-- Name: ev_id; Type: DEFAULT; Schema: pgq; Owner: - +-- + +ALTER TABLE ONLY event_14_2 ALTER COLUMN ev_id SET DEFAULT nextval('event_14_id_seq'::regclass); + + +-- +-- Name: ev_txid; Type: DEFAULT; Schema: pgq; Owner: - +-- + +ALTER TABLE ONLY event_14_2 ALTER COLUMN ev_txid SET DEFAULT txid_current(); + + +-- +-- Name: ev_id; Type: DEFAULT; Schema: pgq; Owner: - +-- + +ALTER TABLE ONLY event_1_0 ALTER COLUMN ev_id SET DEFAULT nextval('event_1_id_seq'::regclass); + + +-- +-- Name: ev_txid; Type: DEFAULT; Schema: pgq; Owner: - +-- + +ALTER TABLE ONLY event_1_0 ALTER COLUMN ev_txid SET DEFAULT txid_current(); + + +-- +-- Name: ev_id; Type: DEFAULT; Schema: pgq; Owner: - +-- + +ALTER TABLE ONLY event_1_1 ALTER COLUMN ev_id SET DEFAULT nextval('event_1_id_seq'::regclass); + + +-- +-- Name: ev_txid; Type: DEFAULT; Schema: pgq; Owner: - +-- + +ALTER TABLE ONLY event_1_1 ALTER COLUMN ev_txid SET DEFAULT txid_current(); + + +-- +-- Name: ev_id; Type: DEFAULT; Schema: pgq; Owner: - +-- + +ALTER TABLE ONLY event_1_2 ALTER COLUMN ev_id SET DEFAULT nextval('event_1_id_seq'::regclass); + + +-- +-- Name: ev_txid; Type: DEFAULT; Schema: pgq; Owner: - +-- + +ALTER TABLE ONLY event_1_2 ALTER COLUMN ev_txid SET DEFAULT txid_current(); + + +-- +-- Name: ev_txid; Type: DEFAULT; Schema: pgq; Owner: - +-- + +ALTER TABLE ONLY event_2 ALTER COLUMN ev_txid SET DEFAULT txid_current(); + + +-- +-- Name: ev_id; Type: DEFAULT; Schema: pgq; Owner: - +-- + +ALTER TABLE ONLY event_2_0 ALTER COLUMN ev_id SET DEFAULT nextval('event_2_id_seq'::regclass); + + +-- +-- Name: ev_txid; Type: DEFAULT; Schema: pgq; Owner: - +-- + +ALTER TABLE ONLY event_2_0 ALTER COLUMN ev_txid SET DEFAULT txid_current(); + + +-- +-- Name: ev_id; Type: DEFAULT; Schema: pgq; Owner: - +-- + +ALTER TABLE ONLY event_2_1 ALTER COLUMN ev_id SET DEFAULT nextval('event_2_id_seq'::regclass); + + +-- +-- Name: ev_txid; Type: DEFAULT; Schema: pgq; Owner: - +-- + +ALTER TABLE ONLY event_2_1 ALTER COLUMN ev_txid SET DEFAULT txid_current(); + + +-- +-- Name: ev_id; Type: DEFAULT; Schema: pgq; Owner: - +-- + +ALTER TABLE ONLY event_2_2 ALTER COLUMN ev_id SET DEFAULT nextval('event_2_id_seq'::regclass); + + +-- +-- Name: ev_txid; Type: DEFAULT; Schema: pgq; Owner: - +-- + +ALTER TABLE ONLY event_2_2 ALTER COLUMN ev_txid SET DEFAULT txid_current(); + + +-- +-- Name: ev_txid; Type: DEFAULT; Schema: pgq; Owner: - +-- + +ALTER TABLE ONLY event_3 ALTER COLUMN ev_txid SET DEFAULT txid_current(); + + +-- +-- Name: ev_id; Type: DEFAULT; Schema: pgq; Owner: - +-- + +ALTER TABLE ONLY event_3_0 ALTER COLUMN ev_id SET DEFAULT nextval('event_3_id_seq'::regclass); + + +-- +-- Name: ev_txid; Type: DEFAULT; Schema: pgq; Owner: - +-- + +ALTER TABLE ONLY event_3_0 ALTER COLUMN ev_txid SET DEFAULT txid_current(); + + +-- +-- Name: ev_id; Type: DEFAULT; Schema: pgq; Owner: - +-- + +ALTER TABLE ONLY event_3_1 ALTER COLUMN ev_id SET DEFAULT nextval('event_3_id_seq'::regclass); + + +-- +-- Name: ev_txid; Type: DEFAULT; Schema: pgq; Owner: - +-- + +ALTER TABLE ONLY event_3_1 ALTER COLUMN ev_txid SET DEFAULT txid_current(); + + +-- +-- Name: ev_id; Type: DEFAULT; Schema: pgq; Owner: - +-- + +ALTER TABLE ONLY event_3_2 ALTER COLUMN ev_id SET DEFAULT nextval('event_3_id_seq'::regclass); + + +-- +-- Name: ev_txid; Type: DEFAULT; Schema: pgq; Owner: - +-- + +ALTER TABLE ONLY event_3_2 ALTER COLUMN ev_txid SET DEFAULT txid_current(); + + +-- +-- Name: ev_txid; Type: DEFAULT; Schema: pgq; Owner: - +-- + +ALTER TABLE ONLY event_4 ALTER COLUMN ev_txid SET DEFAULT txid_current(); + + +-- +-- Name: ev_id; Type: DEFAULT; Schema: pgq; Owner: - +-- + +ALTER TABLE ONLY event_4_0 ALTER COLUMN ev_id SET DEFAULT nextval('event_4_id_seq'::regclass); + + +-- +-- Name: ev_txid; Type: DEFAULT; Schema: pgq; Owner: - +-- + +ALTER TABLE ONLY event_4_0 ALTER COLUMN ev_txid SET DEFAULT txid_current(); + + +-- +-- Name: ev_id; Type: DEFAULT; Schema: pgq; Owner: - +-- + +ALTER TABLE ONLY event_4_1 ALTER COLUMN ev_id SET DEFAULT nextval('event_4_id_seq'::regclass); + + +-- +-- Name: ev_txid; Type: DEFAULT; Schema: pgq; Owner: - +-- + +ALTER TABLE ONLY event_4_1 ALTER COLUMN ev_txid SET DEFAULT txid_current(); + + +-- +-- Name: ev_id; Type: DEFAULT; Schema: pgq; Owner: - +-- + +ALTER TABLE ONLY event_4_2 ALTER COLUMN ev_id SET DEFAULT nextval('event_4_id_seq'::regclass); + + +-- +-- Name: ev_txid; Type: DEFAULT; Schema: pgq; Owner: - +-- + +ALTER TABLE ONLY event_4_2 ALTER COLUMN ev_txid SET DEFAULT txid_current(); + + +-- +-- Name: ev_txid; Type: DEFAULT; Schema: pgq; Owner: - +-- + +ALTER TABLE ONLY event_5 ALTER COLUMN ev_txid SET DEFAULT txid_current(); + + +-- +-- Name: ev_id; Type: DEFAULT; Schema: pgq; Owner: - +-- + +ALTER TABLE ONLY event_5_0 ALTER COLUMN ev_id SET DEFAULT nextval('event_5_id_seq'::regclass); + + +-- +-- Name: ev_txid; Type: DEFAULT; Schema: pgq; Owner: - +-- + +ALTER TABLE ONLY event_5_0 ALTER COLUMN ev_txid SET DEFAULT txid_current(); + + +-- +-- Name: ev_id; Type: DEFAULT; Schema: pgq; Owner: - +-- + +ALTER TABLE ONLY event_5_1 ALTER COLUMN ev_id SET DEFAULT nextval('event_5_id_seq'::regclass); + + +-- +-- Name: ev_txid; Type: DEFAULT; Schema: pgq; Owner: - +-- + +ALTER TABLE ONLY event_5_1 ALTER COLUMN ev_txid SET DEFAULT txid_current(); + + +-- +-- Name: ev_id; Type: DEFAULT; Schema: pgq; Owner: - +-- + +ALTER TABLE ONLY event_5_2 ALTER COLUMN ev_id SET DEFAULT nextval('event_5_id_seq'::regclass); + + +-- +-- Name: ev_txid; Type: DEFAULT; Schema: pgq; Owner: - +-- + +ALTER TABLE ONLY event_5_2 ALTER COLUMN ev_txid SET DEFAULT txid_current(); + + +-- +-- Name: ev_txid; Type: DEFAULT; Schema: pgq; Owner: - +-- + +ALTER TABLE ONLY event_6 ALTER COLUMN ev_txid SET DEFAULT txid_current(); + + +-- +-- Name: ev_id; Type: DEFAULT; Schema: pgq; Owner: - +-- + +ALTER TABLE ONLY event_6_0 ALTER COLUMN ev_id SET DEFAULT nextval('event_6_id_seq'::regclass); + + +-- +-- Name: ev_txid; Type: DEFAULT; Schema: pgq; Owner: - +-- + +ALTER TABLE ONLY event_6_0 ALTER COLUMN ev_txid SET DEFAULT txid_current(); + + +-- +-- Name: ev_id; Type: DEFAULT; Schema: pgq; Owner: - +-- + +ALTER TABLE ONLY event_6_1 ALTER COLUMN ev_id SET DEFAULT nextval('event_6_id_seq'::regclass); + + +-- +-- Name: ev_txid; Type: DEFAULT; Schema: pgq; Owner: - +-- + +ALTER TABLE ONLY event_6_1 ALTER COLUMN ev_txid SET DEFAULT txid_current(); + + +-- +-- Name: ev_id; Type: DEFAULT; Schema: pgq; Owner: - +-- + +ALTER TABLE ONLY event_6_2 ALTER COLUMN ev_id SET DEFAULT nextval('event_6_id_seq'::regclass); + + +-- +-- Name: ev_txid; Type: DEFAULT; Schema: pgq; Owner: - +-- + +ALTER TABLE ONLY event_6_2 ALTER COLUMN ev_txid SET DEFAULT txid_current(); + + +-- +-- Name: ev_txid; Type: DEFAULT; Schema: pgq; Owner: - +-- + +ALTER TABLE ONLY event_7 ALTER COLUMN ev_txid SET DEFAULT txid_current(); + + +-- +-- Name: ev_id; Type: DEFAULT; Schema: pgq; Owner: - +-- + +ALTER TABLE ONLY event_7_0 ALTER COLUMN ev_id SET DEFAULT nextval('event_7_id_seq'::regclass); + + +-- +-- Name: ev_txid; Type: DEFAULT; Schema: pgq; Owner: - +-- + +ALTER TABLE ONLY event_7_0 ALTER COLUMN ev_txid SET DEFAULT txid_current(); + + +-- +-- Name: ev_id; Type: DEFAULT; Schema: pgq; Owner: - +-- + +ALTER TABLE ONLY event_7_1 ALTER COLUMN ev_id SET DEFAULT nextval('event_7_id_seq'::regclass); + + +-- +-- Name: ev_txid; Type: DEFAULT; Schema: pgq; Owner: - +-- + +ALTER TABLE ONLY event_7_1 ALTER COLUMN ev_txid SET DEFAULT txid_current(); + + +-- +-- Name: ev_id; Type: DEFAULT; Schema: pgq; Owner: - +-- + +ALTER TABLE ONLY event_7_2 ALTER COLUMN ev_id SET DEFAULT nextval('event_7_id_seq'::regclass); + + +-- +-- Name: ev_txid; Type: DEFAULT; Schema: pgq; Owner: - +-- + +ALTER TABLE ONLY event_7_2 ALTER COLUMN ev_txid SET DEFAULT txid_current(); + + +-- +-- Name: ev_txid; Type: DEFAULT; Schema: pgq; Owner: - +-- + +ALTER TABLE ONLY event_8 ALTER COLUMN ev_txid SET DEFAULT txid_current(); + + +-- +-- Name: ev_id; Type: DEFAULT; Schema: pgq; Owner: - +-- + +ALTER TABLE ONLY event_8_0 ALTER COLUMN ev_id SET DEFAULT nextval('event_8_id_seq'::regclass); + + +-- +-- Name: ev_txid; Type: DEFAULT; Schema: pgq; Owner: - +-- + +ALTER TABLE ONLY event_8_0 ALTER COLUMN ev_txid SET DEFAULT txid_current(); + + +-- +-- Name: ev_id; Type: DEFAULT; Schema: pgq; Owner: - +-- + +ALTER TABLE ONLY event_8_1 ALTER COLUMN ev_id SET DEFAULT nextval('event_8_id_seq'::regclass); + + +-- +-- Name: ev_txid; Type: DEFAULT; Schema: pgq; Owner: - +-- + +ALTER TABLE ONLY event_8_1 ALTER COLUMN ev_txid SET DEFAULT txid_current(); + + +-- +-- Name: ev_id; Type: DEFAULT; Schema: pgq; Owner: - +-- + +ALTER TABLE ONLY event_8_2 ALTER COLUMN ev_id SET DEFAULT nextval('event_8_id_seq'::regclass); + + +-- +-- Name: ev_txid; Type: DEFAULT; Schema: pgq; Owner: - +-- + +ALTER TABLE ONLY event_8_2 ALTER COLUMN ev_txid SET DEFAULT txid_current(); + + +-- +-- Name: ev_txid; Type: DEFAULT; Schema: pgq; Owner: - +-- + +ALTER TABLE ONLY event_9 ALTER COLUMN ev_txid SET DEFAULT txid_current(); + + +-- +-- Name: ev_id; Type: DEFAULT; Schema: pgq; Owner: - +-- + +ALTER TABLE ONLY event_9_0 ALTER COLUMN ev_id SET DEFAULT nextval('event_9_id_seq'::regclass); + + +-- +-- Name: ev_txid; Type: DEFAULT; Schema: pgq; Owner: - +-- + +ALTER TABLE ONLY event_9_0 ALTER COLUMN ev_txid SET DEFAULT txid_current(); + + +-- +-- Name: ev_id; Type: DEFAULT; Schema: pgq; Owner: - +-- + +ALTER TABLE ONLY event_9_1 ALTER COLUMN ev_id SET DEFAULT nextval('event_9_id_seq'::regclass); + + +-- +-- Name: ev_txid; Type: DEFAULT; Schema: pgq; Owner: - +-- + +ALTER TABLE ONLY event_9_1 ALTER COLUMN ev_txid SET DEFAULT txid_current(); + + +-- +-- Name: ev_id; Type: DEFAULT; Schema: pgq; Owner: - +-- + +ALTER TABLE ONLY event_9_2 ALTER COLUMN ev_id SET DEFAULT nextval('event_9_id_seq'::regclass); + + +-- +-- Name: ev_txid; Type: DEFAULT; Schema: pgq; Owner: - +-- + +ALTER TABLE ONLY event_9_2 ALTER COLUMN ev_txid SET DEFAULT txid_current(); + + +-- +-- Name: queue_id; Type: DEFAULT; Schema: pgq; Owner: - +-- + +ALTER TABLE ONLY queue ALTER COLUMN queue_id SET DEFAULT nextval('queue_queue_id_seq'::regclass); + + +-- +-- Name: sub_id; Type: DEFAULT; Schema: pgq; Owner: - +-- + +ALTER TABLE ONLY subscription ALTER COLUMN sub_id SET DEFAULT nextval('subscription_sub_id_seq'::regclass); + + +SET search_path = public, pg_catalog; + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY account_export_configs ALTER COLUMN id SET DEFAULT nextval('account_export_configs_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY accounts ALTER COLUMN id SET DEFAULT nextval('accounts_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY action_queue ALTER COLUMN id SET DEFAULT nextval('action_queue_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY addresses ALTER COLUMN id SET DEFAULT nextval('addresses_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY admin_dk_news ALTER COLUMN id SET DEFAULT nextval('admin_dk_news_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY amazon_s3_assets ALTER COLUMN id SET DEFAULT nextval('amazon_s3_assets_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY amazon_s3_public_assets ALTER COLUMN id SET DEFAULT nextval('amazon_s3_public_assets_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY answers ALTER COLUMN id SET DEFAULT nextval('answers_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY arrangements ALTER COLUMN id SET DEFAULT nextval('arrangements_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY articles ALTER COLUMN id SET DEFAULT nextval('articles_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY avatars ALTER COLUMN id SET DEFAULT nextval('avatars_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY award_candidates ALTER COLUMN id SET DEFAULT nextval('award_candidates_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY award_nominations ALTER COLUMN id SET DEFAULT nextval('award_nominations_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY award_nominee_votes ALTER COLUMN id SET DEFAULT nextval('award_nominee_votes_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY award_nominees ALTER COLUMN id SET DEFAULT nextval('award_nominees_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY award_rubrics ALTER COLUMN id SET DEFAULT nextval('award_rubrics_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY award_winner_nomination_votes ALTER COLUMN id SET DEFAULT nextval('award_winner_nomination_votes_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY award_winners ALTER COLUMN id SET DEFAULT nextval('award_winners_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY awards ALTER COLUMN id SET DEFAULT nextval('awards_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY base_words ALTER COLUMN id SET DEFAULT nextval('base_words_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY bdrb_job_queues ALTER COLUMN id SET DEFAULT nextval('bdrb_job_queues_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY blacklists ALTER COLUMN id SET DEFAULT nextval('blacklists_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY blog_comments ALTER COLUMN id SET DEFAULT nextval('blog_comments_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY blog_ping_services ALTER COLUMN id SET DEFAULT nextval('blog_ping_services_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY blog_post_contents ALTER COLUMN id SET DEFAULT nextval('blog_post_contents_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY blog_post_images ALTER COLUMN id SET DEFAULT nextval('blog_post_images_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY blog_post_regions ALTER COLUMN id SET DEFAULT nextval('blog_post_regions_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY blog_posts ALTER COLUMN id SET DEFAULT nextval('blog_posts_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY blog_rubric_mappings ALTER COLUMN id SET DEFAULT nextval('blog_rubric_mappings_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY blog_rubric_statistics ALTER COLUMN id SET DEFAULT nextval('blog_rubric_statistics_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY blog_rubrics ALTER COLUMN id SET DEFAULT nextval('blog_rubrics_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY blog_settings ALTER COLUMN id SET DEFAULT nextval('blog_settings_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY blog_user_statistics ALTER COLUMN id SET DEFAULT nextval('user_blog_statistics_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY business_types ALTER COLUMN id SET DEFAULT nextval('business_types_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY catalogue_logs ALTER COLUMN id SET DEFAULT nextval('catalogue_logs_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY categories ALTER COLUMN id SET DEFAULT nextval('categories_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY category_rubrics ALTER COLUMN id SET DEFAULT nextval('category_rubrics_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY cities ALTER COLUMN id SET DEFAULT nextval('cities_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY city_types ALTER COLUMN id SET DEFAULT nextval('city_types_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY ckeditor_assets ALTER COLUMN id SET DEFAULT nextval('ckeditor_assets_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY cms_company_regions ALTER COLUMN id SET DEFAULT nextval('cms_company_regions_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY cms_page_industries_backup ALTER COLUMN id SET DEFAULT nextval('cms_page_industries_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY cms_page_rubrics ALTER COLUMN id SET DEFAULT nextval('cms_page_rubrics_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY cms_pages ALTER COLUMN id SET DEFAULT nextval('cms_pages_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY comment_wiki_pages ALTER COLUMN id SET DEFAULT nextval('comment_wiki_pages_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY comments ALTER COLUMN id SET DEFAULT nextval('comments_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY companies ALTER COLUMN id SET DEFAULT nextval('companies_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY company_abouts ALTER COLUMN id SET DEFAULT nextval('company_abouts_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY company_arrangements_sort_methods ALTER COLUMN id SET DEFAULT nextval('company_arrangements_sort_methods_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY company_background_images ALTER COLUMN id SET DEFAULT nextval('company_background_images_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY company_billings ALTER COLUMN id SET DEFAULT nextval('company_billings_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY company_business_types ALTER COLUMN id SET DEFAULT nextval('company_business_types_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY company_categories ALTER COLUMN id SET DEFAULT nextval('company_categories_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY company_custom_page_titles ALTER COLUMN id SET DEFAULT nextval('company_custom_page_titles_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY company_documents ALTER COLUMN id SET DEFAULT nextval('company_documents_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY company_domain_stopwords ALTER COLUMN id SET DEFAULT nextval('company_domain_stopwords_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY company_domains ALTER COLUMN id SET DEFAULT nextval('company_domains_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY company_event_types ALTER COLUMN id SET DEFAULT nextval('company_event_types_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY company_event_wiki_pages ALTER COLUMN id SET DEFAULT nextval('company_event_wiki_pages_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY company_events ALTER COLUMN id SET DEFAULT nextval('company_events_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY company_events_publish_regions ALTER COLUMN id SET DEFAULT nextval('company_events_publish_regions_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY company_header_flashes ALTER COLUMN id SET DEFAULT nextval('company_header_flashes_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY company_header_images ALTER COLUMN id SET DEFAULT nextval('company_header_images_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY company_imports ALTER COLUMN id SET DEFAULT nextval('company_imports_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY company_industries ALTER COLUMN id SET DEFAULT nextval('company_industries_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY company_links ALTER COLUMN id SET DEFAULT nextval('company_links_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY company_logos ALTER COLUMN id SET DEFAULT nextval('company_logos_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY company_main_rubrics ALTER COLUMN id SET DEFAULT nextval('company_main_rubrics_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY company_manager_stats ALTER COLUMN id SET DEFAULT nextval('company_manager_stats_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY company_menu_settings ALTER COLUMN id SET DEFAULT nextval('company_menu_settings_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY company_moderations ALTER COLUMN id SET DEFAULT nextval('company_moderations_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY company_news_rubrics ALTER COLUMN id SET DEFAULT nextval('company_news_rubrics_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY company_payments ALTER COLUMN id SET DEFAULT nextval('company_payments_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY company_previous_statistics ALTER COLUMN id SET DEFAULT nextval('company_previous_statistics_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY company_price_product_rubrics ALTER COLUMN id SET DEFAULT nextval('company_price_product_rubrics_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY company_pricelist_online_status_logs ALTER COLUMN id SET DEFAULT nextval('company_pricelist_online_status_logs_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY company_prices ALTER COLUMN id SET DEFAULT nextval('company_prices_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY company_publish_queue ALTER COLUMN id SET DEFAULT nextval('company_publish_queue_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY company_region_commercials ALTER COLUMN id SET DEFAULT nextval('company_region_commercials_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY company_regions ALTER COLUMN id SET DEFAULT nextval('company_regions_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY company_registration_sources ALTER COLUMN id SET DEFAULT nextval('company_registration_sources_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY company_review_comments ALTER COLUMN id SET DEFAULT nextval('company_review_comments_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY company_reviews ALTER COLUMN id SET DEFAULT nextval('company_reviews_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY company_rubric_regions ALTER COLUMN id SET DEFAULT nextval('company_rubric_regions_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY company_rubrics ALTER COLUMN id SET DEFAULT nextval('company_rubrics_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY company_schedules ALTER COLUMN id SET DEFAULT nextval('company_schedules_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY company_searcher_confirmations ALTER COLUMN id SET DEFAULT nextval('company_searcher_confirmations_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY company_settings ALTER COLUMN id SET DEFAULT nextval('company_settings_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY company_sites ALTER COLUMN id SET DEFAULT nextval('company_sites_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY company_thematic_rubrics ALTER COLUMN id SET DEFAULT nextval('company_thematic_rubrics_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY company_tokens ALTER COLUMN id SET DEFAULT nextval('company_tokens_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY company_traffic_limits ALTER COLUMN id SET DEFAULT nextval('company_traffic_limits_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY company_users ALTER COLUMN id SET DEFAULT nextval('company_users_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY company_videos ALTER COLUMN id SET DEFAULT nextval('company_videos_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY company_widgets ALTER COLUMN id SET DEFAULT nextval('company_widgets_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY company_widgets_stats ALTER COLUMN id SET DEFAULT nextval('company_widgets_stats_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY company_yandex_rubrics ALTER COLUMN id SET DEFAULT nextval('company_yandex_rubrics_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY complaints ALTER COLUMN id SET DEFAULT nextval('complaints_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY contact_types ALTER COLUMN id SET DEFAULT nextval('contact_types_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY contacts ALTER COLUMN id SET DEFAULT nextval('contacts_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY copied_users ALTER COLUMN id SET DEFAULT nextval('copied_users_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY countries ALTER COLUMN id SET DEFAULT nextval('countries_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY demand_items ALTER COLUMN id SET DEFAULT nextval('demand_items_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY demand_statistics ALTER COLUMN id SET DEFAULT nextval('demand_statistics_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY demands ALTER COLUMN id SET DEFAULT nextval('demands_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY dialog_messages ALTER COLUMN id SET DEFAULT nextval('dialog_messages_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY dialog_participants ALTER COLUMN id SET DEFAULT nextval('dialog_participants_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY dialogs ALTER COLUMN id SET DEFAULT nextval('dialogs_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY dirty_industries ALTER COLUMN id SET DEFAULT nextval('dirty_industries_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY dirty_rubric_log_entries ALTER COLUMN id SET DEFAULT nextval('dirty_rubric_log_entries_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY dirty_rubric_redirects ALTER COLUMN id SET DEFAULT nextval('dirty_rubric_redirects_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY dirty_rubric_trait_value_redirects ALTER COLUMN id SET DEFAULT nextval('dirty_rubric_trait_value_redirects_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY dirty_rubrics ALTER COLUMN id SET DEFAULT nextval('dirty_rubrics_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY dirty_rubrics_nested_set ALTER COLUMN id SET DEFAULT nextval('dirty_rubrics_nested_set_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY dirty_thematic_rubric_industries ALTER COLUMN id SET DEFAULT nextval('dirty_thematic_rubric_industries_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY dirty_thematic_rubrics ALTER COLUMN id SET DEFAULT nextval('dirty_thematic_rubrics_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY district_types ALTER COLUMN id SET DEFAULT nextval('district_types_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY districts ALTER COLUMN id SET DEFAULT nextval('districts_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY event_addresses ALTER COLUMN id SET DEFAULT nextval('event_addresses_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY event_contacts ALTER COLUMN id SET DEFAULT nextval('event_contacts_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY event_phones ALTER COLUMN id SET DEFAULT nextval('event_phones_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY event_thematic_rubrics ALTER COLUMN id SET DEFAULT nextval('event_thematic_rubrics_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY external_forms ALTER COLUMN id SET DEFAULT nextval('external_forms_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY feedback_categories ALTER COLUMN id SET DEFAULT nextval('feedback_categories_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY feedbacks ALTER COLUMN id SET DEFAULT nextval('feedbacks_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY franchise_user_regions ALTER COLUMN id SET DEFAULT nextval('franchise_user_regions_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY glossary_log ALTER COLUMN id SET DEFAULT nextval('glossary_log_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY images ALTER COLUMN id SET DEFAULT nextval('images_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY industries ALTER COLUMN id SET DEFAULT nextval('industries_id_seq1'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY industries_backup ALTER COLUMN id SET DEFAULT nextval('industries_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY industry_redirects ALTER COLUMN id SET DEFAULT nextval('industry_redirects_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY informer_prices ALTER COLUMN id SET DEFAULT nextval('informer_prices_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY informers ALTER COLUMN id SET DEFAULT nextval('informers_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY ip_infos ALTER COLUMN id SET DEFAULT nextval('ip_infos_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY licenses ALTER COLUMN id SET DEFAULT nextval('licenses_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY magazine_subscription_notification_emails ALTER COLUMN id SET DEFAULT nextval('magazine_subscription_notification_emails_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY map_address_candidates ALTER COLUMN id SET DEFAULT nextval('map_address_candidates_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY map_addresses ALTER COLUMN id SET DEFAULT nextval('map_addresses_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY mappings ALTER COLUMN id SET DEFAULT nextval('mappings_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY measure_unit_groups ALTER COLUMN id SET DEFAULT nextval('measure_unit_groups_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY measure_units ALTER COLUMN id SET DEFAULT nextval('measure_units_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY migration_errors ALTER COLUMN id SET DEFAULT nextval('migration_errors_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY migrations ALTER COLUMN id SET DEFAULT nextval('migrations_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY native_region_regions ALTER COLUMN id SET DEFAULT nextval('native_region_regions_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY news ALTER COLUMN id SET DEFAULT nextval('news_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY news_paid_placements ALTER COLUMN id SET DEFAULT nextval('news_paid_placements_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY news_regions ALTER COLUMN id SET DEFAULT nextval('news_regions_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY news_regions_zones ALTER COLUMN id SET DEFAULT nextval('news_regions_zones_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY news_rubrics ALTER COLUMN id SET DEFAULT nextval('news_rubrics_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY news_sources ALTER COLUMN id SET DEFAULT nextval('news_sources_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY news_thematic_news ALTER COLUMN id SET DEFAULT nextval('news_thematic_news_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY news_thematic_rubrics ALTER COLUMN id SET DEFAULT nextval('news_thematic_rubrics_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY news_wiki_pages ALTER COLUMN id SET DEFAULT nextval('news_editorials_wiki_pages_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY news_zones ALTER COLUMN id SET DEFAULT nextval('news_zones_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY offline_regions ALTER COLUMN id SET DEFAULT nextval('offline_regions_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY old_online_store_categories ALTER COLUMN id SET DEFAULT nextval('online_store_categories_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY old_online_store_category_rubrics ALTER COLUMN id SET DEFAULT nextval('online_store_category_rubrics_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY old_online_store_import_logs ALTER COLUMN id SET DEFAULT nextval('online_store_import_logs_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY old_online_store_product_regions ALTER COLUMN id SET DEFAULT nextval('online_store_product_regions_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY old_online_store_products ALTER COLUMN id SET DEFAULT nextval('online_store_products_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY old_online_store_products_merge_errors ALTER COLUMN id SET DEFAULT nextval('online_store_products_merge_errors_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY old_online_store_schedules ALTER COLUMN id SET DEFAULT nextval('online_store_schedules_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY old_online_stores ALTER COLUMN id SET DEFAULT nextval('online_stores_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY online_users_stat_by_days ALTER COLUMN id SET DEFAULT nextval('online_users_stat_by_days_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY online_users_stat_by_hours ALTER COLUMN id SET DEFAULT nextval('online_users_stat_by_hours_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY online_users_stat_by_mins ALTER COLUMN id SET DEFAULT nextval('online_users_stat_by_mins_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY online_users_stat_by_months ALTER COLUMN id SET DEFAULT nextval('online_users_stat_by_months_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY packet_discounts ALTER COLUMN id SET DEFAULT nextval('packet_discounts_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY packet_region_settings ALTER COLUMN id SET DEFAULT nextval('packet_region_settings_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY packets ALTER COLUMN id SET DEFAULT nextval('packets_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY page_descriptions ALTER COLUMN id SET DEFAULT nextval('page_descriptions_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY payment_systems ALTER COLUMN id SET DEFAULT nextval('payment_systems_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY phone_types ALTER COLUMN id SET DEFAULT nextval('phone_types_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY phones ALTER COLUMN id SET DEFAULT nextval('phones_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY poll_answers ALTER COLUMN id SET DEFAULT nextval('poll_answers_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY poll_questions ALTER COLUMN id SET DEFAULT nextval('poll_questions_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY poll_steps ALTER COLUMN id SET DEFAULT nextval('poll_steps_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY poll_votes ALTER COLUMN id SET DEFAULT nextval('poll_votes_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY polls ALTER COLUMN id SET DEFAULT nextval('polls_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY prerendered_rubricators ALTER COLUMN id SET DEFAULT nextval('prerendered_rubricators_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY price_list_rows ALTER COLUMN id SET DEFAULT nextval('price_list_rows_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY product_announce_categories ALTER COLUMN id SET DEFAULT nextval('product_announce_categories_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY product_announce_patterns ALTER COLUMN id SET DEFAULT nextval('product_announce_patterns_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY product_deltas ALTER COLUMN id SET DEFAULT nextval('product_deltas_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY product_description_stats ALTER COLUMN id SET DEFAULT nextval('product_description_stats_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY product_group_images ALTER COLUMN id SET DEFAULT nextval('product_group_images_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY product_groups ALTER COLUMN id SET DEFAULT nextval('product_groups_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY product_images ALTER COLUMN id SET DEFAULT nextval('product_images_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY product_price_list_rows ALTER COLUMN id SET DEFAULT nextval('product_price_list_rows_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY product_properties ALTER COLUMN id SET DEFAULT nextval('product_properties_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY product_url_names ALTER COLUMN id SET DEFAULT nextval('product_url_names_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY provinces ALTER COLUMN id SET DEFAULT nextval('provinces_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY redactor_images ALTER COLUMN id SET DEFAULT nextval('redactor_images_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY redirects ALTER COLUMN id SET DEFAULT nextval('redirects_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY region_contacts ALTER COLUMN id SET DEFAULT nextval('region_contacts_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY region_footer_contacts ALTER COLUMN id SET DEFAULT nextval('region_footer_contacts_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY region_packets ALTER COLUMN id SET DEFAULT nextval('region_packets_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY regions ALTER COLUMN id SET DEFAULT nextval('regions_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY roles ALTER COLUMN id SET DEFAULT nextval('roles_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY rss_channels ALTER COLUMN id SET DEFAULT nextval('rss_channels_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY rubric_industries_backup ALTER COLUMN id SET DEFAULT nextval('rubric_industries_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY rubric_normal_stats ALTER COLUMN id SET DEFAULT nextval('rubric_normal_stats_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY rubric_redirects ALTER COLUMN id SET DEFAULT nextval('rubric_redirects_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY rubric_statistics ALTER COLUMN id SET DEFAULT nextval('rubric_statistics_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY rubric_statistics_paid ALTER COLUMN id SET DEFAULT nextval('rubric_statistics_paid_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY rubric_tags ALTER COLUMN id SET DEFAULT nextval('rubric_tags_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY rubrics ALTER COLUMN id SET DEFAULT nextval('rubrics_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY rubrics_total_statistics ALTER COLUMN id SET DEFAULT nextval('rubrics_total_statistics_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY schedule_brakes ALTER COLUMN id SET DEFAULT nextval('schedule_brakes_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY schedule_days ALTER COLUMN id SET DEFAULT nextval('schedule_days_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY schedule_times ALTER COLUMN id SET DEFAULT nextval('schedule_times_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY search_index_companies ALTER COLUMN id SET DEFAULT nextval('search_index_companies_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY search_index_demands ALTER COLUMN id SET DEFAULT nextval('search_index_demands_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY search_index_price_list_rows ALTER COLUMN id SET DEFAULT nextval('search_index_price_list_rows_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY search_index_products ALTER COLUMN id SET DEFAULT nextval('search_index_products_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY search_index_queue ALTER COLUMN id SET DEFAULT nextval('search_index_queue_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY search_index_rubrics ALTER COLUMN id SET DEFAULT nextval('search_index_rubrics_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY search_specwords ALTER COLUMN id SET DEFAULT nextval('search_specwords_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY search_stopwords ALTER COLUMN id SET DEFAULT nextval('search_stopwords_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY search_unitnames ALTER COLUMN id SET DEFAULT nextval('search_unitnames_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY search_wordforms ALTER COLUMN id SET DEFAULT nextval('search_wordforms_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY see_also_stats ALTER COLUMN id SET DEFAULT nextval('see_also_stats_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY seo_anchors ALTER COLUMN id SET DEFAULT nextval('seo_anchors_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY seo_entities ALTER COLUMN id SET DEFAULT nextval('seo_entities_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY seo_entity_modifications ALTER COLUMN id SET DEFAULT nextval('seo_entity_modifications_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY seo_entity_stopwords ALTER COLUMN id SET DEFAULT nextval('seo_entity_stopwords_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY seo_entity_wordforms ALTER COLUMN id SET DEFAULT nextval('seo_entity_wordforms_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY sessions ALTER COLUMN id SET DEFAULT nextval('sessions_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY showcase_images ALTER COLUMN id SET DEFAULT nextval('showcase_images_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY showcase_order_periods ALTER COLUMN id SET DEFAULT nextval('showcase_order_periods_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY showcase_order_regions ALTER COLUMN id SET DEFAULT nextval('showcase_order_regions_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY showcase_order_stats ALTER COLUMN id SET DEFAULT nextval('showcase_order_stats_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY showcase_orders ALTER COLUMN id SET DEFAULT nextval('showcase_orders_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY showcases ALTER COLUMN id SET DEFAULT nextval('showcases_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY sitemap ALTER COLUMN id SET DEFAULT nextval('sitemap_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY snippet_rubrics ALTER COLUMN id SET DEFAULT nextval('snippet_rubrics_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY snippet_text_regions ALTER COLUMN id SET DEFAULT nextval('snippet_text_regions_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY snippet_texts ALTER COLUMN id SET DEFAULT nextval('snippet_texts_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY snippets ALTER COLUMN id SET DEFAULT nextval('snippets_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY social_surveys ALTER COLUMN id SET DEFAULT nextval('social_surveys_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY sources ALTER COLUMN id SET DEFAULT nextval('sources_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY static_links_by_products ALTER COLUMN id SET DEFAULT nextval('static_links_by_products_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY static_links_by_rubrics ALTER COLUMN id SET DEFAULT nextval('static_links_by_rubrics_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY static_links_for_predls ALTER COLUMN id SET DEFAULT nextval('static_links_for_predls_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY street_types ALTER COLUMN id SET DEFAULT nextval('street_types_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY streets ALTER COLUMN id SET DEFAULT nextval('streets_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY subscribe_popups ALTER COLUMN id SET DEFAULT nextval('subscribe_popups_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY subscriptions ALTER COLUMN id SET DEFAULT nextval('subscriptions_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY synonyms ALTER COLUMN id SET DEFAULT nextval('synonyms_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY system_params ALTER COLUMN id SET DEFAULT nextval('system_params_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY taggings ALTER COLUMN id SET DEFAULT nextval('taggings_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY tags ALTER COLUMN id SET DEFAULT nextval('tags_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY template_categories ALTER COLUMN id SET DEFAULT nextval('template_categories_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY template_schemes ALTER COLUMN id SET DEFAULT nextval('template_schemes_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY test_packets ALTER COLUMN id SET DEFAULT nextval('test_packets_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY text_zone_rubrics ALTER COLUMN id SET DEFAULT nextval('text_zone_rubrics_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY text_zones ALTER COLUMN id SET DEFAULT nextval('text_zones_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY thematic_rubric_industries ALTER COLUMN id SET DEFAULT nextval('thematic_rubric_industries_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY thematic_rubric_links ALTER COLUMN id SET DEFAULT nextval('thematic_rubric_links_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY thematic_rubricators ALTER COLUMN id SET DEFAULT nextval('thematic_rubricators_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY thematic_rubrics ALTER COLUMN id SET DEFAULT nextval('thematic_rubrics_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY trait_products ALTER COLUMN id SET DEFAULT nextval('trait_products_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY trait_rubrics ALTER COLUMN id SET DEFAULT nextval('trait_rubrics_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY trait_value_redirects ALTER COLUMN id SET DEFAULT nextval('trait_value_redirects_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY trait_values ALTER COLUMN id SET DEFAULT nextval('trait_values_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY traits ALTER COLUMN id SET DEFAULT nextval('traits_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY ugc_stats ALTER COLUMN id SET DEFAULT nextval('ugc_stats_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY useful_link_categories ALTER COLUMN id SET DEFAULT nextval('useful_link_categories_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY useful_link_categories_industries ALTER COLUMN id SET DEFAULT nextval('useful_link_categories_industries_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY useful_link_statistics ALTER COLUMN id SET DEFAULT nextval('useful_link_statistics_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY useful_links ALTER COLUMN id SET DEFAULT nextval('useful_links_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY user_profiles ALTER COLUMN id SET DEFAULT nextval('user_profiles_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY user_roles ALTER COLUMN id SET DEFAULT nextval('user_roles_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY user_settings ALTER COLUMN id SET DEFAULT nextval('user_settings_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY users ALTER COLUMN id SET DEFAULT nextval('users_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY villages ALTER COLUMN id SET DEFAULT nextval('villages_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY visit_cards ALTER COLUMN id SET DEFAULT nextval('visit_cards_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY wiki_page_versions ALTER COLUMN id SET DEFAULT nextval('wiki_page_versions_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY wiki_pages ALTER COLUMN id SET DEFAULT nextval('wiki_pages_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY wiki_pages_to_wiki_pages ALTER COLUMN id SET DEFAULT nextval('wiki_pages_to_wiki_pages_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY wiki_types ALTER COLUMN id SET DEFAULT nextval('wiki_types_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY wordstat_rubrics ALTER COLUMN id SET DEFAULT nextval('wordstat_rubrics_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY xml_clients ALTER COLUMN id SET DEFAULT nextval('xml_clients_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY yandex_direct_banner_rubrics ALTER COLUMN id SET DEFAULT nextval('yandex_direct_banner_rubrics_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY yandex_direct_banners ALTER COLUMN id SET DEFAULT nextval('yandex_direct_banners_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY yandex_direct_campaigns ALTER COLUMN id SET DEFAULT nextval('yandex_direct_campaigns_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY yandex_ips ALTER COLUMN id SET DEFAULT nextval('yandex_ips_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY yandex_map_coordinates ALTER COLUMN id SET DEFAULT nextval('yandex_map_coordinates_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY yandex_region_regions ALTER COLUMN id SET DEFAULT nextval('yandex_region_regions_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY yandex_regions ALTER COLUMN id SET DEFAULT nextval('yandex_regions_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY yandex_rubrics ALTER COLUMN id SET DEFAULT nextval('yandex_rubrics_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY yandex_rubrics_pc_rubrics ALTER COLUMN id SET DEFAULT nextval('yandex_rubrics_pc_rubrics_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY yandex_search_widgets ALTER COLUMN id SET DEFAULT nextval('yandex_search_widgets_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY zombie_rows ALTER COLUMN id SET DEFAULT nextval('zombie_rows_id_seq'::regclass); + + +SET search_path = search_hints, pg_catalog; + +-- +-- Name: id; Type: DEFAULT; Schema: search_hints; Owner: - +-- + +ALTER TABLE ONLY form_frequency ALTER COLUMN id SET DEFAULT nextval('form_frequency_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: search_hints; Owner: - +-- + +ALTER TABLE ONLY form_rubrics ALTER COLUMN id SET DEFAULT nextval('form_rubrics_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: search_hints; Owner: - +-- + +ALTER TABLE ONLY forms ALTER COLUMN id SET DEFAULT nextval('forms_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: search_hints; Owner: - +-- + +ALTER TABLE ONLY requests ALTER COLUMN id SET DEFAULT nextval('requests_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: search_hints; Owner: - +-- + +ALTER TABLE ONLY requests_for_load ALTER COLUMN id SET DEFAULT nextval('requests_for_load_id_seq'::regclass); + + +SET search_path = service_box, pg_catalog; + +-- +-- Name: id; Type: DEFAULT; Schema: service_box; Owner: - +-- + +ALTER TABLE ONLY web_searchers ALTER COLUMN id SET DEFAULT nextval('web_searchers_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: service_box; Owner: - +-- + +ALTER TABLE ONLY web_searchers_codes_stats ALTER COLUMN id SET DEFAULT nextval('web_searchers_codes_stats_id_seq'::regclass); + + +SET search_path = statistics, pg_catalog; + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY blog_post_statistic_total_by_days ALTER COLUMN id SET DEFAULT nextval('blog_post_statistic_total_by_days_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY blog_post_statistic_total_by_days_14_07 ALTER COLUMN id SET DEFAULT nextval('blog_post_statistic_total_by_days_id_seq'::regclass); + + +-- +-- Name: hits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY blog_post_statistic_total_by_days_14_07 ALTER COLUMN hits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY blog_post_statistic_total_by_days_14_08 ALTER COLUMN id SET DEFAULT nextval('blog_post_statistic_total_by_days_id_seq'::regclass); + + +-- +-- Name: hits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY blog_post_statistic_total_by_days_14_08 ALTER COLUMN hits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY blog_post_statistic_total_by_days_14_09 ALTER COLUMN id SET DEFAULT nextval('blog_post_statistic_total_by_days_id_seq'::regclass); + + +-- +-- Name: hits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY blog_post_statistic_total_by_days_14_09 ALTER COLUMN hits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY blog_post_statistic_total_by_days_14_10 ALTER COLUMN id SET DEFAULT nextval('blog_post_statistic_total_by_days_id_seq'::regclass); + + +-- +-- Name: hits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY blog_post_statistic_total_by_days_14_10 ALTER COLUMN hits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY blog_post_statistic_total_by_days_14_11 ALTER COLUMN id SET DEFAULT nextval('blog_post_statistic_total_by_days_id_seq'::regclass); + + +-- +-- Name: hits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY blog_post_statistic_total_by_days_14_11 ALTER COLUMN hits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY blog_post_statistic_total_by_days_14_12 ALTER COLUMN id SET DEFAULT nextval('blog_post_statistic_total_by_days_id_seq'::regclass); + + +-- +-- Name: hits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY blog_post_statistic_total_by_days_14_12 ALTER COLUMN hits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY blog_post_statistic_total_by_days_15_01 ALTER COLUMN id SET DEFAULT nextval('blog_post_statistic_total_by_days_id_seq'::regclass); + + +-- +-- Name: hits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY blog_post_statistic_total_by_days_15_01 ALTER COLUMN hits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY blog_post_statistic_totals ALTER COLUMN id SET DEFAULT nextval('blog_post_statistic_totals_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_activities_by_days ALTER COLUMN id SET DEFAULT nextval('company_statistic_activities_by_days_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_activities_by_days_15_09 ALTER COLUMN id SET DEFAULT nextval('company_statistic_activities_by_days_id_seq'::regclass); + + +-- +-- Name: value; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_activities_by_days_15_09 ALTER COLUMN value SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_activities_by_months ALTER COLUMN id SET DEFAULT nextval('company_statistic_activities_by_months_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_activities_by_months_15_09 ALTER COLUMN id SET DEFAULT nextval('company_statistic_activities_by_months_id_seq'::regclass); + + +-- +-- Name: value; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_activities_by_months_15_09 ALTER COLUMN value SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_activities_by_weeks ALTER COLUMN id SET DEFAULT nextval('company_statistic_activities_by_weeks_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_activities_by_weeks_15_09 ALTER COLUMN id SET DEFAULT nextval('company_statistic_activities_by_weeks_id_seq'::regclass); + + +-- +-- Name: value; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_activities_by_weeks_15_09 ALTER COLUMN value SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_activities_totals ALTER COLUMN id SET DEFAULT nextval('company_statistic_activities_totals_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months ALTER COLUMN id SET DEFAULT nextval('company_statistic_geo_by_months_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_09_04 ALTER COLUMN id SET DEFAULT nextval('company_statistic_geo_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_09_04 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_09_04 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_09_05 ALTER COLUMN id SET DEFAULT nextval('company_statistic_geo_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_09_05 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_09_05 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_09_06 ALTER COLUMN id SET DEFAULT nextval('company_statistic_geo_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_09_06 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_09_06 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_09_07 ALTER COLUMN id SET DEFAULT nextval('company_statistic_geo_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_09_07 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_09_07 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_09_08 ALTER COLUMN id SET DEFAULT nextval('company_statistic_geo_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_09_08 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_09_08 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_09_09 ALTER COLUMN id SET DEFAULT nextval('company_statistic_geo_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_09_09 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_09_09 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_09_10 ALTER COLUMN id SET DEFAULT nextval('company_statistic_geo_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_09_10 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_09_10 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_09_11 ALTER COLUMN id SET DEFAULT nextval('company_statistic_geo_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_09_11 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_09_11 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_09_12 ALTER COLUMN id SET DEFAULT nextval('company_statistic_geo_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_09_12 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_09_12 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_10_01 ALTER COLUMN id SET DEFAULT nextval('company_statistic_geo_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_10_01 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_10_01 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_10_02 ALTER COLUMN id SET DEFAULT nextval('company_statistic_geo_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_10_02 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_10_02 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_10_03 ALTER COLUMN id SET DEFAULT nextval('company_statistic_geo_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_10_03 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_10_03 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_10_04 ALTER COLUMN id SET DEFAULT nextval('company_statistic_geo_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_10_04 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_10_04 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_10_05 ALTER COLUMN id SET DEFAULT nextval('company_statistic_geo_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_10_05 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_10_05 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_10_06 ALTER COLUMN id SET DEFAULT nextval('company_statistic_geo_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_10_06 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_10_06 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_10_07 ALTER COLUMN id SET DEFAULT nextval('company_statistic_geo_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_10_07 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_10_07 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_10_08 ALTER COLUMN id SET DEFAULT nextval('company_statistic_geo_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_10_08 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_10_08 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_10_09 ALTER COLUMN id SET DEFAULT nextval('company_statistic_geo_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_10_09 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_10_09 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_10_10 ALTER COLUMN id SET DEFAULT nextval('company_statistic_geo_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_10_10 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_10_10 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_10_11 ALTER COLUMN id SET DEFAULT nextval('company_statistic_geo_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_10_11 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_10_11 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_10_12 ALTER COLUMN id SET DEFAULT nextval('company_statistic_geo_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_10_12 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_10_12 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_11_11 ALTER COLUMN id SET DEFAULT nextval('company_statistic_geo_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_11_11 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_11_11 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_11_12 ALTER COLUMN id SET DEFAULT nextval('company_statistic_geo_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_11_12 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_11_12 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_12_01 ALTER COLUMN id SET DEFAULT nextval('company_statistic_geo_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_12_01 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_12_01 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_12_02 ALTER COLUMN id SET DEFAULT nextval('company_statistic_geo_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_12_02 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_12_02 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_12_03 ALTER COLUMN id SET DEFAULT nextval('company_statistic_geo_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_12_03 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_12_03 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_12_04 ALTER COLUMN id SET DEFAULT nextval('company_statistic_geo_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_12_04 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_12_04 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_12_05 ALTER COLUMN id SET DEFAULT nextval('company_statistic_geo_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_12_05 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_12_05 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_12_06 ALTER COLUMN id SET DEFAULT nextval('company_statistic_geo_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_12_06 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_12_06 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_12_07 ALTER COLUMN id SET DEFAULT nextval('company_statistic_geo_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_12_07 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_12_07 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_12_08 ALTER COLUMN id SET DEFAULT nextval('company_statistic_geo_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_12_08 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_12_08 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_12_09 ALTER COLUMN id SET DEFAULT nextval('company_statistic_geo_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_12_09 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_12_09 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_12_10 ALTER COLUMN id SET DEFAULT nextval('company_statistic_geo_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_12_10 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_12_10 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_12_11 ALTER COLUMN id SET DEFAULT nextval('company_statistic_geo_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_12_11 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_12_11 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_12_12 ALTER COLUMN id SET DEFAULT nextval('company_statistic_geo_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_12_12 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_12_12 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_13_01 ALTER COLUMN id SET DEFAULT nextval('company_statistic_geo_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_13_01 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_13_01 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_13_02 ALTER COLUMN id SET DEFAULT nextval('company_statistic_geo_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_13_02 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_13_02 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_13_03 ALTER COLUMN id SET DEFAULT nextval('company_statistic_geo_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_13_03 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_13_03 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_13_04 ALTER COLUMN id SET DEFAULT nextval('company_statistic_geo_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_13_04 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_13_04 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_13_05 ALTER COLUMN id SET DEFAULT nextval('company_statistic_geo_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_13_05 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_13_05 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_13_06 ALTER COLUMN id SET DEFAULT nextval('company_statistic_geo_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_13_06 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_13_06 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_13_07 ALTER COLUMN id SET DEFAULT nextval('company_statistic_geo_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_13_07 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_13_07 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_13_08 ALTER COLUMN id SET DEFAULT nextval('company_statistic_geo_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_13_08 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_13_08 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_13_09 ALTER COLUMN id SET DEFAULT nextval('company_statistic_geo_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_13_09 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_13_09 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_13_10 ALTER COLUMN id SET DEFAULT nextval('company_statistic_geo_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_13_10 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_13_10 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_13_11 ALTER COLUMN id SET DEFAULT nextval('company_statistic_geo_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_13_11 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_13_11 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_13_12 ALTER COLUMN id SET DEFAULT nextval('company_statistic_geo_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_13_12 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_13_12 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_14_01 ALTER COLUMN id SET DEFAULT nextval('company_statistic_geo_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_14_01 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_14_01 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_14_02 ALTER COLUMN id SET DEFAULT nextval('company_statistic_geo_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_14_02 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_14_02 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_14_03 ALTER COLUMN id SET DEFAULT nextval('company_statistic_geo_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_14_03 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_14_03 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_14_04 ALTER COLUMN id SET DEFAULT nextval('company_statistic_geo_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_14_04 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_14_04 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_14_05 ALTER COLUMN id SET DEFAULT nextval('company_statistic_geo_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_14_05 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_14_05 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_14_06 ALTER COLUMN id SET DEFAULT nextval('company_statistic_geo_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_14_06 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_14_06 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_14_07 ALTER COLUMN id SET DEFAULT nextval('company_statistic_geo_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_14_07 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_14_07 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_14_08 ALTER COLUMN id SET DEFAULT nextval('company_statistic_geo_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_14_08 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_14_08 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_14_09 ALTER COLUMN id SET DEFAULT nextval('company_statistic_geo_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_14_09 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_14_09 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_14_10 ALTER COLUMN id SET DEFAULT nextval('company_statistic_geo_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_14_10 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_14_10 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_14_11 ALTER COLUMN id SET DEFAULT nextval('company_statistic_geo_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_14_11 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_14_11 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_14_12 ALTER COLUMN id SET DEFAULT nextval('company_statistic_geo_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_14_12 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_14_12 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_15_01 ALTER COLUMN id SET DEFAULT nextval('company_statistic_geo_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_15_01 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_15_01 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_15_09 ALTER COLUMN id SET DEFAULT nextval('company_statistic_geo_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_15_09 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_months_15_09 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks ALTER COLUMN id SET DEFAULT nextval('company_statistic_geo_by_weeks_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_09_04 ALTER COLUMN id SET DEFAULT nextval('company_statistic_geo_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_09_04 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_09_04 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_09_05 ALTER COLUMN id SET DEFAULT nextval('company_statistic_geo_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_09_05 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_09_05 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_09_06 ALTER COLUMN id SET DEFAULT nextval('company_statistic_geo_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_09_06 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_09_06 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_09_07 ALTER COLUMN id SET DEFAULT nextval('company_statistic_geo_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_09_07 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_09_07 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_09_08 ALTER COLUMN id SET DEFAULT nextval('company_statistic_geo_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_09_08 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_09_08 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_09_09 ALTER COLUMN id SET DEFAULT nextval('company_statistic_geo_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_09_09 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_09_09 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_09_10 ALTER COLUMN id SET DEFAULT nextval('company_statistic_geo_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_09_10 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_09_10 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_09_11 ALTER COLUMN id SET DEFAULT nextval('company_statistic_geo_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_09_11 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_09_11 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_09_12 ALTER COLUMN id SET DEFAULT nextval('company_statistic_geo_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_09_12 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_09_12 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_10_01 ALTER COLUMN id SET DEFAULT nextval('company_statistic_geo_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_10_01 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_10_01 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_10_02 ALTER COLUMN id SET DEFAULT nextval('company_statistic_geo_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_10_02 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_10_02 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_10_03 ALTER COLUMN id SET DEFAULT nextval('company_statistic_geo_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_10_03 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_10_03 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_10_04 ALTER COLUMN id SET DEFAULT nextval('company_statistic_geo_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_10_04 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_10_04 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_10_05 ALTER COLUMN id SET DEFAULT nextval('company_statistic_geo_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_10_05 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_10_05 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_10_06 ALTER COLUMN id SET DEFAULT nextval('company_statistic_geo_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_10_06 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_10_06 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_10_07 ALTER COLUMN id SET DEFAULT nextval('company_statistic_geo_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_10_07 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_10_07 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_10_08 ALTER COLUMN id SET DEFAULT nextval('company_statistic_geo_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_10_08 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_10_08 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_10_09 ALTER COLUMN id SET DEFAULT nextval('company_statistic_geo_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_10_09 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_10_09 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_10_10 ALTER COLUMN id SET DEFAULT nextval('company_statistic_geo_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_10_10 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_10_10 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_10_11 ALTER COLUMN id SET DEFAULT nextval('company_statistic_geo_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_10_11 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_10_11 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_10_12 ALTER COLUMN id SET DEFAULT nextval('company_statistic_geo_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_10_12 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_10_12 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_11_11 ALTER COLUMN id SET DEFAULT nextval('company_statistic_geo_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_11_11 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_11_11 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_11_12 ALTER COLUMN id SET DEFAULT nextval('company_statistic_geo_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_11_12 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_11_12 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_12_01 ALTER COLUMN id SET DEFAULT nextval('company_statistic_geo_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_12_01 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_12_01 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_12_02 ALTER COLUMN id SET DEFAULT nextval('company_statistic_geo_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_12_02 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_12_02 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_12_03 ALTER COLUMN id SET DEFAULT nextval('company_statistic_geo_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_12_03 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_12_03 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_12_04 ALTER COLUMN id SET DEFAULT nextval('company_statistic_geo_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_12_04 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_12_04 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_12_05 ALTER COLUMN id SET DEFAULT nextval('company_statistic_geo_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_12_05 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_12_05 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_12_06 ALTER COLUMN id SET DEFAULT nextval('company_statistic_geo_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_12_06 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_12_06 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_12_07 ALTER COLUMN id SET DEFAULT nextval('company_statistic_geo_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_12_07 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_12_07 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_12_08 ALTER COLUMN id SET DEFAULT nextval('company_statistic_geo_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_12_08 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_12_08 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_12_09 ALTER COLUMN id SET DEFAULT nextval('company_statistic_geo_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_12_09 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_12_09 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_12_10 ALTER COLUMN id SET DEFAULT nextval('company_statistic_geo_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_12_10 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_12_10 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_12_11 ALTER COLUMN id SET DEFAULT nextval('company_statistic_geo_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_12_11 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_12_11 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_12_12 ALTER COLUMN id SET DEFAULT nextval('company_statistic_geo_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_12_12 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_12_12 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_13_01 ALTER COLUMN id SET DEFAULT nextval('company_statistic_geo_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_13_01 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_13_01 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_13_02 ALTER COLUMN id SET DEFAULT nextval('company_statistic_geo_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_13_02 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_13_02 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_13_03 ALTER COLUMN id SET DEFAULT nextval('company_statistic_geo_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_13_03 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_13_03 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_13_04 ALTER COLUMN id SET DEFAULT nextval('company_statistic_geo_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_13_04 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_13_04 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_13_05 ALTER COLUMN id SET DEFAULT nextval('company_statistic_geo_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_13_05 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_13_05 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_13_06 ALTER COLUMN id SET DEFAULT nextval('company_statistic_geo_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_13_06 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_13_06 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_13_07 ALTER COLUMN id SET DEFAULT nextval('company_statistic_geo_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_13_07 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_13_07 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_13_08 ALTER COLUMN id SET DEFAULT nextval('company_statistic_geo_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_13_08 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_13_08 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_13_09 ALTER COLUMN id SET DEFAULT nextval('company_statistic_geo_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_13_09 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_13_09 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_13_10 ALTER COLUMN id SET DEFAULT nextval('company_statistic_geo_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_13_10 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_13_10 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_13_11 ALTER COLUMN id SET DEFAULT nextval('company_statistic_geo_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_13_11 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_13_11 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_13_12 ALTER COLUMN id SET DEFAULT nextval('company_statistic_geo_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_13_12 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_13_12 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_14_01 ALTER COLUMN id SET DEFAULT nextval('company_statistic_geo_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_14_01 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_14_01 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_14_02 ALTER COLUMN id SET DEFAULT nextval('company_statistic_geo_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_14_02 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_14_02 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_14_03 ALTER COLUMN id SET DEFAULT nextval('company_statistic_geo_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_14_03 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_14_03 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_14_04 ALTER COLUMN id SET DEFAULT nextval('company_statistic_geo_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_14_04 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_14_04 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_14_05 ALTER COLUMN id SET DEFAULT nextval('company_statistic_geo_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_14_05 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_14_05 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_14_06 ALTER COLUMN id SET DEFAULT nextval('company_statistic_geo_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_14_06 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_14_06 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_14_07 ALTER COLUMN id SET DEFAULT nextval('company_statistic_geo_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_14_07 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_14_07 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_14_08 ALTER COLUMN id SET DEFAULT nextval('company_statistic_geo_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_14_08 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_14_08 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_14_09 ALTER COLUMN id SET DEFAULT nextval('company_statistic_geo_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_14_09 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_14_09 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_14_10 ALTER COLUMN id SET DEFAULT nextval('company_statistic_geo_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_14_10 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_14_10 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_14_11 ALTER COLUMN id SET DEFAULT nextval('company_statistic_geo_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_14_11 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_14_11 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_14_12 ALTER COLUMN id SET DEFAULT nextval('company_statistic_geo_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_14_12 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_14_12 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_15_01 ALTER COLUMN id SET DEFAULT nextval('company_statistic_geo_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_15_01 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_15_01 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_15_09 ALTER COLUMN id SET DEFAULT nextval('company_statistic_geo_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_15_09 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks_15_09 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_months ALTER COLUMN id SET DEFAULT nextval('company_statistic_pages_by_months_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_months_09_04 ALTER COLUMN id SET DEFAULT nextval('company_statistic_pages_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_months_09_04 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_months_09_05 ALTER COLUMN id SET DEFAULT nextval('company_statistic_pages_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_months_09_05 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_months_09_06 ALTER COLUMN id SET DEFAULT nextval('company_statistic_pages_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_months_09_06 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_months_09_07 ALTER COLUMN id SET DEFAULT nextval('company_statistic_pages_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_months_09_07 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_months_09_08 ALTER COLUMN id SET DEFAULT nextval('company_statistic_pages_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_months_09_08 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_months_09_09 ALTER COLUMN id SET DEFAULT nextval('company_statistic_pages_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_months_09_09 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_months_09_10 ALTER COLUMN id SET DEFAULT nextval('company_statistic_pages_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_months_09_10 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_months_09_11 ALTER COLUMN id SET DEFAULT nextval('company_statistic_pages_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_months_09_11 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_months_09_12 ALTER COLUMN id SET DEFAULT nextval('company_statistic_pages_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_months_09_12 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_months_10_01 ALTER COLUMN id SET DEFAULT nextval('company_statistic_pages_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_months_10_01 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_months_10_02 ALTER COLUMN id SET DEFAULT nextval('company_statistic_pages_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_months_10_02 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_months_10_03 ALTER COLUMN id SET DEFAULT nextval('company_statistic_pages_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_months_10_03 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_months_10_04 ALTER COLUMN id SET DEFAULT nextval('company_statistic_pages_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_months_10_04 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_months_10_05 ALTER COLUMN id SET DEFAULT nextval('company_statistic_pages_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_months_10_05 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_months_10_06 ALTER COLUMN id SET DEFAULT nextval('company_statistic_pages_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_months_10_06 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_months_10_07 ALTER COLUMN id SET DEFAULT nextval('company_statistic_pages_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_months_10_07 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_months_10_08 ALTER COLUMN id SET DEFAULT nextval('company_statistic_pages_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_months_10_08 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_months_10_09 ALTER COLUMN id SET DEFAULT nextval('company_statistic_pages_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_months_10_09 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_months_10_10 ALTER COLUMN id SET DEFAULT nextval('company_statistic_pages_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_months_10_10 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_months_10_11 ALTER COLUMN id SET DEFAULT nextval('company_statistic_pages_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_months_10_11 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_months_10_12 ALTER COLUMN id SET DEFAULT nextval('company_statistic_pages_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_months_10_12 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_months_11_11 ALTER COLUMN id SET DEFAULT nextval('company_statistic_pages_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_months_11_11 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_months_11_12 ALTER COLUMN id SET DEFAULT nextval('company_statistic_pages_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_months_11_12 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_months_12_01 ALTER COLUMN id SET DEFAULT nextval('company_statistic_pages_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_months_12_01 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_months_12_02 ALTER COLUMN id SET DEFAULT nextval('company_statistic_pages_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_months_12_02 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_months_12_03 ALTER COLUMN id SET DEFAULT nextval('company_statistic_pages_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_months_12_03 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_months_12_04 ALTER COLUMN id SET DEFAULT nextval('company_statistic_pages_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_months_12_04 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_months_12_05 ALTER COLUMN id SET DEFAULT nextval('company_statistic_pages_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_months_12_05 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_months_12_06 ALTER COLUMN id SET DEFAULT nextval('company_statistic_pages_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_months_12_06 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_months_12_07 ALTER COLUMN id SET DEFAULT nextval('company_statistic_pages_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_months_12_07 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_months_12_08 ALTER COLUMN id SET DEFAULT nextval('company_statistic_pages_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_months_12_08 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_months_12_09 ALTER COLUMN id SET DEFAULT nextval('company_statistic_pages_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_months_12_09 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_months_12_10 ALTER COLUMN id SET DEFAULT nextval('company_statistic_pages_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_months_12_10 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_months_12_11 ALTER COLUMN id SET DEFAULT nextval('company_statistic_pages_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_months_12_11 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_months_12_12 ALTER COLUMN id SET DEFAULT nextval('company_statistic_pages_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_months_12_12 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_months_13_01 ALTER COLUMN id SET DEFAULT nextval('company_statistic_pages_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_months_13_01 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_months_13_02 ALTER COLUMN id SET DEFAULT nextval('company_statistic_pages_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_months_13_02 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_months_13_03 ALTER COLUMN id SET DEFAULT nextval('company_statistic_pages_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_months_13_03 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_months_13_04 ALTER COLUMN id SET DEFAULT nextval('company_statistic_pages_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_months_13_04 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_months_13_05 ALTER COLUMN id SET DEFAULT nextval('company_statistic_pages_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_months_13_05 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_months_13_06 ALTER COLUMN id SET DEFAULT nextval('company_statistic_pages_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_months_13_06 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_months_13_07 ALTER COLUMN id SET DEFAULT nextval('company_statistic_pages_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_months_13_07 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_months_13_08 ALTER COLUMN id SET DEFAULT nextval('company_statistic_pages_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_months_13_08 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_months_13_09 ALTER COLUMN id SET DEFAULT nextval('company_statistic_pages_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_months_13_09 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_months_13_10 ALTER COLUMN id SET DEFAULT nextval('company_statistic_pages_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_months_13_10 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_months_13_11 ALTER COLUMN id SET DEFAULT nextval('company_statistic_pages_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_months_13_11 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_months_13_12 ALTER COLUMN id SET DEFAULT nextval('company_statistic_pages_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_months_13_12 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_months_14_01 ALTER COLUMN id SET DEFAULT nextval('company_statistic_pages_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_months_14_01 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_months_14_02 ALTER COLUMN id SET DEFAULT nextval('company_statistic_pages_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_months_14_02 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_months_14_03 ALTER COLUMN id SET DEFAULT nextval('company_statistic_pages_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_months_14_03 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_months_14_04 ALTER COLUMN id SET DEFAULT nextval('company_statistic_pages_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_months_14_04 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_months_14_05 ALTER COLUMN id SET DEFAULT nextval('company_statistic_pages_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_months_14_05 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_months_14_06 ALTER COLUMN id SET DEFAULT nextval('company_statistic_pages_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_months_14_06 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_months_14_07 ALTER COLUMN id SET DEFAULT nextval('company_statistic_pages_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_months_14_07 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_months_14_08 ALTER COLUMN id SET DEFAULT nextval('company_statistic_pages_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_months_14_08 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_months_14_09 ALTER COLUMN id SET DEFAULT nextval('company_statistic_pages_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_months_14_09 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_months_14_10 ALTER COLUMN id SET DEFAULT nextval('company_statistic_pages_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_months_14_10 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_months_14_11 ALTER COLUMN id SET DEFAULT nextval('company_statistic_pages_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_months_14_11 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_months_14_12 ALTER COLUMN id SET DEFAULT nextval('company_statistic_pages_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_months_14_12 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_months_15_01 ALTER COLUMN id SET DEFAULT nextval('company_statistic_pages_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_months_15_01 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_months_15_09 ALTER COLUMN id SET DEFAULT nextval('company_statistic_pages_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_months_15_09 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_weeks ALTER COLUMN id SET DEFAULT nextval('company_statistic_pages_by_weeks_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_weeks_09_04 ALTER COLUMN id SET DEFAULT nextval('company_statistic_pages_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_weeks_09_04 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_weeks_09_05 ALTER COLUMN id SET DEFAULT nextval('company_statistic_pages_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_weeks_09_05 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_weeks_09_06 ALTER COLUMN id SET DEFAULT nextval('company_statistic_pages_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_weeks_09_06 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_weeks_09_07 ALTER COLUMN id SET DEFAULT nextval('company_statistic_pages_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_weeks_09_07 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_weeks_09_08 ALTER COLUMN id SET DEFAULT nextval('company_statistic_pages_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_weeks_09_08 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_weeks_09_09 ALTER COLUMN id SET DEFAULT nextval('company_statistic_pages_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_weeks_09_09 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_weeks_09_10 ALTER COLUMN id SET DEFAULT nextval('company_statistic_pages_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_weeks_09_10 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_weeks_09_11 ALTER COLUMN id SET DEFAULT nextval('company_statistic_pages_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_weeks_09_11 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_weeks_09_12 ALTER COLUMN id SET DEFAULT nextval('company_statistic_pages_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_weeks_09_12 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_weeks_10_01 ALTER COLUMN id SET DEFAULT nextval('company_statistic_pages_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_weeks_10_01 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_weeks_10_02 ALTER COLUMN id SET DEFAULT nextval('company_statistic_pages_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_weeks_10_02 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_weeks_10_03 ALTER COLUMN id SET DEFAULT nextval('company_statistic_pages_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_weeks_10_03 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_weeks_10_04 ALTER COLUMN id SET DEFAULT nextval('company_statistic_pages_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_weeks_10_04 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_weeks_10_05 ALTER COLUMN id SET DEFAULT nextval('company_statistic_pages_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_weeks_10_05 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_weeks_10_06 ALTER COLUMN id SET DEFAULT nextval('company_statistic_pages_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_weeks_10_06 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_weeks_10_07 ALTER COLUMN id SET DEFAULT nextval('company_statistic_pages_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_weeks_10_07 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_weeks_10_08 ALTER COLUMN id SET DEFAULT nextval('company_statistic_pages_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_weeks_10_08 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_weeks_10_09 ALTER COLUMN id SET DEFAULT nextval('company_statistic_pages_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_weeks_10_09 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_weeks_10_10 ALTER COLUMN id SET DEFAULT nextval('company_statistic_pages_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_weeks_10_10 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_weeks_10_11 ALTER COLUMN id SET DEFAULT nextval('company_statistic_pages_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_weeks_10_11 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_weeks_10_12 ALTER COLUMN id SET DEFAULT nextval('company_statistic_pages_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_weeks_10_12 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_weeks_11_11 ALTER COLUMN id SET DEFAULT nextval('company_statistic_pages_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_weeks_11_11 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_weeks_11_12 ALTER COLUMN id SET DEFAULT nextval('company_statistic_pages_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_weeks_11_12 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_weeks_12_01 ALTER COLUMN id SET DEFAULT nextval('company_statistic_pages_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_weeks_12_01 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_weeks_12_02 ALTER COLUMN id SET DEFAULT nextval('company_statistic_pages_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_weeks_12_02 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_weeks_12_03 ALTER COLUMN id SET DEFAULT nextval('company_statistic_pages_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_weeks_12_03 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_weeks_12_04 ALTER COLUMN id SET DEFAULT nextval('company_statistic_pages_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_weeks_12_04 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_weeks_12_05 ALTER COLUMN id SET DEFAULT nextval('company_statistic_pages_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_weeks_12_05 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_weeks_12_06 ALTER COLUMN id SET DEFAULT nextval('company_statistic_pages_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_weeks_12_06 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_weeks_12_07 ALTER COLUMN id SET DEFAULT nextval('company_statistic_pages_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_weeks_12_07 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_weeks_12_08 ALTER COLUMN id SET DEFAULT nextval('company_statistic_pages_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_weeks_12_08 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_weeks_12_09 ALTER COLUMN id SET DEFAULT nextval('company_statistic_pages_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_weeks_12_09 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_weeks_12_10 ALTER COLUMN id SET DEFAULT nextval('company_statistic_pages_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_weeks_12_10 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_weeks_12_11 ALTER COLUMN id SET DEFAULT nextval('company_statistic_pages_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_weeks_12_11 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_weeks_12_12 ALTER COLUMN id SET DEFAULT nextval('company_statistic_pages_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_weeks_12_12 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_weeks_13_01 ALTER COLUMN id SET DEFAULT nextval('company_statistic_pages_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_weeks_13_01 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_weeks_13_02 ALTER COLUMN id SET DEFAULT nextval('company_statistic_pages_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_weeks_13_02 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_weeks_13_03 ALTER COLUMN id SET DEFAULT nextval('company_statistic_pages_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_weeks_13_03 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_weeks_13_04 ALTER COLUMN id SET DEFAULT nextval('company_statistic_pages_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_weeks_13_04 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_weeks_13_05 ALTER COLUMN id SET DEFAULT nextval('company_statistic_pages_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_weeks_13_05 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_weeks_13_06 ALTER COLUMN id SET DEFAULT nextval('company_statistic_pages_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_weeks_13_06 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_weeks_13_07 ALTER COLUMN id SET DEFAULT nextval('company_statistic_pages_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_weeks_13_07 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_weeks_13_08 ALTER COLUMN id SET DEFAULT nextval('company_statistic_pages_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_weeks_13_08 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_weeks_13_09 ALTER COLUMN id SET DEFAULT nextval('company_statistic_pages_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_weeks_13_09 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_weeks_13_10 ALTER COLUMN id SET DEFAULT nextval('company_statistic_pages_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_weeks_13_10 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_weeks_13_11 ALTER COLUMN id SET DEFAULT nextval('company_statistic_pages_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_weeks_13_11 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_weeks_13_12 ALTER COLUMN id SET DEFAULT nextval('company_statistic_pages_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_weeks_13_12 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_weeks_14_01 ALTER COLUMN id SET DEFAULT nextval('company_statistic_pages_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_weeks_14_01 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_weeks_14_02 ALTER COLUMN id SET DEFAULT nextval('company_statistic_pages_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_weeks_14_02 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_weeks_14_03 ALTER COLUMN id SET DEFAULT nextval('company_statistic_pages_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_weeks_14_03 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_weeks_14_04 ALTER COLUMN id SET DEFAULT nextval('company_statistic_pages_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_weeks_14_04 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_weeks_14_05 ALTER COLUMN id SET DEFAULT nextval('company_statistic_pages_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_weeks_14_05 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_weeks_14_06 ALTER COLUMN id SET DEFAULT nextval('company_statistic_pages_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_weeks_14_06 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_weeks_14_07 ALTER COLUMN id SET DEFAULT nextval('company_statistic_pages_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_weeks_14_07 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_weeks_14_08 ALTER COLUMN id SET DEFAULT nextval('company_statistic_pages_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_weeks_14_08 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_weeks_14_09 ALTER COLUMN id SET DEFAULT nextval('company_statistic_pages_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_weeks_14_09 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_weeks_14_10 ALTER COLUMN id SET DEFAULT nextval('company_statistic_pages_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_weeks_14_10 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_weeks_14_11 ALTER COLUMN id SET DEFAULT nextval('company_statistic_pages_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_weeks_14_11 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_weeks_14_12 ALTER COLUMN id SET DEFAULT nextval('company_statistic_pages_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_weeks_14_12 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_weeks_15_01 ALTER COLUMN id SET DEFAULT nextval('company_statistic_pages_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_weeks_15_01 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_weeks_15_09 ALTER COLUMN id SET DEFAULT nextval('company_statistic_pages_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_pages_by_weeks_15_09 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_months ALTER COLUMN id SET DEFAULT nextval('company_statistic_referers_by_months_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_months_09_07 ALTER COLUMN id SET DEFAULT nextval('company_statistic_referers_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_months_09_07 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_months_09_08 ALTER COLUMN id SET DEFAULT nextval('company_statistic_referers_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_months_09_08 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_months_09_09 ALTER COLUMN id SET DEFAULT nextval('company_statistic_referers_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_months_09_09 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_months_09_10 ALTER COLUMN id SET DEFAULT nextval('company_statistic_referers_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_months_09_10 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_months_09_11 ALTER COLUMN id SET DEFAULT nextval('company_statistic_referers_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_months_09_11 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_months_09_12 ALTER COLUMN id SET DEFAULT nextval('company_statistic_referers_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_months_09_12 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_months_10_01 ALTER COLUMN id SET DEFAULT nextval('company_statistic_referers_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_months_10_01 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_months_10_02 ALTER COLUMN id SET DEFAULT nextval('company_statistic_referers_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_months_10_02 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_months_10_03 ALTER COLUMN id SET DEFAULT nextval('company_statistic_referers_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_months_10_03 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_months_10_04 ALTER COLUMN id SET DEFAULT nextval('company_statistic_referers_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_months_10_04 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_months_10_05 ALTER COLUMN id SET DEFAULT nextval('company_statistic_referers_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_months_10_05 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_months_10_06 ALTER COLUMN id SET DEFAULT nextval('company_statistic_referers_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_months_10_06 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_months_10_07 ALTER COLUMN id SET DEFAULT nextval('company_statistic_referers_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_months_10_07 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_months_10_08 ALTER COLUMN id SET DEFAULT nextval('company_statistic_referers_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_months_10_08 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_months_10_09 ALTER COLUMN id SET DEFAULT nextval('company_statistic_referers_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_months_10_09 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_months_10_10 ALTER COLUMN id SET DEFAULT nextval('company_statistic_referers_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_months_10_10 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_months_10_11 ALTER COLUMN id SET DEFAULT nextval('company_statistic_referers_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_months_10_11 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_months_10_12 ALTER COLUMN id SET DEFAULT nextval('company_statistic_referers_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_months_10_12 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_months_11_11 ALTER COLUMN id SET DEFAULT nextval('company_statistic_referers_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_months_11_11 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_months_11_12 ALTER COLUMN id SET DEFAULT nextval('company_statistic_referers_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_months_11_12 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_months_12_01 ALTER COLUMN id SET DEFAULT nextval('company_statistic_referers_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_months_12_01 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_months_12_02 ALTER COLUMN id SET DEFAULT nextval('company_statistic_referers_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_months_12_02 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_months_12_03 ALTER COLUMN id SET DEFAULT nextval('company_statistic_referers_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_months_12_03 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_months_12_04 ALTER COLUMN id SET DEFAULT nextval('company_statistic_referers_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_months_12_04 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_months_12_05 ALTER COLUMN id SET DEFAULT nextval('company_statistic_referers_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_months_12_05 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_months_12_06 ALTER COLUMN id SET DEFAULT nextval('company_statistic_referers_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_months_12_06 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_months_12_07 ALTER COLUMN id SET DEFAULT nextval('company_statistic_referers_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_months_12_07 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_months_12_08 ALTER COLUMN id SET DEFAULT nextval('company_statistic_referers_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_months_12_08 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_months_12_09 ALTER COLUMN id SET DEFAULT nextval('company_statistic_referers_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_months_12_09 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_months_12_10 ALTER COLUMN id SET DEFAULT nextval('company_statistic_referers_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_months_12_10 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_months_12_11 ALTER COLUMN id SET DEFAULT nextval('company_statistic_referers_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_months_12_11 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_months_12_12 ALTER COLUMN id SET DEFAULT nextval('company_statistic_referers_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_months_12_12 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_months_13_01 ALTER COLUMN id SET DEFAULT nextval('company_statistic_referers_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_months_13_01 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_months_13_02 ALTER COLUMN id SET DEFAULT nextval('company_statistic_referers_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_months_13_02 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_months_13_03 ALTER COLUMN id SET DEFAULT nextval('company_statistic_referers_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_months_13_03 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_months_13_04 ALTER COLUMN id SET DEFAULT nextval('company_statistic_referers_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_months_13_04 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_months_13_05 ALTER COLUMN id SET DEFAULT nextval('company_statistic_referers_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_months_13_05 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_months_13_06 ALTER COLUMN id SET DEFAULT nextval('company_statistic_referers_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_months_13_06 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_months_13_07 ALTER COLUMN id SET DEFAULT nextval('company_statistic_referers_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_months_13_07 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_months_13_08 ALTER COLUMN id SET DEFAULT nextval('company_statistic_referers_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_months_13_08 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_months_13_09 ALTER COLUMN id SET DEFAULT nextval('company_statistic_referers_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_months_13_09 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_months_13_10 ALTER COLUMN id SET DEFAULT nextval('company_statistic_referers_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_months_13_10 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_months_13_11 ALTER COLUMN id SET DEFAULT nextval('company_statistic_referers_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_months_13_11 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_months_13_12 ALTER COLUMN id SET DEFAULT nextval('company_statistic_referers_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_months_13_12 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_months_14_01 ALTER COLUMN id SET DEFAULT nextval('company_statistic_referers_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_months_14_01 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_months_14_02 ALTER COLUMN id SET DEFAULT nextval('company_statistic_referers_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_months_14_02 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_months_14_03 ALTER COLUMN id SET DEFAULT nextval('company_statistic_referers_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_months_14_03 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_months_14_04 ALTER COLUMN id SET DEFAULT nextval('company_statistic_referers_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_months_14_04 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_months_14_05 ALTER COLUMN id SET DEFAULT nextval('company_statistic_referers_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_months_14_05 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_months_14_06 ALTER COLUMN id SET DEFAULT nextval('company_statistic_referers_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_months_14_06 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_months_14_07 ALTER COLUMN id SET DEFAULT nextval('company_statistic_referers_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_months_14_07 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_months_14_08 ALTER COLUMN id SET DEFAULT nextval('company_statistic_referers_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_months_14_08 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_months_14_09 ALTER COLUMN id SET DEFAULT nextval('company_statistic_referers_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_months_14_09 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_months_14_10 ALTER COLUMN id SET DEFAULT nextval('company_statistic_referers_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_months_14_10 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_months_14_11 ALTER COLUMN id SET DEFAULT nextval('company_statistic_referers_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_months_14_11 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_months_14_12 ALTER COLUMN id SET DEFAULT nextval('company_statistic_referers_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_months_14_12 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_months_15_01 ALTER COLUMN id SET DEFAULT nextval('company_statistic_referers_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_months_15_01 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_months_15_08 ALTER COLUMN id SET DEFAULT nextval('company_statistic_referers_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_months_15_08 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_months_15_09 ALTER COLUMN id SET DEFAULT nextval('company_statistic_referers_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_months_15_09 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_weeks ALTER COLUMN id SET DEFAULT nextval('company_statistic_referers_by_weeks_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_weeks_09_06 ALTER COLUMN id SET DEFAULT nextval('company_statistic_referers_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_weeks_09_06 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_weeks_09_07 ALTER COLUMN id SET DEFAULT nextval('company_statistic_referers_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_weeks_09_07 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_weeks_09_08 ALTER COLUMN id SET DEFAULT nextval('company_statistic_referers_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_weeks_09_08 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_weeks_09_09 ALTER COLUMN id SET DEFAULT nextval('company_statistic_referers_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_weeks_09_09 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_weeks_09_10 ALTER COLUMN id SET DEFAULT nextval('company_statistic_referers_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_weeks_09_10 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_weeks_09_11 ALTER COLUMN id SET DEFAULT nextval('company_statistic_referers_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_weeks_09_11 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_weeks_09_12 ALTER COLUMN id SET DEFAULT nextval('company_statistic_referers_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_weeks_09_12 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_weeks_10_01 ALTER COLUMN id SET DEFAULT nextval('company_statistic_referers_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_weeks_10_01 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_weeks_10_02 ALTER COLUMN id SET DEFAULT nextval('company_statistic_referers_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_weeks_10_02 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_weeks_10_03 ALTER COLUMN id SET DEFAULT nextval('company_statistic_referers_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_weeks_10_03 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_weeks_10_04 ALTER COLUMN id SET DEFAULT nextval('company_statistic_referers_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_weeks_10_04 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_weeks_10_05 ALTER COLUMN id SET DEFAULT nextval('company_statistic_referers_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_weeks_10_05 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_weeks_10_06 ALTER COLUMN id SET DEFAULT nextval('company_statistic_referers_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_weeks_10_06 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_weeks_10_07 ALTER COLUMN id SET DEFAULT nextval('company_statistic_referers_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_weeks_10_07 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_weeks_10_08 ALTER COLUMN id SET DEFAULT nextval('company_statistic_referers_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_weeks_10_08 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_weeks_10_09 ALTER COLUMN id SET DEFAULT nextval('company_statistic_referers_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_weeks_10_09 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_weeks_10_10 ALTER COLUMN id SET DEFAULT nextval('company_statistic_referers_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_weeks_10_10 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_weeks_10_11 ALTER COLUMN id SET DEFAULT nextval('company_statistic_referers_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_weeks_10_11 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_weeks_10_12 ALTER COLUMN id SET DEFAULT nextval('company_statistic_referers_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_weeks_10_12 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_weeks_11_11 ALTER COLUMN id SET DEFAULT nextval('company_statistic_referers_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_weeks_11_11 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_weeks_11_12 ALTER COLUMN id SET DEFAULT nextval('company_statistic_referers_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_weeks_11_12 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_weeks_12_01 ALTER COLUMN id SET DEFAULT nextval('company_statistic_referers_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_weeks_12_01 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_weeks_12_02 ALTER COLUMN id SET DEFAULT nextval('company_statistic_referers_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_weeks_12_02 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_weeks_12_03 ALTER COLUMN id SET DEFAULT nextval('company_statistic_referers_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_weeks_12_03 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_weeks_12_04 ALTER COLUMN id SET DEFAULT nextval('company_statistic_referers_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_weeks_12_04 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_weeks_12_05 ALTER COLUMN id SET DEFAULT nextval('company_statistic_referers_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_weeks_12_05 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_weeks_12_06 ALTER COLUMN id SET DEFAULT nextval('company_statistic_referers_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_weeks_12_06 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_weeks_12_07 ALTER COLUMN id SET DEFAULT nextval('company_statistic_referers_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_weeks_12_07 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_weeks_12_08 ALTER COLUMN id SET DEFAULT nextval('company_statistic_referers_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_weeks_12_08 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_weeks_12_09 ALTER COLUMN id SET DEFAULT nextval('company_statistic_referers_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_weeks_12_09 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_weeks_12_10 ALTER COLUMN id SET DEFAULT nextval('company_statistic_referers_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_weeks_12_10 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_weeks_12_11 ALTER COLUMN id SET DEFAULT nextval('company_statistic_referers_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_weeks_12_11 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_weeks_12_12 ALTER COLUMN id SET DEFAULT nextval('company_statistic_referers_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_weeks_12_12 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_weeks_13_01 ALTER COLUMN id SET DEFAULT nextval('company_statistic_referers_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_weeks_13_01 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_weeks_13_02 ALTER COLUMN id SET DEFAULT nextval('company_statistic_referers_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_weeks_13_02 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_weeks_13_03 ALTER COLUMN id SET DEFAULT nextval('company_statistic_referers_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_weeks_13_03 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_weeks_13_04 ALTER COLUMN id SET DEFAULT nextval('company_statistic_referers_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_weeks_13_04 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_weeks_13_05 ALTER COLUMN id SET DEFAULT nextval('company_statistic_referers_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_weeks_13_05 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_weeks_13_06 ALTER COLUMN id SET DEFAULT nextval('company_statistic_referers_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_weeks_13_06 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_weeks_13_07 ALTER COLUMN id SET DEFAULT nextval('company_statistic_referers_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_weeks_13_07 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_weeks_13_08 ALTER COLUMN id SET DEFAULT nextval('company_statistic_referers_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_weeks_13_08 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_weeks_13_09 ALTER COLUMN id SET DEFAULT nextval('company_statistic_referers_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_weeks_13_09 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_weeks_13_10 ALTER COLUMN id SET DEFAULT nextval('company_statistic_referers_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_weeks_13_10 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_weeks_13_11 ALTER COLUMN id SET DEFAULT nextval('company_statistic_referers_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_weeks_13_11 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_weeks_13_12 ALTER COLUMN id SET DEFAULT nextval('company_statistic_referers_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_weeks_13_12 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_weeks_14_01 ALTER COLUMN id SET DEFAULT nextval('company_statistic_referers_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_weeks_14_01 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_weeks_14_02 ALTER COLUMN id SET DEFAULT nextval('company_statistic_referers_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_weeks_14_02 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_weeks_14_03 ALTER COLUMN id SET DEFAULT nextval('company_statistic_referers_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_weeks_14_03 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_weeks_14_04 ALTER COLUMN id SET DEFAULT nextval('company_statistic_referers_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_weeks_14_04 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_weeks_14_05 ALTER COLUMN id SET DEFAULT nextval('company_statistic_referers_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_weeks_14_05 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_weeks_14_06 ALTER COLUMN id SET DEFAULT nextval('company_statistic_referers_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_weeks_14_06 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_weeks_14_07 ALTER COLUMN id SET DEFAULT nextval('company_statistic_referers_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_weeks_14_07 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_weeks_14_08 ALTER COLUMN id SET DEFAULT nextval('company_statistic_referers_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_weeks_14_08 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_weeks_14_09 ALTER COLUMN id SET DEFAULT nextval('company_statistic_referers_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_weeks_14_09 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_weeks_14_10 ALTER COLUMN id SET DEFAULT nextval('company_statistic_referers_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_weeks_14_10 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_weeks_14_11 ALTER COLUMN id SET DEFAULT nextval('company_statistic_referers_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_weeks_14_11 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_weeks_14_12 ALTER COLUMN id SET DEFAULT nextval('company_statistic_referers_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_weeks_14_12 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_weeks_15_01 ALTER COLUMN id SET DEFAULT nextval('company_statistic_referers_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_weeks_15_01 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_weeks_15_08 ALTER COLUMN id SET DEFAULT nextval('company_statistic_referers_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_weeks_15_08 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_weeks_15_09 ALTER COLUMN id SET DEFAULT nextval('company_statistic_referers_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_referers_by_weeks_15_09 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_days_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_09_11 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_days_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_09_11 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_09_11 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_09_12 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_days_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_09_12 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_09_12 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_10_01 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_days_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_10_01 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_10_01 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_10_02 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_days_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_10_02 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_10_02 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_10_03 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_days_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_10_03 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_10_03 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_10_04 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_days_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_10_04 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_10_04 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_10_05 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_days_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_10_05 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_10_05 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_10_06 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_days_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_10_06 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_10_06 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_10_07 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_days_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_10_07 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_10_07 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_10_08 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_days_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_10_08 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_10_08 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_10_09 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_days_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_10_09 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_10_09 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_10_10 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_days_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_10_10 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_10_10 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_10_11 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_days_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_10_11 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_10_11 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_10_12 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_days_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_10_12 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_10_12 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_11_11 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_days_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_11_11 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_11_11 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_11_12 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_days_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_11_12 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_11_12 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_12_01 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_days_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_12_01 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_12_01 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_12_02 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_days_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_12_02 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_12_02 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_12_03 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_days_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_12_03 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_12_03 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_12_04 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_days_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_12_04 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_12_04 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_12_05 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_days_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_12_05 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_12_05 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_12_06 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_days_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_12_06 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_12_06 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_12_07 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_days_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_12_07 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_12_07 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_12_08 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_days_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_12_08 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_12_08 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_12_09 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_days_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_12_09 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_12_09 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_12_10 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_days_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_12_10 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_12_10 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_12_11 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_days_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_12_11 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_12_11 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_12_12 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_days_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_12_12 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_12_12 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_13_01 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_days_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_13_01 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_13_01 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_13_02 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_days_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_13_02 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_13_02 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_13_03 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_days_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_13_03 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_13_03 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_13_04 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_days_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_13_04 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_13_04 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_13_05 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_days_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_13_05 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_13_05 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_13_06 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_days_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_13_06 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_13_06 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_13_07 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_days_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_13_07 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_13_07 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_13_08 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_days_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_13_08 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_13_08 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_13_09 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_days_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_13_09 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_13_09 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_13_10 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_days_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_13_10 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_13_10 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_13_11 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_days_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_13_11 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_13_11 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_13_12 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_days_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_13_12 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_13_12 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_14_01 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_days_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_14_01 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_14_01 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_14_02 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_days_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_14_02 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_14_02 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_14_03 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_days_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_14_03 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_14_03 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_14_04 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_days_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_14_04 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_14_04 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_14_05 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_days_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_14_05 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_14_05 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_14_06 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_days_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_14_06 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_14_06 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_14_07 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_days_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_14_07 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_14_07 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_14_08 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_days_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_14_08 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_14_08 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_14_09 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_days_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_14_09 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_14_09 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_14_10 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_days_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_14_10 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_14_10 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_14_11 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_days_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_14_11 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_14_11 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_14_12 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_days_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_14_12 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_14_12 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_15_01 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_days_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_15_01 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_15_01 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_15_08 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_days_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_15_08 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_15_08 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_15_09 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_days_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_15_09 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_days_15_09 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_months_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_09_04 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_09_04 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_09_04 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_09_05 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_09_05 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_09_05 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_09_06 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_09_06 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_09_06 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_09_07 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_09_07 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_09_07 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_09_08 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_09_08 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_09_08 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_09_09 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_09_09 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_09_09 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_09_10 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_09_10 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_09_10 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_09_11 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_09_11 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_09_11 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_09_12 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_09_12 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_09_12 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_10_01 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_10_01 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_10_01 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_10_02 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_10_02 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_10_02 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_10_03 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_10_03 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_10_03 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_10_04 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_10_04 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_10_04 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_10_05 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_10_05 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_10_05 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_10_06 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_10_06 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_10_06 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_10_07 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_10_07 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_10_07 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_10_08 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_10_08 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_10_08 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_10_09 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_10_09 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_10_09 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_10_10 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_10_10 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_10_10 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_10_11 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_10_11 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_10_11 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_10_12 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_10_12 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_10_12 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_11_11 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_11_11 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_11_11 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_11_12 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_11_12 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_11_12 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_12_01 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_12_01 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_12_01 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_12_02 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_12_02 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_12_02 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_12_03 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_12_03 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_12_03 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_12_04 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_12_04 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_12_04 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_12_05 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_12_05 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_12_05 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_12_06 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_12_06 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_12_06 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_12_07 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_12_07 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_12_07 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_12_08 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_12_08 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_12_08 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_12_09 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_12_09 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_12_09 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_12_10 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_12_10 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_12_10 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_12_11 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_12_11 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_12_11 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_12_12 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_12_12 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_12_12 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_13_01 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_13_01 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_13_01 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_13_02 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_13_02 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_13_02 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_13_03 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_13_03 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_13_03 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_13_04 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_13_04 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_13_04 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_13_05 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_13_05 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_13_05 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_13_06 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_13_06 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_13_06 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_13_07 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_13_07 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_13_07 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_13_08 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_13_08 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_13_08 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_13_09 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_13_09 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_13_09 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_13_10 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_13_10 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_13_10 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_13_11 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_13_11 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_13_11 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_13_12 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_13_12 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_13_12 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_14_01 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_14_01 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_14_01 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_14_02 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_14_02 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_14_02 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_14_03 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_14_03 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_14_03 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_14_04 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_14_04 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_14_04 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_14_05 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_14_05 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_14_05 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_14_06 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_14_06 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_14_06 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_14_07 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_14_07 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_14_07 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_14_08 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_14_08 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_14_08 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_14_09 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_14_09 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_14_09 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_14_10 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_14_10 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_14_10 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_14_11 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_14_11 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_14_11 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_14_12 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_14_12 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_14_12 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_15_01 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_15_01 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_15_01 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_15_08 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_15_08 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_15_08 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_15_09 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_months_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_15_09 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_months_15_09 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_weeks_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_09_04 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_09_04 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_09_04 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_09_05 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_09_05 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_09_05 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_09_06 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_09_06 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_09_06 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_09_07 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_09_07 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_09_07 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_09_08 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_09_08 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_09_08 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_09_09 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_09_09 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_09_09 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_09_10 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_09_10 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_09_10 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_09_11 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_09_11 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_09_11 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_09_12 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_09_12 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_09_12 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_10_01 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_10_01 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_10_01 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_10_02 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_10_02 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_10_02 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_10_03 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_10_03 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_10_03 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_10_04 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_10_04 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_10_04 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_10_05 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_10_05 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_10_05 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_10_06 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_10_06 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_10_06 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_10_07 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_10_07 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_10_07 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_10_08 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_10_08 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_10_08 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_10_09 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_10_09 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_10_09 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_10_10 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_10_10 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_10_10 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_10_11 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_10_11 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_10_11 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_10_12 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_10_12 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_10_12 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_11_11 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_11_11 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_11_11 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_11_12 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_11_12 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_11_12 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_12_01 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_12_01 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_12_01 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_12_02 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_12_02 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_12_02 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_12_03 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_12_03 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_12_03 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_12_04 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_12_04 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_12_04 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_12_05 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_12_05 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_12_05 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_12_06 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_12_06 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_12_06 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_12_07 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_12_07 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_12_07 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_12_08 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_12_08 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_12_08 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_12_09 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_12_09 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_12_09 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_12_10 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_12_10 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_12_10 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_12_11 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_12_11 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_12_11 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_12_12 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_12_12 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_12_12 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_13_01 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_13_01 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_13_01 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_13_02 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_13_02 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_13_02 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_13_03 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_13_03 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_13_03 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_13_04 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_13_04 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_13_04 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_13_05 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_13_05 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_13_05 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_13_06 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_13_06 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_13_06 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_13_07 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_13_07 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_13_07 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_13_08 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_13_08 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_13_08 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_13_09 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_13_09 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_13_09 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_13_10 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_13_10 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_13_10 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_13_11 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_13_11 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_13_11 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_13_12 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_13_12 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_13_12 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_14_01 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_14_01 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_14_01 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_14_02 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_14_02 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_14_02 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_14_03 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_14_03 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_14_03 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_14_04 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_14_04 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_14_04 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_14_05 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_14_05 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_14_05 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_14_06 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_14_06 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_14_06 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_14_07 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_14_07 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_14_07 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_14_08 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_14_08 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_14_08 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_14_09 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_14_09 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_14_09 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_14_10 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_14_10 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_14_10 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_14_11 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_14_11 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_14_11 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_14_12 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_14_12 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_14_12 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_15_01 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_15_01 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_15_01 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_15_08 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_15_08 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_15_08 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_15_09 ALTER COLUMN id SET DEFAULT nextval('company_statistic_total_by_weeks_id_seq'::regclass); + + +-- +-- Name: pages; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_15_09 ALTER COLUMN pages SET DEFAULT 0; + + +-- +-- Name: visits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks_15_09 ALTER COLUMN visits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY company_statistic_totals ALTER COLUMN id SET DEFAULT nextval('company_statistic_totals_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY entities_statistic_by_region ALTER COLUMN id SET DEFAULT nextval('entities_statistic_by_region_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY news_statistic_mainpage_by_days ALTER COLUMN id SET DEFAULT nextval('news_statistic_mainpage_by_days_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY news_statistic_mainpage_by_days_11_10 ALTER COLUMN id SET DEFAULT nextval('news_statistic_mainpage_by_days_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY news_statistic_mainpage_by_days_11_11 ALTER COLUMN id SET DEFAULT nextval('news_statistic_mainpage_by_days_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY news_statistic_mainpage_by_days_11_12 ALTER COLUMN id SET DEFAULT nextval('news_statistic_mainpage_by_days_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY news_statistic_mainpage_by_days_12_01 ALTER COLUMN id SET DEFAULT nextval('news_statistic_mainpage_by_days_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY news_statistic_mainpage_by_days_12_02 ALTER COLUMN id SET DEFAULT nextval('news_statistic_mainpage_by_days_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY news_statistic_mainpage_by_days_12_03 ALTER COLUMN id SET DEFAULT nextval('news_statistic_mainpage_by_days_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY news_statistic_mainpage_by_days_12_04 ALTER COLUMN id SET DEFAULT nextval('news_statistic_mainpage_by_days_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY news_statistic_mainpage_by_days_12_05 ALTER COLUMN id SET DEFAULT nextval('news_statistic_mainpage_by_days_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY news_statistic_mainpage_by_days_12_06 ALTER COLUMN id SET DEFAULT nextval('news_statistic_mainpage_by_days_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY news_statistic_mainpage_by_days_12_07 ALTER COLUMN id SET DEFAULT nextval('news_statistic_mainpage_by_days_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY news_statistic_mainpage_by_days_12_08 ALTER COLUMN id SET DEFAULT nextval('news_statistic_mainpage_by_days_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY news_statistic_mainpage_by_days_12_09 ALTER COLUMN id SET DEFAULT nextval('news_statistic_mainpage_by_days_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY news_statistic_mainpage_by_days_12_10 ALTER COLUMN id SET DEFAULT nextval('news_statistic_mainpage_by_days_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY news_statistic_mainpage_by_days_12_11 ALTER COLUMN id SET DEFAULT nextval('news_statistic_mainpage_by_days_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY news_statistic_mainpage_by_days_12_12 ALTER COLUMN id SET DEFAULT nextval('news_statistic_mainpage_by_days_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY news_statistic_mainpage_by_days_13_01 ALTER COLUMN id SET DEFAULT nextval('news_statistic_mainpage_by_days_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY news_statistic_mainpage_by_days_13_02 ALTER COLUMN id SET DEFAULT nextval('news_statistic_mainpage_by_days_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY news_statistic_mainpage_by_days_13_03 ALTER COLUMN id SET DEFAULT nextval('news_statistic_mainpage_by_days_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY news_statistic_mainpage_by_days_13_04 ALTER COLUMN id SET DEFAULT nextval('news_statistic_mainpage_by_days_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY news_statistic_mainpage_by_days_13_05 ALTER COLUMN id SET DEFAULT nextval('news_statistic_mainpage_by_days_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY news_statistic_mainpage_by_days_13_06 ALTER COLUMN id SET DEFAULT nextval('news_statistic_mainpage_by_days_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY news_statistic_mainpage_by_days_13_07 ALTER COLUMN id SET DEFAULT nextval('news_statistic_mainpage_by_days_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY news_statistic_mainpage_by_days_13_08 ALTER COLUMN id SET DEFAULT nextval('news_statistic_mainpage_by_days_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY news_statistic_mainpage_by_days_13_09 ALTER COLUMN id SET DEFAULT nextval('news_statistic_mainpage_by_days_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY news_statistic_mainpage_by_days_13_10 ALTER COLUMN id SET DEFAULT nextval('news_statistic_mainpage_by_days_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY news_statistic_mainpage_by_days_13_11 ALTER COLUMN id SET DEFAULT nextval('news_statistic_mainpage_by_days_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY news_statistic_mainpage_by_days_13_12 ALTER COLUMN id SET DEFAULT nextval('news_statistic_mainpage_by_days_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY news_statistic_mainpage_by_days_14_01 ALTER COLUMN id SET DEFAULT nextval('news_statistic_mainpage_by_days_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY news_statistic_mainpage_by_days_14_02 ALTER COLUMN id SET DEFAULT nextval('news_statistic_mainpage_by_days_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY news_statistic_mainpage_by_days_14_03 ALTER COLUMN id SET DEFAULT nextval('news_statistic_mainpage_by_days_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY news_statistic_mainpage_by_days_14_04 ALTER COLUMN id SET DEFAULT nextval('news_statistic_mainpage_by_days_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY news_statistic_mainpage_by_days_14_05 ALTER COLUMN id SET DEFAULT nextval('news_statistic_mainpage_by_days_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY news_statistic_mainpage_by_days_14_06 ALTER COLUMN id SET DEFAULT nextval('news_statistic_mainpage_by_days_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY news_statistic_mainpage_by_days_14_07 ALTER COLUMN id SET DEFAULT nextval('news_statistic_mainpage_by_days_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY news_statistic_mainpage_by_days_14_08 ALTER COLUMN id SET DEFAULT nextval('news_statistic_mainpage_by_days_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY news_statistic_mainpage_by_days_14_09 ALTER COLUMN id SET DEFAULT nextval('news_statistic_mainpage_by_days_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY news_statistic_mainpage_by_days_14_10 ALTER COLUMN id SET DEFAULT nextval('news_statistic_mainpage_by_days_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY news_statistic_mainpage_by_days_14_11 ALTER COLUMN id SET DEFAULT nextval('news_statistic_mainpage_by_days_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY news_statistic_mainpage_by_days_14_12 ALTER COLUMN id SET DEFAULT nextval('news_statistic_mainpage_by_days_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY news_statistic_mainpage_by_days_15_01 ALTER COLUMN id SET DEFAULT nextval('news_statistic_mainpage_by_days_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY news_statistic_referers_by_months ALTER COLUMN id SET DEFAULT nextval('news_statistic_referers_by_months_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY news_statistic_referers_by_months_15_08 ALTER COLUMN id SET DEFAULT nextval('news_statistic_referers_by_months_id_seq'::regclass); + + +-- +-- Name: hits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY news_statistic_referers_by_months_15_08 ALTER COLUMN hits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY news_statistic_referers_by_months_15_09 ALTER COLUMN id SET DEFAULT nextval('news_statistic_referers_by_months_id_seq'::regclass); + + +-- +-- Name: hits; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY news_statistic_referers_by_months_15_09 ALTER COLUMN hits SET DEFAULT 0; + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY news_statistic_total_by_regions ALTER COLUMN id SET DEFAULT nextval('news_statistic_total_by_regions_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY news_statistic_totals ALTER COLUMN id SET DEFAULT nextval('news_statistic_totals_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY query_log ALTER COLUMN id SET DEFAULT nextval('query_log_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY query_log_10_07 ALTER COLUMN id SET DEFAULT nextval('query_log_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY query_log_10_08 ALTER COLUMN id SET DEFAULT nextval('query_log_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY query_log_10_09 ALTER COLUMN id SET DEFAULT nextval('query_log_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY query_log_10_10 ALTER COLUMN id SET DEFAULT nextval('query_log_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY query_log_10_11 ALTER COLUMN id SET DEFAULT nextval('query_log_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY query_log_10_12 ALTER COLUMN id SET DEFAULT nextval('query_log_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY query_log_11_02 ALTER COLUMN id SET DEFAULT nextval('query_log_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY rubric_region_adds ALTER COLUMN id SET DEFAULT nextval('rubric_region_adds_id_seq'::regclass); + + +SET search_path = xls_import, pg_catalog; + +-- +-- Name: id; Type: DEFAULT; Schema: xls_import; Owner: - +-- + +ALTER TABLE ONLY deleted_products ALTER COLUMN id SET DEFAULT nextval('deleted_products_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: xls_import; Owner: - +-- + +ALTER TABLE ONLY parsed_rows ALTER COLUMN id SET DEFAULT nextval('parsed_rows_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: xls_import; Owner: - +-- + +ALTER TABLE ONLY transactions ALTER COLUMN id SET DEFAULT nextval('transactions_id_seq'::regclass); + + +SET search_path = classes, pg_catalog; + +-- +-- Name: catalogue_rubrics_id_key; Type: CONSTRAINT; Schema: classes; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY catalogue_rubric + ADD CONSTRAINT catalogue_rubrics_id_key UNIQUE (id); + + +SET search_path = denormalization, pg_catalog; + +-- +-- Name: events_log_pkey; Type: CONSTRAINT; Schema: denormalization; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY events_log + ADD CONSTRAINT events_log_pkey PRIMARY KEY (id); + + +-- +-- Name: fields_pkey; Type: CONSTRAINT; Schema: denormalization; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY fields + ADD CONSTRAINT fields_pkey PRIMARY KEY (id); + + +-- +-- Name: processors_pkey; Type: CONSTRAINT; Schema: denormalization; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY processors + ADD CONSTRAINT processors_pkey PRIMARY KEY (id); + + +-- +-- Name: queues_pkey; Type: CONSTRAINT; Schema: denormalization; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY queues + ADD CONSTRAINT queues_pkey PRIMARY KEY (id); + + +-- +-- Name: supervisor_status_pkey; Type: CONSTRAINT; Schema: denormalization; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY supervisor_status + ADD CONSTRAINT supervisor_status_pkey PRIMARY KEY (id); + + +-- +-- Name: workers_pkey; Type: CONSTRAINT; Schema: denormalization; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY workers + ADD CONSTRAINT workers_pkey PRIMARY KEY (id); + + +SET search_path = export, pg_catalog; + +-- +-- Name: export_log_pkey; Type: CONSTRAINT; Schema: export; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY export_log + ADD CONSTRAINT export_log_pkey PRIMARY KEY (id); + + +-- +-- Name: sync_products_queue_product_id_key; Type: CONSTRAINT; Schema: export; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY sync_products_queue + ADD CONSTRAINT sync_products_queue_product_id_key UNIQUE (product_id); + + +SET search_path = import, pg_catalog; + +-- +-- Name: import_log_pkey; Type: CONSTRAINT; Schema: import; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY import_log + ADD CONSTRAINT import_log_pkey PRIMARY KEY (id); + + +-- +-- Name: vw_site_rubric_pkey; Type: CONSTRAINT; Schema: import; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY vw_site_rubric + ADD CONSTRAINT vw_site_rubric_pkey PRIMARY KEY (id); + + +SET search_path = import_full, pg_catalog; + +-- +-- Name: companies_logos_to_delete_pkey; Type: CONSTRAINT; Schema: import_full; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY companies_images_to_delete + ADD CONSTRAINT companies_logos_to_delete_pkey PRIMARY KEY (id); + + +-- +-- Name: import_log_pkey; Type: CONSTRAINT; Schema: import_full; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY import_log + ADD CONSTRAINT import_log_pkey PRIMARY KEY (id); + + +-- +-- Name: new_companies_ids_pkey; Type: CONSTRAINT; Schema: import_full; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY new_companies_ids + ADD CONSTRAINT new_companies_ids_pkey PRIMARY KEY (oferta_id); + + +-- +-- Name: tmp_companies_company_id_key; Type: CONSTRAINT; Schema: import_full; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY tmp_companies + ADD CONSTRAINT tmp_companies_company_id_key UNIQUE (company_id); + + +-- +-- Name: vw_site_actualize_offer_pkey; Type: CONSTRAINT; Schema: import_full; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY vw_site_actualize_offer + ADD CONSTRAINT vw_site_actualize_offer_pkey PRIMARY KEY (id); + + +-- +-- Name: vw_site_deleted_firm_pkey; Type: CONSTRAINT; Schema: import_full; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY vw_site_deleted_firm + ADD CONSTRAINT vw_site_deleted_firm_pkey PRIMARY KEY (site_id); + + +-- +-- Name: vw_site_deleted_offer_pkey; Type: CONSTRAINT; Schema: import_full; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY vw_site_deleted_offer + ADD CONSTRAINT vw_site_deleted_offer_pkey PRIMARY KEY (id); + + +-- +-- Name: vw_site_estate_contact_pkey; Type: CONSTRAINT; Schema: import_full; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY vw_site_estate_contact + ADD CONSTRAINT vw_site_estate_contact_pkey PRIMARY KEY (id); + + +-- +-- Name: vw_site_estate_phone_pkey; Type: CONSTRAINT; Schema: import_full; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY vw_site_estate_phone + ADD CONSTRAINT vw_site_estate_phone_pkey PRIMARY KEY (id); + + +-- +-- Name: vw_site_estate_pkey; Type: CONSTRAINT; Schema: import_full; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY vw_site_estate + ADD CONSTRAINT vw_site_estate_pkey PRIMARY KEY (id); + + +-- +-- Name: vw_site_firm_pkey; Type: CONSTRAINT; Schema: import_full; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY vw_site_firm + ADD CONSTRAINT vw_site_firm_pkey PRIMARY KEY (oferta_id); + + +-- +-- Name: vw_site_firm_site_pkey; Type: CONSTRAINT; Schema: import_full; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY vw_site_firm_site + ADD CONSTRAINT vw_site_firm_site_pkey PRIMARY KEY (id); + + +-- +-- Name: vw_site_modified_offer_pkey; Type: CONSTRAINT; Schema: import_full; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY vw_site_modified_offer + ADD CONSTRAINT vw_site_modified_offer_pkey PRIMARY KEY (id); + + +-- +-- Name: vw_site_rubric_pkey; Type: CONSTRAINT; Schema: import_full; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY vw_site_rubric + ADD CONSTRAINT vw_site_rubric_pkey PRIMARY KEY (id); + + +SET search_path = londiste, pg_catalog; + +-- +-- Name: applied_execute_pkey; Type: CONSTRAINT; Schema: londiste; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY applied_execute + ADD CONSTRAINT applied_execute_pkey PRIMARY KEY (queue_name, execute_file); + + +-- +-- Name: pending_fkeys_pkey; Type: CONSTRAINT; Schema: londiste; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY pending_fkeys + ADD CONSTRAINT pending_fkeys_pkey PRIMARY KEY (from_table, fkey_name); + + +-- +-- Name: seq_info_pkey; Type: CONSTRAINT; Schema: londiste; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY seq_info + ADD CONSTRAINT seq_info_pkey PRIMARY KEY (queue_name, seq_name); + + +-- +-- Name: table_info_pkey; Type: CONSTRAINT; Schema: londiste; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY table_info + ADD CONSTRAINT table_info_pkey PRIMARY KEY (queue_name, table_name); + + +SET search_path = mail_deliveries, pg_catalog; + +-- +-- Name: categories_pkey; Type: CONSTRAINT; Schema: mail_deliveries; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY categories + ADD CONSTRAINT categories_pkey PRIMARY KEY (id); + + +-- +-- Name: company_sends_log_pkey; Type: CONSTRAINT; Schema: mail_deliveries; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY company_sends_log + ADD CONSTRAINT company_sends_log_pkey PRIMARY KEY (id); + + +-- +-- Name: deliveries_pkey; Type: CONSTRAINT; Schema: mail_deliveries; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY deliveries + ADD CONSTRAINT deliveries_pkey PRIMARY KEY (id); + + +-- +-- Name: delivery_company_filters_pkey; Type: CONSTRAINT; Schema: mail_deliveries; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY delivery_company_filters + ADD CONSTRAINT delivery_company_filters_pkey PRIMARY KEY (id); + + +-- +-- Name: unsubscribed_users_pkey; Type: CONSTRAINT; Schema: mail_deliveries; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY unsubscribed_users + ADD CONSTRAINT unsubscribed_users_pkey PRIMARY KEY (id); + + +-- +-- Name: user_category_settings_pkey; Type: CONSTRAINT; Schema: mail_deliveries; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY user_category_settings + ADD CONSTRAINT user_category_settings_pkey PRIMARY KEY (id); + + +SET search_path = mail_delivery, pg_catalog; + +-- +-- Name: attached_blogs_pkey; Type: CONSTRAINT; Schema: mail_delivery; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY attached_blogs + ADD CONSTRAINT attached_blogs_pkey PRIMARY KEY (id); + + +-- +-- Name: attached_company_events_pkey; Type: CONSTRAINT; Schema: mail_delivery; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY attached_company_events + ADD CONSTRAINT attached_company_events_pkey PRIMARY KEY (id); + + +-- +-- Name: attached_partner_projects_pkey; Type: CONSTRAINT; Schema: mail_delivery; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY attached_partner_projects + ADD CONSTRAINT attached_partner_projects_pkey PRIMARY KEY (id); + + +-- +-- Name: auto_deliveries_pkey; Type: CONSTRAINT; Schema: mail_delivery; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY auto_deliveries + ADD CONSTRAINT auto_deliveries_pkey PRIMARY KEY (id); + + +-- +-- Name: companies_data_sets_pkey; Type: CONSTRAINT; Schema: mail_delivery; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY companies_data_sets + ADD CONSTRAINT companies_data_sets_pkey PRIMARY KEY (id); + + +-- +-- Name: companies_datasources_pkey; Type: CONSTRAINT; Schema: mail_delivery; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY companies_datasources + ADD CONSTRAINT companies_datasources_pkey PRIMARY KEY (id); + + +-- +-- Name: companies_filters_pkey; Type: CONSTRAINT; Schema: mail_delivery; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY companies_filters + ADD CONSTRAINT companies_filters_pkey PRIMARY KEY (id); + + +-- +-- Name: deliveries_pkey; Type: CONSTRAINT; Schema: mail_delivery; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY deliveries + ADD CONSTRAINT deliveries_pkey PRIMARY KEY (id); + + +-- +-- Name: mail_sets_pkey; Type: CONSTRAINT; Schema: mail_delivery; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY mail_sets + ADD CONSTRAINT mail_sets_pkey PRIMARY KEY (id); + + +-- +-- Name: mails_pkey; Type: CONSTRAINT; Schema: mail_delivery; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY mails + ADD CONSTRAINT mails_pkey PRIMARY KEY (id); + + +-- +-- Name: personal_subscription_data_sets_pkey; Type: CONSTRAINT; Schema: mail_delivery; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY personal_subscription_data_sets + ADD CONSTRAINT personal_subscription_data_sets_pkey PRIMARY KEY (id); + + +-- +-- Name: personal_subscription_deliveries_pkey; Type: CONSTRAINT; Schema: mail_delivery; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY personal_subscription_deliveries + ADD CONSTRAINT personal_subscription_deliveries_pkey PRIMARY KEY (id); + + +-- +-- Name: personal_subscriptions_pkey; Type: CONSTRAINT; Schema: mail_delivery; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY personal_subscriptions + ADD CONSTRAINT personal_subscriptions_pkey PRIMARY KEY (id); + + +-- +-- Name: portal_news_subscription_deliveries_pkey; Type: CONSTRAINT; Schema: mail_delivery; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY portal_news_subscription_deliveries + ADD CONSTRAINT portal_news_subscription_deliveries_pkey PRIMARY KEY (id); + + +-- +-- Name: portal_news_subscriptions_mail_set_content_templates_pkey; Type: CONSTRAINT; Schema: mail_delivery; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY portal_news_subscriptions_mail_set_content_templates + ADD CONSTRAINT portal_news_subscriptions_mail_set_content_templates_pkey PRIMARY KEY (id); + + +-- +-- Name: portal_news_subscriptions_pkey; Type: CONSTRAINT; Schema: mail_delivery; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY portal_news_subscriptions + ADD CONSTRAINT portal_news_subscriptions_pkey PRIMARY KEY (id); + + +-- +-- Name: portal_subscription_mail_set_news_pkey; Type: CONSTRAINT; Schema: mail_delivery; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY portal_subscription_mail_set_news + ADD CONSTRAINT portal_subscription_mail_set_news_pkey PRIMARY KEY (id); + + +-- +-- Name: portal_subscription_mail_set_news_position_unique; Type: CONSTRAINT; Schema: mail_delivery; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY portal_subscription_mail_set_news + ADD CONSTRAINT portal_subscription_mail_set_news_position_unique UNIQUE (mail_set_content_template_id, "position") DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: schedules_pkey; Type: CONSTRAINT; Schema: mail_delivery; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY schedules + ADD CONSTRAINT schedules_pkey PRIMARY KEY (id); + + +-- +-- Name: senders_pkey; Type: CONSTRAINT; Schema: mail_delivery; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY senders + ADD CONSTRAINT senders_pkey PRIMARY KEY (id); + + +-- +-- Name: subscriptions_pkey; Type: CONSTRAINT; Schema: mail_delivery; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY subscriptions + ADD CONSTRAINT subscriptions_pkey PRIMARY KEY (id); + + +-- +-- Name: unreachable_emails_pkey; Type: CONSTRAINT; Schema: mail_delivery; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY unreachable_emails + ADD CONSTRAINT unreachable_emails_pkey PRIMARY KEY (id); + + +-- +-- Name: unsubscribed_emails_pkey; Type: CONSTRAINT; Schema: mail_delivery; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY unsubscribed_emails + ADD CONSTRAINT unsubscribed_emails_pkey PRIMARY KEY (id); + + +-- +-- Name: variables_pkey; Type: CONSTRAINT; Schema: mail_delivery; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY variables + ADD CONSTRAINT variables_pkey PRIMARY KEY (id); + + +SET search_path = permissions, pg_catalog; + +-- +-- Name: admin_permissions_pkey; Type: CONSTRAINT; Schema: permissions; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY admin_permissions + ADD CONSTRAINT admin_permissions_pkey PRIMARY KEY (id); + + +-- +-- Name: admin_sections_pkey; Type: CONSTRAINT; Schema: permissions; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY admin_sections + ADD CONSTRAINT admin_sections_pkey PRIMARY KEY (id); + + +SET search_path = pgq, pg_catalog; + +-- +-- Name: consumer_name_uq; Type: CONSTRAINT; Schema: pgq; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY consumer + ADD CONSTRAINT consumer_name_uq UNIQUE (co_name); + + +-- +-- Name: consumer_pkey; Type: CONSTRAINT; Schema: pgq; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY consumer + ADD CONSTRAINT consumer_pkey PRIMARY KEY (co_id); + + +-- +-- Name: queue_name_uq; Type: CONSTRAINT; Schema: pgq; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY queue + ADD CONSTRAINT queue_name_uq UNIQUE (queue_name); + + +-- +-- Name: queue_pkey; Type: CONSTRAINT; Schema: pgq; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY queue + ADD CONSTRAINT queue_pkey PRIMARY KEY (queue_id); + + +-- +-- Name: rq_pkey; Type: CONSTRAINT; Schema: pgq; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY retry_queue + ADD CONSTRAINT rq_pkey PRIMARY KEY (ev_owner, ev_id); + + +-- +-- Name: subscription_batch_idx; Type: CONSTRAINT; Schema: pgq; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY subscription + ADD CONSTRAINT subscription_batch_idx UNIQUE (sub_batch); + + +-- +-- Name: subscription_pkey; Type: CONSTRAINT; Schema: pgq; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY subscription + ADD CONSTRAINT subscription_pkey PRIMARY KEY (sub_queue, sub_consumer); + + +-- +-- Name: tick_pkey; Type: CONSTRAINT; Schema: pgq; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY tick + ADD CONSTRAINT tick_pkey PRIMARY KEY (tick_queue, tick_id); + + +SET search_path = pgq_ext, pg_catalog; + +-- +-- Name: completed_batch_pkey; Type: CONSTRAINT; Schema: pgq_ext; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY completed_batch + ADD CONSTRAINT completed_batch_pkey PRIMARY KEY (consumer_id, subconsumer_id); + + +-- +-- Name: completed_event_pkey; Type: CONSTRAINT; Schema: pgq_ext; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY completed_event + ADD CONSTRAINT completed_event_pkey PRIMARY KEY (consumer_id, subconsumer_id, batch_id, event_id); + + +-- +-- Name: completed_tick_pkey; Type: CONSTRAINT; Schema: pgq_ext; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY completed_tick + ADD CONSTRAINT completed_tick_pkey PRIMARY KEY (consumer_id, subconsumer_id); + + +-- +-- Name: partial_batch_pkey; Type: CONSTRAINT; Schema: pgq_ext; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY partial_batch + ADD CONSTRAINT partial_batch_pkey PRIMARY KEY (consumer_id, subconsumer_id); + + +SET search_path = pgq_node, pg_catalog; + +-- +-- Name: local_state_pkey; Type: CONSTRAINT; Schema: pgq_node; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY local_state + ADD CONSTRAINT local_state_pkey PRIMARY KEY (queue_name, consumer_name); + + +-- +-- Name: node_info_pkey; Type: CONSTRAINT; Schema: pgq_node; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY node_info + ADD CONSTRAINT node_info_pkey PRIMARY KEY (queue_name); + + +-- +-- Name: node_location_pkey; Type: CONSTRAINT; Schema: pgq_node; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY node_location + ADD CONSTRAINT node_location_pkey PRIMARY KEY (queue_name, node_name); + + +-- +-- Name: subscriber_info_pkey; Type: CONSTRAINT; Schema: pgq_node; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY subscriber_info + ADD CONSTRAINT subscriber_info_pkey PRIMARY KEY (queue_name, subscriber_node); + + +SET search_path = public, pg_catalog; + +-- +-- Name: account_export_configs_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY account_export_configs + ADD CONSTRAINT account_export_configs_pkey PRIMARY KEY (id); + + +-- +-- Name: accounts_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY accounts + ADD CONSTRAINT accounts_pkey PRIMARY KEY (id); + + +-- +-- Name: action_queue_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY action_queue + ADD CONSTRAINT action_queue_pkey PRIMARY KEY (id); + + +-- +-- Name: addresses_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY addresses + ADD CONSTRAINT addresses_pkey PRIMARY KEY (id); + + +-- +-- Name: admin_dk_news_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY admin_dk_news + ADD CONSTRAINT admin_dk_news_pkey PRIMARY KEY (id); + + +-- +-- Name: amazon_s3_assets_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY amazon_s3_assets + ADD CONSTRAINT amazon_s3_assets_pkey PRIMARY KEY (id); + + +-- +-- Name: amazon_s3_public_assets_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY amazon_s3_public_assets + ADD CONSTRAINT amazon_s3_public_assets_pkey PRIMARY KEY (id); + + +-- +-- Name: answers_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY answers + ADD CONSTRAINT answers_pkey PRIMARY KEY (id); + + +-- +-- Name: arrangements_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY arrangements + ADD CONSTRAINT arrangements_pkey PRIMARY KEY (id); + + +-- +-- Name: articles_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY articles + ADD CONSTRAINT articles_pkey PRIMARY KEY (id); + + +-- +-- Name: avatars_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY avatars + ADD CONSTRAINT avatars_pkey PRIMARY KEY (id); + + +-- +-- Name: award_candidates_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY award_candidates + ADD CONSTRAINT award_candidates_pkey PRIMARY KEY (id); + + +-- +-- Name: award_nominations_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY award_nominations + ADD CONSTRAINT award_nominations_pkey PRIMARY KEY (id); + + +-- +-- Name: award_nominee_votes_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY award_nominee_votes + ADD CONSTRAINT award_nominee_votes_pkey PRIMARY KEY (id); + + +-- +-- Name: award_nominees_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY award_nominees + ADD CONSTRAINT award_nominees_pkey PRIMARY KEY (id); + + +-- +-- Name: award_rubrics_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY award_rubrics + ADD CONSTRAINT award_rubrics_pkey PRIMARY KEY (id); + + +-- +-- Name: award_winner_nomination_votes_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY award_winner_nomination_votes + ADD CONSTRAINT award_winner_nomination_votes_pkey PRIMARY KEY (id); + + +-- +-- Name: award_winners_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY award_winners + ADD CONSTRAINT award_winners_pkey PRIMARY KEY (id); + + +-- +-- Name: awards_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY awards + ADD CONSTRAINT awards_pkey PRIMARY KEY (id); + + +-- +-- Name: base_words_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY base_words + ADD CONSTRAINT base_words_pkey PRIMARY KEY (id); + + +-- +-- Name: bdrb_job_queues_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY bdrb_job_queues + ADD CONSTRAINT bdrb_job_queues_pkey PRIMARY KEY (id); + + +-- +-- Name: blacklists_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY blacklists + ADD CONSTRAINT blacklists_pkey PRIMARY KEY (id); + + +-- +-- Name: blog_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY blog_comments + ADD CONSTRAINT blog_comments_pkey PRIMARY KEY (id); + + +-- +-- Name: blog_ping_services_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY blog_ping_services + ADD CONSTRAINT blog_ping_services_pkey PRIMARY KEY (id); + + +-- +-- Name: blog_ping_services_url_key; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY blog_ping_services + ADD CONSTRAINT blog_ping_services_url_key UNIQUE (url); + + +-- +-- Name: blog_post_contents_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY blog_post_contents + ADD CONSTRAINT blog_post_contents_pkey PRIMARY KEY (id); + + +-- +-- Name: blog_post_images_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY blog_post_images + ADD CONSTRAINT blog_post_images_pkey PRIMARY KEY (id); + + +-- +-- Name: blog_post_regions_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY blog_post_regions + ADD CONSTRAINT blog_post_regions_pkey PRIMARY KEY (id); + + +-- +-- Name: blog_posts_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY blog_posts + ADD CONSTRAINT blog_posts_pkey PRIMARY KEY (id); + + +-- +-- Name: blog_rubric_mappings_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY blog_rubric_mappings + ADD CONSTRAINT blog_rubric_mappings_pkey PRIMARY KEY (id); + + +-- +-- Name: blog_rubric_statistics_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY blog_rubric_statistics + ADD CONSTRAINT blog_rubric_statistics_pkey PRIMARY KEY (id); + + +-- +-- Name: blog_rubrics_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY blog_rubrics + ADD CONSTRAINT blog_rubrics_pkey PRIMARY KEY (id); + + +-- +-- Name: blog_settings_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY blog_settings + ADD CONSTRAINT blog_settings_pkey PRIMARY KEY (id); + + +-- +-- Name: business_types_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY business_types + ADD CONSTRAINT business_types_pkey PRIMARY KEY (id); + + +-- +-- Name: catalogue_logs_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY catalogue_logs + ADD CONSTRAINT catalogue_logs_pkey PRIMARY KEY (id); + + +-- +-- Name: categories_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY categories + ADD CONSTRAINT categories_pkey PRIMARY KEY (id); + + +-- +-- Name: category_rubrics_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY category_rubrics + ADD CONSTRAINT category_rubrics_pkey PRIMARY KEY (id); + + +-- +-- Name: cities_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY cities + ADD CONSTRAINT cities_pkey PRIMARY KEY (id); + + +-- +-- Name: city_types_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY city_types + ADD CONSTRAINT city_types_pkey PRIMARY KEY (id); + + +-- +-- Name: ckeditor_assets_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY ckeditor_assets + ADD CONSTRAINT ckeditor_assets_pkey PRIMARY KEY (id); + + +-- +-- Name: cms_company_regions_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY cms_company_regions + ADD CONSTRAINT cms_company_regions_pkey PRIMARY KEY (id); + + +-- +-- Name: cms_page_industries_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY cms_page_industries_backup + ADD CONSTRAINT cms_page_industries_pkey PRIMARY KEY (id); + + +-- +-- Name: cms_page_rubrics_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY cms_page_rubrics + ADD CONSTRAINT cms_page_rubrics_pkey PRIMARY KEY (id); + + +-- +-- Name: cms_pages_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY cms_pages + ADD CONSTRAINT cms_pages_pkey PRIMARY KEY (id); + + +-- +-- Name: comment_wiki_pages_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY comment_wiki_pages + ADD CONSTRAINT comment_wiki_pages_pkey PRIMARY KEY (id); + + +-- +-- Name: comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY comments + ADD CONSTRAINT comments_pkey PRIMARY KEY (id); + + +-- +-- Name: companies_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY companies + ADD CONSTRAINT companies_pkey PRIMARY KEY (id); + + +-- +-- Name: companies_sync_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY companies_sync + ADD CONSTRAINT companies_sync_pkey PRIMARY KEY (new_company_id); + + +-- +-- Name: company_abouts_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY company_abouts + ADD CONSTRAINT company_abouts_pkey PRIMARY KEY (id); + + +-- +-- Name: company_arrangements_sort_methods_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY company_arrangements_sort_methods + ADD CONSTRAINT company_arrangements_sort_methods_pkey PRIMARY KEY (id); + + +-- +-- Name: company_background_images_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY company_background_images + ADD CONSTRAINT company_background_images_pkey PRIMARY KEY (id); + + +-- +-- Name: company_billings_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY company_billings + ADD CONSTRAINT company_billings_pkey PRIMARY KEY (id); + + +-- +-- Name: company_business_types_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY company_business_types + ADD CONSTRAINT company_business_types_pkey PRIMARY KEY (id); + + +-- +-- Name: company_categories_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY company_categories + ADD CONSTRAINT company_categories_pkey PRIMARY KEY (id); + + +-- +-- Name: company_custom_page_titles_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY company_custom_page_titles + ADD CONSTRAINT company_custom_page_titles_pkey PRIMARY KEY (id); + + +-- +-- Name: company_documents_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY company_documents + ADD CONSTRAINT company_documents_pkey PRIMARY KEY (id); + + +-- +-- Name: company_domain_stopwords_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY company_domain_stopwords + ADD CONSTRAINT company_domain_stopwords_pkey PRIMARY KEY (id); + + +-- +-- Name: company_domains_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY company_domains + ADD CONSTRAINT company_domains_pkey PRIMARY KEY (id); + + +-- +-- Name: company_event_types_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY company_event_types + ADD CONSTRAINT company_event_types_pkey PRIMARY KEY (id); + + +-- +-- Name: company_event_wiki_pages_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY company_event_wiki_pages + ADD CONSTRAINT company_event_wiki_pages_pkey PRIMARY KEY (id); + + +-- +-- Name: company_events_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY company_events + ADD CONSTRAINT company_events_pkey PRIMARY KEY (id); + + +-- +-- Name: company_events_publish_regions_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY company_events_publish_regions + ADD CONSTRAINT company_events_publish_regions_pkey PRIMARY KEY (id); + + +-- +-- Name: company_header_flashes_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY company_header_flashes + ADD CONSTRAINT company_header_flashes_pkey PRIMARY KEY (id); + + +-- +-- Name: company_header_images_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY company_header_images + ADD CONSTRAINT company_header_images_pkey PRIMARY KEY (id); + + +-- +-- Name: company_imports_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY company_imports + ADD CONSTRAINT company_imports_pkey PRIMARY KEY (id); + + +-- +-- Name: company_industries_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY company_industries + ADD CONSTRAINT company_industries_pkey PRIMARY KEY (id); + + +-- +-- Name: company_links_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY company_links + ADD CONSTRAINT company_links_pkey PRIMARY KEY (id); + + +-- +-- Name: company_logos_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY company_logos + ADD CONSTRAINT company_logos_pkey PRIMARY KEY (id); + + +-- +-- Name: company_main_rubrics_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY company_main_rubrics + ADD CONSTRAINT company_main_rubrics_pkey PRIMARY KEY (id); + + +-- +-- Name: company_manager_stats_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY company_manager_stats + ADD CONSTRAINT company_manager_stats_pkey PRIMARY KEY (id); + + +-- +-- Name: company_menu_settings_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY company_menu_settings + ADD CONSTRAINT company_menu_settings_pkey PRIMARY KEY (id); + + +-- +-- Name: company_moderations_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY company_moderations + ADD CONSTRAINT company_moderations_pkey PRIMARY KEY (id); + + +-- +-- Name: company_news_rubrics_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY company_news_rubrics + ADD CONSTRAINT company_news_rubrics_pkey PRIMARY KEY (id); + + +-- +-- Name: company_online_stats_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY company_online_stats + ADD CONSTRAINT company_online_stats_pkey PRIMARY KEY (company_id); + + +-- +-- Name: company_payments_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY company_payments + ADD CONSTRAINT company_payments_pkey PRIMARY KEY (id); + + +-- +-- Name: company_previous_statistics_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY company_previous_statistics + ADD CONSTRAINT company_previous_statistics_pkey PRIMARY KEY (id); + + +-- +-- Name: company_price_product_rubrics_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY company_price_product_rubrics + ADD CONSTRAINT company_price_product_rubrics_pkey PRIMARY KEY (id); + + +-- +-- Name: company_pricelist_online_status_logs_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY company_pricelist_online_status_logs + ADD CONSTRAINT company_pricelist_online_status_logs_pkey PRIMARY KEY (id); + + +-- +-- Name: company_prices_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY company_prices + ADD CONSTRAINT company_prices_pkey PRIMARY KEY (id); + + +-- +-- Name: company_publish_queue_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY company_publish_queue + ADD CONSTRAINT company_publish_queue_pkey PRIMARY KEY (id); + + +-- +-- Name: company_region_commercials_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY company_region_commercials + ADD CONSTRAINT company_region_commercials_pkey PRIMARY KEY (id); + + +-- +-- Name: company_regions_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY company_regions + ADD CONSTRAINT company_regions_pkey PRIMARY KEY (id); + + +-- +-- Name: company_registration_sources_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY company_registration_sources + ADD CONSTRAINT company_registration_sources_pkey PRIMARY KEY (id); + + +-- +-- Name: company_review_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY company_review_comments + ADD CONSTRAINT company_review_comments_pkey PRIMARY KEY (id); + + +-- +-- Name: company_reviews_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY company_reviews + ADD CONSTRAINT company_reviews_pkey PRIMARY KEY (id); + + +-- +-- Name: company_rubric_regions_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY company_rubric_regions + ADD CONSTRAINT company_rubric_regions_pkey PRIMARY KEY (id); + + +-- +-- Name: company_rubrics_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY company_rubrics + ADD CONSTRAINT company_rubrics_pkey PRIMARY KEY (id); + + +-- +-- Name: company_schedules_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY company_schedules + ADD CONSTRAINT company_schedules_pkey PRIMARY KEY (id); + + +-- +-- Name: company_searcher_confirmations_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY company_searcher_confirmations + ADD CONSTRAINT company_searcher_confirmations_pkey PRIMARY KEY (id); + + +-- +-- Name: company_settings_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY company_settings + ADD CONSTRAINT company_settings_pkey PRIMARY KEY (id); + + +-- +-- Name: company_sites_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY company_sites + ADD CONSTRAINT company_sites_pkey PRIMARY KEY (id); + + +-- +-- Name: company_thematic_rubrics_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY company_thematic_rubrics + ADD CONSTRAINT company_thematic_rubrics_pkey PRIMARY KEY (id); + + +-- +-- Name: company_tokens_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY company_tokens + ADD CONSTRAINT company_tokens_pkey PRIMARY KEY (id); + + +-- +-- Name: company_traffic_limits_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY company_traffic_limits + ADD CONSTRAINT company_traffic_limits_pkey PRIMARY KEY (id); + + +-- +-- Name: company_users_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY company_users + ADD CONSTRAINT company_users_pkey PRIMARY KEY (id); + + +-- +-- Name: company_videos_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY company_videos + ADD CONSTRAINT company_videos_pkey PRIMARY KEY (id); + + +-- +-- Name: company_widgets_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY company_widgets + ADD CONSTRAINT company_widgets_pkey PRIMARY KEY (id); + + +-- +-- Name: company_widgets_stats_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY company_widgets_stats + ADD CONSTRAINT company_widgets_stats_pkey PRIMARY KEY (id); + + +-- +-- Name: company_yandex_rubrics_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY company_yandex_rubrics + ADD CONSTRAINT company_yandex_rubrics_pkey PRIMARY KEY (id); + + +-- +-- Name: complaints_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY complaints + ADD CONSTRAINT complaints_pkey PRIMARY KEY (id); + + +-- +-- Name: contact_types_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY contact_types + ADD CONSTRAINT contact_types_pkey PRIMARY KEY (id); + + +-- +-- Name: contacts_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY contacts + ADD CONSTRAINT contacts_pkey PRIMARY KEY (id); + + +-- +-- Name: copied_users_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY copied_users + ADD CONSTRAINT copied_users_pkey PRIMARY KEY (id); + + +-- +-- Name: countries_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY countries + ADD CONSTRAINT countries_pkey PRIMARY KEY (id); + + +-- +-- Name: demand_items_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY demand_items + ADD CONSTRAINT demand_items_pkey PRIMARY KEY (id); + + +-- +-- Name: demand_statistics_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY demand_statistics + ADD CONSTRAINT demand_statistics_pkey PRIMARY KEY (id); + + +-- +-- Name: demands_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY demands + ADD CONSTRAINT demands_pkey PRIMARY KEY (id); + + +-- +-- Name: dialog_messages_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY dialog_messages + ADD CONSTRAINT dialog_messages_pkey PRIMARY KEY (id); + + +-- +-- Name: dialog_participants_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY dialog_participants + ADD CONSTRAINT dialog_participants_pkey PRIMARY KEY (id); + + +-- +-- Name: dialogs_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY dialogs + ADD CONSTRAINT dialogs_pkey PRIMARY KEY (id); + + +-- +-- Name: dirty_company_industries_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY dirty_company_industries + ADD CONSTRAINT dirty_company_industries_pkey PRIMARY KEY (id); + + +-- +-- Name: dirty_industries_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY dirty_industries + ADD CONSTRAINT dirty_industries_pkey PRIMARY KEY (id); + + +-- +-- Name: dirty_rubric_log_entries_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY dirty_rubric_log_entries + ADD CONSTRAINT dirty_rubric_log_entries_pkey PRIMARY KEY (id); + + +-- +-- Name: dirty_rubric_redirects_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY dirty_rubric_redirects + ADD CONSTRAINT dirty_rubric_redirects_pkey PRIMARY KEY (id); + + +-- +-- Name: dirty_rubric_trait_tracks_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY dirty_rubric_trait_value_redirects + ADD CONSTRAINT dirty_rubric_trait_tracks_pkey PRIMARY KEY (id); + + +-- +-- Name: dirty_rubrics_nested_set_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY dirty_rubrics_nested_set + ADD CONSTRAINT dirty_rubrics_nested_set_pkey PRIMARY KEY (id); + + +-- +-- Name: dirty_rubrics_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY dirty_rubrics + ADD CONSTRAINT dirty_rubrics_pkey PRIMARY KEY (id); + + +-- +-- Name: dirty_thematic_rubric_industries_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY dirty_thematic_rubric_industries + ADD CONSTRAINT dirty_thematic_rubric_industries_pkey PRIMARY KEY (id); + + +-- +-- Name: dirty_thematic_rubrics_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY dirty_thematic_rubrics + ADD CONSTRAINT dirty_thematic_rubrics_pkey PRIMARY KEY (id); + + +-- +-- Name: district_types_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY district_types + ADD CONSTRAINT district_types_pkey PRIMARY KEY (id); + + +-- +-- Name: districts_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY districts + ADD CONSTRAINT districts_pkey PRIMARY KEY (id); + + +-- +-- Name: event_addresses_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY event_addresses + ADD CONSTRAINT event_addresses_pkey PRIMARY KEY (id); + + +-- +-- Name: event_contacts_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY event_contacts + ADD CONSTRAINT event_contacts_pkey PRIMARY KEY (id); + + +-- +-- Name: event_phones_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY event_phones + ADD CONSTRAINT event_phones_pkey PRIMARY KEY (id); + + +-- +-- Name: event_thematic_rubrics_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY event_thematic_rubrics + ADD CONSTRAINT event_thematic_rubrics_pkey PRIMARY KEY (id); + + +-- +-- Name: external_forms_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY external_forms + ADD CONSTRAINT external_forms_pkey PRIMARY KEY (id); + + +-- +-- Name: feedback_categories_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY feedback_categories + ADD CONSTRAINT feedback_categories_pkey PRIMARY KEY (id); + + +-- +-- Name: feedbacks_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY feedbacks + ADD CONSTRAINT feedbacks_pkey PRIMARY KEY (id); + + +-- +-- Name: franchise_user_regions_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY franchise_user_regions + ADD CONSTRAINT franchise_user_regions_pkey PRIMARY KEY (id); + + +-- +-- Name: glossary_log_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY glossary_log + ADD CONSTRAINT glossary_log_pkey PRIMARY KEY (id); + + +-- +-- Name: images_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY images + ADD CONSTRAINT images_pkey PRIMARY KEY (id); + + +-- +-- Name: index_addresses_on_company_id_and_position; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY addresses + ADD CONSTRAINT index_addresses_on_company_id_and_position UNIQUE (company_id, "position"); + + +-- +-- Name: industries_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY industries_backup + ADD CONSTRAINT industries_pkey PRIMARY KEY (id); + + +-- +-- Name: industries_pkey1; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY industries + ADD CONSTRAINT industries_pkey1 PRIMARY KEY (id); + + +-- +-- Name: industry_redirects_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY industry_redirects + ADD CONSTRAINT industry_redirects_pkey PRIMARY KEY (id); + + +-- +-- Name: informer_prices_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY informer_prices + ADD CONSTRAINT informer_prices_pkey PRIMARY KEY (id); + + +-- +-- Name: informers_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY informers + ADD CONSTRAINT informers_pkey PRIMARY KEY (id); + + +-- +-- Name: ip_infos_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY ip_infos + ADD CONSTRAINT ip_infos_pkey PRIMARY KEY (id); + + +-- +-- Name: licenses_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY licenses + ADD CONSTRAINT licenses_pkey PRIMARY KEY (id); + + +-- +-- Name: magazine_subscription_notification_emails_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY magazine_subscription_notification_emails + ADD CONSTRAINT magazine_subscription_notification_emails_pkey PRIMARY KEY (id); + + +-- +-- Name: map_address_candidates_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY map_address_candidates + ADD CONSTRAINT map_address_candidates_pkey PRIMARY KEY (id); + + +-- +-- Name: map_addresses_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY map_addresses + ADD CONSTRAINT map_addresses_pkey PRIMARY KEY (id); + + +-- +-- Name: mappings_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY mappings + ADD CONSTRAINT mappings_pkey PRIMARY KEY (id); + + +-- +-- Name: measure_unit_groups_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY measure_unit_groups + ADD CONSTRAINT measure_unit_groups_pkey PRIMARY KEY (id); + + +-- +-- Name: measure_units_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY measure_units + ADD CONSTRAINT measure_units_pkey PRIMARY KEY (id); + + +-- +-- Name: migration_errors_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY migration_errors + ADD CONSTRAINT migration_errors_pkey PRIMARY KEY (id); + + +-- +-- Name: migrations_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY migrations + ADD CONSTRAINT migrations_pkey PRIMARY KEY (id); + + +-- +-- Name: native_region_regions_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY native_region_regions + ADD CONSTRAINT native_region_regions_pkey PRIMARY KEY (id); + + +-- +-- Name: news_paid_placements_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY news_paid_placements + ADD CONSTRAINT news_paid_placements_pkey PRIMARY KEY (id); + + +-- +-- Name: news_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY news + ADD CONSTRAINT news_pkey PRIMARY KEY (id); + + +-- +-- Name: news_regions_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY news_regions + ADD CONSTRAINT news_regions_pkey PRIMARY KEY (id); + + +-- +-- Name: news_regions_zones_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY news_regions_zones + ADD CONSTRAINT news_regions_zones_pkey PRIMARY KEY (id); + + +-- +-- Name: news_rubrics_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY news_rubrics + ADD CONSTRAINT news_rubrics_pkey PRIMARY KEY (id); + + +-- +-- Name: news_sources_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY news_sources + ADD CONSTRAINT news_sources_pkey PRIMARY KEY (id); + + +-- +-- Name: news_thematic_news_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY news_thematic_news + ADD CONSTRAINT news_thematic_news_pkey PRIMARY KEY (id); + + +-- +-- Name: news_thematic_rubrics_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY news_thematic_rubrics + ADD CONSTRAINT news_thematic_rubrics_pkey PRIMARY KEY (id); + + +-- +-- Name: news_wiki_pages_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY news_wiki_pages + ADD CONSTRAINT news_wiki_pages_pkey PRIMARY KEY (id); + + +-- +-- Name: news_zones_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY news_zones + ADD CONSTRAINT news_zones_pkey PRIMARY KEY (id); + + +-- +-- Name: offline_regions_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY offline_regions + ADD CONSTRAINT offline_regions_pkey PRIMARY KEY (id); + + +-- +-- Name: online_store_categories_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY old_online_store_categories + ADD CONSTRAINT online_store_categories_pkey PRIMARY KEY (id); + + +-- +-- Name: online_store_category_rubrics_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY old_online_store_category_rubrics + ADD CONSTRAINT online_store_category_rubrics_pkey PRIMARY KEY (id); + + +-- +-- Name: online_store_import_logs_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY old_online_store_import_logs + ADD CONSTRAINT online_store_import_logs_pkey PRIMARY KEY (id); + + +-- +-- Name: online_store_product_regions_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY old_online_store_product_regions + ADD CONSTRAINT online_store_product_regions_pkey PRIMARY KEY (id); + + +-- +-- Name: online_store_products_merge_errors_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY old_online_store_products_merge_errors + ADD CONSTRAINT online_store_products_merge_errors_pkey PRIMARY KEY (id); + + +-- +-- Name: online_store_products_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY old_online_store_products + ADD CONSTRAINT online_store_products_pkey PRIMARY KEY (id); + + +-- +-- Name: online_store_schedules_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY old_online_store_schedules + ADD CONSTRAINT online_store_schedules_pkey PRIMARY KEY (id); + + +-- +-- Name: online_stores_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY old_online_stores + ADD CONSTRAINT online_stores_pkey PRIMARY KEY (id); + + +-- +-- Name: online_users_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY online_users + ADD CONSTRAINT online_users_pkey PRIMARY KEY (user_id); + + +-- +-- Name: online_users_stat_by_days_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY online_users_stat_by_days + ADD CONSTRAINT online_users_stat_by_days_pkey PRIMARY KEY (id); + + +-- +-- Name: online_users_stat_by_hours_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY online_users_stat_by_hours + ADD CONSTRAINT online_users_stat_by_hours_pkey PRIMARY KEY (id); + + +-- +-- Name: online_users_stat_by_mins_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY online_users_stat_by_mins + ADD CONSTRAINT online_users_stat_by_mins_pkey PRIMARY KEY (id); + + +-- +-- Name: online_users_stat_by_months_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY online_users_stat_by_months + ADD CONSTRAINT online_users_stat_by_months_pkey PRIMARY KEY (id); + + +-- +-- Name: packet_discounts_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY packet_discounts + ADD CONSTRAINT packet_discounts_pkey PRIMARY KEY (id); + + +-- +-- Name: packet_region_settings_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY packet_region_settings + ADD CONSTRAINT packet_region_settings_pkey PRIMARY KEY (id); + + +-- +-- Name: packets_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY packets + ADD CONSTRAINT packets_pkey PRIMARY KEY (id); + + +-- +-- Name: page_descriptions_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY page_descriptions + ADD CONSTRAINT page_descriptions_pkey PRIMARY KEY (id); + + +-- +-- Name: payment_systems_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY payment_systems + ADD CONSTRAINT payment_systems_pkey PRIMARY KEY (id); + + +-- +-- Name: phone_types_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY phone_types + ADD CONSTRAINT phone_types_pkey PRIMARY KEY (id); + + +-- +-- Name: phones_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY phones + ADD CONSTRAINT phones_pkey PRIMARY KEY (id); + + +-- +-- Name: poll_answers_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY poll_answers + ADD CONSTRAINT poll_answers_pkey PRIMARY KEY (id); + + +-- +-- Name: poll_questions_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY poll_questions + ADD CONSTRAINT poll_questions_pkey PRIMARY KEY (id); + + +-- +-- Name: poll_steps_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY poll_steps + ADD CONSTRAINT poll_steps_pkey PRIMARY KEY (id); + + +-- +-- Name: poll_votes_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY poll_votes + ADD CONSTRAINT poll_votes_pkey PRIMARY KEY (id); + + +-- +-- Name: polls_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY polls + ADD CONSTRAINT polls_pkey PRIMARY KEY (id); + + +-- +-- Name: prerendered_rubricators_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY prerendered_rubricators + ADD CONSTRAINT prerendered_rubricators_pkey PRIMARY KEY (id); + + +-- +-- Name: price_list_rows_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY price_list_rows + ADD CONSTRAINT price_list_rows_pkey PRIMARY KEY (id); + + +-- +-- Name: product_announce_categories_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY product_announce_categories + ADD CONSTRAINT product_announce_categories_pkey PRIMARY KEY (id); + + +-- +-- Name: product_announce_patterns_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY product_announce_patterns + ADD CONSTRAINT product_announce_patterns_pkey PRIMARY KEY (id); + + +-- +-- Name: product_deltas_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY product_deltas + ADD CONSTRAINT product_deltas_pkey PRIMARY KEY (id); + + +-- +-- Name: product_description_stats_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY product_description_stats + ADD CONSTRAINT product_description_stats_pkey PRIMARY KEY (id); + + +-- +-- Name: product_group_images_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY product_group_images + ADD CONSTRAINT product_group_images_pkey PRIMARY KEY (id); + + +-- +-- Name: product_groups_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY product_groups + ADD CONSTRAINT product_groups_pkey PRIMARY KEY (id); + + +-- +-- Name: product_images_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY product_images + ADD CONSTRAINT product_images_pkey PRIMARY KEY (id); + + +-- +-- Name: product_price_list_rows_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY product_price_list_rows + ADD CONSTRAINT product_price_list_rows_pkey PRIMARY KEY (id); + + +-- +-- Name: product_properties_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY product_properties + ADD CONSTRAINT product_properties_pkey PRIMARY KEY (id); + + +-- +-- Name: product_regions_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY product_regions + ADD CONSTRAINT product_regions_pkey PRIMARY KEY (id); + + +-- +-- Name: product_url_names_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY product_url_names + ADD CONSTRAINT product_url_names_pkey PRIMARY KEY (id); + + +-- +-- Name: products_335_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY products + ADD CONSTRAINT products_335_pkey PRIMARY KEY (id); + + +-- +-- Name: provinces_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY provinces + ADD CONSTRAINT provinces_pkey PRIMARY KEY (id); + + +-- +-- Name: redactor_images_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY redactor_images + ADD CONSTRAINT redactor_images_pkey PRIMARY KEY (id); + + +-- +-- Name: redirects_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY redirects + ADD CONSTRAINT redirects_pkey PRIMARY KEY (id); + + +-- +-- Name: region_contacts_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY region_contacts + ADD CONSTRAINT region_contacts_pkey PRIMARY KEY (id); + + +-- +-- Name: region_footer_contacts_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY region_footer_contacts + ADD CONSTRAINT region_footer_contacts_pkey PRIMARY KEY (id); + + +-- +-- Name: region_packets_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY region_packets + ADD CONSTRAINT region_packets_pkey PRIMARY KEY (id); + + +-- +-- Name: regions_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY regions + ADD CONSTRAINT regions_pkey PRIMARY KEY (id); + + +-- +-- Name: roles_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY roles + ADD CONSTRAINT roles_pkey PRIMARY KEY (id); + + +-- +-- Name: rss_channels_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY rss_channels + ADD CONSTRAINT rss_channels_pkey PRIMARY KEY (id); + + +-- +-- Name: rubric_industries_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY rubric_industries_backup + ADD CONSTRAINT rubric_industries_pkey PRIMARY KEY (id); + + +-- +-- Name: rubric_normal_stats_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY rubric_normal_stats + ADD CONSTRAINT rubric_normal_stats_pkey PRIMARY KEY (id); + + +-- +-- Name: rubric_redirects_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY rubric_redirects + ADD CONSTRAINT rubric_redirects_pkey PRIMARY KEY (id); + + +-- +-- Name: rubric_statistics_paid_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY rubric_statistics_paid + ADD CONSTRAINT rubric_statistics_paid_pkey PRIMARY KEY (id); + + +-- +-- Name: rubric_statistics_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY rubric_statistics + ADD CONSTRAINT rubric_statistics_pkey PRIMARY KEY (id); + + +-- +-- Name: rubric_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY rubric_tags + ADD CONSTRAINT rubric_tags_pkey PRIMARY KEY (id); + + +-- +-- Name: rubrics_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY rubrics + ADD CONSTRAINT rubrics_pkey PRIMARY KEY (id); + + +-- +-- Name: rubrics_total_statistics_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY rubrics_total_statistics + ADD CONSTRAINT rubrics_total_statistics_pkey PRIMARY KEY (id); + + +-- +-- Name: schedule_brakes_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY schedule_brakes + ADD CONSTRAINT schedule_brakes_pkey PRIMARY KEY (id); + + +-- +-- Name: schedule_days_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY schedule_days + ADD CONSTRAINT schedule_days_pkey PRIMARY KEY (id); + + +-- +-- Name: schedule_times_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY schedule_times + ADD CONSTRAINT schedule_times_pkey PRIMARY KEY (id); + + +-- +-- Name: search_index_companies_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY search_index_companies + ADD CONSTRAINT search_index_companies_pkey PRIMARY KEY (id); + + +-- +-- Name: search_index_demands_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY search_index_demands + ADD CONSTRAINT search_index_demands_pkey PRIMARY KEY (id); + + +-- +-- Name: search_index_price_list_rows_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY search_index_price_list_rows + ADD CONSTRAINT search_index_price_list_rows_pkey PRIMARY KEY (id); + + +-- +-- Name: search_index_products_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY search_index_products + ADD CONSTRAINT search_index_products_pkey PRIMARY KEY (id); + + +-- +-- Name: search_index_queue_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY search_index_queue + ADD CONSTRAINT search_index_queue_pkey PRIMARY KEY (id); + + +-- +-- Name: search_index_rubrics_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY search_index_rubrics + ADD CONSTRAINT search_index_rubrics_pkey PRIMARY KEY (id); + + +-- +-- Name: search_specwords_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY search_specwords + ADD CONSTRAINT search_specwords_pkey PRIMARY KEY (id); + + +-- +-- Name: search_stopwords_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY search_stopwords + ADD CONSTRAINT search_stopwords_pkey PRIMARY KEY (id); + + +-- +-- Name: search_unitnames_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY search_unitnames + ADD CONSTRAINT search_unitnames_pkey PRIMARY KEY (id); + + +-- +-- Name: search_wordforms_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY search_wordforms + ADD CONSTRAINT search_wordforms_pkey PRIMARY KEY (id); + + +-- +-- Name: see_also_stats_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY see_also_stats + ADD CONSTRAINT see_also_stats_pkey PRIMARY KEY (id); + + +-- +-- Name: seo_anchors_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY seo_anchors + ADD CONSTRAINT seo_anchors_pkey PRIMARY KEY (id); + + +-- +-- Name: seo_block_links_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY seo_block_links + ADD CONSTRAINT seo_block_links_pkey PRIMARY KEY (id); + + +-- +-- Name: seo_block_rubric_regions_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY seo_block_rubric_regions + ADD CONSTRAINT seo_block_rubric_regions_pkey PRIMARY KEY (id); + + +-- +-- Name: seo_blocks_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY seo_blocks + ADD CONSTRAINT seo_blocks_pkey PRIMARY KEY (id); + + +-- +-- Name: seo_entities_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY seo_entities + ADD CONSTRAINT seo_entities_pkey PRIMARY KEY (id); + + +-- +-- Name: seo_entity_modifications_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY seo_entity_modifications + ADD CONSTRAINT seo_entity_modifications_pkey PRIMARY KEY (id); + + +-- +-- Name: seo_entity_stopwords_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY seo_entity_stopwords + ADD CONSTRAINT seo_entity_stopwords_pkey PRIMARY KEY (id); + + +-- +-- Name: seo_entity_wordforms_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY seo_entity_wordforms + ADD CONSTRAINT seo_entity_wordforms_pkey PRIMARY KEY (id); + + +-- +-- Name: seo_keywords_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY seo_keywords + ADD CONSTRAINT seo_keywords_pkey PRIMARY KEY (id); + + +-- +-- Name: sessions_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY sessions + ADD CONSTRAINT sessions_pkey PRIMARY KEY (id); + + +-- +-- Name: showcase_images_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY showcase_images + ADD CONSTRAINT showcase_images_pkey PRIMARY KEY (id); + + +-- +-- Name: showcase_order_periods_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY showcase_order_periods + ADD CONSTRAINT showcase_order_periods_pkey PRIMARY KEY (id); + + +-- +-- Name: showcase_order_regions_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY showcase_order_regions + ADD CONSTRAINT showcase_order_regions_pkey PRIMARY KEY (id); + + +-- +-- Name: showcase_order_stats_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY showcase_order_stats + ADD CONSTRAINT showcase_order_stats_pkey PRIMARY KEY (id); + + +-- +-- Name: showcase_orders_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY showcase_orders + ADD CONSTRAINT showcase_orders_pkey PRIMARY KEY (id); + + +-- +-- Name: showcases_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY showcases + ADD CONSTRAINT showcases_pkey PRIMARY KEY (id); + + +-- +-- Name: sitemap_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY sitemap + ADD CONSTRAINT sitemap_pkey PRIMARY KEY (id); + + +-- +-- Name: snippet_rubrics_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY snippet_rubrics + ADD CONSTRAINT snippet_rubrics_pkey PRIMARY KEY (id); + + +-- +-- Name: snippet_text_regions_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY snippet_text_regions + ADD CONSTRAINT snippet_text_regions_pkey PRIMARY KEY (id); + + +-- +-- Name: snippet_texts_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY snippet_texts + ADD CONSTRAINT snippet_texts_pkey PRIMARY KEY (id); + + +-- +-- Name: snippets_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY snippets + ADD CONSTRAINT snippets_pkey PRIMARY KEY (id); + + +-- +-- Name: social_surveys_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY social_surveys + ADD CONSTRAINT social_surveys_pkey PRIMARY KEY (id); + + +-- +-- Name: sources_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY sources + ADD CONSTRAINT sources_pkey PRIMARY KEY (id); + + +-- +-- Name: static_links_by_products_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY static_links_by_products + ADD CONSTRAINT static_links_by_products_pkey PRIMARY KEY (id); + + +-- +-- Name: static_links_by_rubrics_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY static_links_by_rubrics + ADD CONSTRAINT static_links_by_rubrics_pkey PRIMARY KEY (id); + + +-- +-- Name: static_links_for_predls_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY static_links_for_predls + ADD CONSTRAINT static_links_for_predls_pkey PRIMARY KEY (id); + + +-- +-- Name: street_types_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY street_types + ADD CONSTRAINT street_types_pkey PRIMARY KEY (id); + + +-- +-- Name: streets_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY streets + ADD CONSTRAINT streets_pkey PRIMARY KEY (id); + + +-- +-- Name: subscribe_popups_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY subscribe_popups + ADD CONSTRAINT subscribe_popups_pkey PRIMARY KEY (id); + + +-- +-- Name: subscriptions_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY subscriptions + ADD CONSTRAINT subscriptions_pkey PRIMARY KEY (id); + + +-- +-- Name: synonyms_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY synonyms + ADD CONSTRAINT synonyms_pkey PRIMARY KEY (id); + + +-- +-- Name: system_params_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY system_params + ADD CONSTRAINT system_params_pkey PRIMARY KEY (id); + + +-- +-- Name: taggings_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY taggings + ADD CONSTRAINT taggings_pkey PRIMARY KEY (id); + + +-- +-- Name: tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY tags + ADD CONSTRAINT tags_pkey PRIMARY KEY (id); + + +-- +-- Name: template_categories_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY template_categories + ADD CONSTRAINT template_categories_pkey PRIMARY KEY (id); + + +-- +-- Name: template_schemes_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY template_schemes + ADD CONSTRAINT template_schemes_pkey PRIMARY KEY (id); + + +-- +-- Name: test_packets_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY test_packets + ADD CONSTRAINT test_packets_pkey PRIMARY KEY (id); + + +-- +-- Name: text_zone_rubrics_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY text_zone_rubrics + ADD CONSTRAINT text_zone_rubrics_pkey PRIMARY KEY (id); + + +-- +-- Name: text_zones_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY text_zones + ADD CONSTRAINT text_zones_pkey PRIMARY KEY (id); + + +-- +-- Name: thematic_rubric_industries_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY thematic_rubric_industries + ADD CONSTRAINT thematic_rubric_industries_pkey PRIMARY KEY (id); + + +-- +-- Name: thematic_rubric_links_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY thematic_rubric_links + ADD CONSTRAINT thematic_rubric_links_pkey PRIMARY KEY (id); + + +-- +-- Name: thematic_rubricators_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY thematic_rubricators + ADD CONSTRAINT thematic_rubricators_pkey PRIMARY KEY (id); + + +-- +-- Name: thematic_rubrics_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY thematic_rubrics + ADD CONSTRAINT thematic_rubrics_pkey PRIMARY KEY (id); + + +-- +-- Name: tmp_seo_entities_slugs_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY tmp_seo_entities_slugs + ADD CONSTRAINT tmp_seo_entities_slugs_pkey PRIMARY KEY (id); + + +-- +-- Name: trait_products_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY trait_products + ADD CONSTRAINT trait_products_pkey PRIMARY KEY (id); + + +-- +-- Name: trait_rubrics_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY trait_rubrics + ADD CONSTRAINT trait_rubrics_pkey PRIMARY KEY (id); + + +-- +-- Name: trait_value_redirects_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY trait_value_redirects + ADD CONSTRAINT trait_value_redirects_pkey PRIMARY KEY (id); + + +-- +-- Name: trait_values_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY trait_values + ADD CONSTRAINT trait_values_pkey PRIMARY KEY (id); + + +-- +-- Name: traits_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY traits + ADD CONSTRAINT traits_pkey PRIMARY KEY (id); + + +-- +-- Name: ugc_stats_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY ugc_stats + ADD CONSTRAINT ugc_stats_pkey PRIMARY KEY (id); + + +-- +-- Name: useful_link_categories_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY useful_link_categories + ADD CONSTRAINT useful_link_categories_pkey PRIMARY KEY (id); + + +-- +-- Name: useful_link_statistics_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY useful_link_statistics + ADD CONSTRAINT useful_link_statistics_pkey PRIMARY KEY (id); + + +-- +-- Name: useful_links_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY useful_links + ADD CONSTRAINT useful_links_pkey PRIMARY KEY (id); + + +-- +-- Name: user_blog_statistics_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY blog_user_statistics + ADD CONSTRAINT user_blog_statistics_pkey PRIMARY KEY (id); + + +-- +-- Name: user_profiles_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY user_profiles + ADD CONSTRAINT user_profiles_pkey PRIMARY KEY (id); + + +-- +-- Name: user_roles_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY user_roles + ADD CONSTRAINT user_roles_pkey PRIMARY KEY (id); + + +-- +-- Name: user_settings_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY user_settings + ADD CONSTRAINT user_settings_pkey PRIMARY KEY (id); + + +-- +-- Name: users_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY users + ADD CONSTRAINT users_pkey PRIMARY KEY (id); + + +-- +-- Name: villages_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY villages + ADD CONSTRAINT villages_pkey PRIMARY KEY (id); + + +-- +-- Name: visit_cards_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY visit_cards + ADD CONSTRAINT visit_cards_pkey PRIMARY KEY (id); + + +-- +-- Name: wiki_page_versions_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY wiki_page_versions + ADD CONSTRAINT wiki_page_versions_pkey PRIMARY KEY (id); + + +-- +-- Name: wiki_pages_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY wiki_pages + ADD CONSTRAINT wiki_pages_pkey PRIMARY KEY (id); + + +-- +-- Name: wiki_pages_to_wiki_pages_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY wiki_pages_to_wiki_pages + ADD CONSTRAINT wiki_pages_to_wiki_pages_pkey PRIMARY KEY (id); + + +-- +-- Name: wiki_types_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY wiki_types + ADD CONSTRAINT wiki_types_pkey PRIMARY KEY (id); + + +-- +-- Name: wordstat_rubrics_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY wordstat_rubrics + ADD CONSTRAINT wordstat_rubrics_pkey PRIMARY KEY (id); + + +-- +-- Name: xml_clients_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY xml_clients + ADD CONSTRAINT xml_clients_pkey PRIMARY KEY (id); + + +-- +-- Name: yandex_direct_banner_rubrics_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY yandex_direct_banner_rubrics + ADD CONSTRAINT yandex_direct_banner_rubrics_pkey PRIMARY KEY (id); + + +-- +-- Name: yandex_direct_banners_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY yandex_direct_banners + ADD CONSTRAINT yandex_direct_banners_pkey PRIMARY KEY (id); + + +-- +-- Name: yandex_direct_campaigns_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY yandex_direct_campaigns + ADD CONSTRAINT yandex_direct_campaigns_pkey PRIMARY KEY (id); + + +-- +-- Name: yandex_ips_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY yandex_ips + ADD CONSTRAINT yandex_ips_pkey PRIMARY KEY (id); + + +-- +-- Name: yandex_map_coordinates_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY yandex_map_coordinates + ADD CONSTRAINT yandex_map_coordinates_pkey PRIMARY KEY (id); + + +-- +-- Name: yandex_region_regions_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY yandex_region_regions + ADD CONSTRAINT yandex_region_regions_pkey PRIMARY KEY (id); + + +-- +-- Name: yandex_regions_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY yandex_regions + ADD CONSTRAINT yandex_regions_pkey PRIMARY KEY (id); + + +-- +-- Name: yandex_rubrics_pc_rubrics_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY yandex_rubrics_pc_rubrics + ADD CONSTRAINT yandex_rubrics_pc_rubrics_pkey PRIMARY KEY (id); + + +-- +-- Name: yandex_rubrics_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY yandex_rubrics + ADD CONSTRAINT yandex_rubrics_pkey PRIMARY KEY (id); + + +-- +-- Name: yandex_search_widgets_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY yandex_search_widgets + ADD CONSTRAINT yandex_search_widgets_pkey PRIMARY KEY (id); + + +-- +-- Name: zombie_rows_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY zombie_rows + ADD CONSTRAINT zombie_rows_pkey PRIMARY KEY (id); + + +SET search_path = search_hints, pg_catalog; + +-- +-- Name: form_frequency_pkey; Type: CONSTRAINT; Schema: search_hints; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY form_frequency + ADD CONSTRAINT form_frequency_pkey PRIMARY KEY (id); + + +-- +-- Name: form_rubrics_pkey; Type: CONSTRAINT; Schema: search_hints; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY form_rubrics + ADD CONSTRAINT form_rubrics_pkey PRIMARY KEY (id); + + +-- +-- Name: forms_pkey; Type: CONSTRAINT; Schema: search_hints; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY forms + ADD CONSTRAINT forms_pkey PRIMARY KEY (id); + + +-- +-- Name: requests_for_load_pkey; Type: CONSTRAINT; Schema: search_hints; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY requests_for_load + ADD CONSTRAINT requests_for_load_pkey PRIMARY KEY (id); + + +-- +-- Name: requests_pkey; Type: CONSTRAINT; Schema: search_hints; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY requests + ADD CONSTRAINT requests_pkey PRIMARY KEY (id); + + +SET search_path = service_box, pg_catalog; + +-- +-- Name: web_searchers_codes_stats_pkey; Type: CONSTRAINT; Schema: service_box; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY web_searchers_codes_stats + ADD CONSTRAINT web_searchers_codes_stats_pkey PRIMARY KEY (id); + + +-- +-- Name: web_searchers_pkey; Type: CONSTRAINT; Schema: service_box; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY web_searchers + ADD CONSTRAINT web_searchers_pkey PRIMARY KEY (id); + + +SET search_path = statistics, pg_catalog; + +-- +-- Name: blog_post_statistic_total_by_days_pkey; Type: CONSTRAINT; Schema: statistics; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY blog_post_statistic_total_by_days + ADD CONSTRAINT blog_post_statistic_total_by_days_pkey PRIMARY KEY (id); + + +-- +-- Name: blog_post_statistic_totals_pkey; Type: CONSTRAINT; Schema: statistics; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY blog_post_statistic_totals + ADD CONSTRAINT blog_post_statistic_totals_pkey PRIMARY KEY (id); + + +-- +-- Name: company_statistic_activities_by_days_pkey; Type: CONSTRAINT; Schema: statistics; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY company_statistic_activities_by_days + ADD CONSTRAINT company_statistic_activities_by_days_pkey PRIMARY KEY (id); + + +-- +-- Name: company_statistic_activities_by_months_pkey; Type: CONSTRAINT; Schema: statistics; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY company_statistic_activities_by_months + ADD CONSTRAINT company_statistic_activities_by_months_pkey PRIMARY KEY (id); + + +-- +-- Name: company_statistic_activities_by_weeks_pkey; Type: CONSTRAINT; Schema: statistics; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY company_statistic_activities_by_weeks + ADD CONSTRAINT company_statistic_activities_by_weeks_pkey PRIMARY KEY (id); + + +-- +-- Name: company_statistic_activities_totals_pkey; Type: CONSTRAINT; Schema: statistics; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY company_statistic_activities_totals + ADD CONSTRAINT company_statistic_activities_totals_pkey PRIMARY KEY (id); + + +-- +-- Name: company_statistic_geo_by_months_pkey; Type: CONSTRAINT; Schema: statistics; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY company_statistic_geo_by_months + ADD CONSTRAINT company_statistic_geo_by_months_pkey PRIMARY KEY (id); + + +-- +-- Name: company_statistic_geo_by_weeks_pkey; Type: CONSTRAINT; Schema: statistics; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY company_statistic_geo_by_weeks + ADD CONSTRAINT company_statistic_geo_by_weeks_pkey PRIMARY KEY (id); + + +-- +-- Name: company_statistic_pages_by_months_pkey; Type: CONSTRAINT; Schema: statistics; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY company_statistic_pages_by_months + ADD CONSTRAINT company_statistic_pages_by_months_pkey PRIMARY KEY (id); + + +-- +-- Name: company_statistic_pages_by_weeks_pkey; Type: CONSTRAINT; Schema: statistics; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY company_statistic_pages_by_weeks + ADD CONSTRAINT company_statistic_pages_by_weeks_pkey PRIMARY KEY (id); + + +-- +-- Name: company_statistic_referers_by_months_pkey; Type: CONSTRAINT; Schema: statistics; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY company_statistic_referers_by_months + ADD CONSTRAINT company_statistic_referers_by_months_pkey PRIMARY KEY (id); + + +-- +-- Name: company_statistic_referers_by_weeks_pkey; Type: CONSTRAINT; Schema: statistics; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY company_statistic_referers_by_weeks + ADD CONSTRAINT company_statistic_referers_by_weeks_pkey PRIMARY KEY (id); + + +-- +-- Name: company_statistic_total_by_days_pkey; Type: CONSTRAINT; Schema: statistics; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY company_statistic_total_by_days + ADD CONSTRAINT company_statistic_total_by_days_pkey PRIMARY KEY (id); + + +-- +-- Name: company_statistic_total_by_months_pkey; Type: CONSTRAINT; Schema: statistics; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY company_statistic_total_by_months + ADD CONSTRAINT company_statistic_total_by_months_pkey PRIMARY KEY (id); + + +-- +-- Name: company_statistic_total_by_weeks_pkey; Type: CONSTRAINT; Schema: statistics; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY company_statistic_total_by_weeks + ADD CONSTRAINT company_statistic_total_by_weeks_pkey PRIMARY KEY (id); + + +-- +-- Name: company_statistic_totals_pkey; Type: CONSTRAINT; Schema: statistics; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY company_statistic_totals + ADD CONSTRAINT company_statistic_totals_pkey PRIMARY KEY (id); + + +-- +-- Name: entities_statistic_by_region_pkey; Type: CONSTRAINT; Schema: statistics; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY entities_statistic_by_region + ADD CONSTRAINT entities_statistic_by_region_pkey PRIMARY KEY (id); + + +-- +-- Name: news_statistic_mainpage_by_days_pkey; Type: CONSTRAINT; Schema: statistics; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY news_statistic_mainpage_by_days + ADD CONSTRAINT news_statistic_mainpage_by_days_pkey PRIMARY KEY (id); + + +-- +-- Name: news_statistic_referers_by_months_pkey; Type: CONSTRAINT; Schema: statistics; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY news_statistic_referers_by_months + ADD CONSTRAINT news_statistic_referers_by_months_pkey PRIMARY KEY (id); + + +-- +-- Name: news_statistic_total_by_regions_pkey; Type: CONSTRAINT; Schema: statistics; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY news_statistic_total_by_regions + ADD CONSTRAINT news_statistic_total_by_regions_pkey PRIMARY KEY (id); + + +-- +-- Name: news_statistic_totals_pkey; Type: CONSTRAINT; Schema: statistics; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY news_statistic_totals + ADD CONSTRAINT news_statistic_totals_pkey PRIMARY KEY (id); + + +-- +-- Name: query_log_pkey; Type: CONSTRAINT; Schema: statistics; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY query_log + ADD CONSTRAINT query_log_pkey PRIMARY KEY (id); + + +-- +-- Name: rubric_region_adds_pkey; Type: CONSTRAINT; Schema: statistics; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY rubric_region_adds + ADD CONSTRAINT rubric_region_adds_pkey PRIMARY KEY (id); + + +SET search_path = system, pg_catalog; + +-- +-- Name: table_partitions_primary_key; Type: CONSTRAINT; Schema: system; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY table_partitions + ADD CONSTRAINT table_partitions_primary_key PRIMARY KEY (master_table, partition_table); + + +SET search_path = xls_import, pg_catalog; + +-- +-- Name: deleted_products_pkey; Type: CONSTRAINT; Schema: xls_import; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY deleted_products + ADD CONSTRAINT deleted_products_pkey PRIMARY KEY (id); + + +-- +-- Name: parsed_rows_pkey; Type: CONSTRAINT; Schema: xls_import; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY parsed_rows + ADD CONSTRAINT parsed_rows_pkey PRIMARY KEY (id); + + +-- +-- Name: transactions_pkey; Type: CONSTRAINT; Schema: xls_import; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY transactions + ADD CONSTRAINT transactions_pkey PRIMARY KEY (id); + + +SET search_path = denormalization, pg_catalog; + +-- +-- Name: uq_fields_class; Type: INDEX; Schema: denormalization; Owner: -; Tablespace: +-- + +CREATE UNIQUE INDEX uq_fields_class ON fields USING btree (field_class); + + +-- +-- Name: uq_fields_consumer_name; Type: INDEX; Schema: denormalization; Owner: -; Tablespace: +-- + +CREATE UNIQUE INDEX uq_fields_consumer_name ON processors USING btree (consumer_name); + + +-- +-- Name: uq_fields_title; Type: INDEX; Schema: denormalization; Owner: -; Tablespace: +-- + +CREATE UNIQUE INDEX uq_fields_title ON fields USING btree (title); + + +-- +-- Name: uq_processors; Type: INDEX; Schema: denormalization; Owner: -; Tablespace: +-- + +CREATE UNIQUE INDEX uq_processors ON processors USING btree (processor_class, params); + + +-- +-- Name: uq_queues; Type: INDEX; Schema: denormalization; Owner: -; Tablespace: +-- + +CREATE UNIQUE INDEX uq_queues ON queues USING btree (name, table_name); + + +-- +-- Name: uq_workers_name; Type: INDEX; Schema: denormalization; Owner: -; Tablespace: +-- + +CREATE UNIQUE INDEX uq_workers_name ON workers USING btree (name); + + +SET search_path = mail_deliveries, pg_catalog; + +-- +-- Name: ix_deliveries_category; Type: INDEX; Schema: mail_deliveries; Owner: -; Tablespace: +-- + +CREATE INDEX ix_deliveries_category ON deliveries USING btree (category_id); + + +-- +-- Name: uq_categories_description; Type: INDEX; Schema: mail_deliveries; Owner: -; Tablespace: +-- + +CREATE UNIQUE INDEX uq_categories_description ON categories USING btree (description); + + +-- +-- Name: uq_categories_portal_description; Type: INDEX; Schema: mail_deliveries; Owner: -; Tablespace: +-- + +CREATE UNIQUE INDEX uq_categories_portal_description ON categories USING btree (portal_description); + + +-- +-- Name: uq_categories_portal_title; Type: INDEX; Schema: mail_deliveries; Owner: -; Tablespace: +-- + +CREATE UNIQUE INDEX uq_categories_portal_title ON categories USING btree (portal_title); + + +-- +-- Name: uq_categories_title; Type: INDEX; Schema: mail_deliveries; Owner: -; Tablespace: +-- + +CREATE UNIQUE INDEX uq_categories_title ON categories USING btree (title); + + +-- +-- Name: uq_deliveries; Type: INDEX; Schema: mail_deliveries; Owner: -; Tablespace: +-- + +CREATE UNIQUE INDEX uq_deliveries ON deliveries USING btree (type, title); + + +-- +-- Name: uq_deliveries_slug; Type: INDEX; Schema: mail_deliveries; Owner: -; Tablespace: +-- + +CREATE UNIQUE INDEX uq_deliveries_slug ON deliveries USING btree (slug, type); + + +-- +-- Name: uq_delivery_company_filters; Type: INDEX; Schema: mail_deliveries; Owner: -; Tablespace: +-- + +CREATE UNIQUE INDEX uq_delivery_company_filters ON delivery_company_filters USING btree (delivery_id, filter_id); + + +-- +-- Name: uq_unsubscribed_users; Type: INDEX; Schema: mail_deliveries; Owner: -; Tablespace: +-- + +CREATE UNIQUE INDEX uq_unsubscribed_users ON unsubscribed_users USING btree (category_id, user_id); + + +-- +-- Name: uq_user_category_settings; Type: INDEX; Schema: mail_deliveries; Owner: -; Tablespace: +-- + +CREATE UNIQUE INDEX uq_user_category_settings ON user_category_settings USING btree (category_id, user_id); + + +SET search_path = mail_delivery, pg_catalog; + +-- +-- Name: i_attached_partner_projects_on_delivery_id; Type: INDEX; Schema: mail_delivery; Owner: -; Tablespace: +-- + +CREATE INDEX i_attached_partner_projects_on_delivery_id ON attached_partner_projects USING btree (portal_news_subscription_delivery_id); + + +-- +-- Name: i_auto_deliveries_delivery_at; Type: INDEX; Schema: mail_delivery; Owner: -; Tablespace: +-- + +CREATE INDEX i_auto_deliveries_delivery_at ON auto_deliveries USING btree (delivery_at); + + +-- +-- Name: i_mail_delivery_deliveries_token; Type: INDEX; Schema: mail_delivery; Owner: -; Tablespace: +-- + +CREATE INDEX i_mail_delivery_deliveries_token ON deliveries USING btree (token); + + +-- +-- Name: i_mail_delivery_delivery_send_type; Type: INDEX; Schema: mail_delivery; Owner: -; Tablespace: +-- + +CREATE INDEX i_mail_delivery_delivery_send_type ON deliveries USING btree (send_type); + + +-- +-- Name: i_mail_delivery_unreachable_emails_uniq; Type: INDEX; Schema: mail_delivery; Owner: -; Tablespace: +-- + +CREATE UNIQUE INDEX i_mail_delivery_unreachable_emails_uniq ON unreachable_emails USING btree (email); + + +-- +-- Name: i_mail_delivery_unsubscribed_emails_delivery_id; Type: INDEX; Schema: mail_delivery; Owner: -; Tablespace: +-- + +CREATE INDEX i_mail_delivery_unsubscribed_emails_delivery_id ON unsubscribed_emails USING btree (delivery_id); + + +-- +-- Name: idx_mail_set_content_template_theme_of_day_news_id; Type: INDEX; Schema: mail_delivery; Owner: -; Tablespace: +-- + +CREATE INDEX idx_mail_set_content_template_theme_of_day_news_id ON portal_news_subscriptions_mail_set_content_templates USING btree (theme_of_day_news_id); + + +-- +-- Name: idx_portal_news_delivery_region_id; Type: INDEX; Schema: mail_delivery; Owner: -; Tablespace: +-- + +CREATE INDEX idx_portal_news_delivery_region_id ON portal_news_subscription_deliveries USING btree (region_id); + + +-- +-- Name: idx_portal_news_subscr_user_id; Type: INDEX; Schema: mail_delivery; Owner: -; Tablespace: +-- + +CREATE INDEX idx_portal_news_subscr_user_id ON portal_news_subscriptions USING btree (user_id); + + +-- +-- Name: idx_portal_subscription_news_mail_set_content_template_id; Type: INDEX; Schema: mail_delivery; Owner: -; Tablespace: +-- + +CREATE INDEX idx_portal_subscription_news_mail_set_content_template_id ON portal_subscription_mail_set_news USING btree (mail_set_content_template_id); + + +-- +-- Name: index_attached_blogs_on_blog_post_id; Type: INDEX; Schema: mail_delivery; Owner: -; Tablespace: +-- + +CREATE INDEX index_attached_blogs_on_blog_post_id ON attached_blogs USING btree (blog_post_id); + + +-- +-- Name: index_attached_blogs_on_mail_set_content_template_id; Type: INDEX; Schema: mail_delivery; Owner: -; Tablespace: +-- + +CREATE INDEX index_attached_blogs_on_mail_set_content_template_id ON attached_blogs USING btree (mail_set_content_template_id); + + +-- +-- Name: index_attached_company_events_for_delivery; Type: INDEX; Schema: mail_delivery; Owner: -; Tablespace: +-- + +CREATE UNIQUE INDEX index_attached_company_events_for_delivery ON attached_company_events USING btree (mail_set_content_template_id, company_event_id); + + +-- +-- Name: index_attached_company_events_on_company_event_id; Type: INDEX; Schema: mail_delivery; Owner: -; Tablespace: +-- + +CREATE INDEX index_attached_company_events_on_company_event_id ON attached_company_events USING btree (company_event_id); + + +-- +-- Name: index_attached_company_events_on_mail_set_content_template_id; Type: INDEX; Schema: mail_delivery; Owner: -; Tablespace: +-- + +CREATE INDEX index_attached_company_events_on_mail_set_content_template_id ON attached_company_events USING btree (mail_set_content_template_id); + + +-- +-- Name: index_mail_delivery.companies_data_sets_on_company_id; Type: INDEX; Schema: mail_delivery; Owner: -; Tablespace: +-- + +CREATE INDEX "index_mail_delivery.companies_data_sets_on_company_id" ON companies_data_sets USING btree (company_id); + + +-- +-- Name: index_mail_delivery.companies_data_sets_on_filter_id; Type: INDEX; Schema: mail_delivery; Owner: -; Tablespace: +-- + +CREATE INDEX "index_mail_delivery.companies_data_sets_on_filter_id" ON companies_data_sets USING btree (filter_id); + + +-- +-- Name: index_mail_delivery.companies_data_sets_on_mail_set_id; Type: INDEX; Schema: mail_delivery; Owner: -; Tablespace: +-- + +CREATE INDEX "index_mail_delivery.companies_data_sets_on_mail_set_id" ON companies_data_sets USING btree (mail_set_id); + + +-- +-- Name: index_mail_delivery.companies_data_sets_on_region_id; Type: INDEX; Schema: mail_delivery; Owner: -; Tablespace: +-- + +CREATE INDEX "index_mail_delivery.companies_data_sets_on_region_id" ON companies_data_sets USING btree (region_id); + + +-- +-- Name: index_mail_delivery.companies_data_sets_on_user_id; Type: INDEX; Schema: mail_delivery; Owner: -; Tablespace: +-- + +CREATE INDEX "index_mail_delivery.companies_data_sets_on_user_id" ON companies_data_sets USING btree (user_id); + + +-- +-- Name: index_mail_delivery.companies_datasources_on_delivery_id; Type: INDEX; Schema: mail_delivery; Owner: -; Tablespace: +-- + +CREATE INDEX "index_mail_delivery.companies_datasources_on_delivery_id" ON companies_datasources USING btree (delivery_id); + + +-- +-- Name: index_mail_delivery.companies_filters_on_delivery_id; Type: INDEX; Schema: mail_delivery; Owner: -; Tablespace: +-- + +CREATE INDEX "index_mail_delivery.companies_filters_on_delivery_id" ON companies_filters USING btree (delivery_id); + + +-- +-- Name: index_mail_delivery.mail_sets_on_state; Type: INDEX; Schema: mail_delivery; Owner: -; Tablespace: +-- + +CREATE INDEX "index_mail_delivery.mail_sets_on_state" ON mail_sets USING btree (state); + + +-- +-- Name: index_mail_delivery.mails_on_mail_set_id; Type: INDEX; Schema: mail_delivery; Owner: -; Tablespace: +-- + +CREATE INDEX "index_mail_delivery.mails_on_mail_set_id" ON mails USING btree (mail_set_id); + + +-- +-- Name: index_mail_delivery.mails_on_mail_set_id_and_state; Type: INDEX; Schema: mail_delivery; Owner: -; Tablespace: +-- + +CREATE INDEX "index_mail_delivery.mails_on_mail_set_id_and_state" ON mails USING btree (mail_set_id, state); + + +-- +-- Name: index_mail_delivery.personal_subscription_data_prepared_drr; Type: INDEX; Schema: mail_delivery; Owner: -; Tablespace: +-- + +CREATE INDEX "index_mail_delivery.personal_subscription_data_prepared_drr" ON personal_subscription_data_prepared USING btree (delivery_id, region_id, rubric_id); + + +-- +-- Name: index_mail_delivery.personal_subscription_data_sets_on_user_id; Type: INDEX; Schema: mail_delivery; Owner: -; Tablespace: +-- + +CREATE INDEX "index_mail_delivery.personal_subscription_data_sets_on_user_id" ON personal_subscription_data_sets USING btree (user_id); + + +-- +-- Name: index_mail_delivery.personal_subscriptions_on_delivery_id; Type: INDEX; Schema: mail_delivery; Owner: -; Tablespace: +-- + +CREATE INDEX "index_mail_delivery.personal_subscriptions_on_delivery_id" ON personal_subscriptions USING btree (delivery_id); + + +-- +-- Name: index_mail_delivery.personal_subscriptions_on_user_id_and_email; Type: INDEX; Schema: mail_delivery; Owner: -; Tablespace: +-- + +CREATE INDEX "index_mail_delivery.personal_subscriptions_on_user_id_and_email" ON personal_subscriptions USING btree (user_id, email); + + +-- +-- Name: index_mail_delivery.schedules_on_send_date; Type: INDEX; Schema: mail_delivery; Owner: -; Tablespace: +-- + +CREATE INDEX "index_mail_delivery.schedules_on_send_date" ON schedules USING btree (send_date); + + +-- +-- Name: index_mail_delivery.schedules_on_send_frequency; Type: INDEX; Schema: mail_delivery; Owner: -; Tablespace: +-- + +CREATE INDEX "index_mail_delivery.schedules_on_send_frequency" ON schedules USING btree (send_frequency); + + +-- +-- Name: index_mail_delivery.schedules_on_subject_id_and_subject_type; Type: INDEX; Schema: mail_delivery; Owner: -; Tablespace: +-- + +CREATE INDEX "index_mail_delivery.schedules_on_subject_id_and_subject_type" ON schedules USING btree (subject_id, subject_type); + + +-- +-- Name: index_mail_delivery.senders_on_region_id; Type: INDEX; Schema: mail_delivery; Owner: -; Tablespace: +-- + +CREATE INDEX "index_mail_delivery.senders_on_region_id" ON senders USING btree (region_id); + + +-- +-- Name: index_mail_delivery.subscriptions_on_email_ci; Type: INDEX; Schema: mail_delivery; Owner: -; Tablespace: +-- + +CREATE UNIQUE INDEX "index_mail_delivery.subscriptions_on_email_ci" ON subscriptions USING btree (lower((email)::text)); + + +-- +-- Name: index_mail_delivery.variables_on_name; Type: INDEX; Schema: mail_delivery; Owner: -; Tablespace: +-- + +CREATE INDEX "index_mail_delivery.variables_on_name" ON variables USING btree (name); + + +-- +-- Name: index_unique_blog_posts_for_delivery; Type: INDEX; Schema: mail_delivery; Owner: -; Tablespace: +-- + +CREATE UNIQUE INDEX index_unique_blog_posts_for_delivery ON attached_blogs USING btree (blog_post_id, mail_set_content_template_id); + + +SET search_path = permissions, pg_catalog; + +-- +-- Name: i_permissions_admin_permission_section_id; Type: INDEX; Schema: permissions; Owner: -; Tablespace: +-- + +CREATE INDEX i_permissions_admin_permission_section_id ON admin_permissions USING btree (section_id); + + +-- +-- Name: i_permissions_admin_permission_user_id; Type: INDEX; Schema: permissions; Owner: -; Tablespace: +-- + +CREATE INDEX i_permissions_admin_permission_user_id ON admin_permissions USING btree (user_id); + + +-- +-- Name: i_permissions_admin_sections_slug; Type: INDEX; Schema: permissions; Owner: -; Tablespace: +-- + +CREATE INDEX i_permissions_admin_sections_slug ON admin_sections USING btree (slug); + + +SET search_path = pgq, pg_catalog; + +-- +-- Name: event_10_0_txid_idx; Type: INDEX; Schema: pgq; Owner: -; Tablespace: +-- + +CREATE INDEX event_10_0_txid_idx ON event_10_0 USING btree (ev_txid); + + +-- +-- Name: event_10_1_txid_idx; Type: INDEX; Schema: pgq; Owner: -; Tablespace: +-- + +CREATE INDEX event_10_1_txid_idx ON event_10_1 USING btree (ev_txid); + + +-- +-- Name: event_10_2_txid_idx; Type: INDEX; Schema: pgq; Owner: -; Tablespace: +-- + +CREATE INDEX event_10_2_txid_idx ON event_10_2 USING btree (ev_txid); + + +-- +-- Name: event_11_0_txid_idx; Type: INDEX; Schema: pgq; Owner: -; Tablespace: +-- + +CREATE INDEX event_11_0_txid_idx ON event_11_0 USING btree (ev_txid); + + +-- +-- Name: event_11_1_txid_idx; Type: INDEX; Schema: pgq; Owner: -; Tablespace: +-- + +CREATE INDEX event_11_1_txid_idx ON event_11_1 USING btree (ev_txid); + + +-- +-- Name: event_11_2_txid_idx; Type: INDEX; Schema: pgq; Owner: -; Tablespace: +-- + +CREATE INDEX event_11_2_txid_idx ON event_11_2 USING btree (ev_txid); + + +-- +-- Name: event_12_0_txid_idx; Type: INDEX; Schema: pgq; Owner: -; Tablespace: +-- + +CREATE INDEX event_12_0_txid_idx ON event_12_0 USING btree (ev_txid); + + +-- +-- Name: event_12_1_txid_idx; Type: INDEX; Schema: pgq; Owner: -; Tablespace: +-- + +CREATE INDEX event_12_1_txid_idx ON event_12_1 USING btree (ev_txid); + + +-- +-- Name: event_12_2_txid_idx; Type: INDEX; Schema: pgq; Owner: -; Tablespace: +-- + +CREATE INDEX event_12_2_txid_idx ON event_12_2 USING btree (ev_txid); + + +-- +-- Name: event_13_0_txid_idx; Type: INDEX; Schema: pgq; Owner: -; Tablespace: +-- + +CREATE INDEX event_13_0_txid_idx ON event_13_0 USING btree (ev_txid); + + +-- +-- Name: event_13_1_txid_idx; Type: INDEX; Schema: pgq; Owner: -; Tablespace: +-- + +CREATE INDEX event_13_1_txid_idx ON event_13_1 USING btree (ev_txid); + + +-- +-- Name: event_13_2_txid_idx; Type: INDEX; Schema: pgq; Owner: -; Tablespace: +-- + +CREATE INDEX event_13_2_txid_idx ON event_13_2 USING btree (ev_txid); + + +-- +-- Name: event_14_0_txid_idx; Type: INDEX; Schema: pgq; Owner: -; Tablespace: +-- + +CREATE INDEX event_14_0_txid_idx ON event_14_0 USING btree (ev_txid); + + +-- +-- Name: event_14_1_txid_idx; Type: INDEX; Schema: pgq; Owner: -; Tablespace: +-- + +CREATE INDEX event_14_1_txid_idx ON event_14_1 USING btree (ev_txid); + + +-- +-- Name: event_14_2_txid_idx; Type: INDEX; Schema: pgq; Owner: -; Tablespace: +-- + +CREATE INDEX event_14_2_txid_idx ON event_14_2 USING btree (ev_txid); + + +-- +-- Name: event_1_0_txid_idx; Type: INDEX; Schema: pgq; Owner: -; Tablespace: +-- + +CREATE INDEX event_1_0_txid_idx ON event_1_0 USING btree (ev_txid); + + +-- +-- Name: event_1_1_txid_idx; Type: INDEX; Schema: pgq; Owner: -; Tablespace: +-- + +CREATE INDEX event_1_1_txid_idx ON event_1_1 USING btree (ev_txid); + + +-- +-- Name: event_1_2_txid_idx; Type: INDEX; Schema: pgq; Owner: -; Tablespace: +-- + +CREATE INDEX event_1_2_txid_idx ON event_1_2 USING btree (ev_txid); + + +-- +-- Name: event_2_0_txid_idx; Type: INDEX; Schema: pgq; Owner: -; Tablespace: +-- + +CREATE INDEX event_2_0_txid_idx ON event_2_0 USING btree (ev_txid); + + +-- +-- Name: event_2_1_txid_idx; Type: INDEX; Schema: pgq; Owner: -; Tablespace: +-- + +CREATE INDEX event_2_1_txid_idx ON event_2_1 USING btree (ev_txid); + + +-- +-- Name: event_2_2_txid_idx; Type: INDEX; Schema: pgq; Owner: -; Tablespace: +-- + +CREATE INDEX event_2_2_txid_idx ON event_2_2 USING btree (ev_txid); + + +-- +-- Name: event_3_0_txid_idx; Type: INDEX; Schema: pgq; Owner: -; Tablespace: +-- + +CREATE INDEX event_3_0_txid_idx ON event_3_0 USING btree (ev_txid); + + +-- +-- Name: event_3_1_txid_idx; Type: INDEX; Schema: pgq; Owner: -; Tablespace: +-- + +CREATE INDEX event_3_1_txid_idx ON event_3_1 USING btree (ev_txid); + + +-- +-- Name: event_3_2_txid_idx; Type: INDEX; Schema: pgq; Owner: -; Tablespace: +-- + +CREATE INDEX event_3_2_txid_idx ON event_3_2 USING btree (ev_txid); + + +-- +-- Name: event_4_0_txid_idx; Type: INDEX; Schema: pgq; Owner: -; Tablespace: +-- + +CREATE INDEX event_4_0_txid_idx ON event_4_0 USING btree (ev_txid); + + +-- +-- Name: event_4_1_txid_idx; Type: INDEX; Schema: pgq; Owner: -; Tablespace: +-- + +CREATE INDEX event_4_1_txid_idx ON event_4_1 USING btree (ev_txid); + + +-- +-- Name: event_4_2_txid_idx; Type: INDEX; Schema: pgq; Owner: -; Tablespace: +-- + +CREATE INDEX event_4_2_txid_idx ON event_4_2 USING btree (ev_txid); + + +-- +-- Name: event_5_0_txid_idx; Type: INDEX; Schema: pgq; Owner: -; Tablespace: +-- + +CREATE INDEX event_5_0_txid_idx ON event_5_0 USING btree (ev_txid); + + +-- +-- Name: event_5_1_txid_idx; Type: INDEX; Schema: pgq; Owner: -; Tablespace: +-- + +CREATE INDEX event_5_1_txid_idx ON event_5_1 USING btree (ev_txid); + + +-- +-- Name: event_5_2_txid_idx; Type: INDEX; Schema: pgq; Owner: -; Tablespace: +-- + +CREATE INDEX event_5_2_txid_idx ON event_5_2 USING btree (ev_txid); + + +-- +-- Name: event_6_0_txid_idx; Type: INDEX; Schema: pgq; Owner: -; Tablespace: +-- + +CREATE INDEX event_6_0_txid_idx ON event_6_0 USING btree (ev_txid); + + +-- +-- Name: event_6_1_txid_idx; Type: INDEX; Schema: pgq; Owner: -; Tablespace: +-- + +CREATE INDEX event_6_1_txid_idx ON event_6_1 USING btree (ev_txid); + + +-- +-- Name: event_6_2_txid_idx; Type: INDEX; Schema: pgq; Owner: -; Tablespace: +-- + +CREATE INDEX event_6_2_txid_idx ON event_6_2 USING btree (ev_txid); + + +-- +-- Name: event_7_0_txid_idx; Type: INDEX; Schema: pgq; Owner: -; Tablespace: +-- + +CREATE INDEX event_7_0_txid_idx ON event_7_0 USING btree (ev_txid); + + +-- +-- Name: event_7_1_txid_idx; Type: INDEX; Schema: pgq; Owner: -; Tablespace: +-- + +CREATE INDEX event_7_1_txid_idx ON event_7_1 USING btree (ev_txid); + + +-- +-- Name: event_7_2_txid_idx; Type: INDEX; Schema: pgq; Owner: -; Tablespace: +-- + +CREATE INDEX event_7_2_txid_idx ON event_7_2 USING btree (ev_txid); + + +-- +-- Name: event_8_0_txid_idx; Type: INDEX; Schema: pgq; Owner: -; Tablespace: +-- + +CREATE INDEX event_8_0_txid_idx ON event_8_0 USING btree (ev_txid); + + +-- +-- Name: event_8_1_txid_idx; Type: INDEX; Schema: pgq; Owner: -; Tablespace: +-- + +CREATE INDEX event_8_1_txid_idx ON event_8_1 USING btree (ev_txid); + + +-- +-- Name: event_8_2_txid_idx; Type: INDEX; Schema: pgq; Owner: -; Tablespace: +-- + +CREATE INDEX event_8_2_txid_idx ON event_8_2 USING btree (ev_txid); + + +-- +-- Name: event_9_0_txid_idx; Type: INDEX; Schema: pgq; Owner: -; Tablespace: +-- + +CREATE INDEX event_9_0_txid_idx ON event_9_0 USING btree (ev_txid); + + +-- +-- Name: event_9_1_txid_idx; Type: INDEX; Schema: pgq; Owner: -; Tablespace: +-- + +CREATE INDEX event_9_1_txid_idx ON event_9_1 USING btree (ev_txid); + + +-- +-- Name: event_9_2_txid_idx; Type: INDEX; Schema: pgq; Owner: -; Tablespace: +-- + +CREATE INDEX event_9_2_txid_idx ON event_9_2 USING btree (ev_txid); + + +-- +-- Name: rq_retry_idx; Type: INDEX; Schema: pgq; Owner: -; Tablespace: +-- + +CREATE INDEX rq_retry_idx ON retry_queue USING btree (ev_retry_after); + + +SET search_path = public, pg_catalog; + +-- +-- Name: base_words_id_is_deleted_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX base_words_id_is_deleted_idx ON base_words USING btree (id, is_deleted) WHERE (is_deleted = false); + + +-- +-- Name: by_cached_level; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX by_cached_level ON rubrics USING btree (cached_level, lft); + +ALTER TABLE rubrics CLUSTER ON by_cached_level; + + +-- +-- Name: by_year_month; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE UNIQUE INDEX by_year_month ON showcase_order_periods USING btree (year, month, showcase_order_id); + + +-- +-- Name: company_users_unique_user_id_company_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE UNIQUE INDEX company_users_unique_user_id_company_id ON company_users USING btree (user_id, company_id); + + +-- +-- Name: fk_assetable; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX fk_assetable ON ckeditor_assets USING btree (assetable_type, assetable_id); + + +-- +-- Name: fk_user; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX fk_user ON ckeditor_assets USING btree (user_id); + + +-- +-- Name: i_account_export_configs_name; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE UNIQUE INDEX i_account_export_configs_name ON account_export_configs USING btree (name); + + +-- +-- Name: i_accounts_company; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX i_accounts_company ON accounts USING btree (company_id); + + +-- +-- Name: i_award_nominees_award_rubric_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX i_award_nominees_award_rubric_id ON award_nominees USING btree (award_rubric_id); + + +-- +-- Name: i_award_nominees_company_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX i_award_nominees_company_id ON award_nominees USING btree (company_id); + + +-- +-- Name: i_award_nominees_for_window; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX i_award_nominees_for_window ON award_nominees USING btree (award_id, award_rubric_id, votes_count DESC); + + +-- +-- Name: i_award_winner_nomination_user_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX i_award_winner_nomination_user_id ON award_winner_nomination_votes USING btree (user_id); + + +-- +-- Name: i_award_winner_nomination_votes_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX i_award_winner_nomination_votes_idx ON award_winner_nomination_votes USING btree (award_nomination_id, award_winner_id); + + +-- +-- Name: i_cms_company_regions_company_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX i_cms_company_regions_company_id ON cms_company_regions USING btree (company_id); + + +-- +-- Name: i_cms_pages_cached_path; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX i_cms_pages_cached_path ON cms_pages USING btree (cached_path); + + +-- +-- Name: i_companies_oferta_sync_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX i_companies_oferta_sync_id ON companies USING btree (oferta_sync_id); + + +-- +-- Name: i_company_business_types_company_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX i_company_business_types_company_id ON company_business_types USING btree (company_id); + + +-- +-- Name: i_company_registration_sources_company_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX i_company_registration_sources_company_id ON company_registration_sources USING btree (company_id); + + +-- +-- Name: i_company_reviews_comments_company; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX i_company_reviews_comments_company ON company_review_comments USING btree (review_id, state); + + +-- +-- Name: i_company_reviews_company_state_created; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX i_company_reviews_company_state_created ON company_reviews USING btree (company_id, state, created_at DESC); + + +-- +-- Name: i_company_rubrics_company_id_rubric_id_rubric_level; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX i_company_rubrics_company_id_rubric_id_rubric_level ON company_rubrics USING btree (company_id, rubric_id, rubric_level); + + +-- +-- Name: i_company_rubrics_company_id_rubric_id_uniq; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE UNIQUE INDEX i_company_rubrics_company_id_rubric_id_uniq ON company_rubrics USING btree (company_id, rubric_id); + + +-- +-- Name: i_company_sites_company_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX i_company_sites_company_id ON company_sites USING btree (company_id); + + +-- +-- Name: i_company_sites_company_id_url_uniq; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE UNIQUE INDEX i_company_sites_company_id_url_uniq ON company_sites USING btree (company_id, url); + + +-- +-- Name: i_news_company_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX i_news_company_id ON news USING btree (company_id); + + +-- +-- Name: i_online_users_stat_by_day_dt; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX i_online_users_stat_by_day_dt ON online_users_stat_by_days USING btree (date); + + +-- +-- Name: i_online_users_stat_by_hour_dt; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX i_online_users_stat_by_hour_dt ON online_users_stat_by_hours USING btree (date); + + +-- +-- Name: i_online_users_stat_by_min_dt; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX i_online_users_stat_by_min_dt ON online_users_stat_by_mins USING btree (dt); + + +-- +-- Name: i_phones_address_id_code_number_type_id_uniq; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE UNIQUE INDEX i_phones_address_id_code_number_type_id_uniq ON phones USING btree (address_id, code, number, type_id); + + +-- +-- Name: i_product_deltas_company_id_product_id_uniq; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE UNIQUE INDEX i_product_deltas_company_id_product_id_uniq ON product_deltas USING btree (company_id, product_id); + + +-- +-- Name: i_product_deltas_is_new_is_true; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX i_product_deltas_is_new_is_true ON product_deltas USING btree (is_new) WHERE (is_new IS TRUE); + + +-- +-- Name: i_product_deltas_product_id_uniq; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE UNIQUE INDEX i_product_deltas_product_id_uniq ON product_deltas USING btree (product_id); + + +-- +-- Name: i_product_groups_company_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX i_product_groups_company_id ON product_groups USING btree (company_id); + + +-- +-- Name: i_product_images_processing_is_true; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX i_product_images_processing_is_true ON product_images USING btree (processing) WHERE (processing IS TRUE); + + +-- +-- Name: i_product_images_product_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX i_product_images_product_id ON product_images USING btree (product_id); + + +-- +-- Name: i_product_images_product_id_position; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE UNIQUE INDEX i_product_images_product_id_position ON product_images USING btree (product_id, "position"); + + +-- +-- Name: i_product_images_product_id_position_first; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX i_product_images_product_id_position_first ON product_images USING btree (product_id, "position") WHERE ("position" = 1); + + +-- +-- Name: i_product_regions_product_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX i_product_regions_product_id ON product_regions USING btree (product_id); + + +-- +-- Name: i_product_regions_region_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX i_product_regions_region_id ON product_regions USING btree (region_id); + + +-- +-- Name: i_products_335_company_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX i_products_335_company_id ON products USING btree (company_id); + + +-- +-- Name: i_products_335_oferta_sync_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX i_products_335_oferta_sync_id ON products USING btree (oferta_sync_id); + + +-- +-- Name: i_products_335_product_group_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX i_products_335_product_group_id ON products USING btree (product_group_id); + + +-- +-- Name: i_products_335_rubric_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX i_products_335_rubric_id ON products USING btree (rubric_id); + + +-- +-- Name: i_products_335_state; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX i_products_335_state ON products USING btree (state); + + +-- +-- Name: i_products_335_url_name; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX i_products_335_url_name ON products USING btree (url_name); + + +-- +-- Name: i_rubric_statistics_products_stat; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX i_rubric_statistics_products_stat ON rubric_statistics USING btree (products_stat); + + +-- +-- Name: i_rubrics_denormalization_tree_rubric_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE UNIQUE INDEX i_rubrics_denormalization_tree_rubric_id ON rubrics_denormalization_tree USING btree (rubric_id); + + +-- +-- Name: i_rubrics_denormalization_tree_rubric_l3_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX i_rubrics_denormalization_tree_rubric_l3_id ON rubrics_denormalization_tree USING btree (rubric_l3_id); + + +-- +-- Name: i_rubrics_denormalization_tree_rubric_l4_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX i_rubrics_denormalization_tree_rubric_l4_id ON rubrics_denormalization_tree USING btree (rubric_l4_id); + + +-- +-- Name: i_rubrics_lft; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX i_rubrics_lft ON rubrics USING btree (lft); + + +-- +-- Name: i_rubrics_on_lft_and_rgt_and_level_is_published; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX i_rubrics_on_lft_and_rgt_and_level_is_published ON rubrics USING btree (lft, rgt, cached_level) WHERE (is_published = true); + + +-- +-- Name: i_rubrics_parent_id_is_published_eq1_and_slug_not_another; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX i_rubrics_parent_id_is_published_eq1_and_slug_not_another ON rubrics USING btree (parent_id) WHERE (((slug)::text <> 'another'::text) AND (is_published = true)); + + +-- +-- Name: i_rubrics_rgt; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX i_rubrics_rgt ON rubrics USING btree (rgt); + + +-- +-- Name: i_search_index_class_name; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX i_search_index_class_name ON search_index_queue USING btree (class_name); + + +-- +-- Name: i_search_wordforms_form_word; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX i_search_wordforms_form_word ON search_wordforms USING btree (form, word, is_deleted); + + +-- +-- Name: i_seo_entities_on_rubric_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX i_seo_entities_on_rubric_id ON seo_entities USING btree (rubric_id); + + +-- +-- Name: i_test_packets_company_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX i_test_packets_company_id ON test_packets USING btree (company_id); + + +-- +-- Name: i_text_zones_rotation_tag_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX i_text_zones_rotation_tag_id ON text_zones USING btree (rotation_tag, id); + + +-- +-- Name: i_text_zones_slug; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE UNIQUE INDEX i_text_zones_slug ON text_zones USING btree (slug); + + +-- +-- Name: i_trait_value_redirects_trait_rubric; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX i_trait_value_redirects_trait_rubric ON trait_value_redirects USING btree (trait_rubric_id); + + +-- +-- Name: i_trait_value_redirects_trait_value; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX i_trait_value_redirects_trait_value ON trait_value_redirects USING btree (trait_value_id); + + +-- +-- Name: i_uniq_ip_infos_on_ip_end; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE UNIQUE INDEX i_uniq_ip_infos_on_ip_end ON ip_infos USING btree (ip_end); + + +-- +-- Name: i_uniq_ip_infos_on_ip_start; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE UNIQUE INDEX i_uniq_ip_infos_on_ip_start ON ip_infos USING btree (ip_start); + + +-- +-- Name: i_unique_news_rubrics; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE UNIQUE INDEX i_unique_news_rubrics ON news_rubrics USING btree (news_id, rubric_id); + + +-- +-- Name: i_user_profile_user_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE UNIQUE INDEX i_user_profile_user_id ON user_profiles USING btree (user_id); + + +-- +-- Name: idx_assetable_type; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX idx_assetable_type ON ckeditor_assets USING btree (assetable_type, type, assetable_id); + + +-- +-- Name: idx_wiki_to_wiki_by_page_id_other_page_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX idx_wiki_to_wiki_by_page_id_other_page_id ON wiki_pages_to_wiki_pages USING btree (wiki_page_id, other_page_id); + + +-- +-- Name: index_accounts_on_company_id_and_type; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_accounts_on_company_id_and_type ON accounts USING btree (company_id, type); + + +-- +-- Name: index_accounts_on_type; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_accounts_on_type ON accounts USING btree (type); + + +-- +-- Name: index_action_queue_on_created_at; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_action_queue_on_created_at ON action_queue USING btree (created_at); + + +-- +-- Name: index_action_queue_on_initiator_id_and_initiator_type; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_action_queue_on_initiator_id_and_initiator_type ON action_queue USING btree (initiator_id, initiator_type); + + +-- +-- Name: index_action_queue_on_initiator_type_and_status; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_action_queue_on_initiator_type_and_status ON action_queue USING btree (initiator_type, status); + + +-- +-- Name: index_addresses_on_city_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_addresses_on_city_id ON addresses USING btree (city_id); + + +-- +-- Name: index_addresses_on_company_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_addresses_on_company_id ON addresses USING btree (company_id); + + +-- +-- Name: index_addresses_on_map_address_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_addresses_on_map_address_id ON addresses USING btree (map_address_id); + + +-- +-- Name: index_addresses_on_oferta_sync_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_addresses_on_oferta_sync_id ON addresses USING btree (oferta_sync_id); + + +-- +-- Name: index_addresses_on_street_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_addresses_on_street_id ON addresses USING btree (street_id); + + +-- +-- Name: index_amazon_s3_assets_on_attachable_id_and_attachable_type; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_amazon_s3_assets_on_attachable_id_and_attachable_type ON amazon_s3_assets USING btree (attachable_id, attachable_type); + + +-- +-- Name: index_amazon_s3_public_assets_on_attachable_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_amazon_s3_public_assets_on_attachable_id ON amazon_s3_public_assets USING btree (attachable_id); + + +-- +-- Name: index_amazon_s3_public_assets_on_attachable_type; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_amazon_s3_public_assets_on_attachable_type ON amazon_s3_public_assets USING btree (attachable_type); + + +-- +-- Name: index_answers_on_company_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_answers_on_company_id ON answers USING btree (company_id); + + +-- +-- Name: index_arrangements_on_company_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_arrangements_on_company_id ON arrangements USING btree (company_id); + + +-- +-- Name: index_articles_on_company_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_articles_on_company_id ON articles USING btree (company_id); + + +-- +-- Name: index_avatars_on_parent_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_avatars_on_parent_id ON avatars USING btree (parent_id); + + +-- +-- Name: index_avatars_on_user_profile_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_avatars_on_user_profile_id ON avatars USING btree (user_profile_id); + + +-- +-- Name: index_banner_zones_on_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_banner_zones_on_id ON banner_zones USING btree (id); + + +-- +-- Name: index_banner_zones_on_rubric_id_and_rubric_type; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_banner_zones_on_rubric_id_and_rubric_type ON banner_zones USING btree (rubric_id, rubric_type); + + +-- +-- Name: index_base_words_on_is_deleted; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_base_words_on_is_deleted ON base_words USING btree (is_deleted); + + +-- +-- Name: index_base_words_on_name; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_base_words_on_name ON base_words USING btree (name); + + +-- +-- Name: index_base_words_on_name_terms; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_base_words_on_name_terms ON base_words USING gin (name_terms); + + +-- +-- Name: index_blog_comments_on_blog_post_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_blog_comments_on_blog_post_id ON blog_comments USING btree (blog_post_id); + + +-- +-- Name: index_blog_comments_on_user_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_blog_comments_on_user_id ON blog_comments USING btree (user_id); + + +-- +-- Name: index_blog_post_contents_on_blog_post_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_blog_post_contents_on_blog_post_id ON blog_post_contents USING btree (blog_post_id); + + +-- +-- Name: index_blog_post_contents_on_blog_post_id_and_position; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_blog_post_contents_on_blog_post_id_and_position ON blog_post_contents USING btree (blog_post_id, "position"); + + +-- +-- Name: index_blog_post_images_on_blog_post_content_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_blog_post_images_on_blog_post_content_id ON blog_post_images USING btree (blog_post_content_id); + + +-- +-- Name: index_blog_post_images_on_blog_post_content_id_and_position; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_blog_post_images_on_blog_post_content_id_and_position ON blog_post_images USING btree (blog_post_content_id, "position"); + + +-- +-- Name: index_blog_post_regions_on_blog_post_id_and_region_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE UNIQUE INDEX index_blog_post_regions_on_blog_post_id_and_region_id ON blog_post_regions USING btree (blog_post_id, region_id); + + +-- +-- Name: index_blog_posts_on_blog_rubric_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_blog_posts_on_blog_rubric_id ON blog_posts USING btree (blog_rubric_id); + + +-- +-- Name: index_blog_posts_on_deleted_at; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_blog_posts_on_deleted_at ON blog_posts USING btree (deleted_at); + + +-- +-- Name: index_blog_posts_on_flags; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_blog_posts_on_flags ON blog_posts USING btree (flags); + + +-- +-- Name: index_blog_posts_on_main_region_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_blog_posts_on_main_region_id ON blog_posts USING btree (main_region_id); + + +-- +-- Name: index_blog_posts_on_moderated_at; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_blog_posts_on_moderated_at ON blog_posts USING btree (moderated_at); + + +-- +-- Name: index_blog_posts_on_moderator_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_blog_posts_on_moderator_id ON blog_posts USING btree (moderated_by); + + +-- +-- Name: index_blog_posts_on_published_at; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_blog_posts_on_published_at ON blog_posts USING btree (published_at); + + +-- +-- Name: index_blog_posts_on_state; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_blog_posts_on_state ON blog_posts USING btree (state); + + +-- +-- Name: index_blog_posts_on_user_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_blog_posts_on_user_id ON blog_posts USING btree (user_id); + + +-- +-- Name: index_blog_rubric_mappings_on_rubric_id_and_blog_rubric_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE UNIQUE INDEX index_blog_rubric_mappings_on_rubric_id_and_blog_rubric_id ON blog_rubric_mappings USING btree (rubric_id, blog_rubric_id); + + +-- +-- Name: index_blog_rubric_statistics_on_blog_rubric_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_blog_rubric_statistics_on_blog_rubric_id ON blog_rubric_statistics USING btree (blog_rubric_id); + + +-- +-- Name: index_blog_rubric_statistics_on_count_accept_posts; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_blog_rubric_statistics_on_count_accept_posts ON blog_rubric_statistics USING btree (count_accept_posts); + + +-- +-- Name: index_blog_rubric_statistics_on_count_decline_posts; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_blog_rubric_statistics_on_count_decline_posts ON blog_rubric_statistics USING btree (count_decline_posts); + + +-- +-- Name: index_blog_rubric_statistics_on_count_deleted_posts; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_blog_rubric_statistics_on_count_deleted_posts ON blog_rubric_statistics USING btree (count_deleted_posts); + + +-- +-- Name: index_blog_rubric_statistics_on_count_new_posts; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_blog_rubric_statistics_on_count_new_posts ON blog_rubric_statistics USING btree (count_new_posts); + + +-- +-- Name: index_blog_rubric_statistics_on_count_posts; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_blog_rubric_statistics_on_count_posts ON blog_rubric_statistics USING btree (count_posts); + + +-- +-- Name: index_blog_rubric_statistics_on_count_published_posts; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_blog_rubric_statistics_on_count_published_posts ON blog_rubric_statistics USING btree (count_published_posts); + + +-- +-- Name: index_blog_rubric_statistics_on_region_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_blog_rubric_statistics_on_region_id ON blog_rubric_statistics USING btree (region_id); + + +-- +-- Name: index_blog_rubrics_on_position; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_blog_rubrics_on_position ON blog_rubrics USING btree ("position"); + + +-- +-- Name: index_blog_rubrics_on_slug; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE UNIQUE INDEX index_blog_rubrics_on_slug ON blog_rubrics USING btree (slug); + + +-- +-- Name: index_blog_settings_on_nickname; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE UNIQUE INDEX index_blog_settings_on_nickname ON blog_settings USING btree (nickname); + + +-- +-- Name: index_blog_settings_on_privacy; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_blog_settings_on_privacy ON blog_settings USING btree (privacy); + + +-- +-- Name: index_blog_settings_on_region_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_blog_settings_on_region_id ON blog_settings USING btree (region_id); + + +-- +-- Name: index_blog_settings_on_user_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_blog_settings_on_user_id ON blog_settings USING btree (user_id); + + +-- +-- Name: index_cities_on_province_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_cities_on_province_id ON cities USING btree (province_id); + + +-- +-- Name: index_cities_on_region_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_cities_on_region_id ON cities USING btree (region_id); + + +-- +-- Name: index_cms_pages_on_parent_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_cms_pages_on_parent_id ON cms_pages USING btree (parent_id); + + +-- +-- Name: index_comment_wiki_pages_on_comment_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_comment_wiki_pages_on_comment_id ON comment_wiki_pages USING btree (comment_id); + + +-- +-- Name: index_comment_wiki_pages_on_wiki_page_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_comment_wiki_pages_on_wiki_page_id ON comment_wiki_pages USING btree (wiki_page_id); + + +-- +-- Name: index_comments_on_commentable_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_comments_on_commentable_id ON comments USING btree (commentable_id); + + +-- +-- Name: index_comments_on_commentable_type; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_comments_on_commentable_type ON comments USING btree (commentable_type); + + +-- +-- Name: index_comments_on_status; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_comments_on_status ON comments USING btree (status); + + +-- +-- Name: index_comments_on_updated_at; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_comments_on_updated_at ON comments USING btree (updated_at); + + +-- +-- Name: index_comments_on_user_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_comments_on_user_id ON comments USING btree (user_id); + + +-- +-- Name: index_companies_on_main_region_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_companies_on_main_region_id ON companies USING btree (main_region_id); + + +-- +-- Name: index_companies_on_updated_at; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_companies_on_updated_at ON companies USING btree (updated_at); + + +-- +-- Name: index_company_abouts_on_company_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_company_abouts_on_company_id ON company_abouts USING btree (company_id); + + +-- +-- Name: index_company_background_images_on_company_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE UNIQUE INDEX index_company_background_images_on_company_id ON company_background_images USING btree (company_id); + + +-- +-- Name: index_company_billings_on_company_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE UNIQUE INDEX index_company_billings_on_company_id ON company_billings USING btree (company_id); + + +-- +-- Name: index_company_custom_page_titles_on_company_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE UNIQUE INDEX index_company_custom_page_titles_on_company_id ON company_custom_page_titles USING btree (company_id); + + +-- +-- Name: index_company_documents_on_company_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_company_documents_on_company_id ON company_documents USING btree (company_id); + + +-- +-- Name: index_company_documents_on_company_id_and_state; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_company_documents_on_company_id_and_state ON company_documents USING btree (company_id, state); + + +-- +-- Name: index_company_documents_on_position; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_company_documents_on_position ON company_documents USING btree ("position"); + + +-- +-- Name: index_company_domains_on_company_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE UNIQUE INDEX index_company_domains_on_company_id ON company_domains USING btree (company_id); + + +-- +-- Name: index_company_domains_on_name; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE UNIQUE INDEX index_company_domains_on_name ON company_domains USING btree (name); + + +-- +-- Name: index_company_event_wiki_pages_on_company_event_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_company_event_wiki_pages_on_company_event_id ON company_event_wiki_pages USING btree (company_event_id); + + +-- +-- Name: index_company_event_wiki_pages_on_wiki_page_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_company_event_wiki_pages_on_wiki_page_id ON company_event_wiki_pages USING btree (wiki_page_id); + + +-- +-- Name: index_company_events_on_begin_at; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_company_events_on_begin_at ON company_events USING btree (begin_at); + + +-- +-- Name: index_company_events_on_business_afisha; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_company_events_on_business_afisha ON company_events USING btree (business_afisha); + + +-- +-- Name: index_company_events_on_business_afisha_placement_begin; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_company_events_on_business_afisha_placement_begin ON company_events USING btree (business_afisha_placement_begin); + + +-- +-- Name: index_company_events_on_business_afisha_placement_end; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_company_events_on_business_afisha_placement_end ON company_events USING btree (business_afisha_placement_end); + + +-- +-- Name: index_company_events_on_end_in; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_company_events_on_end_in ON company_events USING btree (end_in); + + +-- +-- Name: index_company_geo_denormalizations_on_company_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE UNIQUE INDEX index_company_geo_denormalizations_on_company_id ON company_geo_denormalizations USING btree (company_id); + + +-- +-- Name: index_company_header_images_on_company_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE UNIQUE INDEX index_company_header_images_on_company_id ON company_header_images USING btree (company_id); + + +-- +-- Name: index_company_industries_main; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_company_industries_main ON company_industries USING btree (company_id, industry_id, industry_level); + + +-- +-- Name: index_company_links_on_company_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_company_links_on_company_id ON company_links USING btree (company_id); + + +-- +-- Name: index_company_logos_on_company_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_company_logos_on_company_id ON company_logos USING btree (company_id); + + +-- +-- Name: index_company_logos_on_parent_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_company_logos_on_parent_id ON company_logos USING btree (parent_id); + + +-- +-- Name: index_company_main_rubrics_on_company_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_company_main_rubrics_on_company_id ON company_main_rubrics USING btree (company_id); + + +-- +-- Name: index_company_main_rubrics_on_company_id_and_rubric_level; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_company_main_rubrics_on_company_id_and_rubric_level ON company_main_rubrics USING btree (company_id, rubric_level); + + +-- +-- Name: index_company_main_rubrics_on_rubric_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_company_main_rubrics_on_rubric_id ON company_main_rubrics USING btree (rubric_id); + + +-- +-- Name: index_company_menu_settings_on_company_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE UNIQUE INDEX index_company_menu_settings_on_company_id ON company_menu_settings USING btree (company_id); + + +-- +-- Name: index_company_moderations_on_company_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE UNIQUE INDEX index_company_moderations_on_company_id ON company_moderations USING btree (company_id); + + +-- +-- Name: index_company_previous_statistics_on_company_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE UNIQUE INDEX index_company_previous_statistics_on_company_id ON company_previous_statistics USING btree (company_id); + + +-- +-- Name: index_company_price_product_rubrics_on_rubric_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_company_price_product_rubrics_on_rubric_id ON company_price_product_rubrics USING btree (rubric_id); + + +-- +-- Name: index_company_prices_on_company_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_company_prices_on_company_id ON company_prices USING btree (company_id); + + +-- +-- Name: index_company_prices_on_company_id_and_state; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_company_prices_on_company_id_and_state ON company_prices USING btree (company_id, state); + + +-- +-- Name: index_company_prices_on_position; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_company_prices_on_position ON company_prices USING btree ("position"); + + +-- +-- Name: index_company_region_commercials_on_company_id_and_region_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE UNIQUE INDEX index_company_region_commercials_on_company_id_and_region_id ON company_region_commercials USING btree (company_id, region_id); + + +-- +-- Name: index_company_region_commercials_on_department_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_company_region_commercials_on_department_id ON company_region_commercials USING btree (department_id); + + +-- +-- Name: index_company_regions_on_company_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_company_regions_on_company_id ON company_regions USING btree (company_id); + + +-- +-- Name: index_company_regions_on_department_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_company_regions_on_department_id ON company_regions USING btree (department_id); + + +-- +-- Name: index_company_rubric_regions_on_region_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_company_rubric_regions_on_region_id ON company_rubric_regions USING btree (region_id); + + +-- +-- Name: index_company_rubric_regions_on_rubric_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_company_rubric_regions_on_rubric_id ON company_rubric_regions USING btree (rubric_id); + + +-- +-- Name: index_company_rubrics_on_company_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_company_rubrics_on_company_id ON company_rubrics USING btree (company_id); + + +-- +-- Name: index_company_rubrics_on_rubric_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_company_rubrics_on_rubric_id ON company_rubrics USING btree (rubric_id); + + +-- +-- Name: index_company_schedules_on_address_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_company_schedules_on_address_id ON company_schedules USING btree (address_id); + + +-- +-- Name: index_company_settings_on_company_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_company_settings_on_company_id ON company_settings USING btree (company_id); + + +-- +-- Name: index_company_thematic_rubrics_main; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_company_thematic_rubrics_main ON company_thematic_rubrics USING btree (company_id, thematic_rubric_id, rubric_level); + + +-- +-- Name: index_company_thematic_rubrics_unique; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE UNIQUE INDEX index_company_thematic_rubrics_unique ON company_thematic_rubrics USING btree (company_id, thematic_rubric_id); + + +-- +-- Name: index_company_tokens_on_company_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_company_tokens_on_company_id ON company_tokens USING btree (company_id); + + +-- +-- Name: index_company_tokens_on_email_ci; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_company_tokens_on_email_ci ON company_tokens USING btree (company_id, lower((email)::text)); + + +-- +-- Name: index_company_tokens_on_subject_id_and_subject_type; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_company_tokens_on_subject_id_and_subject_type ON company_tokens USING btree (subject_id, subject_type); + + +-- +-- Name: index_company_tokens_on_token; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE UNIQUE INDEX index_company_tokens_on_token ON company_tokens USING btree (token); + + +-- +-- Name: index_company_traffic_limits_on_company_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_company_traffic_limits_on_company_id ON company_traffic_limits USING btree (company_id); + + +-- +-- Name: index_company_users_on_company_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_company_users_on_company_id ON company_users USING btree (company_id); + + +-- +-- Name: index_company_users_on_user_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_company_users_on_user_id ON company_users USING btree (user_id); + + +-- +-- Name: index_company_widgets_on_code; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE UNIQUE INDEX index_company_widgets_on_code ON company_widgets USING btree (code); + + +-- +-- Name: index_company_widgets_on_company_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_company_widgets_on_company_id ON company_widgets USING btree (company_id); + + +-- +-- Name: index_complaints_on_comment_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_complaints_on_comment_id ON complaints USING btree (comment_id); + + +-- +-- Name: index_complaints_on_user_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_complaints_on_user_id ON complaints USING btree (user_id); + + +-- +-- Name: index_contact_types_on_name; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_contact_types_on_name ON contact_types USING btree (name); + + +-- +-- Name: index_contacts_on_address_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_contacts_on_address_id ON contacts USING btree (address_id); + + +-- +-- Name: index_contacts_on_address_id_and_contact_type_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_contacts_on_address_id_and_contact_type_id ON contacts USING btree (address_id, contact_type_id); + + +-- +-- Name: index_contacts_on_contact_type_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_contacts_on_contact_type_id ON contacts USING btree (contact_type_id); + + +-- +-- Name: index_copied_users_on_copied_from; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_copied_users_on_copied_from ON copied_users USING btree (copied_from); + + +-- +-- Name: index_copied_users_on_user_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_copied_users_on_user_id ON copied_users USING btree (user_id); + + +-- +-- Name: index_demand_items_on_demand_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_demand_items_on_demand_id ON demand_items USING btree (demand_id); + + +-- +-- Name: index_demand_items_on_rubric_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_demand_items_on_rubric_id ON demand_items USING btree (rubric_id); + + +-- +-- Name: index_demand_statistics_on_rubric_id_and_region_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE UNIQUE INDEX index_demand_statistics_on_rubric_id_and_region_id ON demand_statistics USING btree (rubric_id, region_id); + + +-- +-- Name: index_demands_on_company_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_demands_on_company_id ON demands USING btree (company_id); + + +-- +-- Name: index_demands_on_region_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_demands_on_region_id ON demands USING btree (region_id); + + +-- +-- Name: index_demands_on_user_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_demands_on_user_id ON demands USING btree (user_id); + + +-- +-- Name: index_demands_on_valid_till; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_demands_on_valid_till ON demands USING btree (valid_till); + + +-- +-- Name: index_dialog_messages_on_dialog_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_dialog_messages_on_dialog_id ON dialog_messages USING btree (dialog_id); + + +-- +-- Name: index_dialog_messages_on_dialog_participant_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_dialog_messages_on_dialog_participant_id ON dialog_messages USING btree (dialog_participant_id); + + +-- +-- Name: index_dialog_participants_on_company_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_dialog_participants_on_company_id ON dialog_participants USING btree (company_id); + + +-- +-- Name: index_dialog_participants_on_dialog_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_dialog_participants_on_dialog_id ON dialog_participants USING btree (dialog_id); + + +-- +-- Name: index_dialog_participants_on_user_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_dialog_participants_on_user_id ON dialog_participants USING btree (user_id); + + +-- +-- Name: index_dialogs_on_updated_at; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_dialogs_on_updated_at ON dialogs USING btree (updated_at); + + +-- +-- Name: index_dirty_company_industries_main; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_dirty_company_industries_main ON dirty_company_industries USING btree (company_id, industry_id, industry_level); + + +-- +-- Name: index_dirty_company_industries_on_company_id_and_industry_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE UNIQUE INDEX index_dirty_company_industries_on_company_id_and_industry_id ON dirty_company_industries USING btree (company_id, industry_id); + + +-- +-- Name: index_dirty_industries_on_cached_level_and_lft; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_dirty_industries_on_cached_level_and_lft ON dirty_industries USING btree (cached_level, lft); + + +-- +-- Name: index_dirty_industries_on_id_and_lft_and_rgt; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_dirty_industries_on_id_and_lft_and_rgt ON dirty_industries USING btree (id, lft, rgt); + + +-- +-- Name: index_dirty_industries_on_joined_path; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE UNIQUE INDEX index_dirty_industries_on_joined_path ON dirty_industries USING btree (joined_path); + + +-- +-- Name: index_dirty_industries_on_lft_and_rgt; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_dirty_industries_on_lft_and_rgt ON dirty_industries USING btree (lft, rgt); + + +-- +-- Name: index_dirty_industries_on_parent_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_dirty_industries_on_parent_id ON dirty_industries USING btree (parent_id); + + +-- +-- Name: index_dirty_industries_on_parent_id_and_is_visible; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_dirty_industries_on_parent_id_and_is_visible ON dirty_industries USING btree (parent_id, is_visible); + + +-- +-- Name: index_dirty_rubric_log_entries_on_created_at; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_dirty_rubric_log_entries_on_created_at ON dirty_rubric_log_entries USING btree (created_at); + + +-- +-- Name: index_dirty_rubric_redirects_on_redirect_from; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE UNIQUE INDEX index_dirty_rubric_redirects_on_redirect_from ON dirty_rubric_redirects USING btree (redirect_from); + + +-- +-- Name: index_dirty_rubric_redirects_on_rubric_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_dirty_rubric_redirects_on_rubric_id ON dirty_rubric_redirects USING btree (rubric_id); + + +-- +-- Name: index_dirty_rubric_trait_tracks_on_redirect_from; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE UNIQUE INDEX index_dirty_rubric_trait_tracks_on_redirect_from ON dirty_rubric_trait_value_redirects USING btree (redirect_from); + + +-- +-- Name: index_dirty_rubrics_nested_set_on_parent_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_dirty_rubrics_nested_set_on_parent_id ON dirty_rubrics_nested_set USING btree (parent_id); + + +-- +-- Name: index_dirty_rubrics_on_parent_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_dirty_rubrics_on_parent_id ON dirty_rubrics USING btree (parent_id); + + +-- +-- Name: index_dirty_rubrics_on_parent_id_and_slug_number; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE UNIQUE INDEX index_dirty_rubrics_on_parent_id_and_slug_number ON dirty_rubrics USING btree (parent_id, slug_number); + + +-- +-- Name: index_dirty_rubrics_on_target_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_dirty_rubrics_on_target_id ON dirty_rubrics USING btree (target_id) WHERE symlink; + + +-- +-- Name: index_dirty_rubrics_on_target_id_uniq; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE UNIQUE INDEX index_dirty_rubrics_on_target_id_uniq ON dirty_rubrics USING btree (parent_id, target_id) WHERE symlink; + + +-- +-- Name: index_dirty_thematic_rubric_industries_on_industry_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_dirty_thematic_rubric_industries_on_industry_id ON dirty_thematic_rubric_industries USING btree (industry_id); + + +-- +-- Name: index_dirty_thematic_rubric_industries_on_thematic_rubric_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_dirty_thematic_rubric_industries_on_thematic_rubric_id ON dirty_thematic_rubric_industries USING btree (thematic_rubric_id); + + +-- +-- Name: index_dirty_thematic_rubrics_main_unique; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE UNIQUE INDEX index_dirty_thematic_rubrics_main_unique ON dirty_thematic_rubrics USING btree (thematic_rubricator_id, joined_path); + + +-- +-- Name: index_dirty_thematic_rubrics_on_cached_level_and_lft; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_dirty_thematic_rubrics_on_cached_level_and_lft ON dirty_thematic_rubrics USING btree (cached_level, lft); + + +-- +-- Name: index_dirty_thematic_rubrics_on_id_and_lft_and_rgt; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_dirty_thematic_rubrics_on_id_and_lft_and_rgt ON dirty_thematic_rubrics USING btree (id, lft, rgt); + + +-- +-- Name: index_dirty_thematic_rubrics_on_lft_and_rgt; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_dirty_thematic_rubrics_on_lft_and_rgt ON dirty_thematic_rubrics USING btree (lft, rgt); + + +-- +-- Name: index_dirty_thematic_rubrics_on_parent_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_dirty_thematic_rubrics_on_parent_id ON dirty_thematic_rubrics USING btree (parent_id); + + +-- +-- Name: index_dirty_thematic_rubrics_on_parent_id_and_is_visible; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_dirty_thematic_rubrics_on_parent_id_and_is_visible ON dirty_thematic_rubrics USING btree (parent_id, is_visible); + + +-- +-- Name: index_districts_on_city_id_and_slug; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE UNIQUE INDEX index_districts_on_city_id_and_slug ON districts USING btree (city_id, slug); + + +-- +-- Name: index_feedbacks_on_company_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_feedbacks_on_company_id ON feedbacks USING btree (company_id); + + +-- +-- Name: index_feedbacks_on_feedback_category_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_feedbacks_on_feedback_category_id ON feedbacks USING btree (feedback_category_id); + + +-- +-- Name: index_franchise_user_regions_on_user_id_and_region_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE UNIQUE INDEX index_franchise_user_regions_on_user_id_and_region_id ON franchise_user_regions USING btree (user_id, region_id); + + +-- +-- Name: index_glossary_log_on_operation; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_glossary_log_on_operation ON glossary_log USING btree (operation); + + +-- +-- Name: index_glossary_log_on_updated_at; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_glossary_log_on_updated_at ON glossary_log USING btree (updated_at); + + +-- +-- Name: index_images_on_subject_type_and_subject_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_images_on_subject_type_and_subject_id ON images USING btree (subject_type, subject_id); + + +-- +-- Name: index_industries_on_cached_level_and_lft; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_industries_on_cached_level_and_lft ON industries USING btree (cached_level, lft); + + +-- +-- Name: index_industries_on_id_and_lft_and_rgt; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_industries_on_id_and_lft_and_rgt ON industries USING btree (id, lft, rgt); + + +-- +-- Name: index_industries_on_parent_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_industries_on_parent_id ON industries USING btree (parent_id); + + +-- +-- Name: index_industries_on_parent_id_and_is_visible; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_industries_on_parent_id_and_is_visible ON industries USING btree (parent_id, is_visible); + + +-- +-- Name: index_licenses_on_company_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_licenses_on_company_id ON licenses USING btree (company_id); + + +-- +-- Name: index_map_addresses_on_adm_district_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_map_addresses_on_adm_district_id ON map_addresses USING btree (adm_district_id); + + +-- +-- Name: index_map_addresses_on_adm_district_id_and_companies_count; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_map_addresses_on_adm_district_id_and_companies_count ON map_addresses USING btree (adm_district_id, companies_count); + + +-- +-- Name: index_map_addresses_on_dwelling_district_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_map_addresses_on_dwelling_district_id ON map_addresses USING btree (dwelling_district_id); + + +-- +-- Name: index_map_addresses_on_dwelling_district_id_and_companies_count; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_map_addresses_on_dwelling_district_id_and_companies_count ON map_addresses USING btree (dwelling_district_id, companies_count); + + +-- +-- Name: index_map_addresses_on_street_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_map_addresses_on_street_id ON map_addresses USING btree (street_id); + + +-- +-- Name: index_map_addresses_on_street_id_and_slug; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE UNIQUE INDEX index_map_addresses_on_street_id_and_slug ON map_addresses USING btree (street_id, slug); + + +-- +-- Name: index_native_region_regions_on_native_region_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_native_region_regions_on_native_region_id ON native_region_regions USING btree (native_region_id); + + +-- +-- Name: index_native_region_regions_on_region_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_native_region_regions_on_region_id ON native_region_regions USING btree (region_id); + + +-- +-- Name: index_news_editorials_wiki_pages_on_news_editorial_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_news_editorials_wiki_pages_on_news_editorial_id ON news_wiki_pages USING btree (news_id); + + +-- +-- Name: index_news_editorials_wiki_pages_on_wiki_page_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_news_editorials_wiki_pages_on_wiki_page_id ON news_wiki_pages USING btree (wiki_page_id); + + +-- +-- Name: index_news_on_is_editors_choice; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_news_on_is_editors_choice ON news USING btree (is_editors_choice); + + +-- +-- Name: index_news_on_is_opinion; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_news_on_is_opinion ON news USING btree (is_opinion); + + +-- +-- Name: index_news_on_news_source_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_news_on_news_source_id ON news USING btree (news_source_id); + + +-- +-- Name: index_news_on_news_thematic_rubric_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_news_on_news_thematic_rubric_id ON news USING btree (news_thematic_rubric_id); + + +-- +-- Name: index_news_on_news_type; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_news_on_news_type ON news USING btree (news_type); + + +-- +-- Name: index_news_on_region_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_news_on_region_id ON news USING btree (region_id); + + +-- +-- Name: index_news_on_state; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_news_on_state ON news USING btree (state); + + +-- +-- Name: index_news_on_title; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_news_on_title ON news USING btree (title); + + +-- +-- Name: index_news_on_updated_by; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_news_on_updated_by ON news USING btree (updated_by); + + +-- +-- Name: index_news_on_vkontakte_rss; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_news_on_vkontakte_rss ON news USING btree (vkontakte_rss); + + +-- +-- Name: index_news_paid_placements_on_company_news_rubric_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_news_paid_placements_on_company_news_rubric_id ON news_paid_placements USING btree (company_news_rubric_id); + + +-- +-- Name: index_news_paid_placements_on_news_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_news_paid_placements_on_news_id ON news_paid_placements USING btree (news_id); + + +-- +-- Name: index_news_paid_placements_on_news_thematic_rubric_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_news_paid_placements_on_news_thematic_rubric_id ON news_paid_placements USING btree (news_thematic_rubric_id); + + +-- +-- Name: index_news_paid_placements_on_news_type; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_news_paid_placements_on_news_type ON news_paid_placements USING btree (news_type); + + +-- +-- Name: index_news_paid_placements_on_region_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_news_paid_placements_on_region_id ON news_paid_placements USING btree (region_id); + + +-- +-- Name: index_news_regions_on_news_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_news_regions_on_news_id ON news_regions USING btree (news_id); + + +-- +-- Name: index_news_regions_on_region_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_news_regions_on_region_id ON news_regions USING btree (region_id); + + +-- +-- Name: index_news_regions_zones_on_news_region_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_news_regions_zones_on_news_region_id ON news_regions_zones USING btree (news_region_id); + + +-- +-- Name: index_news_regions_zones_on_news_region_id_and_news_zone_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_news_regions_zones_on_news_region_id_and_news_zone_id ON news_regions_zones USING btree (news_region_id, news_zone_id); + + +-- +-- Name: index_news_rubrics_on_rubric_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_news_rubrics_on_rubric_id ON news_rubrics USING btree (rubric_id); + + +-- +-- Name: index_news_thematic_news_on_news_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_news_thematic_news_on_news_id ON news_thematic_news USING btree (news_id); + + +-- +-- Name: index_news_thematic_news_on_news_id_and_thematic_news_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_news_thematic_news_on_news_id_and_thematic_news_id ON news_thematic_news USING btree (news_id, thematic_news_id); + + +-- +-- Name: index_news_thematic_rubrics_on_cached_level_and_lft; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_news_thematic_rubrics_on_cached_level_and_lft ON news_thematic_rubrics USING btree (cached_level, lft); + + +-- +-- Name: index_news_thematic_rubrics_on_id_and_lft_and_rgt; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_news_thematic_rubrics_on_id_and_lft_and_rgt ON news_thematic_rubrics USING btree (id, lft, rgt); + + +-- +-- Name: index_news_thematic_rubrics_on_lft_and_rgt; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_news_thematic_rubrics_on_lft_and_rgt ON news_thematic_rubrics USING btree (lft, rgt); + + +-- +-- Name: index_news_thematic_rubrics_on_parent_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_news_thematic_rubrics_on_parent_id ON news_thematic_rubrics USING btree (parent_id); + + +-- +-- Name: index_news_thematic_rubrics_on_sort_order; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_news_thematic_rubrics_on_sort_order ON news_thematic_rubrics USING btree (sort_order); + + +-- +-- Name: index_offline_regions_on_region_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_offline_regions_on_region_id ON offline_regions USING btree (region_id); + + +-- +-- Name: index_online_store_categories_on_online_store_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_online_store_categories_on_online_store_id ON old_online_store_categories USING btree (online_store_id); + + +-- +-- Name: index_online_store_categories_on_online_store_id_and_yml_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_online_store_categories_on_online_store_id_and_yml_id ON old_online_store_categories USING btree (online_store_id, yml_id); + + +-- +-- Name: index_online_store_categories_on_rubric_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_online_store_categories_on_rubric_id ON old_online_store_categories USING btree (rubric_id); + + +-- +-- Name: index_online_store_category_rubrics_on_rubric_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_online_store_category_rubrics_on_rubric_id ON old_online_store_category_rubrics USING btree (rubric_id); + + +-- +-- Name: index_online_store_category_rubrics_on_store_and_title; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_online_store_category_rubrics_on_store_and_title ON old_online_store_category_rubrics USING btree (online_store_id, title); + + +-- +-- Name: index_online_store_category_rubrics_on_title; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_online_store_category_rubrics_on_title ON old_online_store_category_rubrics USING btree (title); + + +-- +-- Name: index_online_store_import_logs_on_online_store_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_online_store_import_logs_on_online_store_id ON old_online_store_import_logs USING btree (online_store_id); + + +-- +-- Name: index_online_store_product_regions_on_online_store_product_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_online_store_product_regions_on_online_store_product_id ON old_online_store_product_regions USING btree (online_store_product_id); + + +-- +-- Name: index_online_store_product_regions_on_region_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_online_store_product_regions_on_region_id ON old_online_store_product_regions USING btree (region_id); + + +-- +-- Name: index_online_store_products_errors_on_online_store_product_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_online_store_products_errors_on_online_store_product_id ON old_online_store_products_merge_errors USING btree (online_store_product_id); + + +-- +-- Name: index_online_store_products_on_category_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_online_store_products_on_category_id ON old_online_store_products USING btree (category_id); + + +-- +-- Name: index_online_store_products_on_online_store_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_online_store_products_on_online_store_id ON old_online_store_products USING btree (online_store_id); + + +-- +-- Name: index_online_store_products_on_online_store_id_and_rubric_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_online_store_products_on_online_store_id_and_rubric_id ON old_online_store_products USING btree (online_store_id, rubric_id); + + +-- +-- Name: index_online_store_products_on_online_store_id_and_yml_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE UNIQUE INDEX index_online_store_products_on_online_store_id_and_yml_id ON old_online_store_products USING btree (online_store_id, yml_id); + + +-- +-- Name: index_online_store_products_on_product_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_online_store_products_on_product_id ON old_online_store_products USING btree (product_id); + + +-- +-- Name: index_online_store_products_on_rubric_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_online_store_products_on_rubric_id ON old_online_store_products USING btree (rubric_id); + + +-- +-- Name: index_online_store_products_on_yml_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_online_store_products_on_yml_id ON old_online_store_products USING btree (yml_id); + + +-- +-- Name: index_online_store_schedules_on_online_store_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_online_store_schedules_on_online_store_id ON old_online_store_schedules USING btree (online_store_id); + + +-- +-- Name: index_online_users_on_user_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE UNIQUE INDEX index_online_users_on_user_id ON online_users USING btree (user_id); + + +-- +-- Name: index_osp_errors_on_online_store_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_osp_errors_on_online_store_id ON old_online_store_products_merge_errors USING btree (online_store_id); + + +-- +-- Name: index_osp_regions_osp_product; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE UNIQUE INDEX index_osp_regions_osp_product ON old_online_store_product_regions USING btree (online_store_product_id, region_id); + + +-- +-- Name: index_packet_discounts_on_packet_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_packet_discounts_on_packet_id ON packet_discounts USING btree (packet_id); + + +-- +-- Name: index_packet_discounts_on_state; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_packet_discounts_on_state ON packet_discounts USING btree (state); + + +-- +-- Name: index_page_descriptions_on_region_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_page_descriptions_on_region_id ON page_descriptions USING btree (region_id); + + +-- +-- Name: index_page_descriptions_on_url_and_region_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE UNIQUE INDEX index_page_descriptions_on_url_and_region_id ON page_descriptions USING btree (url, region_id); + + +-- +-- Name: index_phones_on_address_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_phones_on_address_id ON phones USING btree (address_id); + + +-- +-- Name: index_phones_on_address_id_and_position; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_phones_on_address_id_and_position ON phones USING btree (address_id, "position"); + + +-- +-- Name: index_phones_on_code_and_number; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_phones_on_code_and_number ON phones USING btree (code, number); + + +-- +-- Name: index_phones_on_type_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_phones_on_type_id ON phones USING btree (type_id); + + +-- +-- Name: index_product_announce_categories_on_kind; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_product_announce_categories_on_kind ON product_announce_categories USING btree (kind); + + +-- +-- Name: index_product_deltas_on_in_process; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_product_deltas_on_in_process ON product_deltas USING btree (in_process); + + +-- +-- Name: index_product_description_stats_on_company_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_product_description_stats_on_company_id ON product_description_stats USING btree (company_id); + + +-- +-- Name: index_product_description_stats_on_company_id_partial; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_product_description_stats_on_company_id_partial ON product_description_stats USING btree (company_id) WHERE (length > 20000); + + +-- +-- Name: index_product_description_stats_on_product_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_product_description_stats_on_product_id ON product_description_stats USING btree (product_id); + + +-- +-- Name: index_product_group_images_on_product_group_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_product_group_images_on_product_group_id ON product_group_images USING btree (product_group_id); + + +-- +-- Name: index_product_groups_on_parent_id_and_position; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_product_groups_on_parent_id_and_position ON product_groups USING btree (parent_id, "position"); + + +-- +-- Name: index_product_properties_on_product_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE UNIQUE INDEX index_product_properties_on_product_id ON product_properties USING btree (product_id); + + +-- +-- Name: index_product_properties_on_updated_at_actualized_at; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_product_properties_on_updated_at_actualized_at ON product_properties USING btree ((GREATEST(updated_at, actualized_at))); + + +-- +-- Name: index_product_regions_on_is_deleted; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_product_regions_on_is_deleted ON product_regions USING btree (is_deleted) WHERE (is_deleted IS FALSE); + + +-- +-- Name: index_product_regions_on_is_public; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_product_regions_on_is_public ON product_regions USING btree (is_public) WHERE (is_public IS TRUE); + + +-- +-- Name: index_product_regions_on_product_id_and_region_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE UNIQUE INDEX index_product_regions_on_product_id_and_region_id ON product_regions USING btree (product_id, region_id); + + +-- +-- Name: index_product_url_names_on_product_id_and_url_name; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE UNIQUE INDEX index_product_url_names_on_product_id_and_url_name ON product_url_names USING btree (product_id, url_name); + + +-- +-- Name: index_region_contacts_on_region_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_region_contacts_on_region_id ON region_contacts USING btree (region_id); + + +-- +-- Name: index_region_contacts_on_user_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_region_contacts_on_user_id ON region_contacts USING btree (user_id); + + +-- +-- Name: index_region_footer_contacts_on_region_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_region_footer_contacts_on_region_id ON region_footer_contacts USING btree (region_id); + + +-- +-- Name: index_region_packets_on_packet; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_region_packets_on_packet ON region_packets USING btree (packet); + + +-- +-- Name: index_region_packets_on_region_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_region_packets_on_region_id ON region_packets USING btree (region_id); + + +-- +-- Name: index_region_packets_on_region_id_and_packet; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE UNIQUE INDEX index_region_packets_on_region_id_and_packet ON region_packets USING btree (region_id, packet); + + +-- +-- Name: index_regions_on_lft_and_rgt; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_regions_on_lft_and_rgt ON regions USING btree (lft, rgt); + + +-- +-- Name: index_regions_on_name; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_regions_on_name ON regions USING btree (name); + + +-- +-- Name: index_regions_on_name_lat; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_regions_on_name_lat ON regions USING btree (name_lat); + + +-- +-- Name: index_regions_on_parent_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_regions_on_parent_id ON regions USING btree (parent_id); + + +-- +-- Name: index_roles_on_name; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE UNIQUE INDEX index_roles_on_name ON roles USING btree (name); + + +-- +-- Name: index_rss_channels_on_slug; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE UNIQUE INDEX index_rss_channels_on_slug ON rss_channels USING btree (slug); + + +-- +-- Name: index_rubric_normal_stats_on_region_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_rubric_normal_stats_on_region_id ON rubric_normal_stats USING btree (region_id); + + +-- +-- Name: index_rubric_normal_stats_on_rubric_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_rubric_normal_stats_on_rubric_id ON rubric_normal_stats USING btree (rubric_id); + + +-- +-- Name: index_rubric_redirects_on_redirect_from; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE UNIQUE INDEX index_rubric_redirects_on_redirect_from ON rubric_redirects USING btree (redirect_from); + + +-- +-- Name: index_rubric_statistics_on_rubric_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_rubric_statistics_on_rubric_id ON rubric_statistics USING btree (rubric_id); + + +-- +-- Name: index_rubric_statistics_on_rubric_id_and_region_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_rubric_statistics_on_rubric_id_and_region_id ON rubric_statistics USING btree (rubric_id, region_id); + + +-- +-- Name: index_rubric_statistics_paid_on_rubric_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_rubric_statistics_paid_on_rubric_id ON rubric_statistics_paid USING btree (rubric_id); + + +-- +-- Name: index_rubric_tags_on_rubric_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_rubric_tags_on_rubric_id ON rubric_tags USING btree (rubric_id); + + +-- +-- Name: index_rubric_tags_on_tag_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_rubric_tags_on_tag_id ON rubric_tags USING btree (tag_id); + + +-- +-- Name: index_rubrics_on_joined_path; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_rubrics_on_joined_path ON rubrics USING btree (joined_path); + + +-- +-- Name: index_rubrics_on_lft_and_rgt; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_rubrics_on_lft_and_rgt ON rubrics USING btree (lft, rgt); + + +-- +-- Name: index_rubrics_on_parent_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_rubrics_on_parent_id ON rubrics USING btree (parent_id); + + +-- +-- Name: index_rubrics_on_parent_id_and_is_published; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_rubrics_on_parent_id_and_is_published ON rubrics USING btree (parent_id, is_published); + + +-- +-- Name: index_rubrics_on_rgt_and_lft; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_rubrics_on_rgt_and_lft ON rubrics USING btree (rgt, lft); + + +-- +-- Name: index_rubrics_on_slug_as_another; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_rubrics_on_slug_as_another ON rubrics USING btree (slug) WHERE ((slug)::text = 'another'::text); + + +-- +-- Name: index_search_index_companies_on_company_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_search_index_companies_on_company_id ON search_index_companies USING btree (company_id); + + +-- +-- Name: index_search_index_products_on_product_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE UNIQUE INDEX index_search_index_products_on_product_id ON search_index_products USING btree (product_id); + + +-- +-- Name: index_search_index_products_on_terms_index; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_search_index_products_on_terms_index ON search_index_products USING gin (terms_index); + + +-- +-- Name: index_search_index_rubrics_on_rubric_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_search_index_rubrics_on_rubric_id ON search_index_rubrics USING btree (rubric_id); + + +-- +-- Name: index_see_also_stats_on_rubric_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_see_also_stats_on_rubric_id ON see_also_stats USING btree (rubric_id); + + +-- +-- Name: index_see_also_stats_on_rubric_id_and_target_rubric_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE UNIQUE INDEX index_see_also_stats_on_rubric_id_and_target_rubric_id ON see_also_stats USING btree (rubric_id, target_rubric_id); + + +-- +-- Name: index_seo_block_links_on_block_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_seo_block_links_on_block_id ON seo_block_links USING btree (block_id); + + +-- +-- Name: index_seo_block_rubric_regions_on_rubric_id_and_region_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE UNIQUE INDEX index_seo_block_rubric_regions_on_rubric_id_and_region_id ON seo_block_rubric_regions USING btree (rubric_id, region_id); + + +-- +-- Name: index_seo_entities_on_region_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_seo_entities_on_region_id ON seo_entities USING btree (region_id); + + +-- +-- Name: index_seo_entity_modifications_on_seo_entity_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_seo_entity_modifications_on_seo_entity_id ON seo_entity_modifications USING btree (seo_entity_id); + + +-- +-- Name: index_seo_entity_modifications_on_user_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_seo_entity_modifications_on_user_id ON seo_entity_modifications USING btree (user_id); + + +-- +-- Name: index_sessions_on_session_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_sessions_on_session_id ON sessions USING btree (session_id); + + +-- +-- Name: index_sessions_on_updated_at; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_sessions_on_updated_at ON sessions USING btree (updated_at); + + +-- +-- Name: index_showcase_images_on_parent_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_showcase_images_on_parent_id ON showcase_images USING btree (parent_id); + + +-- +-- Name: index_showcase_images_on_showcase_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_showcase_images_on_showcase_id ON showcase_images USING btree (showcase_id); + + +-- +-- Name: index_showcase_order_regions_on_showcase_order_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_showcase_order_regions_on_showcase_order_id ON showcase_order_regions USING btree (showcase_order_id); + + +-- +-- Name: index_showcase_order_regions_on_showcase_order_id_and_region_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE UNIQUE INDEX index_showcase_order_regions_on_showcase_order_id_and_region_id ON showcase_order_regions USING btree (showcase_order_id, region_id); + + +-- +-- Name: index_showcase_order_stats_on_showcase_order_id_and_date; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE UNIQUE INDEX index_showcase_order_stats_on_showcase_order_id_and_date ON showcase_order_stats USING btree (showcase_order_id, date); + + +-- +-- Name: index_showcase_orders_on_rubric_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_showcase_orders_on_rubric_id ON showcase_orders USING btree (rubric_id); + + +-- +-- Name: index_showcase_orders_on_rubric_type_and_rubric_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_showcase_orders_on_rubric_type_and_rubric_id ON showcase_orders USING btree (rubric_type, rubric_id); + + +-- +-- Name: index_showcase_orders_on_showcase_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_showcase_orders_on_showcase_id ON showcase_orders USING btree (showcase_id); + + +-- +-- Name: index_showcases_on_company_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_showcases_on_company_id ON showcases USING btree (company_id); + + +-- +-- Name: index_showcases_on_original_showcase_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_showcases_on_original_showcase_id ON showcases USING btree (original_showcase_id); + + +-- +-- Name: index_sitemap_on_element_type_and_region; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_sitemap_on_element_type_and_region ON sitemap USING btree (element_type, region); + + +-- +-- Name: index_sitemap_on_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_sitemap_on_id ON sitemap USING btree (id); + + +-- +-- Name: index_sitemap_on_updated_at; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_sitemap_on_updated_at ON sitemap USING btree (updated_at); + + +-- +-- Name: index_snippet_rubrics_on_rubric_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_snippet_rubrics_on_rubric_id ON snippet_rubrics USING btree (rubric_id); + + +-- +-- Name: index_snippet_text_regions_on_region_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_snippet_text_regions_on_region_id ON snippet_text_regions USING btree (region_id); + + +-- +-- Name: index_snippet_text_regions_on_snippet_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_snippet_text_regions_on_snippet_id ON snippet_text_regions USING btree (snippet_id); + + +-- +-- Name: index_snippet_text_regions_on_snippet_id_and_region_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE UNIQUE INDEX index_snippet_text_regions_on_snippet_id_and_region_id ON snippet_text_regions USING btree (snippet_id, region_id); + + +-- +-- Name: index_snippet_text_regions_on_snippet_text_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_snippet_text_regions_on_snippet_text_id ON snippet_text_regions USING btree (snippet_text_id); + + +-- +-- Name: index_snippet_texts_on_snippet_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_snippet_texts_on_snippet_id ON snippet_texts USING btree (snippet_id); + + +-- +-- Name: index_static_links_by_products_on_product_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_static_links_by_products_on_product_id ON static_links_by_products USING btree (product_id); + + +-- +-- Name: index_static_links_by_rubrics_on_region_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_static_links_by_rubrics_on_region_id ON static_links_by_rubrics USING btree (region_id); + + +-- +-- Name: index_static_links_by_rubrics_on_rubric_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_static_links_by_rubrics_on_rubric_id ON static_links_by_rubrics USING btree (rubric_id); + + +-- +-- Name: index_streets_on_city_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_streets_on_city_id ON streets USING btree (city_id); + + +-- +-- Name: index_synonyms_on_base_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_synonyms_on_base_id ON synonyms USING btree (base_id); + + +-- +-- Name: index_synonyms_on_is_deleted; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_synonyms_on_is_deleted ON synonyms USING btree (is_deleted); + + +-- +-- Name: index_synonyms_on_rubric_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_synonyms_on_rubric_id ON synonyms USING btree (rubric_id); + + +-- +-- Name: index_taggings_on_tag_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_taggings_on_tag_id ON taggings USING btree (tag_id); + + +-- +-- Name: index_taggings_on_taggable_id_and_taggable_type_and_context; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_taggings_on_taggable_id_and_taggable_type_and_context ON taggings USING btree (taggable_id, taggable_type, context); + + +-- +-- Name: index_template_categories_on_position; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_template_categories_on_position ON template_categories USING btree ("position"); + + +-- +-- Name: index_template_categories_on_title; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE UNIQUE INDEX index_template_categories_on_title ON template_categories USING btree (title); + + +-- +-- Name: index_template_schemes_on_state; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_template_schemes_on_state ON template_schemes USING btree (state); + + +-- +-- Name: index_template_schemes_on_template_category_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_template_schemes_on_template_category_id ON template_schemes USING btree (template_category_id); + + +-- +-- Name: index_template_schemes_on_title_and_template_category_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE UNIQUE INDEX index_template_schemes_on_title_and_template_category_id ON template_schemes USING btree (title, template_category_id); + + +-- +-- Name: index_test_packets_on_valid_till; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_test_packets_on_valid_till ON test_packets USING btree (valid_till); + + +-- +-- Name: index_thematic_rubric_industries_on_industry_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_thematic_rubric_industries_on_industry_id ON thematic_rubric_industries USING btree (industry_id); + + +-- +-- Name: index_thematic_rubric_industries_on_thematic_rubric_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_thematic_rubric_industries_on_thematic_rubric_id ON thematic_rubric_industries USING btree (thematic_rubric_id); + + +-- +-- Name: index_thematic_rubric_links_on_target_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_thematic_rubric_links_on_target_id ON thematic_rubric_links USING btree (target_id); + + +-- +-- Name: index_thematic_rubric_links_on_thematic_rubric_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_thematic_rubric_links_on_thematic_rubric_id ON thematic_rubric_links USING btree (thematic_rubric_id); + + +-- +-- Name: index_thematic_rubric_links_on_thematic_rubric_id_and_target_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE UNIQUE INDEX index_thematic_rubric_links_on_thematic_rubric_id_and_target_id ON thematic_rubric_links USING btree (thematic_rubric_id, target_id); + + +-- +-- Name: index_thematic_rubrics_main_unique; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE UNIQUE INDEX index_thematic_rubrics_main_unique ON thematic_rubrics USING btree (thematic_rubricator_id, joined_path); + + +-- +-- Name: index_thematic_rubrics_on_cached_level_and_lft; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_thematic_rubrics_on_cached_level_and_lft ON thematic_rubrics USING btree (cached_level, lft); + + +-- +-- Name: index_thematic_rubrics_on_id_and_lft_and_rgt; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_thematic_rubrics_on_id_and_lft_and_rgt ON thematic_rubrics USING btree (id, lft, rgt); + + +-- +-- Name: index_thematic_rubrics_on_lft_and_rgt; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_thematic_rubrics_on_lft_and_rgt ON thematic_rubrics USING btree (lft, rgt); + + +-- +-- Name: index_thematic_rubrics_on_panel_num; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_thematic_rubrics_on_panel_num ON thematic_rubrics USING btree (panel_num); + + +-- +-- Name: index_thematic_rubrics_on_parent_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_thematic_rubrics_on_parent_id ON thematic_rubrics USING btree (parent_id); + + +-- +-- Name: index_thematic_rubrics_on_parent_id_and_is_visible; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_thematic_rubrics_on_parent_id_and_is_visible ON thematic_rubrics USING btree (parent_id, is_visible); + + +-- +-- Name: index_trait_products_on_product_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_trait_products_on_product_id ON trait_products USING btree (product_id); + + +-- +-- Name: index_trait_products_on_trait_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_trait_products_on_trait_id ON trait_products USING btree (trait_id); + + +-- +-- Name: index_trait_products_on_trait_id_product_id_trait_value_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE UNIQUE INDEX index_trait_products_on_trait_id_product_id_trait_value_id ON trait_products USING btree (trait_id, product_id, trait_value_id); + + +-- +-- Name: index_trait_products_on_trait_value_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_trait_products_on_trait_value_id ON trait_products USING btree (trait_value_id); + + +-- +-- Name: index_trait_rubrics_on_rubric_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_trait_rubrics_on_rubric_id ON trait_rubrics USING btree (rubric_id); + + +-- +-- Name: index_trait_rubrics_on_trait_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_trait_rubrics_on_trait_id ON trait_rubrics USING btree (trait_id); + + +-- +-- Name: index_trait_values_on_state; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_trait_values_on_state ON trait_values USING btree (state); + + +-- +-- Name: index_trait_values_on_trait_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_trait_values_on_trait_id ON trait_values USING btree (trait_id); + + +-- +-- Name: index_trait_values_on_trait_id_and_position; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_trait_values_on_trait_id_and_position ON trait_values USING btree (trait_id, "position"); + + +-- +-- Name: index_trait_values_on_trait_id_and_slug; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE UNIQUE INDEX index_trait_values_on_trait_id_and_slug ON trait_values USING btree (trait_id, slug); + + +-- +-- Name: index_trait_values_on_trait_id_and_value; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE UNIQUE INDEX index_trait_values_on_trait_id_and_value ON trait_values USING btree (trait_id, value); + + +-- +-- Name: index_trait_values_on_value; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_trait_values_on_value ON trait_values USING btree (lower((value)::text)); + + +-- +-- Name: index_traits_on_inside; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE UNIQUE INDEX index_traits_on_inside ON traits USING btree (inside) WHERE (inside IS TRUE); + + +-- +-- Name: index_ugc_stats_on_date; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_ugc_stats_on_date ON ugc_stats USING btree (date); + + +-- +-- Name: index_user_blog_statistics_on_first_letter; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_user_blog_statistics_on_first_letter ON blog_user_statistics USING btree (first_letter); + + +-- +-- Name: index_user_blog_statistics_on_region_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_user_blog_statistics_on_region_id ON blog_user_statistics USING btree (region_id); + + +-- +-- Name: index_user_blog_statistics_on_user_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_user_blog_statistics_on_user_id ON blog_user_statistics USING btree (user_id); + + +-- +-- Name: index_user_settings_on_user_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE UNIQUE INDEX index_user_settings_on_user_id ON user_settings USING btree (user_id); + + +-- +-- Name: index_users_on_email; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_users_on_email ON users USING btree (email); + + +-- +-- Name: index_users_on_email_ci; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE UNIQUE INDEX index_users_on_email_ci ON users USING btree (lower((email)::text) varchar_pattern_ops); + + +-- +-- Name: index_users_on_perishable_token; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE UNIQUE INDEX index_users_on_perishable_token ON users USING btree (perishable_token); + + +-- +-- Name: index_users_on_persistence_token; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE UNIQUE INDEX index_users_on_persistence_token ON users USING btree (persistence_token); + + +-- +-- Name: index_users_on_sso_token; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE UNIQUE INDEX index_users_on_sso_token ON users USING btree (sso_token); + + +-- +-- Name: index_users_on_url_auth_token; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_users_on_url_auth_token ON users USING btree (url_auth_token); + + +-- +-- Name: index_visit_cards_on_subject_type_and_subject_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE UNIQUE INDEX index_visit_cards_on_subject_type_and_subject_id ON visit_cards USING btree (subject_type, subject_id); + + +-- +-- Name: index_wiki_page_versions_on_created_by; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_wiki_page_versions_on_created_by ON wiki_page_versions USING btree (created_by); + + +-- +-- Name: index_wiki_page_versions_on_wiki_page_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_wiki_page_versions_on_wiki_page_id ON wiki_page_versions USING btree (wiki_page_id); + + +-- +-- Name: index_wiki_page_versions_on_wiki_page_id_and_version; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_wiki_page_versions_on_wiki_page_id_and_version ON wiki_page_versions USING btree (wiki_page_id, version); + + +-- +-- Name: index_wiki_pages_on_seo_entity_id_and_region_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE UNIQUE INDEX index_wiki_pages_on_seo_entity_id_and_region_id ON wiki_pages USING btree (seo_entity_id, region_id); + + +-- +-- Name: index_wordstat_rubrics_on_rubric_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_wordstat_rubrics_on_rubric_id ON wordstat_rubrics USING btree (rubric_id); + + +-- +-- Name: index_yandex_direct_banner_rubrics_on_yandex_direct_banner_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_yandex_direct_banner_rubrics_on_yandex_direct_banner_id ON yandex_direct_banner_rubrics USING btree (yandex_direct_banner_id); + + +-- +-- Name: index_yandex_ips_on_lr_and_ip; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE UNIQUE INDEX index_yandex_ips_on_lr_and_ip ON yandex_ips USING btree (lr, ip); + + +-- +-- Name: index_yandex_map_coordinates_on_address_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_yandex_map_coordinates_on_address_id ON yandex_map_coordinates USING btree (address_id); + + +-- +-- Name: ipart_company_rubrics_company_id_rubric_id_rubric_level_eq3; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX ipart_company_rubrics_company_id_rubric_id_rubric_level_eq3 ON company_rubrics USING btree (company_id, rubric_id) WHERE (rubric_level = 3); + + +-- +-- Name: ipart_company_rubrics_company_id_rubric_id_rubric_level_eq4; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX ipart_company_rubrics_company_id_rubric_id_rubric_level_eq4 ON company_rubrics USING btree (company_id, rubric_id) WHERE (rubric_level = 4); + + +-- +-- Name: ipart_ispub_and_cachelvl_eq_4; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX ipart_ispub_and_cachelvl_eq_4 ON rubrics USING btree (parent_id) WHERE ((cached_level <= 4) AND (is_published = true)); + + +-- +-- Name: ipart_products_company_id_mainpage_position_not_null; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX ipart_products_company_id_mainpage_position_not_null ON products USING btree (company_id) WHERE (mainpage_position IS NOT NULL); + + +-- +-- Name: ipart_products_company_id_state_not_deleted; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX ipart_products_company_id_state_not_deleted ON products USING btree (company_id) WHERE (state <> 'deleted'::product_state); + + +-- +-- Name: ipart_products_company_id_state_not_deleted_declined; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX ipart_products_company_id_state_not_deleted_declined ON products USING btree (company_id) WHERE (state <> ALL (ARRAY['declined'::product_state, 'deleted'::product_state])); + + +-- +-- Name: ipart_products_company_id_state_not_deleted_products_is_not_pub; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX ipart_products_company_id_state_not_deleted_products_is_not_pub ON products USING btree (company_id) WHERE ((state <> 'deleted'::product_state) AND (is_public = false)); + + +-- +-- Name: ix_companies_csv_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX ix_companies_csv_id ON companies USING btree (csv_id) WHERE (csv_id IS NOT NULL); + + +-- +-- Name: news_state_is_public_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX news_state_is_public_idx ON news USING btree (state, is_public) WHERE (((state)::text = 'normal'::text) AND (is_public = true)); + + +-- +-- Name: news_state_published_at_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX news_state_published_at_idx ON news USING btree (published_at DESC); + + +-- +-- Name: prerendered_rubricators_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX prerendered_rubricators_idx ON prerendered_rubricators USING btree (region_id, rubric_id); + + +-- +-- Name: products_aa_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX products_aa_id_idx ON products_aa USING btree (id); + + +-- +-- Name: seo_entities_name; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE UNIQUE INDEX seo_entities_name ON seo_entities USING btree (lower(btrim((name)::text))); + + +-- +-- Name: seo_entity_stopwords_word_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX seo_entity_stopwords_word_idx ON seo_entity_stopwords USING btree (word); + + +-- +-- Name: seo_entity_wordforms_seo_entity_id_form_uniq_i; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE UNIQUE INDEX seo_entity_wordforms_seo_entity_id_form_uniq_i ON seo_entity_wordforms USING btree (btrim(lower((form)::text))); + + +-- +-- Name: synonyms_rubric_id_is_deleted_is_new_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX synonyms_rubric_id_is_deleted_is_new_idx ON synonyms USING btree (rubric_id) WHERE (is_deleted = false); + + +-- +-- Name: synonyms_uniq_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE UNIQUE INDEX synonyms_uniq_idx ON synonyms USING btree (base_id, synonym_id, rubric_id, state) WHERE (is_deleted = false); + + +-- +-- Name: taggable_context_tag; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE UNIQUE INDEX taggable_context_tag ON taggings USING btree (taggable_type, context, taggable_id, tag_id); + + +-- +-- Name: unq_dialog_participants; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE UNIQUE INDEX unq_dialog_participants ON dialog_participants USING btree (dialog_id, company_id, user_id); + + +-- +-- Name: uq_company_manager_stats; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE UNIQUE INDEX uq_company_manager_stats ON company_manager_stats USING btree (rubric_id, region_id); + + +-- +-- Name: uq_packet_region_settings_packet_region; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE UNIQUE INDEX uq_packet_region_settings_packet_region ON packet_region_settings USING btree (packet_id, region_id); + + +-- +-- Name: uq_packet_region_settings_region_packet; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE UNIQUE INDEX uq_packet_region_settings_region_packet ON packet_region_settings USING btree (region_id, packet_id); + + +-- +-- Name: uq_packets_slug; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE UNIQUE INDEX uq_packets_slug ON packets USING btree (lower((slug)::text)); + + +-- +-- Name: uq_packets_title; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE UNIQUE INDEX uq_packets_title ON packets USING btree (title); + + +-- +-- Name: uq_system_params_name; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE UNIQUE INDEX uq_system_params_name ON system_params USING btree (name); + + +-- +-- Name: uq_trait_value_redirects_redirect_from; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE UNIQUE INDEX uq_trait_value_redirects_redirect_from ON trait_value_redirects USING btree (redirect_from); + + +-- +-- Name: useful_link_categories_industries_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE UNIQUE INDEX useful_link_categories_industries_idx ON useful_link_categories_industries USING btree (useful_link_category_id, industry_id); + + +-- +-- Name: useful_link_categories_thematic_rubrics_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE UNIQUE INDEX useful_link_categories_thematic_rubrics_idx ON useful_link_categories_thematic_rubrics USING btree (useful_link_category_id, thematic_rubric_id); + + +-- +-- Name: wiki_page_versions_accepter_state_index; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX wiki_page_versions_accepter_state_index ON wiki_page_versions USING btree (wiki_page_id, state) WHERE ((state)::text = ('accepted'::character varying)::text); + + +-- +-- Name: wiki_pages_region_slug_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE UNIQUE INDEX wiki_pages_region_slug_idx ON wiki_pages USING btree (region_id, slug); + + +SET search_path = search_hints, pg_catalog; + +-- +-- Name: ix_forms_main_form; Type: INDEX; Schema: search_hints; Owner: -; Tablespace: +-- + +CREATE INDEX ix_forms_main_form ON forms USING btree (main_form_id); + + +-- +-- Name: uq_form_rubrics; Type: INDEX; Schema: search_hints; Owner: -; Tablespace: +-- + +CREATE UNIQUE INDEX uq_form_rubrics ON form_rubrics USING btree (form_id, rubric_id); + + +-- +-- Name: uq_forms_request; Type: INDEX; Schema: search_hints; Owner: -; Tablespace: +-- + +CREATE UNIQUE INDEX uq_forms_request ON forms USING btree (request_id); + + +-- +-- Name: uq_forms_value; Type: INDEX; Schema: search_hints; Owner: -; Tablespace: +-- + +CREATE UNIQUE INDEX uq_forms_value ON forms USING btree (value); + + +-- +-- Name: uq_requests; Type: INDEX; Schema: search_hints; Owner: -; Tablespace: +-- + +CREATE UNIQUE INDEX uq_requests ON requests USING btree (value); + + +-- +-- Name: uq_requests_for_load; Type: INDEX; Schema: search_hints; Owner: -; Tablespace: +-- + +CREATE UNIQUE INDEX uq_requests_for_load ON requests_for_load USING btree (request); + + +SET search_path = service_box, pg_catalog; + +-- +-- Name: index_service_box.web_searchers_codes_stats_on_web_searcher_id; Type: INDEX; Schema: service_box; Owner: -; Tablespace: +-- + +CREATE INDEX "index_service_box.web_searchers_codes_stats_on_web_searcher_id" ON web_searchers_codes_stats USING btree (web_searcher_id); + + +-- +-- Name: index_web_searchers_codes_stats_on_date; Type: INDEX; Schema: service_box; Owner: -; Tablespace: +-- + +CREATE INDEX index_web_searchers_codes_stats_on_date ON web_searchers_codes_stats USING btree (date); + + +SET search_path = statistics, pg_catalog; + +-- +-- Name: i_news_statistic_total_by_regions_news_id; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX i_news_statistic_total_by_regions_news_id ON news_statistic_total_by_regions USING btree (news_id); + + +-- +-- Name: i_news_statistic_total_by_regions_news_id_region_id; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE UNIQUE INDEX i_news_statistic_total_by_regions_news_id_region_id ON news_statistic_total_by_regions USING btree (news_id, region_id); + + +-- +-- Name: i_news_statistic_totals_news_id; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE UNIQUE INDEX i_news_statistic_totals_news_id ON news_statistic_totals USING btree (news_id); + + +-- +-- Name: idx_company_stats_activities_totals_on_company_id_and_action; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE UNIQUE INDEX idx_company_stats_activities_totals_on_company_id_and_action ON company_statistic_activities_totals USING btree (company_id, action); + + +-- +-- Name: index_statistics.rubric_region_adds_on_rubric_id_and_region_id; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE UNIQUE INDEX "index_statistics.rubric_region_adds_on_rubric_id_and_region_id" ON rubric_region_adds USING btree (rubric_id, region_id); + + +-- +-- Name: ix_company_statistic_totals_on_company_id; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE UNIQUE INDEX ix_company_statistic_totals_on_company_id ON company_statistic_totals USING btree (company_id); + + +-- +-- Name: news_stat_refs_by_months_15_08_news_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX news_stat_refs_by_months_15_08_news_id_date_idx ON news_statistic_referers_by_months_15_08 USING btree (news_id, date); + + +-- +-- Name: news_stat_refs_by_months_15_09_news_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX news_stat_refs_by_months_15_09_news_id_date_idx ON news_statistic_referers_by_months_15_09 USING btree (news_id, date); + + +-- +-- Name: s_blog_post_stat_total_by_days_14_07_blog_post_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_blog_post_stat_total_by_days_14_07_blog_post_id_date_idx ON blog_post_statistic_total_by_days_14_07 USING btree (blog_post_id, date); + + +-- +-- Name: s_blog_post_stat_total_by_days_14_07_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_blog_post_stat_total_by_days_14_07_date_idx ON blog_post_statistic_total_by_days_14_07 USING btree (date); + + +-- +-- Name: s_blog_post_stat_total_by_days_14_08_blog_post_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_blog_post_stat_total_by_days_14_08_blog_post_id_date_idx ON blog_post_statistic_total_by_days_14_08 USING btree (blog_post_id, date); + + +-- +-- Name: s_blog_post_stat_total_by_days_14_08_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_blog_post_stat_total_by_days_14_08_date_idx ON blog_post_statistic_total_by_days_14_08 USING btree (date); + + +-- +-- Name: s_blog_post_stat_total_by_days_14_09_blog_post_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_blog_post_stat_total_by_days_14_09_blog_post_id_date_idx ON blog_post_statistic_total_by_days_14_09 USING btree (blog_post_id, date); + + +-- +-- Name: s_blog_post_stat_total_by_days_14_09_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_blog_post_stat_total_by_days_14_09_date_idx ON blog_post_statistic_total_by_days_14_09 USING btree (date); + + +-- +-- Name: s_blog_post_stat_total_by_days_14_10_blog_post_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_blog_post_stat_total_by_days_14_10_blog_post_id_date_idx ON blog_post_statistic_total_by_days_14_10 USING btree (blog_post_id, date); + + +-- +-- Name: s_blog_post_stat_total_by_days_14_10_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_blog_post_stat_total_by_days_14_10_date_idx ON blog_post_statistic_total_by_days_14_10 USING btree (date); + + +-- +-- Name: s_blog_post_stat_total_by_days_14_11_blog_post_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_blog_post_stat_total_by_days_14_11_blog_post_id_date_idx ON blog_post_statistic_total_by_days_14_11 USING btree (blog_post_id, date); + + +-- +-- Name: s_blog_post_stat_total_by_days_14_11_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_blog_post_stat_total_by_days_14_11_date_idx ON blog_post_statistic_total_by_days_14_11 USING btree (date); + + +-- +-- Name: s_blog_post_stat_total_by_days_14_12_blog_post_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_blog_post_stat_total_by_days_14_12_blog_post_id_date_idx ON blog_post_statistic_total_by_days_14_12 USING btree (blog_post_id, date); + + +-- +-- Name: s_blog_post_stat_total_by_days_14_12_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_blog_post_stat_total_by_days_14_12_date_idx ON blog_post_statistic_total_by_days_14_12 USING btree (date); + + +-- +-- Name: s_blog_post_stat_total_by_days_15_01_blog_post_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_blog_post_stat_total_by_days_15_01_blog_post_id_date_idx ON blog_post_statistic_total_by_days_15_01 USING btree (blog_post_id, date); + + +-- +-- Name: s_blog_post_stat_total_by_days_15_01_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_blog_post_stat_total_by_days_15_01_date_idx ON blog_post_statistic_total_by_days_15_01 USING btree (date); + + +-- +-- Name: s_blog_post_totals_on_blog_post_id; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_blog_post_totals_on_blog_post_id ON blog_post_statistic_totals USING btree (blog_post_id); + + +-- +-- Name: s_c_stat_activities_by_days_15_09_company_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_activities_by_days_15_09_company_id_date_idx ON company_statistic_activities_by_days_15_09 USING btree (company_id, date); + + +-- +-- Name: s_c_stat_activities_by_months_15_09_company_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_activities_by_months_15_09_company_id_date_idx ON company_statistic_activities_by_months_15_09 USING btree (company_id, date); + + +-- +-- Name: s_c_stat_activities_by_weeks_15_09_company_id_first_week_day_id; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_activities_by_weeks_15_09_company_id_first_week_day_id ON company_statistic_activities_by_weeks_15_09 USING btree (company_id, first_week_day); + + +-- +-- Name: s_c_stat_geo_by_months_09_06_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_months_09_06_company_id_date_pages_idx ON company_statistic_geo_by_months_09_06 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_geo_by_months_09_07_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_months_09_07_company_id_date_pages_idx ON company_statistic_geo_by_months_09_07 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_geo_by_months_09_08_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_months_09_08_company_id_date_pages_idx ON company_statistic_geo_by_months_09_08 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_geo_by_months_09_10_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_months_09_10_company_id_date_pages_idx ON company_statistic_geo_by_months_09_10 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_geo_by_months_09_11_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_months_09_11_company_id_date_pages_idx ON company_statistic_geo_by_months_09_11 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_geo_by_months_09_12_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_months_09_12_company_id_date_pages_idx ON company_statistic_geo_by_months_09_12 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_geo_by_months_10_01_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_months_10_01_company_id_date_pages_idx ON company_statistic_geo_by_months_10_01 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_geo_by_months_10_02_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_months_10_02_company_id_date_pages_idx ON company_statistic_geo_by_months_10_02 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_geo_by_months_10_03_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_months_10_03_company_id_date_pages_idx ON company_statistic_geo_by_months_10_03 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_geo_by_months_10_04_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_months_10_04_company_id_date_pages_idx ON company_statistic_geo_by_months_10_04 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_geo_by_months_10_05_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_months_10_05_company_id_date_pages_idx ON company_statistic_geo_by_months_10_05 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_geo_by_months_10_06_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_months_10_06_company_id_date_pages_idx ON company_statistic_geo_by_months_10_06 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_geo_by_months_10_07_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_months_10_07_company_id_date_pages_idx ON company_statistic_geo_by_months_10_07 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_geo_by_months_10_08_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_months_10_08_company_id_date_pages_idx ON company_statistic_geo_by_months_10_08 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_geo_by_months_10_09_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_months_10_09_company_id_date_pages_idx ON company_statistic_geo_by_months_10_09 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_geo_by_months_10_10_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_months_10_10_company_id_date_pages_idx ON company_statistic_geo_by_months_10_10 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_geo_by_months_10_11_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_months_10_11_company_id_date_pages_idx ON company_statistic_geo_by_months_10_11 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_geo_by_months_10_12_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_months_10_12_company_id_date_pages_idx ON company_statistic_geo_by_months_10_12 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_geo_by_months_11_11_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_months_11_11_company_id_date_pages_idx ON company_statistic_geo_by_months_11_11 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_geo_by_months_11_11_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_months_11_11_date_idx ON company_statistic_geo_by_months_11_11 USING btree (date); + + +-- +-- Name: s_c_stat_geo_by_months_11_12_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_months_11_12_company_id_date_pages_idx ON company_statistic_geo_by_months_11_12 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_geo_by_months_11_12_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_months_11_12_date_idx ON company_statistic_geo_by_months_11_12 USING btree (date); + + +-- +-- Name: s_c_stat_geo_by_months_12_01_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_months_12_01_company_id_date_pages_idx ON company_statistic_geo_by_months_12_01 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_geo_by_months_12_01_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_months_12_01_date_idx ON company_statistic_geo_by_months_12_01 USING btree (date); + + +-- +-- Name: s_c_stat_geo_by_months_12_02_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_months_12_02_company_id_date_pages_idx ON company_statistic_geo_by_months_12_02 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_geo_by_months_12_02_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_months_12_02_date_idx ON company_statistic_geo_by_months_12_02 USING btree (date); + + +-- +-- Name: s_c_stat_geo_by_months_12_03_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_months_12_03_company_id_date_pages_idx ON company_statistic_geo_by_months_12_03 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_geo_by_months_12_03_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_months_12_03_date_idx ON company_statistic_geo_by_months_12_03 USING btree (date); + + +-- +-- Name: s_c_stat_geo_by_months_12_04_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_months_12_04_company_id_date_pages_idx ON company_statistic_geo_by_months_12_04 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_geo_by_months_12_04_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_months_12_04_date_idx ON company_statistic_geo_by_months_12_04 USING btree (date); + + +-- +-- Name: s_c_stat_geo_by_months_12_05_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_months_12_05_company_id_date_pages_idx ON company_statistic_geo_by_months_12_05 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_geo_by_months_12_05_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_months_12_05_date_idx ON company_statistic_geo_by_months_12_05 USING btree (date); + + +-- +-- Name: s_c_stat_geo_by_months_12_06_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_months_12_06_company_id_date_pages_idx ON company_statistic_geo_by_months_12_06 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_geo_by_months_12_06_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_months_12_06_date_idx ON company_statistic_geo_by_months_12_06 USING btree (date); + + +-- +-- Name: s_c_stat_geo_by_months_12_07_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_months_12_07_company_id_date_pages_idx ON company_statistic_geo_by_months_12_07 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_geo_by_months_12_07_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_months_12_07_date_idx ON company_statistic_geo_by_months_12_07 USING btree (date); + + +-- +-- Name: s_c_stat_geo_by_months_12_08_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_months_12_08_company_id_date_pages_idx ON company_statistic_geo_by_months_12_08 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_geo_by_months_12_08_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_months_12_08_date_idx ON company_statistic_geo_by_months_12_08 USING btree (date); + + +-- +-- Name: s_c_stat_geo_by_months_12_09_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_months_12_09_company_id_date_pages_idx ON company_statistic_geo_by_months_12_09 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_geo_by_months_12_09_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_months_12_09_date_idx ON company_statistic_geo_by_months_12_09 USING btree (date); + + +-- +-- Name: s_c_stat_geo_by_months_12_10_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_months_12_10_company_id_date_pages_idx ON company_statistic_geo_by_months_12_10 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_geo_by_months_12_10_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_months_12_10_date_idx ON company_statistic_geo_by_months_12_10 USING btree (date); + + +-- +-- Name: s_c_stat_geo_by_months_12_11_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_months_12_11_company_id_date_pages_idx ON company_statistic_geo_by_months_12_11 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_geo_by_months_12_11_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_months_12_11_date_idx ON company_statistic_geo_by_months_12_11 USING btree (date); + + +-- +-- Name: s_c_stat_geo_by_months_12_12_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_months_12_12_company_id_date_pages_idx ON company_statistic_geo_by_months_12_12 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_geo_by_months_12_12_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_months_12_12_date_idx ON company_statistic_geo_by_months_12_12 USING btree (date); + + +-- +-- Name: s_c_stat_geo_by_months_13_01_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_months_13_01_company_id_date_pages_idx ON company_statistic_geo_by_months_13_01 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_geo_by_months_13_01_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_months_13_01_date_idx ON company_statistic_geo_by_months_13_01 USING btree (date); + + +-- +-- Name: s_c_stat_geo_by_months_13_02_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_months_13_02_company_id_date_pages_idx ON company_statistic_geo_by_months_13_02 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_geo_by_months_13_02_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_months_13_02_date_idx ON company_statistic_geo_by_months_13_02 USING btree (date); + + +-- +-- Name: s_c_stat_geo_by_months_13_03_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_months_13_03_company_id_date_pages_idx ON company_statistic_geo_by_months_13_03 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_geo_by_months_13_03_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_months_13_03_date_idx ON company_statistic_geo_by_months_13_03 USING btree (date); + + +-- +-- Name: s_c_stat_geo_by_months_13_04_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_months_13_04_company_id_date_pages_idx ON company_statistic_geo_by_months_13_04 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_geo_by_months_13_04_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_months_13_04_date_idx ON company_statistic_geo_by_months_13_04 USING btree (date); + + +-- +-- Name: s_c_stat_geo_by_months_13_05_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_months_13_05_company_id_date_pages_idx ON company_statistic_geo_by_months_13_05 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_geo_by_months_13_05_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_months_13_05_date_idx ON company_statistic_geo_by_months_13_05 USING btree (date); + + +-- +-- Name: s_c_stat_geo_by_months_13_06_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_months_13_06_company_id_date_pages_idx ON company_statistic_geo_by_months_13_06 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_geo_by_months_13_06_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_months_13_06_date_idx ON company_statistic_geo_by_months_13_06 USING btree (date); + + +-- +-- Name: s_c_stat_geo_by_months_13_07_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_months_13_07_company_id_date_pages_idx ON company_statistic_geo_by_months_13_07 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_geo_by_months_13_07_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_months_13_07_date_idx ON company_statistic_geo_by_months_13_07 USING btree (date); + + +-- +-- Name: s_c_stat_geo_by_months_13_08_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_months_13_08_company_id_date_pages_idx ON company_statistic_geo_by_months_13_08 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_geo_by_months_13_08_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_months_13_08_date_idx ON company_statistic_geo_by_months_13_08 USING btree (date); + + +-- +-- Name: s_c_stat_geo_by_months_13_09_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_months_13_09_company_id_date_pages_idx ON company_statistic_geo_by_months_13_09 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_geo_by_months_13_09_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_months_13_09_date_idx ON company_statistic_geo_by_months_13_09 USING btree (date); + + +-- +-- Name: s_c_stat_geo_by_months_13_10_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_months_13_10_company_id_date_pages_idx ON company_statistic_geo_by_months_13_10 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_geo_by_months_13_10_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_months_13_10_date_idx ON company_statistic_geo_by_months_13_10 USING btree (date); + + +-- +-- Name: s_c_stat_geo_by_months_13_11_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_months_13_11_company_id_date_pages_idx ON company_statistic_geo_by_months_13_11 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_geo_by_months_13_11_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_months_13_11_date_idx ON company_statistic_geo_by_months_13_11 USING btree (date); + + +-- +-- Name: s_c_stat_geo_by_months_13_12_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_months_13_12_company_id_date_pages_idx ON company_statistic_geo_by_months_13_12 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_geo_by_months_13_12_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_months_13_12_date_idx ON company_statistic_geo_by_months_13_12 USING btree (date); + + +-- +-- Name: s_c_stat_geo_by_months_14_01_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_months_14_01_company_id_date_pages_idx ON company_statistic_geo_by_months_14_01 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_geo_by_months_14_01_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_months_14_01_date_idx ON company_statistic_geo_by_months_14_01 USING btree (date); + + +-- +-- Name: s_c_stat_geo_by_months_14_02_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_months_14_02_company_id_date_pages_idx ON company_statistic_geo_by_months_14_02 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_geo_by_months_14_02_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_months_14_02_date_idx ON company_statistic_geo_by_months_14_02 USING btree (date); + + +-- +-- Name: s_c_stat_geo_by_months_14_03_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_months_14_03_company_id_date_pages_idx ON company_statistic_geo_by_months_14_03 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_geo_by_months_14_03_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_months_14_03_date_idx ON company_statistic_geo_by_months_14_03 USING btree (date); + + +-- +-- Name: s_c_stat_geo_by_months_14_04_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_months_14_04_company_id_date_pages_idx ON company_statistic_geo_by_months_14_04 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_geo_by_months_14_04_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_months_14_04_date_idx ON company_statistic_geo_by_months_14_04 USING btree (date); + + +-- +-- Name: s_c_stat_geo_by_months_14_05_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_months_14_05_company_id_date_pages_idx ON company_statistic_geo_by_months_14_05 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_geo_by_months_14_05_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_months_14_05_date_idx ON company_statistic_geo_by_months_14_05 USING btree (date); + + +-- +-- Name: s_c_stat_geo_by_months_14_06_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_months_14_06_company_id_date_pages_idx ON company_statistic_geo_by_months_14_06 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_geo_by_months_14_06_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_months_14_06_date_idx ON company_statistic_geo_by_months_14_06 USING btree (date); + + +-- +-- Name: s_c_stat_geo_by_months_14_07_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_months_14_07_company_id_date_pages_idx ON company_statistic_geo_by_months_14_07 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_geo_by_months_14_07_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_months_14_07_date_idx ON company_statistic_geo_by_months_14_07 USING btree (date); + + +-- +-- Name: s_c_stat_geo_by_months_14_08_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_months_14_08_company_id_date_pages_idx ON company_statistic_geo_by_months_14_08 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_geo_by_months_14_08_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_months_14_08_date_idx ON company_statistic_geo_by_months_14_08 USING btree (date); + + +-- +-- Name: s_c_stat_geo_by_months_14_09_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_months_14_09_company_id_date_pages_idx ON company_statistic_geo_by_months_14_09 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_geo_by_months_14_09_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_months_14_09_date_idx ON company_statistic_geo_by_months_14_09 USING btree (date); + + +-- +-- Name: s_c_stat_geo_by_months_14_10_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_months_14_10_company_id_date_pages_idx ON company_statistic_geo_by_months_14_10 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_geo_by_months_14_10_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_months_14_10_date_idx ON company_statistic_geo_by_months_14_10 USING btree (date); + + +-- +-- Name: s_c_stat_geo_by_months_14_11_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_months_14_11_company_id_date_pages_idx ON company_statistic_geo_by_months_14_11 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_geo_by_months_14_11_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_months_14_11_date_idx ON company_statistic_geo_by_months_14_11 USING btree (date); + + +-- +-- Name: s_c_stat_geo_by_months_14_12_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_months_14_12_company_id_date_pages_idx ON company_statistic_geo_by_months_14_12 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_geo_by_months_14_12_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_months_14_12_date_idx ON company_statistic_geo_by_months_14_12 USING btree (date); + + +-- +-- Name: s_c_stat_geo_by_months_15_01_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_months_15_01_company_id_date_pages_idx ON company_statistic_geo_by_months_15_01 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_geo_by_months_15_01_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_months_15_01_date_idx ON company_statistic_geo_by_months_15_01 USING btree (date); + + +-- +-- Name: s_c_stat_geo_by_months_15_09_company_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_months_15_09_company_id_date_idx ON company_statistic_geo_by_months_15_09 USING btree (company_id, date); + + +-- +-- Name: s_c_stat_geo_by_weeks_09_04_company_id_first_week_day_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_weeks_09_04_company_id_first_week_day_pages_idx ON company_statistic_geo_by_weeks_09_04 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_geo_by_weeks_09_05_company_id_first_week_day_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_weeks_09_05_company_id_first_week_day_pages_idx ON company_statistic_geo_by_weeks_09_05 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_geo_by_weeks_09_06_company_id_first_week_day_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_weeks_09_06_company_id_first_week_day_pages_idx ON company_statistic_geo_by_weeks_09_06 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_geo_by_weeks_09_07_company_id_first_week_day_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_weeks_09_07_company_id_first_week_day_pages_idx ON company_statistic_geo_by_weeks_09_07 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_geo_by_weeks_09_08_company_id_first_week_day_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_weeks_09_08_company_id_first_week_day_pages_idx ON company_statistic_geo_by_weeks_09_08 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_geo_by_weeks_09_09_company_id_first_week_day_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_weeks_09_09_company_id_first_week_day_pages_idx ON company_statistic_geo_by_weeks_09_09 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_geo_by_weeks_09_10_company_id_first_week_day_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_weeks_09_10_company_id_first_week_day_pages_idx ON company_statistic_geo_by_weeks_09_10 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_geo_by_weeks_09_11_company_id_first_week_day_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_weeks_09_11_company_id_first_week_day_pages_idx ON company_statistic_geo_by_weeks_09_11 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_geo_by_weeks_09_12_company_id_first_week_day_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_weeks_09_12_company_id_first_week_day_pages_idx ON company_statistic_geo_by_weeks_09_12 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_geo_by_weeks_10_01_company_id_first_week_day_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_weeks_10_01_company_id_first_week_day_pages_idx ON company_statistic_geo_by_weeks_10_01 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_geo_by_weeks_10_02_company_id_first_week_day_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_weeks_10_02_company_id_first_week_day_pages_idx ON company_statistic_geo_by_weeks_10_02 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_geo_by_weeks_10_03_company_id_first_week_day_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_weeks_10_03_company_id_first_week_day_pages_idx ON company_statistic_geo_by_weeks_10_03 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_geo_by_weeks_10_04_company_id_first_week_day_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_weeks_10_04_company_id_first_week_day_pages_idx ON company_statistic_geo_by_weeks_10_04 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_geo_by_weeks_10_05_company_id_first_week_day_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_weeks_10_05_company_id_first_week_day_pages_idx ON company_statistic_geo_by_weeks_10_05 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_geo_by_weeks_10_06_company_id_first_week_day_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_weeks_10_06_company_id_first_week_day_pages_idx ON company_statistic_geo_by_weeks_10_06 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_geo_by_weeks_10_07_company_id_first_week_day_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_weeks_10_07_company_id_first_week_day_pages_idx ON company_statistic_geo_by_weeks_10_07 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_geo_by_weeks_10_08_company_id_first_week_day_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_weeks_10_08_company_id_first_week_day_pages_idx ON company_statistic_geo_by_weeks_10_08 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_geo_by_weeks_10_09_company_id_first_week_day_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_weeks_10_09_company_id_first_week_day_pages_idx ON company_statistic_geo_by_weeks_10_09 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_geo_by_weeks_10_10_company_id_first_week_day_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_weeks_10_10_company_id_first_week_day_pages_idx ON company_statistic_geo_by_weeks_10_10 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_geo_by_weeks_10_11_company_id_first_week_day_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_weeks_10_11_company_id_first_week_day_pages_idx ON company_statistic_geo_by_weeks_10_11 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_geo_by_weeks_10_12_company_id_first_week_day_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_weeks_10_12_company_id_first_week_day_pages_idx ON company_statistic_geo_by_weeks_10_12 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_geo_by_weeks_11_11_company_id_first_week_day_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_weeks_11_11_company_id_first_week_day_pages_idx ON company_statistic_geo_by_weeks_11_11 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_geo_by_weeks_11_11_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_weeks_11_11_first_week_day_idx ON company_statistic_geo_by_weeks_11_11 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_geo_by_weeks_11_12_company_id_first_week_day_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_weeks_11_12_company_id_first_week_day_pages_idx ON company_statistic_geo_by_weeks_11_12 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_geo_by_weeks_11_12_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_weeks_11_12_first_week_day_idx ON company_statistic_geo_by_weeks_11_12 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_geo_by_weeks_12_01_company_id_first_week_day_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_weeks_12_01_company_id_first_week_day_pages_idx ON company_statistic_geo_by_weeks_12_01 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_geo_by_weeks_12_01_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_weeks_12_01_first_week_day_idx ON company_statistic_geo_by_weeks_12_01 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_geo_by_weeks_12_02_company_id_first_week_day_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_weeks_12_02_company_id_first_week_day_pages_idx ON company_statistic_geo_by_weeks_12_02 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_geo_by_weeks_12_02_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_weeks_12_02_first_week_day_idx ON company_statistic_geo_by_weeks_12_02 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_geo_by_weeks_12_03_company_id_first_week_day_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_weeks_12_03_company_id_first_week_day_pages_idx ON company_statistic_geo_by_weeks_12_03 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_geo_by_weeks_12_03_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_weeks_12_03_first_week_day_idx ON company_statistic_geo_by_weeks_12_03 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_geo_by_weeks_12_04_company_id_first_week_day_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_weeks_12_04_company_id_first_week_day_pages_idx ON company_statistic_geo_by_weeks_12_04 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_geo_by_weeks_12_04_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_weeks_12_04_first_week_day_idx ON company_statistic_geo_by_weeks_12_04 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_geo_by_weeks_12_05_company_id_first_week_day_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_weeks_12_05_company_id_first_week_day_pages_idx ON company_statistic_geo_by_weeks_12_05 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_geo_by_weeks_12_05_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_weeks_12_05_first_week_day_idx ON company_statistic_geo_by_weeks_12_05 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_geo_by_weeks_12_06_company_id_first_week_day_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_weeks_12_06_company_id_first_week_day_pages_idx ON company_statistic_geo_by_weeks_12_06 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_geo_by_weeks_12_06_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_weeks_12_06_first_week_day_idx ON company_statistic_geo_by_weeks_12_06 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_geo_by_weeks_12_07_company_id_first_week_day_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_weeks_12_07_company_id_first_week_day_pages_idx ON company_statistic_geo_by_weeks_12_07 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_geo_by_weeks_12_07_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_weeks_12_07_first_week_day_idx ON company_statistic_geo_by_weeks_12_07 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_geo_by_weeks_12_08_company_id_first_week_day_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_weeks_12_08_company_id_first_week_day_pages_idx ON company_statistic_geo_by_weeks_12_08 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_geo_by_weeks_12_08_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_weeks_12_08_first_week_day_idx ON company_statistic_geo_by_weeks_12_08 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_geo_by_weeks_12_09_company_id_first_week_day_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_weeks_12_09_company_id_first_week_day_pages_idx ON company_statistic_geo_by_weeks_12_09 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_geo_by_weeks_12_09_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_weeks_12_09_first_week_day_idx ON company_statistic_geo_by_weeks_12_09 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_geo_by_weeks_12_10_company_id_first_week_day_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_weeks_12_10_company_id_first_week_day_pages_idx ON company_statistic_geo_by_weeks_12_10 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_geo_by_weeks_12_10_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_weeks_12_10_first_week_day_idx ON company_statistic_geo_by_weeks_12_10 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_geo_by_weeks_12_11_company_id_first_week_day_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_weeks_12_11_company_id_first_week_day_pages_idx ON company_statistic_geo_by_weeks_12_11 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_geo_by_weeks_12_11_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_weeks_12_11_first_week_day_idx ON company_statistic_geo_by_weeks_12_11 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_geo_by_weeks_12_12_company_id_first_week_day_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_weeks_12_12_company_id_first_week_day_pages_idx ON company_statistic_geo_by_weeks_12_12 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_geo_by_weeks_12_12_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_weeks_12_12_first_week_day_idx ON company_statistic_geo_by_weeks_12_12 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_geo_by_weeks_13_01_company_id_first_week_day_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_weeks_13_01_company_id_first_week_day_pages_idx ON company_statistic_geo_by_weeks_13_01 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_geo_by_weeks_13_01_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_weeks_13_01_first_week_day_idx ON company_statistic_geo_by_weeks_13_01 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_geo_by_weeks_13_02_company_id_first_week_day_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_weeks_13_02_company_id_first_week_day_pages_idx ON company_statistic_geo_by_weeks_13_02 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_geo_by_weeks_13_02_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_weeks_13_02_first_week_day_idx ON company_statistic_geo_by_weeks_13_02 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_geo_by_weeks_13_03_company_id_first_week_day_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_weeks_13_03_company_id_first_week_day_pages_idx ON company_statistic_geo_by_weeks_13_03 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_geo_by_weeks_13_03_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_weeks_13_03_first_week_day_idx ON company_statistic_geo_by_weeks_13_03 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_geo_by_weeks_13_04_company_id_first_week_day_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_weeks_13_04_company_id_first_week_day_pages_idx ON company_statistic_geo_by_weeks_13_04 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_geo_by_weeks_13_04_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_weeks_13_04_first_week_day_idx ON company_statistic_geo_by_weeks_13_04 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_geo_by_weeks_13_05_company_id_first_week_day_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_weeks_13_05_company_id_first_week_day_pages_idx ON company_statistic_geo_by_weeks_13_05 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_geo_by_weeks_13_05_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_weeks_13_05_first_week_day_idx ON company_statistic_geo_by_weeks_13_05 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_geo_by_weeks_13_06_company_id_first_week_day_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_weeks_13_06_company_id_first_week_day_pages_idx ON company_statistic_geo_by_weeks_13_06 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_geo_by_weeks_13_06_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_weeks_13_06_first_week_day_idx ON company_statistic_geo_by_weeks_13_06 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_geo_by_weeks_13_07_company_id_first_week_day_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_weeks_13_07_company_id_first_week_day_pages_idx ON company_statistic_geo_by_weeks_13_07 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_geo_by_weeks_13_07_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_weeks_13_07_first_week_day_idx ON company_statistic_geo_by_weeks_13_07 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_geo_by_weeks_13_08_company_id_first_week_day_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_weeks_13_08_company_id_first_week_day_pages_idx ON company_statistic_geo_by_weeks_13_08 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_geo_by_weeks_13_08_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_weeks_13_08_first_week_day_idx ON company_statistic_geo_by_weeks_13_08 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_geo_by_weeks_13_09_company_id_first_week_day_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_weeks_13_09_company_id_first_week_day_pages_idx ON company_statistic_geo_by_weeks_13_09 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_geo_by_weeks_13_09_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_weeks_13_09_first_week_day_idx ON company_statistic_geo_by_weeks_13_09 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_geo_by_weeks_13_10_company_id_first_week_day_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_weeks_13_10_company_id_first_week_day_pages_idx ON company_statistic_geo_by_weeks_13_10 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_geo_by_weeks_13_10_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_weeks_13_10_first_week_day_idx ON company_statistic_geo_by_weeks_13_10 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_geo_by_weeks_13_11_company_id_first_week_day_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_weeks_13_11_company_id_first_week_day_pages_idx ON company_statistic_geo_by_weeks_13_11 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_geo_by_weeks_13_11_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_weeks_13_11_first_week_day_idx ON company_statistic_geo_by_weeks_13_11 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_geo_by_weeks_13_12_company_id_first_week_day_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_weeks_13_12_company_id_first_week_day_pages_idx ON company_statistic_geo_by_weeks_13_12 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_geo_by_weeks_13_12_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_weeks_13_12_first_week_day_idx ON company_statistic_geo_by_weeks_13_12 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_geo_by_weeks_14_01_company_id_first_week_day_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_weeks_14_01_company_id_first_week_day_pages_idx ON company_statistic_geo_by_weeks_14_01 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_geo_by_weeks_14_01_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_weeks_14_01_first_week_day_idx ON company_statistic_geo_by_weeks_14_01 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_geo_by_weeks_14_02_company_id_first_week_day_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_weeks_14_02_company_id_first_week_day_pages_idx ON company_statistic_geo_by_weeks_14_02 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_geo_by_weeks_14_02_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_weeks_14_02_first_week_day_idx ON company_statistic_geo_by_weeks_14_02 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_geo_by_weeks_14_03_company_id_first_week_day_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_weeks_14_03_company_id_first_week_day_pages_idx ON company_statistic_geo_by_weeks_14_03 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_geo_by_weeks_14_03_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_weeks_14_03_first_week_day_idx ON company_statistic_geo_by_weeks_14_03 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_geo_by_weeks_14_04_company_id_first_week_day_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_weeks_14_04_company_id_first_week_day_pages_idx ON company_statistic_geo_by_weeks_14_04 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_geo_by_weeks_14_04_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_weeks_14_04_first_week_day_idx ON company_statistic_geo_by_weeks_14_04 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_geo_by_weeks_14_05_company_id_first_week_day_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_weeks_14_05_company_id_first_week_day_pages_idx ON company_statistic_geo_by_weeks_14_05 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_geo_by_weeks_14_05_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_weeks_14_05_first_week_day_idx ON company_statistic_geo_by_weeks_14_05 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_geo_by_weeks_14_06_company_id_first_week_day_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_weeks_14_06_company_id_first_week_day_pages_idx ON company_statistic_geo_by_weeks_14_06 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_geo_by_weeks_14_06_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_weeks_14_06_first_week_day_idx ON company_statistic_geo_by_weeks_14_06 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_geo_by_weeks_14_07_company_id_first_week_day_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_weeks_14_07_company_id_first_week_day_pages_idx ON company_statistic_geo_by_weeks_14_07 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_geo_by_weeks_14_07_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_weeks_14_07_first_week_day_idx ON company_statistic_geo_by_weeks_14_07 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_geo_by_weeks_14_08_company_id_first_week_day_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_weeks_14_08_company_id_first_week_day_pages_idx ON company_statistic_geo_by_weeks_14_08 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_geo_by_weeks_14_08_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_weeks_14_08_first_week_day_idx ON company_statistic_geo_by_weeks_14_08 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_geo_by_weeks_14_09_company_id_first_week_day_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_weeks_14_09_company_id_first_week_day_pages_idx ON company_statistic_geo_by_weeks_14_09 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_geo_by_weeks_14_09_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_weeks_14_09_first_week_day_idx ON company_statistic_geo_by_weeks_14_09 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_geo_by_weeks_14_10_company_id_first_week_day_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_weeks_14_10_company_id_first_week_day_pages_idx ON company_statistic_geo_by_weeks_14_10 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_geo_by_weeks_14_10_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_weeks_14_10_first_week_day_idx ON company_statistic_geo_by_weeks_14_10 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_geo_by_weeks_14_11_company_id_first_week_day_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_weeks_14_11_company_id_first_week_day_pages_idx ON company_statistic_geo_by_weeks_14_11 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_geo_by_weeks_14_11_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_weeks_14_11_first_week_day_idx ON company_statistic_geo_by_weeks_14_11 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_geo_by_weeks_14_12_company_id_first_week_day_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_weeks_14_12_company_id_first_week_day_pages_idx ON company_statistic_geo_by_weeks_14_12 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_geo_by_weeks_14_12_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_weeks_14_12_first_week_day_idx ON company_statistic_geo_by_weeks_14_12 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_geo_by_weeks_15_01_company_id_first_week_day_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_weeks_15_01_company_id_first_week_day_pages_idx ON company_statistic_geo_by_weeks_15_01 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_geo_by_weeks_15_01_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_weeks_15_01_first_week_day_idx ON company_statistic_geo_by_weeks_15_01 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_geo_by_weeks_15_09_company_id_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_geo_by_weeks_15_09_company_id_first_week_day_idx ON company_statistic_geo_by_weeks_15_09 USING btree (company_id, first_week_day); + + +-- +-- Name: s_c_stat_mainpage_by_days_11_10_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_mainpage_by_days_11_10_date_idx ON news_statistic_mainpage_by_days_11_10 USING btree (date); + + +-- +-- Name: s_c_stat_mainpage_by_days_11_10_news_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_mainpage_by_days_11_10_news_id_date_idx ON news_statistic_mainpage_by_days_11_10 USING btree (news_id, date); + + +-- +-- Name: s_c_stat_mainpage_by_days_11_11_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_mainpage_by_days_11_11_date_idx ON news_statistic_mainpage_by_days_11_11 USING btree (date); + + +-- +-- Name: s_c_stat_mainpage_by_days_11_11_news_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_mainpage_by_days_11_11_news_id_date_idx ON news_statistic_mainpage_by_days_11_11 USING btree (news_id, date); + + +-- +-- Name: s_c_stat_mainpage_by_days_11_12_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_mainpage_by_days_11_12_date_idx ON news_statistic_mainpage_by_days_11_12 USING btree (date); + + +-- +-- Name: s_c_stat_mainpage_by_days_11_12_news_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_mainpage_by_days_11_12_news_id_date_idx ON news_statistic_mainpage_by_days_11_12 USING btree (news_id, date); + + +-- +-- Name: s_c_stat_mainpage_by_days_12_01_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_mainpage_by_days_12_01_date_idx ON news_statistic_mainpage_by_days_12_01 USING btree (date); + + +-- +-- Name: s_c_stat_mainpage_by_days_12_01_news_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_mainpage_by_days_12_01_news_id_date_idx ON news_statistic_mainpage_by_days_12_01 USING btree (news_id, date); + + +-- +-- Name: s_c_stat_mainpage_by_days_12_02_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_mainpage_by_days_12_02_date_idx ON news_statistic_mainpage_by_days_12_02 USING btree (date); + + +-- +-- Name: s_c_stat_mainpage_by_days_12_02_news_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_mainpage_by_days_12_02_news_id_date_idx ON news_statistic_mainpage_by_days_12_02 USING btree (news_id, date); + + +-- +-- Name: s_c_stat_mainpage_by_days_12_03_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_mainpage_by_days_12_03_date_idx ON news_statistic_mainpage_by_days_12_03 USING btree (date); + + +-- +-- Name: s_c_stat_mainpage_by_days_12_03_news_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_mainpage_by_days_12_03_news_id_date_idx ON news_statistic_mainpage_by_days_12_03 USING btree (news_id, date); + + +-- +-- Name: s_c_stat_mainpage_by_days_12_04_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_mainpage_by_days_12_04_date_idx ON news_statistic_mainpage_by_days_12_04 USING btree (date); + + +-- +-- Name: s_c_stat_mainpage_by_days_12_04_news_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_mainpage_by_days_12_04_news_id_date_idx ON news_statistic_mainpage_by_days_12_04 USING btree (news_id, date); + + +-- +-- Name: s_c_stat_mainpage_by_days_12_05_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_mainpage_by_days_12_05_date_idx ON news_statistic_mainpage_by_days_12_05 USING btree (date); + + +-- +-- Name: s_c_stat_mainpage_by_days_12_05_news_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_mainpage_by_days_12_05_news_id_date_idx ON news_statistic_mainpage_by_days_12_05 USING btree (news_id, date); + + +-- +-- Name: s_c_stat_mainpage_by_days_12_06_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_mainpage_by_days_12_06_date_idx ON news_statistic_mainpage_by_days_12_06 USING btree (date); + + +-- +-- Name: s_c_stat_mainpage_by_days_12_06_news_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_mainpage_by_days_12_06_news_id_date_idx ON news_statistic_mainpage_by_days_12_06 USING btree (news_id, date); + + +-- +-- Name: s_c_stat_mainpage_by_days_12_07_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_mainpage_by_days_12_07_date_idx ON news_statistic_mainpage_by_days_12_07 USING btree (date); + + +-- +-- Name: s_c_stat_mainpage_by_days_12_07_news_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_mainpage_by_days_12_07_news_id_date_idx ON news_statistic_mainpage_by_days_12_07 USING btree (news_id, date); + + +-- +-- Name: s_c_stat_mainpage_by_days_12_08_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_mainpage_by_days_12_08_date_idx ON news_statistic_mainpage_by_days_12_08 USING btree (date); + + +-- +-- Name: s_c_stat_mainpage_by_days_12_08_news_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_mainpage_by_days_12_08_news_id_date_idx ON news_statistic_mainpage_by_days_12_08 USING btree (news_id, date); + + +-- +-- Name: s_c_stat_mainpage_by_days_12_09_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_mainpage_by_days_12_09_date_idx ON news_statistic_mainpage_by_days_12_09 USING btree (date); + + +-- +-- Name: s_c_stat_mainpage_by_days_12_09_news_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_mainpage_by_days_12_09_news_id_date_idx ON news_statistic_mainpage_by_days_12_09 USING btree (news_id, date); + + +-- +-- Name: s_c_stat_mainpage_by_days_12_10_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_mainpage_by_days_12_10_date_idx ON news_statistic_mainpage_by_days_12_10 USING btree (date); + + +-- +-- Name: s_c_stat_mainpage_by_days_12_10_news_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_mainpage_by_days_12_10_news_id_date_idx ON news_statistic_mainpage_by_days_12_10 USING btree (news_id, date); + + +-- +-- Name: s_c_stat_mainpage_by_days_12_11_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_mainpage_by_days_12_11_date_idx ON news_statistic_mainpage_by_days_12_11 USING btree (date); + + +-- +-- Name: s_c_stat_mainpage_by_days_12_11_news_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_mainpage_by_days_12_11_news_id_date_idx ON news_statistic_mainpage_by_days_12_11 USING btree (news_id, date); + + +-- +-- Name: s_c_stat_mainpage_by_days_12_12_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_mainpage_by_days_12_12_date_idx ON news_statistic_mainpage_by_days_12_12 USING btree (date); + + +-- +-- Name: s_c_stat_mainpage_by_days_12_12_news_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_mainpage_by_days_12_12_news_id_date_idx ON news_statistic_mainpage_by_days_12_12 USING btree (news_id, date); + + +-- +-- Name: s_c_stat_mainpage_by_days_13_01_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_mainpage_by_days_13_01_date_idx ON news_statistic_mainpage_by_days_13_01 USING btree (date); + + +-- +-- Name: s_c_stat_mainpage_by_days_13_01_news_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_mainpage_by_days_13_01_news_id_date_idx ON news_statistic_mainpage_by_days_13_01 USING btree (news_id, date); + + +-- +-- Name: s_c_stat_mainpage_by_days_13_02_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_mainpage_by_days_13_02_date_idx ON news_statistic_mainpage_by_days_13_02 USING btree (date); + + +-- +-- Name: s_c_stat_mainpage_by_days_13_02_news_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_mainpage_by_days_13_02_news_id_date_idx ON news_statistic_mainpage_by_days_13_02 USING btree (news_id, date); + + +-- +-- Name: s_c_stat_mainpage_by_days_13_03_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_mainpage_by_days_13_03_date_idx ON news_statistic_mainpage_by_days_13_03 USING btree (date); + + +-- +-- Name: s_c_stat_mainpage_by_days_13_03_news_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_mainpage_by_days_13_03_news_id_date_idx ON news_statistic_mainpage_by_days_13_03 USING btree (news_id, date); + + +-- +-- Name: s_c_stat_mainpage_by_days_13_04_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_mainpage_by_days_13_04_date_idx ON news_statistic_mainpage_by_days_13_04 USING btree (date); + + +-- +-- Name: s_c_stat_mainpage_by_days_13_04_news_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_mainpage_by_days_13_04_news_id_date_idx ON news_statistic_mainpage_by_days_13_04 USING btree (news_id, date); + + +-- +-- Name: s_c_stat_mainpage_by_days_13_05_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_mainpage_by_days_13_05_date_idx ON news_statistic_mainpage_by_days_13_05 USING btree (date); + + +-- +-- Name: s_c_stat_mainpage_by_days_13_05_news_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_mainpage_by_days_13_05_news_id_date_idx ON news_statistic_mainpage_by_days_13_05 USING btree (news_id, date); + + +-- +-- Name: s_c_stat_mainpage_by_days_13_06_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_mainpage_by_days_13_06_date_idx ON news_statistic_mainpage_by_days_13_06 USING btree (date); + + +-- +-- Name: s_c_stat_mainpage_by_days_13_06_news_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_mainpage_by_days_13_06_news_id_date_idx ON news_statistic_mainpage_by_days_13_06 USING btree (news_id, date); + + +-- +-- Name: s_c_stat_mainpage_by_days_13_07_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_mainpage_by_days_13_07_date_idx ON news_statistic_mainpage_by_days_13_07 USING btree (date); + + +-- +-- Name: s_c_stat_mainpage_by_days_13_07_news_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_mainpage_by_days_13_07_news_id_date_idx ON news_statistic_mainpage_by_days_13_07 USING btree (news_id, date); + + +-- +-- Name: s_c_stat_mainpage_by_days_13_08_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_mainpage_by_days_13_08_date_idx ON news_statistic_mainpage_by_days_13_08 USING btree (date); + + +-- +-- Name: s_c_stat_mainpage_by_days_13_08_news_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_mainpage_by_days_13_08_news_id_date_idx ON news_statistic_mainpage_by_days_13_08 USING btree (news_id, date); + + +-- +-- Name: s_c_stat_mainpage_by_days_13_09_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_mainpage_by_days_13_09_date_idx ON news_statistic_mainpage_by_days_13_09 USING btree (date); + + +-- +-- Name: s_c_stat_mainpage_by_days_13_09_news_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_mainpage_by_days_13_09_news_id_date_idx ON news_statistic_mainpage_by_days_13_09 USING btree (news_id, date); + + +-- +-- Name: s_c_stat_mainpage_by_days_13_10_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_mainpage_by_days_13_10_date_idx ON news_statistic_mainpage_by_days_13_10 USING btree (date); + + +-- +-- Name: s_c_stat_mainpage_by_days_13_10_news_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_mainpage_by_days_13_10_news_id_date_idx ON news_statistic_mainpage_by_days_13_10 USING btree (news_id, date); + + +-- +-- Name: s_c_stat_mainpage_by_days_13_11_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_mainpage_by_days_13_11_date_idx ON news_statistic_mainpage_by_days_13_11 USING btree (date); + + +-- +-- Name: s_c_stat_mainpage_by_days_13_11_news_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_mainpage_by_days_13_11_news_id_date_idx ON news_statistic_mainpage_by_days_13_11 USING btree (news_id, date); + + +-- +-- Name: s_c_stat_mainpage_by_days_13_12_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_mainpage_by_days_13_12_date_idx ON news_statistic_mainpage_by_days_13_12 USING btree (date); + + +-- +-- Name: s_c_stat_mainpage_by_days_13_12_news_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_mainpage_by_days_13_12_news_id_date_idx ON news_statistic_mainpage_by_days_13_12 USING btree (news_id, date); + + +-- +-- Name: s_c_stat_mainpage_by_days_14_01_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_mainpage_by_days_14_01_date_idx ON news_statistic_mainpage_by_days_14_01 USING btree (date); + + +-- +-- Name: s_c_stat_mainpage_by_days_14_01_news_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_mainpage_by_days_14_01_news_id_date_idx ON news_statistic_mainpage_by_days_14_01 USING btree (news_id, date); + + +-- +-- Name: s_c_stat_mainpage_by_days_14_02_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_mainpage_by_days_14_02_date_idx ON news_statistic_mainpage_by_days_14_02 USING btree (date); + + +-- +-- Name: s_c_stat_mainpage_by_days_14_02_news_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_mainpage_by_days_14_02_news_id_date_idx ON news_statistic_mainpage_by_days_14_02 USING btree (news_id, date); + + +-- +-- Name: s_c_stat_mainpage_by_days_14_03_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_mainpage_by_days_14_03_date_idx ON news_statistic_mainpage_by_days_14_03 USING btree (date); + + +-- +-- Name: s_c_stat_mainpage_by_days_14_03_news_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_mainpage_by_days_14_03_news_id_date_idx ON news_statistic_mainpage_by_days_14_03 USING btree (news_id, date); + + +-- +-- Name: s_c_stat_mainpage_by_days_14_04_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_mainpage_by_days_14_04_date_idx ON news_statistic_mainpage_by_days_14_04 USING btree (date); + + +-- +-- Name: s_c_stat_mainpage_by_days_14_04_news_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_mainpage_by_days_14_04_news_id_date_idx ON news_statistic_mainpage_by_days_14_04 USING btree (news_id, date); + + +-- +-- Name: s_c_stat_mainpage_by_days_14_05_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_mainpage_by_days_14_05_date_idx ON news_statistic_mainpage_by_days_14_05 USING btree (date); + + +-- +-- Name: s_c_stat_mainpage_by_days_14_05_news_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_mainpage_by_days_14_05_news_id_date_idx ON news_statistic_mainpage_by_days_14_05 USING btree (news_id, date); + + +-- +-- Name: s_c_stat_mainpage_by_days_14_06_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_mainpage_by_days_14_06_date_idx ON news_statistic_mainpage_by_days_14_06 USING btree (date); + + +-- +-- Name: s_c_stat_mainpage_by_days_14_06_news_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_mainpage_by_days_14_06_news_id_date_idx ON news_statistic_mainpage_by_days_14_06 USING btree (news_id, date); + + +-- +-- Name: s_c_stat_mainpage_by_days_14_07_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_mainpage_by_days_14_07_date_idx ON news_statistic_mainpage_by_days_14_07 USING btree (date); + + +-- +-- Name: s_c_stat_mainpage_by_days_14_07_news_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_mainpage_by_days_14_07_news_id_date_idx ON news_statistic_mainpage_by_days_14_07 USING btree (news_id, date); + + +-- +-- Name: s_c_stat_mainpage_by_days_14_08_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_mainpage_by_days_14_08_date_idx ON news_statistic_mainpage_by_days_14_08 USING btree (date); + + +-- +-- Name: s_c_stat_mainpage_by_days_14_08_news_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_mainpage_by_days_14_08_news_id_date_idx ON news_statistic_mainpage_by_days_14_08 USING btree (news_id, date); + + +-- +-- Name: s_c_stat_mainpage_by_days_14_09_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_mainpage_by_days_14_09_date_idx ON news_statistic_mainpage_by_days_14_09 USING btree (date); + + +-- +-- Name: s_c_stat_mainpage_by_days_14_09_news_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_mainpage_by_days_14_09_news_id_date_idx ON news_statistic_mainpage_by_days_14_09 USING btree (news_id, date); + + +-- +-- Name: s_c_stat_mainpage_by_days_14_10_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_mainpage_by_days_14_10_date_idx ON news_statistic_mainpage_by_days_14_10 USING btree (date); + + +-- +-- Name: s_c_stat_mainpage_by_days_14_10_news_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_mainpage_by_days_14_10_news_id_date_idx ON news_statistic_mainpage_by_days_14_10 USING btree (news_id, date); + + +-- +-- Name: s_c_stat_mainpage_by_days_14_11_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_mainpage_by_days_14_11_date_idx ON news_statistic_mainpage_by_days_14_11 USING btree (date); + + +-- +-- Name: s_c_stat_mainpage_by_days_14_11_news_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_mainpage_by_days_14_11_news_id_date_idx ON news_statistic_mainpage_by_days_14_11 USING btree (news_id, date); + + +-- +-- Name: s_c_stat_mainpage_by_days_14_12_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_mainpage_by_days_14_12_date_idx ON news_statistic_mainpage_by_days_14_12 USING btree (date); + + +-- +-- Name: s_c_stat_mainpage_by_days_14_12_news_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_mainpage_by_days_14_12_news_id_date_idx ON news_statistic_mainpage_by_days_14_12 USING btree (news_id, date); + + +-- +-- Name: s_c_stat_mainpage_by_days_15_01_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_mainpage_by_days_15_01_date_idx ON news_statistic_mainpage_by_days_15_01 USING btree (date); + + +-- +-- Name: s_c_stat_mainpage_by_days_15_01_news_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_mainpage_by_days_15_01_news_id_date_idx ON news_statistic_mainpage_by_days_15_01 USING btree (news_id, date); + + +-- +-- Name: s_c_stat_pages_by_months_09_05_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_months_09_05_company_id_date_pages_idx ON company_statistic_pages_by_months_09_05 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_pages_by_months_09_06_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_months_09_06_company_id_date_pages_idx ON company_statistic_pages_by_months_09_06 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_pages_by_months_09_09_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_months_09_09_company_id_date_pages_idx ON company_statistic_pages_by_months_09_09 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_pages_by_months_09_10_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_months_09_10_company_id_date_pages_idx ON company_statistic_pages_by_months_09_10 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_pages_by_months_09_11_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_months_09_11_company_id_date_pages_idx ON company_statistic_pages_by_months_09_11 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_pages_by_months_09_12_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_months_09_12_company_id_date_pages_idx ON company_statistic_pages_by_months_09_12 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_pages_by_months_10_01_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_months_10_01_company_id_date_pages_idx ON company_statistic_pages_by_months_10_01 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_pages_by_months_10_02_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_months_10_02_company_id_date_pages_idx ON company_statistic_pages_by_months_10_02 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_pages_by_months_10_03_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_months_10_03_company_id_date_pages_idx ON company_statistic_pages_by_months_10_03 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_pages_by_months_10_04_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_months_10_04_company_id_date_pages_idx ON company_statistic_pages_by_months_10_04 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_pages_by_months_10_05_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_months_10_05_company_id_date_pages_idx ON company_statistic_pages_by_months_10_05 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_pages_by_months_10_06_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_months_10_06_company_id_date_pages_idx ON company_statistic_pages_by_months_10_06 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_pages_by_months_10_07_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_months_10_07_company_id_date_pages_idx ON company_statistic_pages_by_months_10_07 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_pages_by_months_10_08_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_months_10_08_company_id_date_pages_idx ON company_statistic_pages_by_months_10_08 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_pages_by_months_10_09_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_months_10_09_company_id_date_pages_idx ON company_statistic_pages_by_months_10_09 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_pages_by_months_10_10_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_months_10_10_company_id_date_pages_idx ON company_statistic_pages_by_months_10_10 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_pages_by_months_10_11_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_months_10_11_company_id_date_pages_idx ON company_statistic_pages_by_months_10_11 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_pages_by_months_10_12_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_months_10_12_company_id_date_pages_idx ON company_statistic_pages_by_months_10_12 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_pages_by_months_11_11_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_months_11_11_company_id_date_pages_idx ON company_statistic_pages_by_months_11_11 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_pages_by_months_11_11_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_months_11_11_date_idx ON company_statistic_pages_by_months_11_11 USING btree (date); + + +-- +-- Name: s_c_stat_pages_by_months_11_12_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_months_11_12_company_id_date_pages_idx ON company_statistic_pages_by_months_11_12 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_pages_by_months_11_12_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_months_11_12_date_idx ON company_statistic_pages_by_months_11_12 USING btree (date); + + +-- +-- Name: s_c_stat_pages_by_months_12_01_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_months_12_01_company_id_date_pages_idx ON company_statistic_pages_by_months_12_01 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_pages_by_months_12_01_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_months_12_01_date_idx ON company_statistic_pages_by_months_12_01 USING btree (date); + + +-- +-- Name: s_c_stat_pages_by_months_12_02_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_months_12_02_company_id_date_pages_idx ON company_statistic_pages_by_months_12_02 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_pages_by_months_12_02_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_months_12_02_date_idx ON company_statistic_pages_by_months_12_02 USING btree (date); + + +-- +-- Name: s_c_stat_pages_by_months_12_03_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_months_12_03_company_id_date_pages_idx ON company_statistic_pages_by_months_12_03 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_pages_by_months_12_03_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_months_12_03_date_idx ON company_statistic_pages_by_months_12_03 USING btree (date); + + +-- +-- Name: s_c_stat_pages_by_months_12_04_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_months_12_04_company_id_date_pages_idx ON company_statistic_pages_by_months_12_04 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_pages_by_months_12_04_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_months_12_04_date_idx ON company_statistic_pages_by_months_12_04 USING btree (date); + + +-- +-- Name: s_c_stat_pages_by_months_12_05_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_months_12_05_company_id_date_pages_idx ON company_statistic_pages_by_months_12_05 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_pages_by_months_12_05_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_months_12_05_date_idx ON company_statistic_pages_by_months_12_05 USING btree (date); + + +-- +-- Name: s_c_stat_pages_by_months_12_06_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_months_12_06_company_id_date_pages_idx ON company_statistic_pages_by_months_12_06 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_pages_by_months_12_06_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_months_12_06_date_idx ON company_statistic_pages_by_months_12_06 USING btree (date); + + +-- +-- Name: s_c_stat_pages_by_months_12_07_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_months_12_07_company_id_date_pages_idx ON company_statistic_pages_by_months_12_07 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_pages_by_months_12_07_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_months_12_07_date_idx ON company_statistic_pages_by_months_12_07 USING btree (date); + + +-- +-- Name: s_c_stat_pages_by_months_12_08_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_months_12_08_company_id_date_pages_idx ON company_statistic_pages_by_months_12_08 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_pages_by_months_12_08_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_months_12_08_date_idx ON company_statistic_pages_by_months_12_08 USING btree (date); + + +-- +-- Name: s_c_stat_pages_by_months_12_09_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_months_12_09_company_id_date_pages_idx ON company_statistic_pages_by_months_12_09 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_pages_by_months_12_09_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_months_12_09_date_idx ON company_statistic_pages_by_months_12_09 USING btree (date); + + +-- +-- Name: s_c_stat_pages_by_months_12_10_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_months_12_10_company_id_date_pages_idx ON company_statistic_pages_by_months_12_10 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_pages_by_months_12_10_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_months_12_10_date_idx ON company_statistic_pages_by_months_12_10 USING btree (date); + + +-- +-- Name: s_c_stat_pages_by_months_12_11_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_months_12_11_company_id_date_pages_idx ON company_statistic_pages_by_months_12_11 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_pages_by_months_12_11_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_months_12_11_date_idx ON company_statistic_pages_by_months_12_11 USING btree (date); + + +-- +-- Name: s_c_stat_pages_by_months_12_12_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_months_12_12_company_id_date_pages_idx ON company_statistic_pages_by_months_12_12 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_pages_by_months_12_12_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_months_12_12_date_idx ON company_statistic_pages_by_months_12_12 USING btree (date); + + +-- +-- Name: s_c_stat_pages_by_months_13_01_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_months_13_01_company_id_date_pages_idx ON company_statistic_pages_by_months_13_01 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_pages_by_months_13_01_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_months_13_01_date_idx ON company_statistic_pages_by_months_13_01 USING btree (date); + + +-- +-- Name: s_c_stat_pages_by_months_13_02_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_months_13_02_company_id_date_pages_idx ON company_statistic_pages_by_months_13_02 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_pages_by_months_13_02_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_months_13_02_date_idx ON company_statistic_pages_by_months_13_02 USING btree (date); + + +-- +-- Name: s_c_stat_pages_by_months_13_03_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_months_13_03_company_id_date_pages_idx ON company_statistic_pages_by_months_13_03 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_pages_by_months_13_03_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_months_13_03_date_idx ON company_statistic_pages_by_months_13_03 USING btree (date); + + +-- +-- Name: s_c_stat_pages_by_months_13_04_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_months_13_04_company_id_date_pages_idx ON company_statistic_pages_by_months_13_04 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_pages_by_months_13_04_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_months_13_04_date_idx ON company_statistic_pages_by_months_13_04 USING btree (date); + + +-- +-- Name: s_c_stat_pages_by_months_13_05_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_months_13_05_company_id_date_pages_idx ON company_statistic_pages_by_months_13_05 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_pages_by_months_13_05_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_months_13_05_date_idx ON company_statistic_pages_by_months_13_05 USING btree (date); + + +-- +-- Name: s_c_stat_pages_by_months_13_06_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_months_13_06_company_id_date_pages_idx ON company_statistic_pages_by_months_13_06 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_pages_by_months_13_06_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_months_13_06_date_idx ON company_statistic_pages_by_months_13_06 USING btree (date); + + +-- +-- Name: s_c_stat_pages_by_months_13_07_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_months_13_07_company_id_date_pages_idx ON company_statistic_pages_by_months_13_07 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_pages_by_months_13_07_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_months_13_07_date_idx ON company_statistic_pages_by_months_13_07 USING btree (date); + + +-- +-- Name: s_c_stat_pages_by_months_13_08_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_months_13_08_company_id_date_pages_idx ON company_statistic_pages_by_months_13_08 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_pages_by_months_13_08_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_months_13_08_date_idx ON company_statistic_pages_by_months_13_08 USING btree (date); + + +-- +-- Name: s_c_stat_pages_by_months_13_09_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_months_13_09_company_id_date_pages_idx ON company_statistic_pages_by_months_13_09 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_pages_by_months_13_09_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_months_13_09_date_idx ON company_statistic_pages_by_months_13_09 USING btree (date); + + +-- +-- Name: s_c_stat_pages_by_months_13_10_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_months_13_10_company_id_date_pages_idx ON company_statistic_pages_by_months_13_10 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_pages_by_months_13_10_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_months_13_10_date_idx ON company_statistic_pages_by_months_13_10 USING btree (date); + + +-- +-- Name: s_c_stat_pages_by_months_13_11_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_months_13_11_company_id_date_pages_idx ON company_statistic_pages_by_months_13_11 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_pages_by_months_13_11_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_months_13_11_date_idx ON company_statistic_pages_by_months_13_11 USING btree (date); + + +-- +-- Name: s_c_stat_pages_by_months_13_12_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_months_13_12_company_id_date_pages_idx ON company_statistic_pages_by_months_13_12 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_pages_by_months_13_12_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_months_13_12_date_idx ON company_statistic_pages_by_months_13_12 USING btree (date); + + +-- +-- Name: s_c_stat_pages_by_months_14_01_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_months_14_01_company_id_date_pages_idx ON company_statistic_pages_by_months_14_01 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_pages_by_months_14_01_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_months_14_01_date_idx ON company_statistic_pages_by_months_14_01 USING btree (date); + + +-- +-- Name: s_c_stat_pages_by_months_14_02_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_months_14_02_company_id_date_pages_idx ON company_statistic_pages_by_months_14_02 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_pages_by_months_14_02_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_months_14_02_date_idx ON company_statistic_pages_by_months_14_02 USING btree (date); + + +-- +-- Name: s_c_stat_pages_by_months_14_03_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_months_14_03_company_id_date_pages_idx ON company_statistic_pages_by_months_14_03 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_pages_by_months_14_03_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_months_14_03_date_idx ON company_statistic_pages_by_months_14_03 USING btree (date); + + +-- +-- Name: s_c_stat_pages_by_months_14_04_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_months_14_04_company_id_date_pages_idx ON company_statistic_pages_by_months_14_04 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_pages_by_months_14_04_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_months_14_04_date_idx ON company_statistic_pages_by_months_14_04 USING btree (date); + + +-- +-- Name: s_c_stat_pages_by_months_14_05_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_months_14_05_company_id_date_pages_idx ON company_statistic_pages_by_months_14_05 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_pages_by_months_14_05_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_months_14_05_date_idx ON company_statistic_pages_by_months_14_05 USING btree (date); + + +-- +-- Name: s_c_stat_pages_by_months_14_06_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_months_14_06_company_id_date_pages_idx ON company_statistic_pages_by_months_14_06 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_pages_by_months_14_06_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_months_14_06_date_idx ON company_statistic_pages_by_months_14_06 USING btree (date); + + +-- +-- Name: s_c_stat_pages_by_months_14_07_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_months_14_07_company_id_date_pages_idx ON company_statistic_pages_by_months_14_07 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_pages_by_months_14_07_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_months_14_07_date_idx ON company_statistic_pages_by_months_14_07 USING btree (date); + + +-- +-- Name: s_c_stat_pages_by_months_14_08_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_months_14_08_company_id_date_pages_idx ON company_statistic_pages_by_months_14_08 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_pages_by_months_14_08_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_months_14_08_date_idx ON company_statistic_pages_by_months_14_08 USING btree (date); + + +-- +-- Name: s_c_stat_pages_by_months_14_09_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_months_14_09_company_id_date_pages_idx ON company_statistic_pages_by_months_14_09 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_pages_by_months_14_09_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_months_14_09_date_idx ON company_statistic_pages_by_months_14_09 USING btree (date); + + +-- +-- Name: s_c_stat_pages_by_months_14_10_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_months_14_10_company_id_date_pages_idx ON company_statistic_pages_by_months_14_10 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_pages_by_months_14_10_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_months_14_10_date_idx ON company_statistic_pages_by_months_14_10 USING btree (date); + + +-- +-- Name: s_c_stat_pages_by_months_14_11_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_months_14_11_company_id_date_pages_idx ON company_statistic_pages_by_months_14_11 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_pages_by_months_14_11_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_months_14_11_date_idx ON company_statistic_pages_by_months_14_11 USING btree (date); + + +-- +-- Name: s_c_stat_pages_by_months_14_12_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_months_14_12_company_id_date_pages_idx ON company_statistic_pages_by_months_14_12 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_pages_by_months_14_12_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_months_14_12_date_idx ON company_statistic_pages_by_months_14_12 USING btree (date); + + +-- +-- Name: s_c_stat_pages_by_months_15_01_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_months_15_01_company_id_date_pages_idx ON company_statistic_pages_by_months_15_01 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_pages_by_months_15_01_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_months_15_01_date_idx ON company_statistic_pages_by_months_15_01 USING btree (date); + + +-- +-- Name: s_c_stat_pages_by_months_15_09_company_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_months_15_09_company_id_date_idx ON company_statistic_pages_by_months_15_09 USING btree (company_id, date); + + +-- +-- Name: s_c_stat_pages_by_weeks_09_05_company_id_first_week_day_pages_i; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_weeks_09_05_company_id_first_week_day_pages_i ON company_statistic_pages_by_weeks_09_05 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_pages_by_weeks_09_06_company_id_first_week_day_pages_i; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_weeks_09_06_company_id_first_week_day_pages_i ON company_statistic_pages_by_weeks_09_06 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_pages_by_weeks_09_07_company_id_first_week_day_pages_i; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_weeks_09_07_company_id_first_week_day_pages_i ON company_statistic_pages_by_weeks_09_07 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_pages_by_weeks_09_10_company_id_first_week_day_pages_i; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_weeks_09_10_company_id_first_week_day_pages_i ON company_statistic_pages_by_weeks_09_10 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_pages_by_weeks_09_11_company_id_first_week_day_pages_i; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_weeks_09_11_company_id_first_week_day_pages_i ON company_statistic_pages_by_weeks_09_11 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_pages_by_weeks_09_12_company_id_first_week_day_pages_i; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_weeks_09_12_company_id_first_week_day_pages_i ON company_statistic_pages_by_weeks_09_12 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_pages_by_weeks_10_01_company_id_first_week_day_pages_i; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_weeks_10_01_company_id_first_week_day_pages_i ON company_statistic_pages_by_weeks_10_01 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_pages_by_weeks_10_02_company_id_first_week_day_pages_i; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_weeks_10_02_company_id_first_week_day_pages_i ON company_statistic_pages_by_weeks_10_02 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_pages_by_weeks_10_03_company_id_first_week_day_pages_i; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_weeks_10_03_company_id_first_week_day_pages_i ON company_statistic_pages_by_weeks_10_03 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_pages_by_weeks_10_04_company_id_first_week_day_pages_i; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_weeks_10_04_company_id_first_week_day_pages_i ON company_statistic_pages_by_weeks_10_04 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_pages_by_weeks_10_05_company_id_first_week_day_pages_i; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_weeks_10_05_company_id_first_week_day_pages_i ON company_statistic_pages_by_weeks_10_05 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_pages_by_weeks_10_06_company_id_first_week_day_pages_i; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_weeks_10_06_company_id_first_week_day_pages_i ON company_statistic_pages_by_weeks_10_06 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_pages_by_weeks_10_07_company_id_first_week_day_pages_i; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_weeks_10_07_company_id_first_week_day_pages_i ON company_statistic_pages_by_weeks_10_07 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_pages_by_weeks_10_08_company_id_first_week_day_pages_i; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_weeks_10_08_company_id_first_week_day_pages_i ON company_statistic_pages_by_weeks_10_08 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_pages_by_weeks_10_09_company_id_first_week_day_pages_i; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_weeks_10_09_company_id_first_week_day_pages_i ON company_statistic_pages_by_weeks_10_09 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_pages_by_weeks_10_10_company_id_first_week_day_pages_i; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_weeks_10_10_company_id_first_week_day_pages_i ON company_statistic_pages_by_weeks_10_10 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_pages_by_weeks_10_11_company_id_first_week_day_pages_i; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_weeks_10_11_company_id_first_week_day_pages_i ON company_statistic_pages_by_weeks_10_11 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_pages_by_weeks_10_12_company_id_first_week_day_pages_i; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_weeks_10_12_company_id_first_week_day_pages_i ON company_statistic_pages_by_weeks_10_12 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_pages_by_weeks_11_11_company_id_first_week_day_pages_i; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_weeks_11_11_company_id_first_week_day_pages_i ON company_statistic_pages_by_weeks_11_11 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_pages_by_weeks_11_11_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_weeks_11_11_first_week_day_idx ON company_statistic_pages_by_weeks_11_11 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_pages_by_weeks_11_12_company_id_first_week_day_pages_i; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_weeks_11_12_company_id_first_week_day_pages_i ON company_statistic_pages_by_weeks_11_12 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_pages_by_weeks_11_12_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_weeks_11_12_first_week_day_idx ON company_statistic_pages_by_weeks_11_12 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_pages_by_weeks_12_01_company_id_first_week_day_pages_i; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_weeks_12_01_company_id_first_week_day_pages_i ON company_statistic_pages_by_weeks_12_01 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_pages_by_weeks_12_01_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_weeks_12_01_first_week_day_idx ON company_statistic_pages_by_weeks_12_01 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_pages_by_weeks_12_02_company_id_first_week_day_pages_i; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_weeks_12_02_company_id_first_week_day_pages_i ON company_statistic_pages_by_weeks_12_02 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_pages_by_weeks_12_02_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_weeks_12_02_first_week_day_idx ON company_statistic_pages_by_weeks_12_02 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_pages_by_weeks_12_03_company_id_first_week_day_pages_i; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_weeks_12_03_company_id_first_week_day_pages_i ON company_statistic_pages_by_weeks_12_03 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_pages_by_weeks_12_03_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_weeks_12_03_first_week_day_idx ON company_statistic_pages_by_weeks_12_03 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_pages_by_weeks_12_04_company_id_first_week_day_pages_i; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_weeks_12_04_company_id_first_week_day_pages_i ON company_statistic_pages_by_weeks_12_04 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_pages_by_weeks_12_04_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_weeks_12_04_first_week_day_idx ON company_statistic_pages_by_weeks_12_04 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_pages_by_weeks_12_05_company_id_first_week_day_pages_i; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_weeks_12_05_company_id_first_week_day_pages_i ON company_statistic_pages_by_weeks_12_05 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_pages_by_weeks_12_05_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_weeks_12_05_first_week_day_idx ON company_statistic_pages_by_weeks_12_05 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_pages_by_weeks_12_06_company_id_first_week_day_pages_i; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_weeks_12_06_company_id_first_week_day_pages_i ON company_statistic_pages_by_weeks_12_06 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_pages_by_weeks_12_06_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_weeks_12_06_first_week_day_idx ON company_statistic_pages_by_weeks_12_06 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_pages_by_weeks_12_07_company_id_first_week_day_pages_i; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_weeks_12_07_company_id_first_week_day_pages_i ON company_statistic_pages_by_weeks_12_07 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_pages_by_weeks_12_07_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_weeks_12_07_first_week_day_idx ON company_statistic_pages_by_weeks_12_07 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_pages_by_weeks_12_08_company_id_first_week_day_pages_i; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_weeks_12_08_company_id_first_week_day_pages_i ON company_statistic_pages_by_weeks_12_08 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_pages_by_weeks_12_08_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_weeks_12_08_first_week_day_idx ON company_statistic_pages_by_weeks_12_08 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_pages_by_weeks_12_09_company_id_first_week_day_pages_i; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_weeks_12_09_company_id_first_week_day_pages_i ON company_statistic_pages_by_weeks_12_09 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_pages_by_weeks_12_09_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_weeks_12_09_first_week_day_idx ON company_statistic_pages_by_weeks_12_09 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_pages_by_weeks_12_10_company_id_first_week_day_pages_i; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_weeks_12_10_company_id_first_week_day_pages_i ON company_statistic_pages_by_weeks_12_10 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_pages_by_weeks_12_10_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_weeks_12_10_first_week_day_idx ON company_statistic_pages_by_weeks_12_10 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_pages_by_weeks_12_11_company_id_first_week_day_pages_i; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_weeks_12_11_company_id_first_week_day_pages_i ON company_statistic_pages_by_weeks_12_11 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_pages_by_weeks_12_11_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_weeks_12_11_first_week_day_idx ON company_statistic_pages_by_weeks_12_11 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_pages_by_weeks_12_12_company_id_first_week_day_pages_i; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_weeks_12_12_company_id_first_week_day_pages_i ON company_statistic_pages_by_weeks_12_12 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_pages_by_weeks_12_12_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_weeks_12_12_first_week_day_idx ON company_statistic_pages_by_weeks_12_12 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_pages_by_weeks_13_01_company_id_first_week_day_pages_i; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_weeks_13_01_company_id_first_week_day_pages_i ON company_statistic_pages_by_weeks_13_01 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_pages_by_weeks_13_01_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_weeks_13_01_first_week_day_idx ON company_statistic_pages_by_weeks_13_01 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_pages_by_weeks_13_02_company_id_first_week_day_pages_i; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_weeks_13_02_company_id_first_week_day_pages_i ON company_statistic_pages_by_weeks_13_02 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_pages_by_weeks_13_02_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_weeks_13_02_first_week_day_idx ON company_statistic_pages_by_weeks_13_02 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_pages_by_weeks_13_03_company_id_first_week_day_pages_i; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_weeks_13_03_company_id_first_week_day_pages_i ON company_statistic_pages_by_weeks_13_03 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_pages_by_weeks_13_03_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_weeks_13_03_first_week_day_idx ON company_statistic_pages_by_weeks_13_03 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_pages_by_weeks_13_04_company_id_first_week_day_pages_i; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_weeks_13_04_company_id_first_week_day_pages_i ON company_statistic_pages_by_weeks_13_04 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_pages_by_weeks_13_04_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_weeks_13_04_first_week_day_idx ON company_statistic_pages_by_weeks_13_04 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_pages_by_weeks_13_05_company_id_first_week_day_pages_i; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_weeks_13_05_company_id_first_week_day_pages_i ON company_statistic_pages_by_weeks_13_05 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_pages_by_weeks_13_05_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_weeks_13_05_first_week_day_idx ON company_statistic_pages_by_weeks_13_05 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_pages_by_weeks_13_06_company_id_first_week_day_pages_i; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_weeks_13_06_company_id_first_week_day_pages_i ON company_statistic_pages_by_weeks_13_06 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_pages_by_weeks_13_06_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_weeks_13_06_first_week_day_idx ON company_statistic_pages_by_weeks_13_06 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_pages_by_weeks_13_07_company_id_first_week_day_pages_i; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_weeks_13_07_company_id_first_week_day_pages_i ON company_statistic_pages_by_weeks_13_07 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_pages_by_weeks_13_07_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_weeks_13_07_first_week_day_idx ON company_statistic_pages_by_weeks_13_07 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_pages_by_weeks_13_08_company_id_first_week_day_pages_i; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_weeks_13_08_company_id_first_week_day_pages_i ON company_statistic_pages_by_weeks_13_08 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_pages_by_weeks_13_08_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_weeks_13_08_first_week_day_idx ON company_statistic_pages_by_weeks_13_08 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_pages_by_weeks_13_09_company_id_first_week_day_pages_i; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_weeks_13_09_company_id_first_week_day_pages_i ON company_statistic_pages_by_weeks_13_09 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_pages_by_weeks_13_09_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_weeks_13_09_first_week_day_idx ON company_statistic_pages_by_weeks_13_09 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_pages_by_weeks_13_10_company_id_first_week_day_pages_i; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_weeks_13_10_company_id_first_week_day_pages_i ON company_statistic_pages_by_weeks_13_10 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_pages_by_weeks_13_10_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_weeks_13_10_first_week_day_idx ON company_statistic_pages_by_weeks_13_10 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_pages_by_weeks_13_11_company_id_first_week_day_pages_i; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_weeks_13_11_company_id_first_week_day_pages_i ON company_statistic_pages_by_weeks_13_11 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_pages_by_weeks_13_11_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_weeks_13_11_first_week_day_idx ON company_statistic_pages_by_weeks_13_11 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_pages_by_weeks_13_12_company_id_first_week_day_pages_i; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_weeks_13_12_company_id_first_week_day_pages_i ON company_statistic_pages_by_weeks_13_12 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_pages_by_weeks_13_12_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_weeks_13_12_first_week_day_idx ON company_statistic_pages_by_weeks_13_12 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_pages_by_weeks_14_01_company_id_first_week_day_pages_i; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_weeks_14_01_company_id_first_week_day_pages_i ON company_statistic_pages_by_weeks_14_01 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_pages_by_weeks_14_01_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_weeks_14_01_first_week_day_idx ON company_statistic_pages_by_weeks_14_01 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_pages_by_weeks_14_02_company_id_first_week_day_pages_i; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_weeks_14_02_company_id_first_week_day_pages_i ON company_statistic_pages_by_weeks_14_02 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_pages_by_weeks_14_02_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_weeks_14_02_first_week_day_idx ON company_statistic_pages_by_weeks_14_02 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_pages_by_weeks_14_03_company_id_first_week_day_pages_i; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_weeks_14_03_company_id_first_week_day_pages_i ON company_statistic_pages_by_weeks_14_03 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_pages_by_weeks_14_03_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_weeks_14_03_first_week_day_idx ON company_statistic_pages_by_weeks_14_03 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_pages_by_weeks_14_04_company_id_first_week_day_pages_i; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_weeks_14_04_company_id_first_week_day_pages_i ON company_statistic_pages_by_weeks_14_04 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_pages_by_weeks_14_04_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_weeks_14_04_first_week_day_idx ON company_statistic_pages_by_weeks_14_04 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_pages_by_weeks_14_05_company_id_first_week_day_pages_i; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_weeks_14_05_company_id_first_week_day_pages_i ON company_statistic_pages_by_weeks_14_05 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_pages_by_weeks_14_05_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_weeks_14_05_first_week_day_idx ON company_statistic_pages_by_weeks_14_05 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_pages_by_weeks_14_06_company_id_first_week_day_pages_i; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_weeks_14_06_company_id_first_week_day_pages_i ON company_statistic_pages_by_weeks_14_06 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_pages_by_weeks_14_06_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_weeks_14_06_first_week_day_idx ON company_statistic_pages_by_weeks_14_06 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_pages_by_weeks_14_07_company_id_first_week_day_pages_i; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_weeks_14_07_company_id_first_week_day_pages_i ON company_statistic_pages_by_weeks_14_07 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_pages_by_weeks_14_07_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_weeks_14_07_first_week_day_idx ON company_statistic_pages_by_weeks_14_07 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_pages_by_weeks_14_08_company_id_first_week_day_pages_i; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_weeks_14_08_company_id_first_week_day_pages_i ON company_statistic_pages_by_weeks_14_08 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_pages_by_weeks_14_08_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_weeks_14_08_first_week_day_idx ON company_statistic_pages_by_weeks_14_08 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_pages_by_weeks_14_09_company_id_first_week_day_pages_i; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_weeks_14_09_company_id_first_week_day_pages_i ON company_statistic_pages_by_weeks_14_09 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_pages_by_weeks_14_09_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_weeks_14_09_first_week_day_idx ON company_statistic_pages_by_weeks_14_09 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_pages_by_weeks_14_10_company_id_first_week_day_pages_i; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_weeks_14_10_company_id_first_week_day_pages_i ON company_statistic_pages_by_weeks_14_10 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_pages_by_weeks_14_10_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_weeks_14_10_first_week_day_idx ON company_statistic_pages_by_weeks_14_10 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_pages_by_weeks_14_11_company_id_first_week_day_pages_i; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_weeks_14_11_company_id_first_week_day_pages_i ON company_statistic_pages_by_weeks_14_11 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_pages_by_weeks_14_11_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_weeks_14_11_first_week_day_idx ON company_statistic_pages_by_weeks_14_11 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_pages_by_weeks_14_12_company_id_first_week_day_pages_i; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_weeks_14_12_company_id_first_week_day_pages_i ON company_statistic_pages_by_weeks_14_12 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_pages_by_weeks_14_12_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_weeks_14_12_first_week_day_idx ON company_statistic_pages_by_weeks_14_12 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_pages_by_weeks_15_01_company_id_first_week_day_pages_i; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_weeks_15_01_company_id_first_week_day_pages_i ON company_statistic_pages_by_weeks_15_01 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_pages_by_weeks_15_01_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_weeks_15_01_first_week_day_idx ON company_statistic_pages_by_weeks_15_01 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_pages_by_weeks_15_09_company_id_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_pages_by_weeks_15_09_company_id_first_week_day_idx ON company_statistic_pages_by_weeks_15_09 USING btree (company_id, first_week_day); + + +-- +-- Name: s_c_stat_refs_by_months_09_07_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_months_09_07_company_id_date_pages_idx ON company_statistic_referers_by_months_09_07 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_refs_by_months_09_08_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_months_09_08_company_id_date_pages_idx ON company_statistic_referers_by_months_09_08 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_refs_by_months_09_09_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_months_09_09_company_id_date_pages_idx ON company_statistic_referers_by_months_09_09 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_refs_by_months_09_10_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_months_09_10_company_id_date_pages_idx ON company_statistic_referers_by_months_09_10 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_refs_by_months_09_11_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_months_09_11_company_id_date_pages_idx ON company_statistic_referers_by_months_09_11 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_refs_by_months_09_12_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_months_09_12_company_id_date_pages_idx ON company_statistic_referers_by_months_09_12 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_refs_by_months_10_01_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_months_10_01_company_id_date_pages_idx ON company_statistic_referers_by_months_10_01 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_refs_by_months_10_02_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_months_10_02_company_id_date_pages_idx ON company_statistic_referers_by_months_10_02 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_refs_by_months_10_03_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_months_10_03_company_id_date_pages_idx ON company_statistic_referers_by_months_10_03 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_refs_by_months_10_04_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_months_10_04_company_id_date_pages_idx ON company_statistic_referers_by_months_10_04 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_refs_by_months_10_05_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_months_10_05_company_id_date_pages_idx ON company_statistic_referers_by_months_10_05 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_refs_by_months_10_06_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_months_10_06_company_id_date_pages_idx ON company_statistic_referers_by_months_10_06 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_refs_by_months_10_07_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_months_10_07_company_id_date_pages_idx ON company_statistic_referers_by_months_10_07 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_refs_by_months_10_08_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_months_10_08_company_id_date_pages_idx ON company_statistic_referers_by_months_10_08 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_refs_by_months_10_09_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_months_10_09_company_id_date_pages_idx ON company_statistic_referers_by_months_10_09 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_refs_by_months_10_10_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_months_10_10_company_id_date_pages_idx ON company_statistic_referers_by_months_10_10 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_refs_by_months_10_11_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_months_10_11_company_id_date_pages_idx ON company_statistic_referers_by_months_10_11 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_refs_by_months_10_12_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_months_10_12_company_id_date_pages_idx ON company_statistic_referers_by_months_10_12 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_refs_by_months_11_11_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_months_11_11_company_id_date_pages_idx ON company_statistic_referers_by_months_11_11 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_refs_by_months_11_11_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_months_11_11_date_idx ON company_statistic_referers_by_months_11_11 USING btree (date); + + +-- +-- Name: s_c_stat_refs_by_months_11_12_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_months_11_12_company_id_date_pages_idx ON company_statistic_referers_by_months_11_12 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_refs_by_months_11_12_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_months_11_12_date_idx ON company_statistic_referers_by_months_11_12 USING btree (date); + + +-- +-- Name: s_c_stat_refs_by_months_12_01_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_months_12_01_company_id_date_pages_idx ON company_statistic_referers_by_months_12_01 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_refs_by_months_12_01_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_months_12_01_date_idx ON company_statistic_referers_by_months_12_01 USING btree (date); + + +-- +-- Name: s_c_stat_refs_by_months_12_02_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_months_12_02_company_id_date_pages_idx ON company_statistic_referers_by_months_12_02 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_refs_by_months_12_02_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_months_12_02_date_idx ON company_statistic_referers_by_months_12_02 USING btree (date); + + +-- +-- Name: s_c_stat_refs_by_months_12_03_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_months_12_03_company_id_date_pages_idx ON company_statistic_referers_by_months_12_03 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_refs_by_months_12_03_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_months_12_03_date_idx ON company_statistic_referers_by_months_12_03 USING btree (date); + + +-- +-- Name: s_c_stat_refs_by_months_12_04_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_months_12_04_company_id_date_pages_idx ON company_statistic_referers_by_months_12_04 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_refs_by_months_12_04_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_months_12_04_date_idx ON company_statistic_referers_by_months_12_04 USING btree (date); + + +-- +-- Name: s_c_stat_refs_by_months_12_05_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_months_12_05_company_id_date_pages_idx ON company_statistic_referers_by_months_12_05 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_refs_by_months_12_05_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_months_12_05_date_idx ON company_statistic_referers_by_months_12_05 USING btree (date); + + +-- +-- Name: s_c_stat_refs_by_months_12_06_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_months_12_06_company_id_date_pages_idx ON company_statistic_referers_by_months_12_06 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_refs_by_months_12_06_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_months_12_06_date_idx ON company_statistic_referers_by_months_12_06 USING btree (date); + + +-- +-- Name: s_c_stat_refs_by_months_12_07_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_months_12_07_company_id_date_pages_idx ON company_statistic_referers_by_months_12_07 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_refs_by_months_12_07_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_months_12_07_date_idx ON company_statistic_referers_by_months_12_07 USING btree (date); + + +-- +-- Name: s_c_stat_refs_by_months_12_08_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_months_12_08_company_id_date_pages_idx ON company_statistic_referers_by_months_12_08 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_refs_by_months_12_08_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_months_12_08_date_idx ON company_statistic_referers_by_months_12_08 USING btree (date); + + +-- +-- Name: s_c_stat_refs_by_months_12_09_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_months_12_09_company_id_date_pages_idx ON company_statistic_referers_by_months_12_09 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_refs_by_months_12_09_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_months_12_09_date_idx ON company_statistic_referers_by_months_12_09 USING btree (date); + + +-- +-- Name: s_c_stat_refs_by_months_12_10_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_months_12_10_company_id_date_pages_idx ON company_statistic_referers_by_months_12_10 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_refs_by_months_12_10_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_months_12_10_date_idx ON company_statistic_referers_by_months_12_10 USING btree (date); + + +-- +-- Name: s_c_stat_refs_by_months_12_11_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_months_12_11_company_id_date_pages_idx ON company_statistic_referers_by_months_12_11 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_refs_by_months_12_11_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_months_12_11_date_idx ON company_statistic_referers_by_months_12_11 USING btree (date); + + +-- +-- Name: s_c_stat_refs_by_months_12_12_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_months_12_12_company_id_date_pages_idx ON company_statistic_referers_by_months_12_12 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_refs_by_months_12_12_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_months_12_12_date_idx ON company_statistic_referers_by_months_12_12 USING btree (date); + + +-- +-- Name: s_c_stat_refs_by_months_13_01_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_months_13_01_company_id_date_pages_idx ON company_statistic_referers_by_months_13_01 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_refs_by_months_13_01_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_months_13_01_date_idx ON company_statistic_referers_by_months_13_01 USING btree (date); + + +-- +-- Name: s_c_stat_refs_by_months_13_02_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_months_13_02_company_id_date_pages_idx ON company_statistic_referers_by_months_13_02 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_refs_by_months_13_02_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_months_13_02_date_idx ON company_statistic_referers_by_months_13_02 USING btree (date); + + +-- +-- Name: s_c_stat_refs_by_months_13_03_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_months_13_03_company_id_date_pages_idx ON company_statistic_referers_by_months_13_03 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_refs_by_months_13_03_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_months_13_03_date_idx ON company_statistic_referers_by_months_13_03 USING btree (date); + + +-- +-- Name: s_c_stat_refs_by_months_13_04_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_months_13_04_company_id_date_pages_idx ON company_statistic_referers_by_months_13_04 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_refs_by_months_13_04_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_months_13_04_date_idx ON company_statistic_referers_by_months_13_04 USING btree (date); + + +-- +-- Name: s_c_stat_refs_by_months_13_05_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_months_13_05_company_id_date_pages_idx ON company_statistic_referers_by_months_13_05 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_refs_by_months_13_05_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_months_13_05_date_idx ON company_statistic_referers_by_months_13_05 USING btree (date); + + +-- +-- Name: s_c_stat_refs_by_months_13_06_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_months_13_06_company_id_date_pages_idx ON company_statistic_referers_by_months_13_06 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_refs_by_months_13_06_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_months_13_06_date_idx ON company_statistic_referers_by_months_13_06 USING btree (date); + + +-- +-- Name: s_c_stat_refs_by_months_13_07_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_months_13_07_company_id_date_pages_idx ON company_statistic_referers_by_months_13_07 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_refs_by_months_13_07_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_months_13_07_date_idx ON company_statistic_referers_by_months_13_07 USING btree (date); + + +-- +-- Name: s_c_stat_refs_by_months_13_08_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_months_13_08_company_id_date_pages_idx ON company_statistic_referers_by_months_13_08 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_refs_by_months_13_08_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_months_13_08_date_idx ON company_statistic_referers_by_months_13_08 USING btree (date); + + +-- +-- Name: s_c_stat_refs_by_months_13_09_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_months_13_09_company_id_date_pages_idx ON company_statistic_referers_by_months_13_09 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_refs_by_months_13_09_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_months_13_09_date_idx ON company_statistic_referers_by_months_13_09 USING btree (date); + + +-- +-- Name: s_c_stat_refs_by_months_13_10_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_months_13_10_company_id_date_pages_idx ON company_statistic_referers_by_months_13_10 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_refs_by_months_13_10_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_months_13_10_date_idx ON company_statistic_referers_by_months_13_10 USING btree (date); + + +-- +-- Name: s_c_stat_refs_by_months_13_11_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_months_13_11_company_id_date_pages_idx ON company_statistic_referers_by_months_13_11 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_refs_by_months_13_11_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_months_13_11_date_idx ON company_statistic_referers_by_months_13_11 USING btree (date); + + +-- +-- Name: s_c_stat_refs_by_months_13_12_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_months_13_12_company_id_date_pages_idx ON company_statistic_referers_by_months_13_12 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_refs_by_months_13_12_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_months_13_12_date_idx ON company_statistic_referers_by_months_13_12 USING btree (date); + + +-- +-- Name: s_c_stat_refs_by_months_14_01_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_months_14_01_company_id_date_pages_idx ON company_statistic_referers_by_months_14_01 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_refs_by_months_14_01_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_months_14_01_date_idx ON company_statistic_referers_by_months_14_01 USING btree (date); + + +-- +-- Name: s_c_stat_refs_by_months_14_02_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_months_14_02_company_id_date_pages_idx ON company_statistic_referers_by_months_14_02 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_refs_by_months_14_02_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_months_14_02_date_idx ON company_statistic_referers_by_months_14_02 USING btree (date); + + +-- +-- Name: s_c_stat_refs_by_months_14_03_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_months_14_03_company_id_date_pages_idx ON company_statistic_referers_by_months_14_03 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_refs_by_months_14_03_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_months_14_03_date_idx ON company_statistic_referers_by_months_14_03 USING btree (date); + + +-- +-- Name: s_c_stat_refs_by_months_14_04_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_months_14_04_company_id_date_pages_idx ON company_statistic_referers_by_months_14_04 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_refs_by_months_14_04_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_months_14_04_date_idx ON company_statistic_referers_by_months_14_04 USING btree (date); + + +-- +-- Name: s_c_stat_refs_by_months_14_05_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_months_14_05_company_id_date_pages_idx ON company_statistic_referers_by_months_14_05 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_refs_by_months_14_05_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_months_14_05_date_idx ON company_statistic_referers_by_months_14_05 USING btree (date); + + +-- +-- Name: s_c_stat_refs_by_months_14_06_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_months_14_06_company_id_date_pages_idx ON company_statistic_referers_by_months_14_06 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_refs_by_months_14_06_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_months_14_06_date_idx ON company_statistic_referers_by_months_14_06 USING btree (date); + + +-- +-- Name: s_c_stat_refs_by_months_14_07_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_months_14_07_company_id_date_pages_idx ON company_statistic_referers_by_months_14_07 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_refs_by_months_14_07_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_months_14_07_date_idx ON company_statistic_referers_by_months_14_07 USING btree (date); + + +-- +-- Name: s_c_stat_refs_by_months_14_08_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_months_14_08_company_id_date_pages_idx ON company_statistic_referers_by_months_14_08 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_refs_by_months_14_08_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_months_14_08_date_idx ON company_statistic_referers_by_months_14_08 USING btree (date); + + +-- +-- Name: s_c_stat_refs_by_months_14_09_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_months_14_09_company_id_date_pages_idx ON company_statistic_referers_by_months_14_09 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_refs_by_months_14_09_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_months_14_09_date_idx ON company_statistic_referers_by_months_14_09 USING btree (date); + + +-- +-- Name: s_c_stat_refs_by_months_14_10_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_months_14_10_company_id_date_pages_idx ON company_statistic_referers_by_months_14_10 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_refs_by_months_14_10_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_months_14_10_date_idx ON company_statistic_referers_by_months_14_10 USING btree (date); + + +-- +-- Name: s_c_stat_refs_by_months_14_11_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_months_14_11_company_id_date_pages_idx ON company_statistic_referers_by_months_14_11 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_refs_by_months_14_11_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_months_14_11_date_idx ON company_statistic_referers_by_months_14_11 USING btree (date); + + +-- +-- Name: s_c_stat_refs_by_months_14_12_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_months_14_12_company_id_date_pages_idx ON company_statistic_referers_by_months_14_12 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_refs_by_months_14_12_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_months_14_12_date_idx ON company_statistic_referers_by_months_14_12 USING btree (date); + + +-- +-- Name: s_c_stat_refs_by_months_15_01_company_id_date_pages_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_months_15_01_company_id_date_pages_idx ON company_statistic_referers_by_months_15_01 USING btree (company_id, date, pages); + + +-- +-- Name: s_c_stat_refs_by_months_15_01_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_months_15_01_date_idx ON company_statistic_referers_by_months_15_01 USING btree (date); + + +-- +-- Name: s_c_stat_refs_by_months_15_08_company_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_months_15_08_company_id_date_idx ON company_statistic_referers_by_months_15_08 USING btree (company_id, date); + + +-- +-- Name: s_c_stat_refs_by_months_15_09_company_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_months_15_09_company_id_date_idx ON company_statistic_referers_by_months_15_09 USING btree (company_id, date); + + +-- +-- Name: s_c_stat_refs_by_weeks_09_06_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_weeks_09_06_first_week_day_idx ON company_statistic_referers_by_weeks_09_06 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_refs_by_weeks_09_07_company_id_first_week_day_pages_id; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_weeks_09_07_company_id_first_week_day_pages_id ON company_statistic_referers_by_weeks_09_07 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_refs_by_weeks_09_08_company_id_first_week_day_pages_id; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_weeks_09_08_company_id_first_week_day_pages_id ON company_statistic_referers_by_weeks_09_08 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_refs_by_weeks_09_09_company_id_first_week_day_pages_id; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_weeks_09_09_company_id_first_week_day_pages_id ON company_statistic_referers_by_weeks_09_09 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_refs_by_weeks_09_10_company_id_first_week_day_pages_id; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_weeks_09_10_company_id_first_week_day_pages_id ON company_statistic_referers_by_weeks_09_10 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_refs_by_weeks_09_11_company_id_first_week_day_pages_id; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_weeks_09_11_company_id_first_week_day_pages_id ON company_statistic_referers_by_weeks_09_11 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_refs_by_weeks_09_12_company_id_first_week_day_pages_id; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_weeks_09_12_company_id_first_week_day_pages_id ON company_statistic_referers_by_weeks_09_12 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_refs_by_weeks_10_01_company_id_first_week_day_pages_id; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_weeks_10_01_company_id_first_week_day_pages_id ON company_statistic_referers_by_weeks_10_01 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_refs_by_weeks_10_02_company_id_first_week_day_pages_id; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_weeks_10_02_company_id_first_week_day_pages_id ON company_statistic_referers_by_weeks_10_02 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_refs_by_weeks_10_03_company_id_first_week_day_pages_id; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_weeks_10_03_company_id_first_week_day_pages_id ON company_statistic_referers_by_weeks_10_03 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_refs_by_weeks_10_04_company_id_first_week_day_pages_id; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_weeks_10_04_company_id_first_week_day_pages_id ON company_statistic_referers_by_weeks_10_04 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_refs_by_weeks_10_05_company_id_first_week_day_pages_id; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_weeks_10_05_company_id_first_week_day_pages_id ON company_statistic_referers_by_weeks_10_05 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_refs_by_weeks_10_06_company_id_first_week_day_pages_id; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_weeks_10_06_company_id_first_week_day_pages_id ON company_statistic_referers_by_weeks_10_06 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_refs_by_weeks_10_07_company_id_first_week_day_pages_id; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_weeks_10_07_company_id_first_week_day_pages_id ON company_statistic_referers_by_weeks_10_07 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_refs_by_weeks_10_08_company_id_first_week_day_pages_id; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_weeks_10_08_company_id_first_week_day_pages_id ON company_statistic_referers_by_weeks_10_08 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_refs_by_weeks_10_09_company_id_first_week_day_pages_id; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_weeks_10_09_company_id_first_week_day_pages_id ON company_statistic_referers_by_weeks_10_09 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_refs_by_weeks_10_10_company_id_first_week_day_pages_id; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_weeks_10_10_company_id_first_week_day_pages_id ON company_statistic_referers_by_weeks_10_10 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_refs_by_weeks_10_11_company_id_first_week_day_pages_id; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_weeks_10_11_company_id_first_week_day_pages_id ON company_statistic_referers_by_weeks_10_11 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_refs_by_weeks_10_12_company_id_first_week_day_pages_id; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_weeks_10_12_company_id_first_week_day_pages_id ON company_statistic_referers_by_weeks_10_12 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_refs_by_weeks_11_11_company_id_first_week_day_pages_id; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_weeks_11_11_company_id_first_week_day_pages_id ON company_statistic_referers_by_weeks_11_11 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_refs_by_weeks_11_11_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_weeks_11_11_first_week_day_idx ON company_statistic_referers_by_weeks_11_11 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_refs_by_weeks_11_12_company_id_first_week_day_pages_id; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_weeks_11_12_company_id_first_week_day_pages_id ON company_statistic_referers_by_weeks_11_12 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_refs_by_weeks_11_12_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_weeks_11_12_first_week_day_idx ON company_statistic_referers_by_weeks_11_12 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_refs_by_weeks_12_01_company_id_first_week_day_pages_id; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_weeks_12_01_company_id_first_week_day_pages_id ON company_statistic_referers_by_weeks_12_01 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_refs_by_weeks_12_01_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_weeks_12_01_first_week_day_idx ON company_statistic_referers_by_weeks_12_01 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_refs_by_weeks_12_02_company_id_first_week_day_pages_id; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_weeks_12_02_company_id_first_week_day_pages_id ON company_statistic_referers_by_weeks_12_02 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_refs_by_weeks_12_02_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_weeks_12_02_first_week_day_idx ON company_statistic_referers_by_weeks_12_02 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_refs_by_weeks_12_03_company_id_first_week_day_pages_id; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_weeks_12_03_company_id_first_week_day_pages_id ON company_statistic_referers_by_weeks_12_03 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_refs_by_weeks_12_03_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_weeks_12_03_first_week_day_idx ON company_statistic_referers_by_weeks_12_03 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_refs_by_weeks_12_04_company_id_first_week_day_pages_id; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_weeks_12_04_company_id_first_week_day_pages_id ON company_statistic_referers_by_weeks_12_04 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_refs_by_weeks_12_04_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_weeks_12_04_first_week_day_idx ON company_statistic_referers_by_weeks_12_04 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_refs_by_weeks_12_05_company_id_first_week_day_pages_id; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_weeks_12_05_company_id_first_week_day_pages_id ON company_statistic_referers_by_weeks_12_05 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_refs_by_weeks_12_05_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_weeks_12_05_first_week_day_idx ON company_statistic_referers_by_weeks_12_05 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_refs_by_weeks_12_06_company_id_first_week_day_pages_id; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_weeks_12_06_company_id_first_week_day_pages_id ON company_statistic_referers_by_weeks_12_06 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_refs_by_weeks_12_06_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_weeks_12_06_first_week_day_idx ON company_statistic_referers_by_weeks_12_06 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_refs_by_weeks_12_07_company_id_first_week_day_pages_id; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_weeks_12_07_company_id_first_week_day_pages_id ON company_statistic_referers_by_weeks_12_07 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_refs_by_weeks_12_07_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_weeks_12_07_first_week_day_idx ON company_statistic_referers_by_weeks_12_07 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_refs_by_weeks_12_08_company_id_first_week_day_pages_id; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_weeks_12_08_company_id_first_week_day_pages_id ON company_statistic_referers_by_weeks_12_08 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_refs_by_weeks_12_08_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_weeks_12_08_first_week_day_idx ON company_statistic_referers_by_weeks_12_08 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_refs_by_weeks_12_09_company_id_first_week_day_pages_id; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_weeks_12_09_company_id_first_week_day_pages_id ON company_statistic_referers_by_weeks_12_09 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_refs_by_weeks_12_09_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_weeks_12_09_first_week_day_idx ON company_statistic_referers_by_weeks_12_09 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_refs_by_weeks_12_10_company_id_first_week_day_pages_id; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_weeks_12_10_company_id_first_week_day_pages_id ON company_statistic_referers_by_weeks_12_10 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_refs_by_weeks_12_10_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_weeks_12_10_first_week_day_idx ON company_statistic_referers_by_weeks_12_10 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_refs_by_weeks_12_11_company_id_first_week_day_pages_id; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_weeks_12_11_company_id_first_week_day_pages_id ON company_statistic_referers_by_weeks_12_11 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_refs_by_weeks_12_11_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_weeks_12_11_first_week_day_idx ON company_statistic_referers_by_weeks_12_11 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_refs_by_weeks_12_12_company_id_first_week_day_pages_id; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_weeks_12_12_company_id_first_week_day_pages_id ON company_statistic_referers_by_weeks_12_12 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_refs_by_weeks_12_12_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_weeks_12_12_first_week_day_idx ON company_statistic_referers_by_weeks_12_12 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_refs_by_weeks_13_01_company_id_first_week_day_pages_id; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_weeks_13_01_company_id_first_week_day_pages_id ON company_statistic_referers_by_weeks_13_01 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_refs_by_weeks_13_01_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_weeks_13_01_first_week_day_idx ON company_statistic_referers_by_weeks_13_01 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_refs_by_weeks_13_02_company_id_first_week_day_pages_id; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_weeks_13_02_company_id_first_week_day_pages_id ON company_statistic_referers_by_weeks_13_02 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_refs_by_weeks_13_02_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_weeks_13_02_first_week_day_idx ON company_statistic_referers_by_weeks_13_02 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_refs_by_weeks_13_03_company_id_first_week_day_pages_id; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_weeks_13_03_company_id_first_week_day_pages_id ON company_statistic_referers_by_weeks_13_03 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_refs_by_weeks_13_03_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_weeks_13_03_first_week_day_idx ON company_statistic_referers_by_weeks_13_03 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_refs_by_weeks_13_04_company_id_first_week_day_pages_id; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_weeks_13_04_company_id_first_week_day_pages_id ON company_statistic_referers_by_weeks_13_04 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_refs_by_weeks_13_04_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_weeks_13_04_first_week_day_idx ON company_statistic_referers_by_weeks_13_04 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_refs_by_weeks_13_05_company_id_first_week_day_pages_id; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_weeks_13_05_company_id_first_week_day_pages_id ON company_statistic_referers_by_weeks_13_05 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_refs_by_weeks_13_05_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_weeks_13_05_first_week_day_idx ON company_statistic_referers_by_weeks_13_05 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_refs_by_weeks_13_06_company_id_first_week_day_pages_id; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_weeks_13_06_company_id_first_week_day_pages_id ON company_statistic_referers_by_weeks_13_06 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_refs_by_weeks_13_06_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_weeks_13_06_first_week_day_idx ON company_statistic_referers_by_weeks_13_06 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_refs_by_weeks_13_07_company_id_first_week_day_pages_id; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_weeks_13_07_company_id_first_week_day_pages_id ON company_statistic_referers_by_weeks_13_07 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_refs_by_weeks_13_07_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_weeks_13_07_first_week_day_idx ON company_statistic_referers_by_weeks_13_07 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_refs_by_weeks_13_08_company_id_first_week_day_pages_id; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_weeks_13_08_company_id_first_week_day_pages_id ON company_statistic_referers_by_weeks_13_08 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_refs_by_weeks_13_08_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_weeks_13_08_first_week_day_idx ON company_statistic_referers_by_weeks_13_08 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_refs_by_weeks_13_09_company_id_first_week_day_pages_id; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_weeks_13_09_company_id_first_week_day_pages_id ON company_statistic_referers_by_weeks_13_09 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_refs_by_weeks_13_09_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_weeks_13_09_first_week_day_idx ON company_statistic_referers_by_weeks_13_09 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_refs_by_weeks_13_10_company_id_first_week_day_pages_id; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_weeks_13_10_company_id_first_week_day_pages_id ON company_statistic_referers_by_weeks_13_10 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_refs_by_weeks_13_10_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_weeks_13_10_first_week_day_idx ON company_statistic_referers_by_weeks_13_10 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_refs_by_weeks_13_11_company_id_first_week_day_pages_id; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_weeks_13_11_company_id_first_week_day_pages_id ON company_statistic_referers_by_weeks_13_11 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_refs_by_weeks_13_11_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_weeks_13_11_first_week_day_idx ON company_statistic_referers_by_weeks_13_11 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_refs_by_weeks_13_12_company_id_first_week_day_pages_id; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_weeks_13_12_company_id_first_week_day_pages_id ON company_statistic_referers_by_weeks_13_12 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_refs_by_weeks_13_12_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_weeks_13_12_first_week_day_idx ON company_statistic_referers_by_weeks_13_12 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_refs_by_weeks_14_01_company_id_first_week_day_pages_id; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_weeks_14_01_company_id_first_week_day_pages_id ON company_statistic_referers_by_weeks_14_01 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_refs_by_weeks_14_01_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_weeks_14_01_first_week_day_idx ON company_statistic_referers_by_weeks_14_01 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_refs_by_weeks_14_02_company_id_first_week_day_pages_id; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_weeks_14_02_company_id_first_week_day_pages_id ON company_statistic_referers_by_weeks_14_02 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_refs_by_weeks_14_02_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_weeks_14_02_first_week_day_idx ON company_statistic_referers_by_weeks_14_02 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_refs_by_weeks_14_03_company_id_first_week_day_pages_id; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_weeks_14_03_company_id_first_week_day_pages_id ON company_statistic_referers_by_weeks_14_03 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_refs_by_weeks_14_03_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_weeks_14_03_first_week_day_idx ON company_statistic_referers_by_weeks_14_03 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_refs_by_weeks_14_04_company_id_first_week_day_pages_id; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_weeks_14_04_company_id_first_week_day_pages_id ON company_statistic_referers_by_weeks_14_04 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_refs_by_weeks_14_04_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_weeks_14_04_first_week_day_idx ON company_statistic_referers_by_weeks_14_04 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_refs_by_weeks_14_05_company_id_first_week_day_pages_id; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_weeks_14_05_company_id_first_week_day_pages_id ON company_statistic_referers_by_weeks_14_05 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_refs_by_weeks_14_05_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_weeks_14_05_first_week_day_idx ON company_statistic_referers_by_weeks_14_05 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_refs_by_weeks_14_06_company_id_first_week_day_pages_id; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_weeks_14_06_company_id_first_week_day_pages_id ON company_statistic_referers_by_weeks_14_06 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_refs_by_weeks_14_06_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_weeks_14_06_first_week_day_idx ON company_statistic_referers_by_weeks_14_06 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_refs_by_weeks_14_07_company_id_first_week_day_pages_id; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_weeks_14_07_company_id_first_week_day_pages_id ON company_statistic_referers_by_weeks_14_07 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_refs_by_weeks_14_07_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_weeks_14_07_first_week_day_idx ON company_statistic_referers_by_weeks_14_07 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_refs_by_weeks_14_08_company_id_first_week_day_pages_id; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_weeks_14_08_company_id_first_week_day_pages_id ON company_statistic_referers_by_weeks_14_08 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_refs_by_weeks_14_08_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_weeks_14_08_first_week_day_idx ON company_statistic_referers_by_weeks_14_08 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_refs_by_weeks_14_09_company_id_first_week_day_pages_id; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_weeks_14_09_company_id_first_week_day_pages_id ON company_statistic_referers_by_weeks_14_09 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_refs_by_weeks_14_09_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_weeks_14_09_first_week_day_idx ON company_statistic_referers_by_weeks_14_09 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_refs_by_weeks_14_10_company_id_first_week_day_pages_id; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_weeks_14_10_company_id_first_week_day_pages_id ON company_statistic_referers_by_weeks_14_10 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_refs_by_weeks_14_10_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_weeks_14_10_first_week_day_idx ON company_statistic_referers_by_weeks_14_10 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_refs_by_weeks_14_11_company_id_first_week_day_pages_id; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_weeks_14_11_company_id_first_week_day_pages_id ON company_statistic_referers_by_weeks_14_11 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_refs_by_weeks_14_11_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_weeks_14_11_first_week_day_idx ON company_statistic_referers_by_weeks_14_11 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_refs_by_weeks_14_12_company_id_first_week_day_pages_id; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_weeks_14_12_company_id_first_week_day_pages_id ON company_statistic_referers_by_weeks_14_12 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_refs_by_weeks_14_12_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_weeks_14_12_first_week_day_idx ON company_statistic_referers_by_weeks_14_12 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_refs_by_weeks_15_01_company_id_first_week_day_pages_id; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_weeks_15_01_company_id_first_week_day_pages_id ON company_statistic_referers_by_weeks_15_01 USING btree (company_id, first_week_day, pages); + + +-- +-- Name: s_c_stat_refs_by_weeks_15_01_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_weeks_15_01_first_week_day_idx ON company_statistic_referers_by_weeks_15_01 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_refs_by_weeks_15_08_company_id_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_weeks_15_08_company_id_first_week_day_idx ON company_statistic_referers_by_weeks_15_08 USING btree (company_id, first_week_day); + + +-- +-- Name: s_c_stat_refs_by_weeks_15_09_company_id_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_refs_by_weeks_15_09_company_id_first_week_day_idx ON company_statistic_referers_by_weeks_15_09 USING btree (company_id, first_week_day); + + +-- +-- Name: s_c_stat_total_by_days_09_11_company_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_days_09_11_company_id_date_idx ON company_statistic_total_by_days_09_11 USING btree (company_id, date); + + +-- +-- Name: s_c_stat_total_by_days_09_12_company_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_days_09_12_company_id_date_idx ON company_statistic_total_by_days_09_12 USING btree (company_id, date); + + +-- +-- Name: s_c_stat_total_by_days_10_01_company_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_days_10_01_company_id_date_idx ON company_statistic_total_by_days_10_01 USING btree (company_id, date); + + +-- +-- Name: s_c_stat_total_by_days_10_02_company_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_days_10_02_company_id_date_idx ON company_statistic_total_by_days_10_02 USING btree (company_id, date); + + +-- +-- Name: s_c_stat_total_by_days_10_03_company_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_days_10_03_company_id_date_idx ON company_statistic_total_by_days_10_03 USING btree (company_id, date); + + +-- +-- Name: s_c_stat_total_by_days_10_04_company_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_days_10_04_company_id_date_idx ON company_statistic_total_by_days_10_04 USING btree (company_id, date); + + +-- +-- Name: s_c_stat_total_by_days_10_05_company_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_days_10_05_company_id_date_idx ON company_statistic_total_by_days_10_05 USING btree (company_id, date); + + +-- +-- Name: s_c_stat_total_by_days_10_06_company_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_days_10_06_company_id_date_idx ON company_statistic_total_by_days_10_06 USING btree (company_id, date); + + +-- +-- Name: s_c_stat_total_by_days_10_07_company_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_days_10_07_company_id_date_idx ON company_statistic_total_by_days_10_07 USING btree (company_id, date); + + +-- +-- Name: s_c_stat_total_by_days_10_08_company_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_days_10_08_company_id_date_idx ON company_statistic_total_by_days_10_08 USING btree (company_id, date); + + +-- +-- Name: s_c_stat_total_by_days_10_09_company_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_days_10_09_company_id_date_idx ON company_statistic_total_by_days_10_09 USING btree (company_id, date); + + +-- +-- Name: s_c_stat_total_by_days_10_10_company_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_days_10_10_company_id_date_idx ON company_statistic_total_by_days_10_10 USING btree (company_id, date); + + +-- +-- Name: s_c_stat_total_by_days_10_11_company_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_days_10_11_company_id_date_idx ON company_statistic_total_by_days_10_11 USING btree (company_id, date); + + +-- +-- Name: s_c_stat_total_by_days_10_12_company_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_days_10_12_company_id_date_idx ON company_statistic_total_by_days_10_12 USING btree (company_id, date); + + +-- +-- Name: s_c_stat_total_by_days_11_11_company_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_days_11_11_company_id_date_idx ON company_statistic_total_by_days_11_11 USING btree (company_id, date); + + +-- +-- Name: s_c_stat_total_by_days_11_11_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_days_11_11_date_idx ON company_statistic_total_by_days_11_11 USING btree (date); + + +-- +-- Name: s_c_stat_total_by_days_11_12_company_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_days_11_12_company_id_date_idx ON company_statistic_total_by_days_11_12 USING btree (company_id, date); + + +-- +-- Name: s_c_stat_total_by_days_11_12_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_days_11_12_date_idx ON company_statistic_total_by_days_11_12 USING btree (date); + + +-- +-- Name: s_c_stat_total_by_days_12_01_company_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_days_12_01_company_id_date_idx ON company_statistic_total_by_days_12_01 USING btree (company_id, date); + + +-- +-- Name: s_c_stat_total_by_days_12_01_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_days_12_01_date_idx ON company_statistic_total_by_days_12_01 USING btree (date); + + +-- +-- Name: s_c_stat_total_by_days_12_02_company_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_days_12_02_company_id_date_idx ON company_statistic_total_by_days_12_02 USING btree (company_id, date); + + +-- +-- Name: s_c_stat_total_by_days_12_02_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_days_12_02_date_idx ON company_statistic_total_by_days_12_02 USING btree (date); + + +-- +-- Name: s_c_stat_total_by_days_12_03_company_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_days_12_03_company_id_date_idx ON company_statistic_total_by_days_12_03 USING btree (company_id, date); + + +-- +-- Name: s_c_stat_total_by_days_12_03_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_days_12_03_date_idx ON company_statistic_total_by_days_12_03 USING btree (date); + + +-- +-- Name: s_c_stat_total_by_days_12_04_company_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_days_12_04_company_id_date_idx ON company_statistic_total_by_days_12_04 USING btree (company_id, date); + + +-- +-- Name: s_c_stat_total_by_days_12_04_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_days_12_04_date_idx ON company_statistic_total_by_days_12_04 USING btree (date); + + +-- +-- Name: s_c_stat_total_by_days_12_05_company_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_days_12_05_company_id_date_idx ON company_statistic_total_by_days_12_05 USING btree (company_id, date); + + +-- +-- Name: s_c_stat_total_by_days_12_05_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_days_12_05_date_idx ON company_statistic_total_by_days_12_05 USING btree (date); + + +-- +-- Name: s_c_stat_total_by_days_12_06_company_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_days_12_06_company_id_date_idx ON company_statistic_total_by_days_12_06 USING btree (company_id, date); + + +-- +-- Name: s_c_stat_total_by_days_12_06_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_days_12_06_date_idx ON company_statistic_total_by_days_12_06 USING btree (date); + + +-- +-- Name: s_c_stat_total_by_days_12_07_company_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_days_12_07_company_id_date_idx ON company_statistic_total_by_days_12_07 USING btree (company_id, date); + + +-- +-- Name: s_c_stat_total_by_days_12_07_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_days_12_07_date_idx ON company_statistic_total_by_days_12_07 USING btree (date); + + +-- +-- Name: s_c_stat_total_by_days_12_08_company_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_days_12_08_company_id_date_idx ON company_statistic_total_by_days_12_08 USING btree (company_id, date); + + +-- +-- Name: s_c_stat_total_by_days_12_08_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_days_12_08_date_idx ON company_statistic_total_by_days_12_08 USING btree (date); + + +-- +-- Name: s_c_stat_total_by_days_12_09_company_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_days_12_09_company_id_date_idx ON company_statistic_total_by_days_12_09 USING btree (company_id, date); + + +-- +-- Name: s_c_stat_total_by_days_12_09_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_days_12_09_date_idx ON company_statistic_total_by_days_12_09 USING btree (date); + + +-- +-- Name: s_c_stat_total_by_days_12_10_company_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_days_12_10_company_id_date_idx ON company_statistic_total_by_days_12_10 USING btree (company_id, date); + + +-- +-- Name: s_c_stat_total_by_days_12_10_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_days_12_10_date_idx ON company_statistic_total_by_days_12_10 USING btree (date); + + +-- +-- Name: s_c_stat_total_by_days_12_11_company_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_days_12_11_company_id_date_idx ON company_statistic_total_by_days_12_11 USING btree (company_id, date); + + +-- +-- Name: s_c_stat_total_by_days_12_11_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_days_12_11_date_idx ON company_statistic_total_by_days_12_11 USING btree (date); + + +-- +-- Name: s_c_stat_total_by_days_12_12_company_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_days_12_12_company_id_date_idx ON company_statistic_total_by_days_12_12 USING btree (company_id, date); + + +-- +-- Name: s_c_stat_total_by_days_12_12_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_days_12_12_date_idx ON company_statistic_total_by_days_12_12 USING btree (date); + + +-- +-- Name: s_c_stat_total_by_days_13_01_company_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_days_13_01_company_id_date_idx ON company_statistic_total_by_days_13_01 USING btree (company_id, date); + + +-- +-- Name: s_c_stat_total_by_days_13_01_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_days_13_01_date_idx ON company_statistic_total_by_days_13_01 USING btree (date); + + +-- +-- Name: s_c_stat_total_by_days_13_02_company_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_days_13_02_company_id_date_idx ON company_statistic_total_by_days_13_02 USING btree (company_id, date); + + +-- +-- Name: s_c_stat_total_by_days_13_02_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_days_13_02_date_idx ON company_statistic_total_by_days_13_02 USING btree (date); + + +-- +-- Name: s_c_stat_total_by_days_13_03_company_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_days_13_03_company_id_date_idx ON company_statistic_total_by_days_13_03 USING btree (company_id, date); + + +-- +-- Name: s_c_stat_total_by_days_13_03_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_days_13_03_date_idx ON company_statistic_total_by_days_13_03 USING btree (date); + + +-- +-- Name: s_c_stat_total_by_days_13_04_company_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_days_13_04_company_id_date_idx ON company_statistic_total_by_days_13_04 USING btree (company_id, date); + + +-- +-- Name: s_c_stat_total_by_days_13_04_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_days_13_04_date_idx ON company_statistic_total_by_days_13_04 USING btree (date); + + +-- +-- Name: s_c_stat_total_by_days_13_05_company_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_days_13_05_company_id_date_idx ON company_statistic_total_by_days_13_05 USING btree (company_id, date); + + +-- +-- Name: s_c_stat_total_by_days_13_05_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_days_13_05_date_idx ON company_statistic_total_by_days_13_05 USING btree (date); + + +-- +-- Name: s_c_stat_total_by_days_13_06_company_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_days_13_06_company_id_date_idx ON company_statistic_total_by_days_13_06 USING btree (company_id, date); + + +-- +-- Name: s_c_stat_total_by_days_13_06_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_days_13_06_date_idx ON company_statistic_total_by_days_13_06 USING btree (date); + + +-- +-- Name: s_c_stat_total_by_days_13_07_company_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_days_13_07_company_id_date_idx ON company_statistic_total_by_days_13_07 USING btree (company_id, date); + + +-- +-- Name: s_c_stat_total_by_days_13_07_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_days_13_07_date_idx ON company_statistic_total_by_days_13_07 USING btree (date); + + +-- +-- Name: s_c_stat_total_by_days_13_08_company_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_days_13_08_company_id_date_idx ON company_statistic_total_by_days_13_08 USING btree (company_id, date); + + +-- +-- Name: s_c_stat_total_by_days_13_08_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_days_13_08_date_idx ON company_statistic_total_by_days_13_08 USING btree (date); + + +-- +-- Name: s_c_stat_total_by_days_13_09_company_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_days_13_09_company_id_date_idx ON company_statistic_total_by_days_13_09 USING btree (company_id, date); + + +-- +-- Name: s_c_stat_total_by_days_13_09_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_days_13_09_date_idx ON company_statistic_total_by_days_13_09 USING btree (date); + + +-- +-- Name: s_c_stat_total_by_days_13_10_company_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_days_13_10_company_id_date_idx ON company_statistic_total_by_days_13_10 USING btree (company_id, date); + + +-- +-- Name: s_c_stat_total_by_days_13_10_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_days_13_10_date_idx ON company_statistic_total_by_days_13_10 USING btree (date); + + +-- +-- Name: s_c_stat_total_by_days_13_11_company_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_days_13_11_company_id_date_idx ON company_statistic_total_by_days_13_11 USING btree (company_id, date); + + +-- +-- Name: s_c_stat_total_by_days_13_11_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_days_13_11_date_idx ON company_statistic_total_by_days_13_11 USING btree (date); + + +-- +-- Name: s_c_stat_total_by_days_13_12_company_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_days_13_12_company_id_date_idx ON company_statistic_total_by_days_13_12 USING btree (company_id, date); + + +-- +-- Name: s_c_stat_total_by_days_13_12_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_days_13_12_date_idx ON company_statistic_total_by_days_13_12 USING btree (date); + + +-- +-- Name: s_c_stat_total_by_days_14_01_company_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_days_14_01_company_id_date_idx ON company_statistic_total_by_days_14_01 USING btree (company_id, date); + + +-- +-- Name: s_c_stat_total_by_days_14_01_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_days_14_01_date_idx ON company_statistic_total_by_days_14_01 USING btree (date); + + +-- +-- Name: s_c_stat_total_by_days_14_02_company_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_days_14_02_company_id_date_idx ON company_statistic_total_by_days_14_02 USING btree (company_id, date); + + +-- +-- Name: s_c_stat_total_by_days_14_02_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_days_14_02_date_idx ON company_statistic_total_by_days_14_02 USING btree (date); + + +-- +-- Name: s_c_stat_total_by_days_14_03_company_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_days_14_03_company_id_date_idx ON company_statistic_total_by_days_14_03 USING btree (company_id, date); + + +-- +-- Name: s_c_stat_total_by_days_14_03_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_days_14_03_date_idx ON company_statistic_total_by_days_14_03 USING btree (date); + + +-- +-- Name: s_c_stat_total_by_days_14_04_company_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_days_14_04_company_id_date_idx ON company_statistic_total_by_days_14_04 USING btree (company_id, date); + + +-- +-- Name: s_c_stat_total_by_days_14_04_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_days_14_04_date_idx ON company_statistic_total_by_days_14_04 USING btree (date); + + +-- +-- Name: s_c_stat_total_by_days_14_05_company_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_days_14_05_company_id_date_idx ON company_statistic_total_by_days_14_05 USING btree (company_id, date); + + +-- +-- Name: s_c_stat_total_by_days_14_05_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_days_14_05_date_idx ON company_statistic_total_by_days_14_05 USING btree (date); + + +-- +-- Name: s_c_stat_total_by_days_14_06_company_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_days_14_06_company_id_date_idx ON company_statistic_total_by_days_14_06 USING btree (company_id, date); + + +-- +-- Name: s_c_stat_total_by_days_14_06_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_days_14_06_date_idx ON company_statistic_total_by_days_14_06 USING btree (date); + + +-- +-- Name: s_c_stat_total_by_days_14_07_company_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_days_14_07_company_id_date_idx ON company_statistic_total_by_days_14_07 USING btree (company_id, date); + + +-- +-- Name: s_c_stat_total_by_days_14_07_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_days_14_07_date_idx ON company_statistic_total_by_days_14_07 USING btree (date); + + +-- +-- Name: s_c_stat_total_by_days_14_08_company_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_days_14_08_company_id_date_idx ON company_statistic_total_by_days_14_08 USING btree (company_id, date); + + +-- +-- Name: s_c_stat_total_by_days_14_08_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_days_14_08_date_idx ON company_statistic_total_by_days_14_08 USING btree (date); + + +-- +-- Name: s_c_stat_total_by_days_14_09_company_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_days_14_09_company_id_date_idx ON company_statistic_total_by_days_14_09 USING btree (company_id, date); + + +-- +-- Name: s_c_stat_total_by_days_14_09_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_days_14_09_date_idx ON company_statistic_total_by_days_14_09 USING btree (date); + + +-- +-- Name: s_c_stat_total_by_days_14_10_company_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_days_14_10_company_id_date_idx ON company_statistic_total_by_days_14_10 USING btree (company_id, date); + + +-- +-- Name: s_c_stat_total_by_days_14_10_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_days_14_10_date_idx ON company_statistic_total_by_days_14_10 USING btree (date); + + +-- +-- Name: s_c_stat_total_by_days_14_11_company_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_days_14_11_company_id_date_idx ON company_statistic_total_by_days_14_11 USING btree (company_id, date); + + +-- +-- Name: s_c_stat_total_by_days_14_11_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_days_14_11_date_idx ON company_statistic_total_by_days_14_11 USING btree (date); + + +-- +-- Name: s_c_stat_total_by_days_14_12_company_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_days_14_12_company_id_date_idx ON company_statistic_total_by_days_14_12 USING btree (company_id, date); + + +-- +-- Name: s_c_stat_total_by_days_14_12_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_days_14_12_date_idx ON company_statistic_total_by_days_14_12 USING btree (date); + + +-- +-- Name: s_c_stat_total_by_days_15_01_company_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_days_15_01_company_id_date_idx ON company_statistic_total_by_days_15_01 USING btree (company_id, date); + + +-- +-- Name: s_c_stat_total_by_days_15_01_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_days_15_01_date_idx ON company_statistic_total_by_days_15_01 USING btree (date); + + +-- +-- Name: s_c_stat_total_by_days_15_08_company_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_days_15_08_company_id_date_idx ON company_statistic_total_by_days_15_08 USING btree (company_id, date); + + +-- +-- Name: s_c_stat_total_by_days_15_09_company_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_days_15_09_company_id_date_idx ON company_statistic_total_by_days_15_09 USING btree (company_id, date); + + +-- +-- Name: s_c_stat_total_by_months_09_04_company_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_months_09_04_company_id_date_idx ON company_statistic_total_by_months_09_04 USING btree (company_id, date); + + +-- +-- Name: s_c_stat_total_by_months_09_04_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_months_09_04_date_idx ON company_statistic_total_by_months_09_04 USING btree (date); + + +-- +-- Name: s_c_stat_total_by_months_09_05_company_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_months_09_05_company_id_date_idx ON company_statistic_total_by_months_09_05 USING btree (company_id, date); + + +-- +-- Name: s_c_stat_total_by_months_09_05_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_months_09_05_date_idx ON company_statistic_total_by_months_09_05 USING btree (date); + + +-- +-- Name: s_c_stat_total_by_months_09_06_company_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_months_09_06_company_id_date_idx ON company_statistic_total_by_months_09_06 USING btree (company_id, date); + + +-- +-- Name: s_c_stat_total_by_months_09_06_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_months_09_06_date_idx ON company_statistic_total_by_months_09_06 USING btree (date); + + +-- +-- Name: s_c_stat_total_by_months_09_07_company_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_months_09_07_company_id_date_idx ON company_statistic_total_by_months_09_07 USING btree (company_id, date); + + +-- +-- Name: s_c_stat_total_by_months_09_07_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_months_09_07_date_idx ON company_statistic_total_by_months_09_07 USING btree (date); + + +-- +-- Name: s_c_stat_total_by_months_09_08_company_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_months_09_08_company_id_date_idx ON company_statistic_total_by_months_09_08 USING btree (company_id, date); + + +-- +-- Name: s_c_stat_total_by_months_09_08_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_months_09_08_date_idx ON company_statistic_total_by_months_09_08 USING btree (date); + + +-- +-- Name: s_c_stat_total_by_months_09_09_company_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_months_09_09_company_id_date_idx ON company_statistic_total_by_months_09_09 USING btree (company_id, date); + + +-- +-- Name: s_c_stat_total_by_months_09_09_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_months_09_09_date_idx ON company_statistic_total_by_months_09_09 USING btree (date); + + +-- +-- Name: s_c_stat_total_by_months_09_10_company_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_months_09_10_company_id_date_idx ON company_statistic_total_by_months_09_10 USING btree (company_id, date); + + +-- +-- Name: s_c_stat_total_by_months_09_10_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_months_09_10_date_idx ON company_statistic_total_by_months_09_10 USING btree (date); + + +-- +-- Name: s_c_stat_total_by_months_09_11_company_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_months_09_11_company_id_date_idx ON company_statistic_total_by_months_09_11 USING btree (company_id, date); + + +-- +-- Name: s_c_stat_total_by_months_09_11_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_months_09_11_date_idx ON company_statistic_total_by_months_09_11 USING btree (date); + + +-- +-- Name: s_c_stat_total_by_months_09_12_company_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_months_09_12_company_id_date_idx ON company_statistic_total_by_months_09_12 USING btree (company_id, date); + + +-- +-- Name: s_c_stat_total_by_months_09_12_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_months_09_12_date_idx ON company_statistic_total_by_months_09_12 USING btree (date); + + +-- +-- Name: s_c_stat_total_by_months_10_01_company_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_months_10_01_company_id_date_idx ON company_statistic_total_by_months_10_01 USING btree (company_id, date); + + +-- +-- Name: s_c_stat_total_by_months_10_01_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_months_10_01_date_idx ON company_statistic_total_by_months_10_01 USING btree (date); + + +-- +-- Name: s_c_stat_total_by_months_10_02_company_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_months_10_02_company_id_date_idx ON company_statistic_total_by_months_10_02 USING btree (company_id, date); + + +-- +-- Name: s_c_stat_total_by_months_10_02_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_months_10_02_date_idx ON company_statistic_total_by_months_10_02 USING btree (date); + + +-- +-- Name: s_c_stat_total_by_months_10_03_company_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_months_10_03_company_id_date_idx ON company_statistic_total_by_months_10_03 USING btree (company_id, date); + + +-- +-- Name: s_c_stat_total_by_months_10_03_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_months_10_03_date_idx ON company_statistic_total_by_months_10_03 USING btree (date); + + +-- +-- Name: s_c_stat_total_by_months_10_04_company_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_months_10_04_company_id_date_idx ON company_statistic_total_by_months_10_04 USING btree (company_id, date); + + +-- +-- Name: s_c_stat_total_by_months_10_04_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_months_10_04_date_idx ON company_statistic_total_by_months_10_04 USING btree (date); + + +-- +-- Name: s_c_stat_total_by_months_10_05_company_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_months_10_05_company_id_date_idx ON company_statistic_total_by_months_10_05 USING btree (company_id, date); + + +-- +-- Name: s_c_stat_total_by_months_10_05_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_months_10_05_date_idx ON company_statistic_total_by_months_10_05 USING btree (date); + + +-- +-- Name: s_c_stat_total_by_months_10_06_company_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_months_10_06_company_id_date_idx ON company_statistic_total_by_months_10_06 USING btree (company_id, date); + + +-- +-- Name: s_c_stat_total_by_months_10_06_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_months_10_06_date_idx ON company_statistic_total_by_months_10_06 USING btree (date); + + +-- +-- Name: s_c_stat_total_by_months_10_07_company_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_months_10_07_company_id_date_idx ON company_statistic_total_by_months_10_07 USING btree (company_id, date); + + +-- +-- Name: s_c_stat_total_by_months_10_07_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_months_10_07_date_idx ON company_statistic_total_by_months_10_07 USING btree (date); + + +-- +-- Name: s_c_stat_total_by_months_10_08_company_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_months_10_08_company_id_date_idx ON company_statistic_total_by_months_10_08 USING btree (company_id, date); + + +-- +-- Name: s_c_stat_total_by_months_10_08_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_months_10_08_date_idx ON company_statistic_total_by_months_10_08 USING btree (date); + + +-- +-- Name: s_c_stat_total_by_months_10_09_company_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_months_10_09_company_id_date_idx ON company_statistic_total_by_months_10_09 USING btree (company_id, date); + + +-- +-- Name: s_c_stat_total_by_months_10_09_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_months_10_09_date_idx ON company_statistic_total_by_months_10_09 USING btree (date); + + +-- +-- Name: s_c_stat_total_by_months_10_10_company_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_months_10_10_company_id_date_idx ON company_statistic_total_by_months_10_10 USING btree (company_id, date); + + +-- +-- Name: s_c_stat_total_by_months_10_10_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_months_10_10_date_idx ON company_statistic_total_by_months_10_10 USING btree (date); + + +-- +-- Name: s_c_stat_total_by_months_10_11_company_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_months_10_11_company_id_date_idx ON company_statistic_total_by_months_10_11 USING btree (company_id, date); + + +-- +-- Name: s_c_stat_total_by_months_10_11_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_months_10_11_date_idx ON company_statistic_total_by_months_10_11 USING btree (date); + + +-- +-- Name: s_c_stat_total_by_months_10_12_company_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_months_10_12_company_id_date_idx ON company_statistic_total_by_months_10_12 USING btree (company_id, date); + + +-- +-- Name: s_c_stat_total_by_months_10_12_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_months_10_12_date_idx ON company_statistic_total_by_months_10_12 USING btree (date); + + +-- +-- Name: s_c_stat_total_by_months_11_11_company_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_months_11_11_company_id_date_idx ON company_statistic_total_by_months_11_11 USING btree (company_id, date); + + +-- +-- Name: s_c_stat_total_by_months_11_11_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_months_11_11_date_idx ON company_statistic_total_by_months_11_11 USING btree (date); + + +-- +-- Name: s_c_stat_total_by_months_11_12_company_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_months_11_12_company_id_date_idx ON company_statistic_total_by_months_11_12 USING btree (company_id, date); + + +-- +-- Name: s_c_stat_total_by_months_11_12_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_months_11_12_date_idx ON company_statistic_total_by_months_11_12 USING btree (date); + + +-- +-- Name: s_c_stat_total_by_months_12_01_company_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_months_12_01_company_id_date_idx ON company_statistic_total_by_months_12_01 USING btree (company_id, date); + + +-- +-- Name: s_c_stat_total_by_months_12_01_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_months_12_01_date_idx ON company_statistic_total_by_months_12_01 USING btree (date); + + +-- +-- Name: s_c_stat_total_by_months_12_02_company_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_months_12_02_company_id_date_idx ON company_statistic_total_by_months_12_02 USING btree (company_id, date); + + +-- +-- Name: s_c_stat_total_by_months_12_02_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_months_12_02_date_idx ON company_statistic_total_by_months_12_02 USING btree (date); + + +-- +-- Name: s_c_stat_total_by_months_12_03_company_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_months_12_03_company_id_date_idx ON company_statistic_total_by_months_12_03 USING btree (company_id, date); + + +-- +-- Name: s_c_stat_total_by_months_12_03_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_months_12_03_date_idx ON company_statistic_total_by_months_12_03 USING btree (date); + + +-- +-- Name: s_c_stat_total_by_months_12_04_company_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_months_12_04_company_id_date_idx ON company_statistic_total_by_months_12_04 USING btree (company_id, date); + + +-- +-- Name: s_c_stat_total_by_months_12_04_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_months_12_04_date_idx ON company_statistic_total_by_months_12_04 USING btree (date); + + +-- +-- Name: s_c_stat_total_by_months_12_05_company_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_months_12_05_company_id_date_idx ON company_statistic_total_by_months_12_05 USING btree (company_id, date); + + +-- +-- Name: s_c_stat_total_by_months_12_05_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_months_12_05_date_idx ON company_statistic_total_by_months_12_05 USING btree (date); + + +-- +-- Name: s_c_stat_total_by_months_12_06_company_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_months_12_06_company_id_date_idx ON company_statistic_total_by_months_12_06 USING btree (company_id, date); + + +-- +-- Name: s_c_stat_total_by_months_12_06_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_months_12_06_date_idx ON company_statistic_total_by_months_12_06 USING btree (date); + + +-- +-- Name: s_c_stat_total_by_months_12_07_company_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_months_12_07_company_id_date_idx ON company_statistic_total_by_months_12_07 USING btree (company_id, date); + + +-- +-- Name: s_c_stat_total_by_months_12_07_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_months_12_07_date_idx ON company_statistic_total_by_months_12_07 USING btree (date); + + +-- +-- Name: s_c_stat_total_by_months_12_08_company_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_months_12_08_company_id_date_idx ON company_statistic_total_by_months_12_08 USING btree (company_id, date); + + +-- +-- Name: s_c_stat_total_by_months_12_08_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_months_12_08_date_idx ON company_statistic_total_by_months_12_08 USING btree (date); + + +-- +-- Name: s_c_stat_total_by_months_12_09_company_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_months_12_09_company_id_date_idx ON company_statistic_total_by_months_12_09 USING btree (company_id, date); + + +-- +-- Name: s_c_stat_total_by_months_12_09_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_months_12_09_date_idx ON company_statistic_total_by_months_12_09 USING btree (date); + + +-- +-- Name: s_c_stat_total_by_months_12_10_company_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_months_12_10_company_id_date_idx ON company_statistic_total_by_months_12_10 USING btree (company_id, date); + + +-- +-- Name: s_c_stat_total_by_months_12_10_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_months_12_10_date_idx ON company_statistic_total_by_months_12_10 USING btree (date); + + +-- +-- Name: s_c_stat_total_by_months_12_11_company_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_months_12_11_company_id_date_idx ON company_statistic_total_by_months_12_11 USING btree (company_id, date); + + +-- +-- Name: s_c_stat_total_by_months_12_11_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_months_12_11_date_idx ON company_statistic_total_by_months_12_11 USING btree (date); + + +-- +-- Name: s_c_stat_total_by_months_12_12_company_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_months_12_12_company_id_date_idx ON company_statistic_total_by_months_12_12 USING btree (company_id, date); + + +-- +-- Name: s_c_stat_total_by_months_12_12_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_months_12_12_date_idx ON company_statistic_total_by_months_12_12 USING btree (date); + + +-- +-- Name: s_c_stat_total_by_months_13_01_company_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_months_13_01_company_id_date_idx ON company_statistic_total_by_months_13_01 USING btree (company_id, date); + + +-- +-- Name: s_c_stat_total_by_months_13_01_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_months_13_01_date_idx ON company_statistic_total_by_months_13_01 USING btree (date); + + +-- +-- Name: s_c_stat_total_by_months_13_02_company_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_months_13_02_company_id_date_idx ON company_statistic_total_by_months_13_02 USING btree (company_id, date); + + +-- +-- Name: s_c_stat_total_by_months_13_02_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_months_13_02_date_idx ON company_statistic_total_by_months_13_02 USING btree (date); + + +-- +-- Name: s_c_stat_total_by_months_13_03_company_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_months_13_03_company_id_date_idx ON company_statistic_total_by_months_13_03 USING btree (company_id, date); + + +-- +-- Name: s_c_stat_total_by_months_13_03_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_months_13_03_date_idx ON company_statistic_total_by_months_13_03 USING btree (date); + + +-- +-- Name: s_c_stat_total_by_months_13_04_company_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_months_13_04_company_id_date_idx ON company_statistic_total_by_months_13_04 USING btree (company_id, date); + + +-- +-- Name: s_c_stat_total_by_months_13_04_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_months_13_04_date_idx ON company_statistic_total_by_months_13_04 USING btree (date); + + +-- +-- Name: s_c_stat_total_by_months_13_05_company_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_months_13_05_company_id_date_idx ON company_statistic_total_by_months_13_05 USING btree (company_id, date); + + +-- +-- Name: s_c_stat_total_by_months_13_05_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_months_13_05_date_idx ON company_statistic_total_by_months_13_05 USING btree (date); + + +-- +-- Name: s_c_stat_total_by_months_13_06_company_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_months_13_06_company_id_date_idx ON company_statistic_total_by_months_13_06 USING btree (company_id, date); + + +-- +-- Name: s_c_stat_total_by_months_13_06_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_months_13_06_date_idx ON company_statistic_total_by_months_13_06 USING btree (date); + + +-- +-- Name: s_c_stat_total_by_months_13_07_company_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_months_13_07_company_id_date_idx ON company_statistic_total_by_months_13_07 USING btree (company_id, date); + + +-- +-- Name: s_c_stat_total_by_months_13_07_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_months_13_07_date_idx ON company_statistic_total_by_months_13_07 USING btree (date); + + +-- +-- Name: s_c_stat_total_by_months_13_08_company_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_months_13_08_company_id_date_idx ON company_statistic_total_by_months_13_08 USING btree (company_id, date); + + +-- +-- Name: s_c_stat_total_by_months_13_08_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_months_13_08_date_idx ON company_statistic_total_by_months_13_08 USING btree (date); + + +-- +-- Name: s_c_stat_total_by_months_13_09_company_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_months_13_09_company_id_date_idx ON company_statistic_total_by_months_13_09 USING btree (company_id, date); + + +-- +-- Name: s_c_stat_total_by_months_13_09_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_months_13_09_date_idx ON company_statistic_total_by_months_13_09 USING btree (date); + + +-- +-- Name: s_c_stat_total_by_months_13_10_company_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_months_13_10_company_id_date_idx ON company_statistic_total_by_months_13_10 USING btree (company_id, date); + + +-- +-- Name: s_c_stat_total_by_months_13_10_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_months_13_10_date_idx ON company_statistic_total_by_months_13_10 USING btree (date); + + +-- +-- Name: s_c_stat_total_by_months_13_11_company_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_months_13_11_company_id_date_idx ON company_statistic_total_by_months_13_11 USING btree (company_id, date); + + +-- +-- Name: s_c_stat_total_by_months_13_11_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_months_13_11_date_idx ON company_statistic_total_by_months_13_11 USING btree (date); + + +-- +-- Name: s_c_stat_total_by_months_13_12_company_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_months_13_12_company_id_date_idx ON company_statistic_total_by_months_13_12 USING btree (company_id, date); + + +-- +-- Name: s_c_stat_total_by_months_13_12_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_months_13_12_date_idx ON company_statistic_total_by_months_13_12 USING btree (date); + + +-- +-- Name: s_c_stat_total_by_months_14_01_company_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_months_14_01_company_id_date_idx ON company_statistic_total_by_months_14_01 USING btree (company_id, date); + + +-- +-- Name: s_c_stat_total_by_months_14_01_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_months_14_01_date_idx ON company_statistic_total_by_months_14_01 USING btree (date); + + +-- +-- Name: s_c_stat_total_by_months_14_02_company_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_months_14_02_company_id_date_idx ON company_statistic_total_by_months_14_02 USING btree (company_id, date); + + +-- +-- Name: s_c_stat_total_by_months_14_02_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_months_14_02_date_idx ON company_statistic_total_by_months_14_02 USING btree (date); + + +-- +-- Name: s_c_stat_total_by_months_14_03_company_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_months_14_03_company_id_date_idx ON company_statistic_total_by_months_14_03 USING btree (company_id, date); + + +-- +-- Name: s_c_stat_total_by_months_14_03_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_months_14_03_date_idx ON company_statistic_total_by_months_14_03 USING btree (date); + + +-- +-- Name: s_c_stat_total_by_months_14_04_company_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_months_14_04_company_id_date_idx ON company_statistic_total_by_months_14_04 USING btree (company_id, date); + + +-- +-- Name: s_c_stat_total_by_months_14_04_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_months_14_04_date_idx ON company_statistic_total_by_months_14_04 USING btree (date); + + +-- +-- Name: s_c_stat_total_by_months_14_05_company_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_months_14_05_company_id_date_idx ON company_statistic_total_by_months_14_05 USING btree (company_id, date); + + +-- +-- Name: s_c_stat_total_by_months_14_05_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_months_14_05_date_idx ON company_statistic_total_by_months_14_05 USING btree (date); + + +-- +-- Name: s_c_stat_total_by_months_14_06_company_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_months_14_06_company_id_date_idx ON company_statistic_total_by_months_14_06 USING btree (company_id, date); + + +-- +-- Name: s_c_stat_total_by_months_14_06_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_months_14_06_date_idx ON company_statistic_total_by_months_14_06 USING btree (date); + + +-- +-- Name: s_c_stat_total_by_months_14_07_company_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_months_14_07_company_id_date_idx ON company_statistic_total_by_months_14_07 USING btree (company_id, date); + + +-- +-- Name: s_c_stat_total_by_months_14_07_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_months_14_07_date_idx ON company_statistic_total_by_months_14_07 USING btree (date); + + +-- +-- Name: s_c_stat_total_by_months_14_08_company_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_months_14_08_company_id_date_idx ON company_statistic_total_by_months_14_08 USING btree (company_id, date); + + +-- +-- Name: s_c_stat_total_by_months_14_08_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_months_14_08_date_idx ON company_statistic_total_by_months_14_08 USING btree (date); + + +-- +-- Name: s_c_stat_total_by_months_14_09_company_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_months_14_09_company_id_date_idx ON company_statistic_total_by_months_14_09 USING btree (company_id, date); + + +-- +-- Name: s_c_stat_total_by_months_14_09_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_months_14_09_date_idx ON company_statistic_total_by_months_14_09 USING btree (date); + + +-- +-- Name: s_c_stat_total_by_months_14_10_company_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_months_14_10_company_id_date_idx ON company_statistic_total_by_months_14_10 USING btree (company_id, date); + + +-- +-- Name: s_c_stat_total_by_months_14_10_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_months_14_10_date_idx ON company_statistic_total_by_months_14_10 USING btree (date); + + +-- +-- Name: s_c_stat_total_by_months_14_11_company_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_months_14_11_company_id_date_idx ON company_statistic_total_by_months_14_11 USING btree (company_id, date); + + +-- +-- Name: s_c_stat_total_by_months_14_11_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_months_14_11_date_idx ON company_statistic_total_by_months_14_11 USING btree (date); + + +-- +-- Name: s_c_stat_total_by_months_14_12_company_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_months_14_12_company_id_date_idx ON company_statistic_total_by_months_14_12 USING btree (company_id, date); + + +-- +-- Name: s_c_stat_total_by_months_14_12_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_months_14_12_date_idx ON company_statistic_total_by_months_14_12 USING btree (date); + + +-- +-- Name: s_c_stat_total_by_months_15_01_company_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_months_15_01_company_id_date_idx ON company_statistic_total_by_months_15_01 USING btree (company_id, date); + + +-- +-- Name: s_c_stat_total_by_months_15_01_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_months_15_01_date_idx ON company_statistic_total_by_months_15_01 USING btree (date); + + +-- +-- Name: s_c_stat_total_by_months_15_08_company_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_months_15_08_company_id_date_idx ON company_statistic_total_by_months_15_08 USING btree (company_id, date); + + +-- +-- Name: s_c_stat_total_by_months_15_09_company_id_date_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_months_15_09_company_id_date_idx ON company_statistic_total_by_months_15_09 USING btree (company_id, date); + + +-- +-- Name: s_c_stat_total_by_weeks_09_04_company_id_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_weeks_09_04_company_id_first_week_day_idx ON company_statistic_total_by_weeks_09_04 USING btree (company_id, first_week_day); + + +-- +-- Name: s_c_stat_total_by_weeks_09_04_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_weeks_09_04_first_week_day_idx ON company_statistic_total_by_weeks_09_04 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_total_by_weeks_09_05_company_id_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_weeks_09_05_company_id_first_week_day_idx ON company_statistic_total_by_weeks_09_05 USING btree (company_id, first_week_day); + + +-- +-- Name: s_c_stat_total_by_weeks_09_05_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_weeks_09_05_first_week_day_idx ON company_statistic_total_by_weeks_09_05 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_total_by_weeks_09_06_company_id_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_weeks_09_06_company_id_first_week_day_idx ON company_statistic_total_by_weeks_09_06 USING btree (company_id, first_week_day); + + +-- +-- Name: s_c_stat_total_by_weeks_09_06_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_weeks_09_06_first_week_day_idx ON company_statistic_total_by_weeks_09_06 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_total_by_weeks_09_07_company_id_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_weeks_09_07_company_id_first_week_day_idx ON company_statistic_total_by_weeks_09_07 USING btree (company_id, first_week_day); + + +-- +-- Name: s_c_stat_total_by_weeks_09_07_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_weeks_09_07_first_week_day_idx ON company_statistic_total_by_weeks_09_07 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_total_by_weeks_09_08_company_id_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_weeks_09_08_company_id_first_week_day_idx ON company_statistic_total_by_weeks_09_08 USING btree (company_id, first_week_day); + + +-- +-- Name: s_c_stat_total_by_weeks_09_08_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_weeks_09_08_first_week_day_idx ON company_statistic_total_by_weeks_09_08 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_total_by_weeks_09_09_company_id_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_weeks_09_09_company_id_first_week_day_idx ON company_statistic_total_by_weeks_09_09 USING btree (company_id, first_week_day); + + +-- +-- Name: s_c_stat_total_by_weeks_09_09_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_weeks_09_09_first_week_day_idx ON company_statistic_total_by_weeks_09_09 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_total_by_weeks_09_10_company_id_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_weeks_09_10_company_id_first_week_day_idx ON company_statistic_total_by_weeks_09_10 USING btree (company_id, first_week_day); + + +-- +-- Name: s_c_stat_total_by_weeks_09_10_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_weeks_09_10_first_week_day_idx ON company_statistic_total_by_weeks_09_10 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_total_by_weeks_09_11_company_id_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_weeks_09_11_company_id_first_week_day_idx ON company_statistic_total_by_weeks_09_11 USING btree (company_id, first_week_day); + + +-- +-- Name: s_c_stat_total_by_weeks_09_11_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_weeks_09_11_first_week_day_idx ON company_statistic_total_by_weeks_09_11 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_total_by_weeks_09_12_company_id_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_weeks_09_12_company_id_first_week_day_idx ON company_statistic_total_by_weeks_09_12 USING btree (company_id, first_week_day); + + +-- +-- Name: s_c_stat_total_by_weeks_09_12_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_weeks_09_12_first_week_day_idx ON company_statistic_total_by_weeks_09_12 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_total_by_weeks_10_01_company_id_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_weeks_10_01_company_id_first_week_day_idx ON company_statistic_total_by_weeks_10_01 USING btree (company_id, first_week_day); + + +-- +-- Name: s_c_stat_total_by_weeks_10_01_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_weeks_10_01_first_week_day_idx ON company_statistic_total_by_weeks_10_01 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_total_by_weeks_10_02_company_id_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_weeks_10_02_company_id_first_week_day_idx ON company_statistic_total_by_weeks_10_02 USING btree (company_id, first_week_day); + + +-- +-- Name: s_c_stat_total_by_weeks_10_02_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_weeks_10_02_first_week_day_idx ON company_statistic_total_by_weeks_10_02 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_total_by_weeks_10_03_company_id_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_weeks_10_03_company_id_first_week_day_idx ON company_statistic_total_by_weeks_10_03 USING btree (company_id, first_week_day); + + +-- +-- Name: s_c_stat_total_by_weeks_10_03_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_weeks_10_03_first_week_day_idx ON company_statistic_total_by_weeks_10_03 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_total_by_weeks_10_04_company_id_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_weeks_10_04_company_id_first_week_day_idx ON company_statistic_total_by_weeks_10_04 USING btree (company_id, first_week_day); + + +-- +-- Name: s_c_stat_total_by_weeks_10_04_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_weeks_10_04_first_week_day_idx ON company_statistic_total_by_weeks_10_04 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_total_by_weeks_10_05_company_id_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_weeks_10_05_company_id_first_week_day_idx ON company_statistic_total_by_weeks_10_05 USING btree (company_id, first_week_day); + + +-- +-- Name: s_c_stat_total_by_weeks_10_05_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_weeks_10_05_first_week_day_idx ON company_statistic_total_by_weeks_10_05 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_total_by_weeks_10_06_company_id_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_weeks_10_06_company_id_first_week_day_idx ON company_statistic_total_by_weeks_10_06 USING btree (company_id, first_week_day); + + +-- +-- Name: s_c_stat_total_by_weeks_10_06_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_weeks_10_06_first_week_day_idx ON company_statistic_total_by_weeks_10_06 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_total_by_weeks_10_07_company_id_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_weeks_10_07_company_id_first_week_day_idx ON company_statistic_total_by_weeks_10_07 USING btree (company_id, first_week_day); + + +-- +-- Name: s_c_stat_total_by_weeks_10_07_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_weeks_10_07_first_week_day_idx ON company_statistic_total_by_weeks_10_07 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_total_by_weeks_10_08_company_id_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_weeks_10_08_company_id_first_week_day_idx ON company_statistic_total_by_weeks_10_08 USING btree (company_id, first_week_day); + + +-- +-- Name: s_c_stat_total_by_weeks_10_08_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_weeks_10_08_first_week_day_idx ON company_statistic_total_by_weeks_10_08 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_total_by_weeks_10_09_company_id_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_weeks_10_09_company_id_first_week_day_idx ON company_statistic_total_by_weeks_10_09 USING btree (company_id, first_week_day); + + +-- +-- Name: s_c_stat_total_by_weeks_10_09_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_weeks_10_09_first_week_day_idx ON company_statistic_total_by_weeks_10_09 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_total_by_weeks_10_10_company_id_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_weeks_10_10_company_id_first_week_day_idx ON company_statistic_total_by_weeks_10_10 USING btree (company_id, first_week_day); + + +-- +-- Name: s_c_stat_total_by_weeks_10_10_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_weeks_10_10_first_week_day_idx ON company_statistic_total_by_weeks_10_10 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_total_by_weeks_10_11_company_id_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_weeks_10_11_company_id_first_week_day_idx ON company_statistic_total_by_weeks_10_11 USING btree (company_id, first_week_day); + + +-- +-- Name: s_c_stat_total_by_weeks_10_11_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_weeks_10_11_first_week_day_idx ON company_statistic_total_by_weeks_10_11 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_total_by_weeks_10_12_company_id_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_weeks_10_12_company_id_first_week_day_idx ON company_statistic_total_by_weeks_10_12 USING btree (company_id, first_week_day); + + +-- +-- Name: s_c_stat_total_by_weeks_10_12_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_weeks_10_12_first_week_day_idx ON company_statistic_total_by_weeks_10_12 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_total_by_weeks_11_11_company_id_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_weeks_11_11_company_id_first_week_day_idx ON company_statistic_total_by_weeks_11_11 USING btree (company_id, first_week_day); + + +-- +-- Name: s_c_stat_total_by_weeks_11_11_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_weeks_11_11_first_week_day_idx ON company_statistic_total_by_weeks_11_11 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_total_by_weeks_11_12_company_id_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_weeks_11_12_company_id_first_week_day_idx ON company_statistic_total_by_weeks_11_12 USING btree (company_id, first_week_day); + + +-- +-- Name: s_c_stat_total_by_weeks_11_12_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_weeks_11_12_first_week_day_idx ON company_statistic_total_by_weeks_11_12 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_total_by_weeks_12_01_company_id_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_weeks_12_01_company_id_first_week_day_idx ON company_statistic_total_by_weeks_12_01 USING btree (company_id, first_week_day); + + +-- +-- Name: s_c_stat_total_by_weeks_12_01_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_weeks_12_01_first_week_day_idx ON company_statistic_total_by_weeks_12_01 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_total_by_weeks_12_02_company_id_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_weeks_12_02_company_id_first_week_day_idx ON company_statistic_total_by_weeks_12_02 USING btree (company_id, first_week_day); + + +-- +-- Name: s_c_stat_total_by_weeks_12_02_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_weeks_12_02_first_week_day_idx ON company_statistic_total_by_weeks_12_02 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_total_by_weeks_12_03_company_id_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_weeks_12_03_company_id_first_week_day_idx ON company_statistic_total_by_weeks_12_03 USING btree (company_id, first_week_day); + + +-- +-- Name: s_c_stat_total_by_weeks_12_03_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_weeks_12_03_first_week_day_idx ON company_statistic_total_by_weeks_12_03 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_total_by_weeks_12_04_company_id_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_weeks_12_04_company_id_first_week_day_idx ON company_statistic_total_by_weeks_12_04 USING btree (company_id, first_week_day); + + +-- +-- Name: s_c_stat_total_by_weeks_12_04_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_weeks_12_04_first_week_day_idx ON company_statistic_total_by_weeks_12_04 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_total_by_weeks_12_05_company_id_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_weeks_12_05_company_id_first_week_day_idx ON company_statistic_total_by_weeks_12_05 USING btree (company_id, first_week_day); + + +-- +-- Name: s_c_stat_total_by_weeks_12_05_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_weeks_12_05_first_week_day_idx ON company_statistic_total_by_weeks_12_05 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_total_by_weeks_12_06_company_id_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_weeks_12_06_company_id_first_week_day_idx ON company_statistic_total_by_weeks_12_06 USING btree (company_id, first_week_day); + + +-- +-- Name: s_c_stat_total_by_weeks_12_06_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_weeks_12_06_first_week_day_idx ON company_statistic_total_by_weeks_12_06 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_total_by_weeks_12_07_company_id_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_weeks_12_07_company_id_first_week_day_idx ON company_statistic_total_by_weeks_12_07 USING btree (company_id, first_week_day); + + +-- +-- Name: s_c_stat_total_by_weeks_12_07_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_weeks_12_07_first_week_day_idx ON company_statistic_total_by_weeks_12_07 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_total_by_weeks_12_08_company_id_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_weeks_12_08_company_id_first_week_day_idx ON company_statistic_total_by_weeks_12_08 USING btree (company_id, first_week_day); + + +-- +-- Name: s_c_stat_total_by_weeks_12_08_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_weeks_12_08_first_week_day_idx ON company_statistic_total_by_weeks_12_08 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_total_by_weeks_12_09_company_id_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_weeks_12_09_company_id_first_week_day_idx ON company_statistic_total_by_weeks_12_09 USING btree (company_id, first_week_day); + + +-- +-- Name: s_c_stat_total_by_weeks_12_09_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_weeks_12_09_first_week_day_idx ON company_statistic_total_by_weeks_12_09 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_total_by_weeks_12_10_company_id_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_weeks_12_10_company_id_first_week_day_idx ON company_statistic_total_by_weeks_12_10 USING btree (company_id, first_week_day); + + +-- +-- Name: s_c_stat_total_by_weeks_12_10_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_weeks_12_10_first_week_day_idx ON company_statistic_total_by_weeks_12_10 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_total_by_weeks_12_11_company_id_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_weeks_12_11_company_id_first_week_day_idx ON company_statistic_total_by_weeks_12_11 USING btree (company_id, first_week_day); + + +-- +-- Name: s_c_stat_total_by_weeks_12_11_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_weeks_12_11_first_week_day_idx ON company_statistic_total_by_weeks_12_11 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_total_by_weeks_12_12_company_id_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_weeks_12_12_company_id_first_week_day_idx ON company_statistic_total_by_weeks_12_12 USING btree (company_id, first_week_day); + + +-- +-- Name: s_c_stat_total_by_weeks_12_12_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_weeks_12_12_first_week_day_idx ON company_statistic_total_by_weeks_12_12 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_total_by_weeks_13_01_company_id_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_weeks_13_01_company_id_first_week_day_idx ON company_statistic_total_by_weeks_13_01 USING btree (company_id, first_week_day); + + +-- +-- Name: s_c_stat_total_by_weeks_13_01_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_weeks_13_01_first_week_day_idx ON company_statistic_total_by_weeks_13_01 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_total_by_weeks_13_02_company_id_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_weeks_13_02_company_id_first_week_day_idx ON company_statistic_total_by_weeks_13_02 USING btree (company_id, first_week_day); + + +-- +-- Name: s_c_stat_total_by_weeks_13_02_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_weeks_13_02_first_week_day_idx ON company_statistic_total_by_weeks_13_02 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_total_by_weeks_13_03_company_id_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_weeks_13_03_company_id_first_week_day_idx ON company_statistic_total_by_weeks_13_03 USING btree (company_id, first_week_day); + + +-- +-- Name: s_c_stat_total_by_weeks_13_03_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_weeks_13_03_first_week_day_idx ON company_statistic_total_by_weeks_13_03 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_total_by_weeks_13_04_company_id_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_weeks_13_04_company_id_first_week_day_idx ON company_statistic_total_by_weeks_13_04 USING btree (company_id, first_week_day); + + +-- +-- Name: s_c_stat_total_by_weeks_13_04_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_weeks_13_04_first_week_day_idx ON company_statistic_total_by_weeks_13_04 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_total_by_weeks_13_05_company_id_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_weeks_13_05_company_id_first_week_day_idx ON company_statistic_total_by_weeks_13_05 USING btree (company_id, first_week_day); + + +-- +-- Name: s_c_stat_total_by_weeks_13_05_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_weeks_13_05_first_week_day_idx ON company_statistic_total_by_weeks_13_05 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_total_by_weeks_13_06_company_id_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_weeks_13_06_company_id_first_week_day_idx ON company_statistic_total_by_weeks_13_06 USING btree (company_id, first_week_day); + + +-- +-- Name: s_c_stat_total_by_weeks_13_06_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_weeks_13_06_first_week_day_idx ON company_statistic_total_by_weeks_13_06 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_total_by_weeks_13_07_company_id_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_weeks_13_07_company_id_first_week_day_idx ON company_statistic_total_by_weeks_13_07 USING btree (company_id, first_week_day); + + +-- +-- Name: s_c_stat_total_by_weeks_13_07_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_weeks_13_07_first_week_day_idx ON company_statistic_total_by_weeks_13_07 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_total_by_weeks_13_08_company_id_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_weeks_13_08_company_id_first_week_day_idx ON company_statistic_total_by_weeks_13_08 USING btree (company_id, first_week_day); + + +-- +-- Name: s_c_stat_total_by_weeks_13_08_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_weeks_13_08_first_week_day_idx ON company_statistic_total_by_weeks_13_08 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_total_by_weeks_13_09_company_id_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_weeks_13_09_company_id_first_week_day_idx ON company_statistic_total_by_weeks_13_09 USING btree (company_id, first_week_day); + + +-- +-- Name: s_c_stat_total_by_weeks_13_09_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_weeks_13_09_first_week_day_idx ON company_statistic_total_by_weeks_13_09 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_total_by_weeks_13_10_company_id_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_weeks_13_10_company_id_first_week_day_idx ON company_statistic_total_by_weeks_13_10 USING btree (company_id, first_week_day); + + +-- +-- Name: s_c_stat_total_by_weeks_13_10_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_weeks_13_10_first_week_day_idx ON company_statistic_total_by_weeks_13_10 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_total_by_weeks_13_11_company_id_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_weeks_13_11_company_id_first_week_day_idx ON company_statistic_total_by_weeks_13_11 USING btree (company_id, first_week_day); + + +-- +-- Name: s_c_stat_total_by_weeks_13_11_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_weeks_13_11_first_week_day_idx ON company_statistic_total_by_weeks_13_11 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_total_by_weeks_13_12_company_id_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_weeks_13_12_company_id_first_week_day_idx ON company_statistic_total_by_weeks_13_12 USING btree (company_id, first_week_day); + + +-- +-- Name: s_c_stat_total_by_weeks_13_12_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_weeks_13_12_first_week_day_idx ON company_statistic_total_by_weeks_13_12 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_total_by_weeks_14_01_company_id_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_weeks_14_01_company_id_first_week_day_idx ON company_statistic_total_by_weeks_14_01 USING btree (company_id, first_week_day); + + +-- +-- Name: s_c_stat_total_by_weeks_14_01_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_weeks_14_01_first_week_day_idx ON company_statistic_total_by_weeks_14_01 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_total_by_weeks_14_02_company_id_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_weeks_14_02_company_id_first_week_day_idx ON company_statistic_total_by_weeks_14_02 USING btree (company_id, first_week_day); + + +-- +-- Name: s_c_stat_total_by_weeks_14_02_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_weeks_14_02_first_week_day_idx ON company_statistic_total_by_weeks_14_02 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_total_by_weeks_14_03_company_id_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_weeks_14_03_company_id_first_week_day_idx ON company_statistic_total_by_weeks_14_03 USING btree (company_id, first_week_day); + + +-- +-- Name: s_c_stat_total_by_weeks_14_03_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_weeks_14_03_first_week_day_idx ON company_statistic_total_by_weeks_14_03 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_total_by_weeks_14_04_company_id_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_weeks_14_04_company_id_first_week_day_idx ON company_statistic_total_by_weeks_14_04 USING btree (company_id, first_week_day); + + +-- +-- Name: s_c_stat_total_by_weeks_14_04_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_weeks_14_04_first_week_day_idx ON company_statistic_total_by_weeks_14_04 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_total_by_weeks_14_05_company_id_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_weeks_14_05_company_id_first_week_day_idx ON company_statistic_total_by_weeks_14_05 USING btree (company_id, first_week_day); + + +-- +-- Name: s_c_stat_total_by_weeks_14_05_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_weeks_14_05_first_week_day_idx ON company_statistic_total_by_weeks_14_05 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_total_by_weeks_14_06_company_id_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_weeks_14_06_company_id_first_week_day_idx ON company_statistic_total_by_weeks_14_06 USING btree (company_id, first_week_day); + + +-- +-- Name: s_c_stat_total_by_weeks_14_06_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_weeks_14_06_first_week_day_idx ON company_statistic_total_by_weeks_14_06 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_total_by_weeks_14_07_company_id_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_weeks_14_07_company_id_first_week_day_idx ON company_statistic_total_by_weeks_14_07 USING btree (company_id, first_week_day); + + +-- +-- Name: s_c_stat_total_by_weeks_14_07_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_weeks_14_07_first_week_day_idx ON company_statistic_total_by_weeks_14_07 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_total_by_weeks_14_08_company_id_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_weeks_14_08_company_id_first_week_day_idx ON company_statistic_total_by_weeks_14_08 USING btree (company_id, first_week_day); + + +-- +-- Name: s_c_stat_total_by_weeks_14_08_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_weeks_14_08_first_week_day_idx ON company_statistic_total_by_weeks_14_08 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_total_by_weeks_14_09_company_id_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_weeks_14_09_company_id_first_week_day_idx ON company_statistic_total_by_weeks_14_09 USING btree (company_id, first_week_day); + + +-- +-- Name: s_c_stat_total_by_weeks_14_09_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_weeks_14_09_first_week_day_idx ON company_statistic_total_by_weeks_14_09 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_total_by_weeks_14_10_company_id_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_weeks_14_10_company_id_first_week_day_idx ON company_statistic_total_by_weeks_14_10 USING btree (company_id, first_week_day); + + +-- +-- Name: s_c_stat_total_by_weeks_14_10_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_weeks_14_10_first_week_day_idx ON company_statistic_total_by_weeks_14_10 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_total_by_weeks_14_11_company_id_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_weeks_14_11_company_id_first_week_day_idx ON company_statistic_total_by_weeks_14_11 USING btree (company_id, first_week_day); + + +-- +-- Name: s_c_stat_total_by_weeks_14_11_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_weeks_14_11_first_week_day_idx ON company_statistic_total_by_weeks_14_11 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_total_by_weeks_14_12_company_id_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_weeks_14_12_company_id_first_week_day_idx ON company_statistic_total_by_weeks_14_12 USING btree (company_id, first_week_day); + + +-- +-- Name: s_c_stat_total_by_weeks_14_12_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_weeks_14_12_first_week_day_idx ON company_statistic_total_by_weeks_14_12 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_total_by_weeks_15_01_company_id_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_weeks_15_01_company_id_first_week_day_idx ON company_statistic_total_by_weeks_15_01 USING btree (company_id, first_week_day); + + +-- +-- Name: s_c_stat_total_by_weeks_15_01_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_weeks_15_01_first_week_day_idx ON company_statistic_total_by_weeks_15_01 USING btree (first_week_day); + + +-- +-- Name: s_c_stat_total_by_weeks_15_08_company_id_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_weeks_15_08_company_id_first_week_day_idx ON company_statistic_total_by_weeks_15_08 USING btree (company_id, first_week_day); + + +-- +-- Name: s_c_stat_total_by_weeks_15_09_company_id_first_week_day_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_c_stat_total_by_weeks_15_09_company_id_first_week_day_idx ON company_statistic_total_by_weeks_15_09 USING btree (company_id, first_week_day); + + +-- +-- Name: s_qlog_10_07_created_at_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_qlog_10_07_created_at_idx ON query_log_10_07 USING btree (created_at); + + +-- +-- Name: s_qlog_10_07_search_scope_results_count_created_at_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_qlog_10_07_search_scope_results_count_created_at_idx ON query_log_10_07 USING btree (search_scope, results_count, created_at); + + +-- +-- Name: s_qlog_10_07_session_id_query_string_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_qlog_10_07_session_id_query_string_idx ON query_log_10_07 USING btree (session_id, query_string); + + +-- +-- Name: s_qlog_10_08_created_at_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_qlog_10_08_created_at_idx ON query_log_10_08 USING btree (created_at); + + +-- +-- Name: s_qlog_10_08_search_scope_results_count_created_at_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_qlog_10_08_search_scope_results_count_created_at_idx ON query_log_10_08 USING btree (search_scope, results_count, created_at); + + +-- +-- Name: s_qlog_10_08_session_id_query_string_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_qlog_10_08_session_id_query_string_idx ON query_log_10_08 USING btree (session_id, query_string); + + +-- +-- Name: s_qlog_10_09_created_at_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_qlog_10_09_created_at_idx ON query_log_10_09 USING btree (created_at); + + +-- +-- Name: s_qlog_10_09_search_scope_results_count_created_at_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_qlog_10_09_search_scope_results_count_created_at_idx ON query_log_10_09 USING btree (search_scope, results_count, created_at); + + +-- +-- Name: s_qlog_10_09_session_id_query_string_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_qlog_10_09_session_id_query_string_idx ON query_log_10_09 USING btree (session_id, query_string); + + +-- +-- Name: s_qlog_10_10_created_at_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_qlog_10_10_created_at_idx ON query_log_10_10 USING btree (created_at); + + +-- +-- Name: s_qlog_10_10_search_scope_results_count_created_at_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_qlog_10_10_search_scope_results_count_created_at_idx ON query_log_10_10 USING btree (search_scope, results_count, created_at); + + +-- +-- Name: s_qlog_10_10_session_id_query_string_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_qlog_10_10_session_id_query_string_idx ON query_log_10_10 USING btree (session_id, query_string); + + +-- +-- Name: s_qlog_10_11_created_at_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_qlog_10_11_created_at_idx ON query_log_10_11 USING btree (created_at); + + +-- +-- Name: s_qlog_10_11_search_scope_results_count_created_at_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_qlog_10_11_search_scope_results_count_created_at_idx ON query_log_10_11 USING btree (search_scope, results_count, created_at); + + +-- +-- Name: s_qlog_10_11_session_id_query_string_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_qlog_10_11_session_id_query_string_idx ON query_log_10_11 USING btree (session_id, query_string); + + +-- +-- Name: s_qlog_10_12_created_at_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_qlog_10_12_created_at_idx ON query_log_10_12 USING btree (created_at); + + +-- +-- Name: s_qlog_10_12_search_scope_results_count_created_at_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_qlog_10_12_search_scope_results_count_created_at_idx ON query_log_10_12 USING btree (search_scope, results_count, created_at); + + +-- +-- Name: s_qlog_10_12_session_id_query_string_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_qlog_10_12_session_id_query_string_idx ON query_log_10_12 USING btree (session_id, query_string); + + +-- +-- Name: s_qlog_11_02_created_at_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_qlog_11_02_created_at_idx ON query_log_11_02 USING btree (created_at); + + +-- +-- Name: s_qlog_11_02_search_scope_results_count_created_at_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_qlog_11_02_search_scope_results_count_created_at_idx ON query_log_11_02 USING btree (search_scope, results_count, created_at); + + +-- +-- Name: s_qlog_11_02_session_id_query_string_idx; Type: INDEX; Schema: statistics; Owner: -; Tablespace: +-- + +CREATE INDEX s_qlog_11_02_session_id_query_string_idx ON query_log_11_02 USING btree (session_id, query_string); + + +SET search_path = xls_import, pg_catalog; + +-- +-- Name: i_xls_import_parsed_rows_transaction_id_skipped; Type: INDEX; Schema: xls_import; Owner: -; Tablespace: +-- + +CREATE INDEX i_xls_import_parsed_rows_transaction_id_skipped ON parsed_rows USING btree (transaction_id, skipped) WHERE (skipped = false); + + +-- +-- Name: index_xls_import.parsed_rows_on_is_public; Type: INDEX; Schema: xls_import; Owner: -; Tablespace: +-- + +CREATE INDEX "index_xls_import.parsed_rows_on_is_public" ON parsed_rows USING btree (is_public); + + +-- +-- Name: index_xls_import.parsed_rows_on_rubric_id; Type: INDEX; Schema: xls_import; Owner: -; Tablespace: +-- + +CREATE INDEX "index_xls_import.parsed_rows_on_rubric_id" ON parsed_rows USING btree (rubric_id); + + +-- +-- Name: index_xls_import.parsed_rows_on_transaction_id_and_product_id; Type: INDEX; Schema: xls_import; Owner: -; Tablespace: +-- + +CREATE INDEX "index_xls_import.parsed_rows_on_transaction_id_and_product_id" ON parsed_rows USING btree (transaction_id, product_id); + + +-- +-- Name: index_xls_import.transactions_on_user_id; Type: INDEX; Schema: xls_import; Owner: -; Tablespace: +-- + +CREATE INDEX "index_xls_import.transactions_on_user_id" ON transactions USING btree (user_id); + + +SET search_path = londiste, pg_catalog; + +-- +-- Name: table_info_trigger_sync; Type: TRIGGER; Schema: londiste; Owner: - +-- + +CREATE TRIGGER table_info_trigger_sync AFTER DELETE ON table_info FOR EACH ROW EXECUTE PROCEDURE table_info_trigger(); + + +SET search_path = public, pg_catalog; + +-- +-- Name: tr_base_words_name_terms; Type: TRIGGER; Schema: public; Owner: - +-- + +CREATE TRIGGER tr_base_words_name_terms BEFORE INSERT OR UPDATE OF name ON base_words FOR EACH ROW EXECUTE PROCEDURE search.base_words_update_name_terms(); + + +-- +-- Name: tr_denorm_company_domain; Type: TRIGGER; Schema: public; Owner: - +-- + +CREATE TRIGGER tr_denorm_company_domain AFTER INSERT OR DELETE OR UPDATE ON company_domains FOR EACH ROW EXECUTE PROCEDURE pgq.logutriga('q_company_domain', 'backup', 'ignore=id,updated_by,moderated_by,moderated_at,moderator_comment,created_at,updated_at,previous_name,previous_level'); + + +-- +-- Name: tr_denorm_company_fields_translation; Type: TRIGGER; Schema: public; Owner: - +-- + +CREATE TRIGGER tr_denorm_company_fields_translation AFTER INSERT OR DELETE OR UPDATE ON companies FOR EACH ROW EXECUTE PROCEDURE pgq.logutriga('q_company_fields_translation', 'backup', 'ignore=name_rest,synonym,description,updated_at,rubrics_denorm,regions,title_ord,first_letter_ord,name_alt,original_pricelist_file_name,original_pricelist_content_type,original_pricelist_file_size,original_pricelist_updated_at,oferta_sync_id,oferta_online_flag,oferta_sync_dt,moderated_at,moderator_message,moderated_by,updated_by,updated_issues,annonce,has_email,pricelist_actualized_at,oferta_modified_at,csv_id,tmp,is_paid,is_pricelist_online,is_pricelist_printable,regions_with_comm,b_types_denorm,is_price_notification_visible,is_online_store,news_count,images_count,showcases_count,industries_denorm,thematic_rubrics_denorm,main_company_id,videos_count,is_pricelist_discable,company_events_count,has_regional_product_properties,deleted_at,pricelist_mass_actualized_at,deleted_by,short_name,paid_placement_expired_at'); + + +-- +-- Name: tr_denorm_company_first_user_binding_date; Type: TRIGGER; Schema: public; Owner: - +-- + +CREATE TRIGGER tr_denorm_company_first_user_binding_date AFTER INSERT ON company_users FOR EACH ROW EXECUTE PROCEDURE pgq.logutriga('q_company_first_user_binding_date', 'backup', 'ignore=id,user_id,updated_at,is_representative'); + + +-- +-- Name: tr_denorm_company_last_product_created_at; Type: TRIGGER; Schema: public; Owner: - +-- + +CREATE TRIGGER tr_denorm_company_last_product_created_at AFTER INSERT ON products FOR EACH ROW EXECUTE PROCEDURE pgq.logutriga('q_company_last_product_created_at', 'backup', 'ignore=id,name,announce,description,price,price_max,updated_at,rubric_id,is_public,is_exact_price,regions,moderator_comment,position,actualized_at,modified_at,updated_by,moderated_at,moderated_by,state,currency,oferta_sync_id,url_name,rubric_l4_priority,rubric_l5_priority,delta,exists,paid_conditions,delivery_time,rand_sort,mainpage_position,product_group_id,article,order_url,yml_id,yml_image_url_crc,deleted_at,measure_unit_id,page_title,total_order_clicks,min_qty,qty_measure_unit_id,announce_valid,archived_at'); + + +-- +-- Name: tr_denorm_company_main_rubrics_translation; Type: TRIGGER; Schema: public; Owner: - +-- + +CREATE TRIGGER tr_denorm_company_main_rubrics_translation AFTER INSERT OR DELETE OR UPDATE ON company_main_rubrics FOR EACH ROW EXECUTE PROCEDURE pgq.logutriga('q_company_main_rubrics_translation', 'backup', 'ignore=id'); + + +-- +-- Name: tr_denorm_company_test_packet; Type: TRIGGER; Schema: public; Owner: - +-- + +CREATE TRIGGER tr_denorm_company_test_packet AFTER INSERT OR DELETE OR UPDATE ON test_packets FOR EACH ROW EXECUTE PROCEDURE pgq.logutriga('q_company_test_packet', 'backup', 'ignore=id,packet,created_at,updated_at,source'); + + +-- +-- Name: tr_denorm_company_users; Type: TRIGGER; Schema: public; Owner: - +-- + +CREATE TRIGGER tr_denorm_company_users AFTER INSERT OR DELETE OR UPDATE ON company_users FOR EACH ROW EXECUTE PROCEDURE pgq.logutriga('q_company_users', 'backup', 'ignore=id,created_at,updated_at,is_representative'); + + +-- +-- Name: tr_denorm_products_counter; Type: TRIGGER; Schema: public; Owner: - +-- + +CREATE TRIGGER tr_denorm_products_counter AFTER INSERT OR DELETE OR UPDATE ON products FOR EACH ROW EXECUTE PROCEDURE pgq.logutriga('q_products_counter', 'backup', 'ignore=id,name,announce,description,price,price_max,created_at,updated_at,rubric_id,is_exact_price,regions,moderator_comment,position,actualized_at,modified_at,updated_by,moderated_at,moderated_by,currency,oferta_sync_id,url_name,rubric_l4_priority,rubric_l5_priority,delta,exists,paid_conditions,delivery_time,rand_sort,mainpage_position,product_group_id,article,order_url,yml_id,yml_image_url_crc,deleted_at,measure_unit_id,page_title,total_order_clicks,min_qty,qty_measure_unit_id,archived_at'); + + +-- +-- Name: tr_denorm_user_last_seen_date; Type: TRIGGER; Schema: public; Owner: - +-- + +CREATE TRIGGER tr_denorm_user_last_seen_date AFTER INSERT OR DELETE OR UPDATE ON online_users FOR EACH ROW EXECUTE PROCEDURE pgq.logutriga('q_user_last_seen_date', 'backup', 'ignore=last_seen'); + + +-- +-- Name: tr_denorm_user_profile; Type: TRIGGER; Schema: public; Owner: - +-- + +CREATE TRIGGER tr_denorm_user_profile AFTER INSERT OR DELETE OR UPDATE ON user_profiles FOR EACH ROW EXECUTE PROCEDURE pgq.logutriga('q_user_profile', 'backup', 'ignore=id,gender,birthday,city_id,about,created_at,updated_at,contacts,position,additional_contacts,show_email'); + + +-- +-- Name: tr_denorm_users_translation; Type: TRIGGER; Schema: public; Owner: - +-- + +CREATE TRIGGER tr_denorm_users_translation AFTER INSERT OR DELETE OR UPDATE ON users FOR EACH ROW EXECUTE PROCEDURE pgq.logutriga('q_users_translation', 'backup', 'ignore=created_at,updated_at,encrypted_password,salt,persistence_token,remember_token_expires_at,perishable_token,is_pcim_user,spam_complaints_count,spam_state,terms_agree,sso_token,sso_token_updated_at,last_request_at'); + + +-- +-- Name: tr_products_search_terms; Type: TRIGGER; Schema: public; Owner: - +-- + +CREATE TRIGGER tr_products_search_terms BEFORE INSERT OR UPDATE OF name, announce, rubric_id ON products FOR EACH ROW EXECUTE PROCEDURE search.products_update_search_terms(); + + +SET search_path = statistics, pg_catalog; + +-- +-- Name: a_tr_denorm_company_statistic_total_by_months; Type: TRIGGER; Schema: statistics; Owner: - +-- + +CREATE TRIGGER a_tr_denorm_company_statistic_total_by_months BEFORE INSERT ON company_statistic_total_by_months FOR EACH ROW EXECUTE PROCEDURE pgq.logutriga('q_company_statistics_total_by_month'); + + +-- +-- Name: statistics_blog_post_statistic_total_by_days_events_before_inse; Type: TRIGGER; Schema: statistics; Owner: - +-- + +CREATE TRIGGER statistics_blog_post_statistic_total_by_days_events_before_inse BEFORE INSERT ON blog_post_statistic_total_by_days FOR EACH ROW EXECUTE PROCEDURE blog_post_statistic_total_by_days_insert_trigger(); + + +-- +-- Name: statistics_company_statistic_activities_by_days_events_before_i; Type: TRIGGER; Schema: statistics; Owner: - +-- + +CREATE TRIGGER statistics_company_statistic_activities_by_days_events_before_i BEFORE INSERT ON company_statistic_activities_by_days FOR EACH ROW EXECUTE PROCEDURE company_statistic_activities_by_days_insert_trigger(); + + +-- +-- Name: statistics_company_statistic_activities_by_months_events_before; Type: TRIGGER; Schema: statistics; Owner: - +-- + +CREATE TRIGGER statistics_company_statistic_activities_by_months_events_before BEFORE INSERT ON company_statistic_activities_by_months FOR EACH ROW EXECUTE PROCEDURE company_statistic_activities_by_months_insert_trigger(); + + +-- +-- Name: statistics_company_statistic_activities_by_weeks_events_before_; Type: TRIGGER; Schema: statistics; Owner: - +-- + +CREATE TRIGGER statistics_company_statistic_activities_by_weeks_events_before_ BEFORE INSERT ON company_statistic_activities_by_weeks FOR EACH ROW EXECUTE PROCEDURE company_statistic_activities_by_weeks_insert_trigger(); + + +-- +-- Name: statistics_company_statistic_geo_by_months_events_before_insert; Type: TRIGGER; Schema: statistics; Owner: - +-- + +CREATE TRIGGER statistics_company_statistic_geo_by_months_events_before_insert BEFORE INSERT ON company_statistic_geo_by_months FOR EACH ROW EXECUTE PROCEDURE company_statistic_geo_by_months_insert_trigger(); + + +-- +-- Name: statistics_company_statistic_geo_by_weeks_events_before_insert; Type: TRIGGER; Schema: statistics; Owner: - +-- + +CREATE TRIGGER statistics_company_statistic_geo_by_weeks_events_before_insert BEFORE INSERT ON company_statistic_geo_by_weeks FOR EACH ROW EXECUTE PROCEDURE company_statistic_geo_by_weeks_insert_trigger(); + + +-- +-- Name: statistics_company_statistic_pages_by_months_events_before_inse; Type: TRIGGER; Schema: statistics; Owner: - +-- + +CREATE TRIGGER statistics_company_statistic_pages_by_months_events_before_inse BEFORE INSERT ON company_statistic_pages_by_months FOR EACH ROW EXECUTE PROCEDURE company_statistic_pages_by_months_insert_trigger(); + + +-- +-- Name: statistics_company_statistic_pages_by_weeks_events_before_inser; Type: TRIGGER; Schema: statistics; Owner: - +-- + +CREATE TRIGGER statistics_company_statistic_pages_by_weeks_events_before_inser BEFORE INSERT ON company_statistic_pages_by_weeks FOR EACH ROW EXECUTE PROCEDURE company_statistic_pages_by_weeks_insert_trigger(); + + +-- +-- Name: statistics_company_statistic_referers_by_months_events_before_i; Type: TRIGGER; Schema: statistics; Owner: - +-- + +CREATE TRIGGER statistics_company_statistic_referers_by_months_events_before_i BEFORE INSERT ON company_statistic_referers_by_months FOR EACH ROW EXECUTE PROCEDURE company_statistic_referers_by_months_insert_trigger(); + + +-- +-- Name: statistics_company_statistic_referers_by_weeks_events_before_in; Type: TRIGGER; Schema: statistics; Owner: - +-- + +CREATE TRIGGER statistics_company_statistic_referers_by_weeks_events_before_in BEFORE INSERT ON company_statistic_referers_by_weeks FOR EACH ROW EXECUTE PROCEDURE company_statistic_referers_by_weeks_insert_trigger(); + + +-- +-- Name: statistics_company_statistic_total_by_days_events_before_insert; Type: TRIGGER; Schema: statistics; Owner: - +-- + +CREATE TRIGGER statistics_company_statistic_total_by_days_events_before_insert BEFORE INSERT ON company_statistic_total_by_days FOR EACH ROW EXECUTE PROCEDURE company_statistic_total_by_days_insert_trigger(); + + +-- +-- Name: statistics_company_statistic_total_by_months_events_before_inse; Type: TRIGGER; Schema: statistics; Owner: - +-- + +CREATE TRIGGER statistics_company_statistic_total_by_months_events_before_inse BEFORE INSERT ON company_statistic_total_by_months FOR EACH ROW EXECUTE PROCEDURE company_statistic_total_by_months_insert_trigger(); + + +-- +-- Name: statistics_company_statistic_total_by_weeks_events_before_inser; Type: TRIGGER; Schema: statistics; Owner: - +-- + +CREATE TRIGGER statistics_company_statistic_total_by_weeks_events_before_inser BEFORE INSERT ON company_statistic_total_by_weeks FOR EACH ROW EXECUTE PROCEDURE company_statistic_total_by_weeks_insert_trigger(); + + +-- +-- Name: statistics_news_statistic_mainpage_by_days_events_before_insert; Type: TRIGGER; Schema: statistics; Owner: - +-- + +CREATE TRIGGER statistics_news_statistic_mainpage_by_days_events_before_insert BEFORE INSERT ON news_statistic_mainpage_by_days FOR EACH ROW EXECUTE PROCEDURE news_statistic_mainpage_by_days_insert_trigger(); + + +-- +-- Name: statistics_news_statistic_referers_by_months_events_before_inse; Type: TRIGGER; Schema: statistics; Owner: - +-- + +CREATE TRIGGER statistics_news_statistic_referers_by_months_events_before_inse BEFORE INSERT ON news_statistic_referers_by_months FOR EACH ROW EXECUTE PROCEDURE news_statistic_referers_by_months_insert_trigger(); + + +-- +-- Name: statistics_query_log_events_before_insert; Type: TRIGGER; Schema: statistics; Owner: - +-- + +CREATE TRIGGER statistics_query_log_events_before_insert BEFORE INSERT ON query_log FOR EACH ROW EXECUTE PROCEDURE query_log_insert_trigger(); + + +SET search_path = denormalization, pg_catalog; + +-- +-- Name: fk_processors_field; Type: FK CONSTRAINT; Schema: denormalization; Owner: - +-- + +ALTER TABLE ONLY processors + ADD CONSTRAINT fk_processors_field FOREIGN KEY (field_id) REFERENCES fields(id) DEFERRABLE; + + +-- +-- Name: fk_processors_queue; Type: FK CONSTRAINT; Schema: denormalization; Owner: - +-- + +ALTER TABLE ONLY processors + ADD CONSTRAINT fk_processors_queue FOREIGN KEY (queue_id) REFERENCES queues(id) DEFERRABLE; + + +SET search_path = mail_deliveries, pg_catalog; + +-- +-- Name: fk_mail_deliveries.deliveries_category_id; Type: FK CONSTRAINT; Schema: mail_deliveries; Owner: - +-- + +ALTER TABLE ONLY deliveries + ADD CONSTRAINT "fk_mail_deliveries.deliveries_category_id" FOREIGN KEY (category_id) REFERENCES categories(id) ON DELETE RESTRICT DEFERRABLE; + + +-- +-- Name: fk_mail_deliveries.delivery_company_filters_delivery_id; Type: FK CONSTRAINT; Schema: mail_deliveries; Owner: - +-- + +ALTER TABLE ONLY delivery_company_filters + ADD CONSTRAINT "fk_mail_deliveries.delivery_company_filters_delivery_id" FOREIGN KEY (delivery_id) REFERENCES deliveries(id) ON DELETE CASCADE; + + +-- +-- Name: fk_mail_deliveries.unsubscribed_users_category_id; Type: FK CONSTRAINT; Schema: mail_deliveries; Owner: - +-- + +ALTER TABLE ONLY unsubscribed_users + ADD CONSTRAINT "fk_mail_deliveries.unsubscribed_users_category_id" FOREIGN KEY (category_id) REFERENCES categories(id) ON DELETE CASCADE DEFERRABLE; + + +-- +-- Name: fk_mail_deliveries.unsubscribed_users_user_id; Type: FK CONSTRAINT; Schema: mail_deliveries; Owner: - +-- + +ALTER TABLE ONLY unsubscribed_users + ADD CONSTRAINT "fk_mail_deliveries.unsubscribed_users_user_id" FOREIGN KEY (user_id) REFERENCES public.users(id) ON DELETE CASCADE DEFERRABLE; + + +-- +-- Name: fk_mail_deliveries.user_category_settings_category_id; Type: FK CONSTRAINT; Schema: mail_deliveries; Owner: - +-- + +ALTER TABLE ONLY user_category_settings + ADD CONSTRAINT "fk_mail_deliveries.user_category_settings_category_id" FOREIGN KEY (category_id) REFERENCES categories(id) ON DELETE CASCADE DEFERRABLE; + + +SET search_path = mail_delivery, pg_catalog; + +-- +-- Name: fk_attached_partner_projects_on_delivery_id; Type: FK CONSTRAINT; Schema: mail_delivery; Owner: - +-- + +ALTER TABLE ONLY attached_partner_projects + ADD CONSTRAINT fk_attached_partner_projects_on_delivery_id FOREIGN KEY (portal_news_subscription_delivery_id) REFERENCES portal_news_subscription_deliveries(id); + + +-- +-- Name: fk_companies_data_sets_company_id; Type: FK CONSTRAINT; Schema: mail_delivery; Owner: - +-- + +ALTER TABLE ONLY companies_data_sets + ADD CONSTRAINT fk_companies_data_sets_company_id FOREIGN KEY (company_id) REFERENCES public.companies(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE; + + +-- +-- Name: fk_companies_data_sets_filter_id; Type: FK CONSTRAINT; Schema: mail_delivery; Owner: - +-- + +ALTER TABLE ONLY companies_data_sets + ADD CONSTRAINT fk_companies_data_sets_filter_id FOREIGN KEY (filter_id) REFERENCES companies_filters(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE; + + +-- +-- Name: fk_companies_data_sets_mail_sets_id; Type: FK CONSTRAINT; Schema: mail_delivery; Owner: - +-- + +ALTER TABLE ONLY companies_data_sets + ADD CONSTRAINT fk_companies_data_sets_mail_sets_id FOREIGN KEY (mail_set_id) REFERENCES mail_sets(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE; + + +-- +-- Name: fk_companies_data_sets_region_id; Type: FK CONSTRAINT; Schema: mail_delivery; Owner: - +-- + +ALTER TABLE ONLY companies_data_sets + ADD CONSTRAINT fk_companies_data_sets_region_id FOREIGN KEY (region_id) REFERENCES public.regions(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE; + + +-- +-- Name: fk_companies_data_sets_user_id; Type: FK CONSTRAINT; Schema: mail_delivery; Owner: - +-- + +ALTER TABLE ONLY companies_data_sets + ADD CONSTRAINT fk_companies_data_sets_user_id FOREIGN KEY (user_id) REFERENCES public.users(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE; + + +-- +-- Name: fk_companies_datasources_delivery_id; Type: FK CONSTRAINT; Schema: mail_delivery; Owner: - +-- + +ALTER TABLE ONLY companies_datasources + ADD CONSTRAINT fk_companies_datasources_delivery_id FOREIGN KEY (delivery_id) REFERENCES deliveries(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE; + + +-- +-- Name: fk_companies_filters_delivery_id; Type: FK CONSTRAINT; Schema: mail_delivery; Owner: - +-- + +ALTER TABLE ONLY companies_filters + ADD CONSTRAINT fk_companies_filters_delivery_id FOREIGN KEY (delivery_id) REFERENCES deliveries(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE; + + +-- +-- Name: fk_mail_delivery.attached_blogs_blog_post_id; Type: FK CONSTRAINT; Schema: mail_delivery; Owner: - +-- + +ALTER TABLE ONLY attached_blogs + ADD CONSTRAINT "fk_mail_delivery.attached_blogs_blog_post_id" FOREIGN KEY (blog_post_id) REFERENCES public.blog_posts(id) MATCH FULL ON UPDATE CASCADE ON DELETE CASCADE; + + +-- +-- Name: fk_mail_delivery.portal_news_subscriptions_user_id; Type: FK CONSTRAINT; Schema: mail_delivery; Owner: - +-- + +ALTER TABLE ONLY portal_news_subscriptions + ADD CONSTRAINT "fk_mail_delivery.portal_news_subscriptions_user_id" FOREIGN KEY (user_id) REFERENCES public.users(id) ON UPDATE CASCADE ON DELETE CASCADE; + + +-- +-- Name: fk_mail_delivery.portal_subscription_mail_set_news_news_id; Type: FK CONSTRAINT; Schema: mail_delivery; Owner: - +-- + +ALTER TABLE ONLY portal_subscription_mail_set_news + ADD CONSTRAINT "fk_mail_delivery.portal_subscription_mail_set_news_news_id" FOREIGN KEY (news_id) REFERENCES public.news(id) ON UPDATE CASCADE ON DELETE CASCADE; + + +-- +-- Name: fk_mail_set_content_template_to_theme_of_day_news; Type: FK CONSTRAINT; Schema: mail_delivery; Owner: - +-- + +ALTER TABLE ONLY portal_news_subscriptions_mail_set_content_templates + ADD CONSTRAINT fk_mail_set_content_template_to_theme_of_day_news FOREIGN KEY (theme_of_day_news_id) REFERENCES public.news(id) ON UPDATE CASCADE ON DELETE CASCADE; + + +-- +-- Name: fk_mails_mail_set_id; Type: FK CONSTRAINT; Schema: mail_delivery; Owner: - +-- + +ALTER TABLE ONLY mails + ADD CONSTRAINT fk_mails_mail_set_id FOREIGN KEY (mail_set_id) REFERENCES mail_sets(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE; + + +-- +-- Name: fk_on_attached_company_events_company_event_id; Type: FK CONSTRAINT; Schema: mail_delivery; Owner: - +-- + +ALTER TABLE ONLY attached_company_events + ADD CONSTRAINT fk_on_attached_company_events_company_event_id FOREIGN KEY (company_event_id) REFERENCES public.company_events(id) MATCH FULL ON UPDATE CASCADE ON DELETE CASCADE; + + +-- +-- Name: fk_on_attached_company_events_delivery_template_id; Type: FK CONSTRAINT; Schema: mail_delivery; Owner: - +-- + +ALTER TABLE ONLY attached_company_events + ADD CONSTRAINT fk_on_attached_company_events_delivery_template_id FOREIGN KEY (mail_set_content_template_id) REFERENCES portal_news_subscriptions_mail_set_content_templates(id) MATCH FULL ON UPDATE CASCADE ON DELETE CASCADE; + + +-- +-- Name: fk_personal_subscription_data_sets_mail_set_id; Type: FK CONSTRAINT; Schema: mail_delivery; Owner: - +-- + +ALTER TABLE ONLY personal_subscription_data_sets + ADD CONSTRAINT fk_personal_subscription_data_sets_mail_set_id FOREIGN KEY (mail_set_id) REFERENCES mail_sets(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE; + + +-- +-- Name: fk_personal_subscription_data_sets_user_id; Type: FK CONSTRAINT; Schema: mail_delivery; Owner: - +-- + +ALTER TABLE ONLY personal_subscription_data_sets + ADD CONSTRAINT fk_personal_subscription_data_sets_user_id FOREIGN KEY (user_id) REFERENCES public.users(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE; + + +-- +-- Name: fk_personal_subscriptions_delivery_id_delivery; Type: FK CONSTRAINT; Schema: mail_delivery; Owner: - +-- + +ALTER TABLE ONLY personal_subscriptions + ADD CONSTRAINT fk_personal_subscriptions_delivery_id_delivery FOREIGN KEY (delivery_id) REFERENCES personal_subscription_deliveries(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE; + + +-- +-- Name: fk_portal_subscription_news_mail_set_content_template_id; Type: FK CONSTRAINT; Schema: mail_delivery; Owner: - +-- + +ALTER TABLE ONLY portal_subscription_mail_set_news + ADD CONSTRAINT fk_portal_subscription_news_mail_set_content_template_id FOREIGN KEY (mail_set_content_template_id) REFERENCES portal_news_subscriptions_mail_set_content_templates(id) ON UPDATE CASCADE ON DELETE CASCADE; + + +-- +-- Name: fk_unsubscribed_emails_delivery_id; Type: FK CONSTRAINT; Schema: mail_delivery; Owner: - +-- + +ALTER TABLE ONLY unsubscribed_emails + ADD CONSTRAINT fk_unsubscribed_emails_delivery_id FOREIGN KEY (delivery_id) REFERENCES deliveries(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE; + + +SET search_path = permissions, pg_catalog; + +-- +-- Name: fk_permissions_admin_permissions_section_id; Type: FK CONSTRAINT; Schema: permissions; Owner: - +-- + +ALTER TABLE ONLY admin_permissions + ADD CONSTRAINT fk_permissions_admin_permissions_section_id FOREIGN KEY (section_id) REFERENCES admin_sections(id) ON UPDATE CASCADE ON DELETE CASCADE; + + +-- +-- Name: fk_permissions_admin_permissions_user_id; Type: FK CONSTRAINT; Schema: permissions; Owner: - +-- + +ALTER TABLE ONLY admin_permissions + ADD CONSTRAINT fk_permissions_admin_permissions_user_id FOREIGN KEY (user_id) REFERENCES public.users(id) ON UPDATE CASCADE ON DELETE CASCADE; + + +SET search_path = pgq, pg_catalog; + +-- +-- Name: rq_queue_id_fkey; Type: FK CONSTRAINT; Schema: pgq; Owner: - +-- + +ALTER TABLE ONLY retry_queue + ADD CONSTRAINT rq_queue_id_fkey FOREIGN KEY (ev_queue) REFERENCES queue(queue_id); + + +-- +-- Name: sub_consumer_fkey; Type: FK CONSTRAINT; Schema: pgq; Owner: - +-- + +ALTER TABLE ONLY subscription + ADD CONSTRAINT sub_consumer_fkey FOREIGN KEY (sub_consumer) REFERENCES consumer(co_id); + + +-- +-- Name: sub_queue_fkey; Type: FK CONSTRAINT; Schema: pgq; Owner: - +-- + +ALTER TABLE ONLY subscription + ADD CONSTRAINT sub_queue_fkey FOREIGN KEY (sub_queue) REFERENCES queue(queue_id); + + +-- +-- Name: tick_queue_fkey; Type: FK CONSTRAINT; Schema: pgq; Owner: - +-- + +ALTER TABLE ONLY tick + ADD CONSTRAINT tick_queue_fkey FOREIGN KEY (tick_queue) REFERENCES queue(queue_id); + + +SET search_path = pgq_node, pg_catalog; + +-- +-- Name: local_state_queue_name_fkey; Type: FK CONSTRAINT; Schema: pgq_node; Owner: - +-- + +ALTER TABLE ONLY local_state + ADD CONSTRAINT local_state_queue_name_fkey FOREIGN KEY (queue_name) REFERENCES node_info(queue_name); + + +-- +-- Name: local_state_queue_name_fkey1; Type: FK CONSTRAINT; Schema: pgq_node; Owner: - +-- + +ALTER TABLE ONLY local_state + ADD CONSTRAINT local_state_queue_name_fkey1 FOREIGN KEY (queue_name, provider_node) REFERENCES node_location(queue_name, node_name); + + +-- +-- Name: node_info_queue_name_fkey; Type: FK CONSTRAINT; Schema: pgq_node; Owner: - +-- + +ALTER TABLE ONLY node_info + ADD CONSTRAINT node_info_queue_name_fkey FOREIGN KEY (queue_name, node_name) REFERENCES node_location(queue_name, node_name); + + +-- +-- Name: subscriber_info_queue_name_fkey; Type: FK CONSTRAINT; Schema: pgq_node; Owner: - +-- + +ALTER TABLE ONLY subscriber_info + ADD CONSTRAINT subscriber_info_queue_name_fkey FOREIGN KEY (queue_name, subscriber_node) REFERENCES node_location(queue_name, node_name); + + +-- +-- Name: subscriber_info_watermark_name_fkey; Type: FK CONSTRAINT; Schema: pgq_node; Owner: - +-- + +ALTER TABLE ONLY subscriber_info + ADD CONSTRAINT subscriber_info_watermark_name_fkey FOREIGN KEY (watermark_name) REFERENCES pgq.consumer(co_name); + + +-- +-- Name: subscriber_info_worker_name_fkey; Type: FK CONSTRAINT; Schema: pgq_node; Owner: - +-- + +ALTER TABLE ONLY subscriber_info + ADD CONSTRAINT subscriber_info_worker_name_fkey FOREIGN KEY (worker_name) REFERENCES pgq.consumer(co_name); + + +SET search_path = public, pg_catalog; + +-- +-- Name: address_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY company_schedules + ADD CONSTRAINT address_id_fk FOREIGN KEY (address_id) REFERENCES addresses(id) ON UPDATE CASCADE ON DELETE CASCADE; + + +-- +-- Name: adm_district_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY map_addresses + ADD CONSTRAINT adm_district_id_fk FOREIGN KEY (adm_district_id) REFERENCES districts(id) ON UPDATE CASCADE ON DELETE CASCADE; + + +-- +-- Name: blog_post_contents_blog_post_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY blog_post_contents + ADD CONSTRAINT blog_post_contents_blog_post_id_fk FOREIGN KEY (blog_post_id) REFERENCES blog_posts(id); + + +-- +-- Name: blog_post_images_blog_post_content_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY blog_post_images + ADD CONSTRAINT blog_post_images_blog_post_content_id_fk FOREIGN KEY (blog_post_content_id) REFERENCES blog_post_contents(id); + + +-- +-- Name: blog_post_regions_blog_post_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY blog_post_regions + ADD CONSTRAINT blog_post_regions_blog_post_id_fk FOREIGN KEY (blog_post_id) REFERENCES blog_posts(id) ON DELETE CASCADE; + + +-- +-- Name: blog_post_regions_region_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY blog_post_regions + ADD CONSTRAINT blog_post_regions_region_id_fk FOREIGN KEY (region_id) REFERENCES regions(id) ON DELETE CASCADE; + + +-- +-- Name: blog_posts_blog_rubric_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY blog_posts + ADD CONSTRAINT blog_posts_blog_rubric_id_fk FOREIGN KEY (blog_rubric_id) REFERENCES blog_rubrics(id) ON DELETE CASCADE; + + +-- +-- Name: blog_posts_main_region_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY blog_posts + ADD CONSTRAINT blog_posts_main_region_id_fk FOREIGN KEY (main_region_id) REFERENCES regions(id) ON DELETE CASCADE; + + +-- +-- Name: blog_posts_moderator_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY blog_posts + ADD CONSTRAINT blog_posts_moderator_id_fk FOREIGN KEY (moderated_by) REFERENCES users(id) ON DELETE CASCADE; + + +-- +-- Name: blog_posts_user_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY blog_posts + ADD CONSTRAINT blog_posts_user_id_fk FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE; + + +-- +-- Name: blog_rubric_mappings_blog_rubric_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY blog_rubric_mappings + ADD CONSTRAINT blog_rubric_mappings_blog_rubric_id_fk FOREIGN KEY (blog_rubric_id) REFERENCES blog_rubrics(id) ON DELETE CASCADE; + + +-- +-- Name: blog_rubric_statistics_blog_rubric_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY blog_rubric_statistics + ADD CONSTRAINT blog_rubric_statistics_blog_rubric_id_fk FOREIGN KEY (blog_rubric_id) REFERENCES blog_rubrics(id) ON DELETE CASCADE; + + +-- +-- Name: blog_rubric_statistics_region_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY blog_rubric_statistics + ADD CONSTRAINT blog_rubric_statistics_region_id_fk FOREIGN KEY (region_id) REFERENCES regions(id) ON DELETE CASCADE; + + +-- +-- Name: blog_settings_region_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY blog_settings + ADD CONSTRAINT blog_settings_region_id_fk FOREIGN KEY (region_id) REFERENCES regions(id); + + +-- +-- Name: blog_settings_user_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY blog_settings + ADD CONSTRAINT blog_settings_user_id_fk FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE; + + +-- +-- Name: city_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY districts + ADD CONSTRAINT city_id_fk FOREIGN KEY (city_id) REFERENCES cities(id) ON UPDATE CASCADE ON DELETE CASCADE; + + +-- +-- Name: city_types_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY villages + ADD CONSTRAINT city_types_id_fk FOREIGN KEY (city_type_id) REFERENCES city_types(id) ON UPDATE CASCADE ON DELETE CASCADE; + + +-- +-- Name: cms_company_regions_company_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY cms_company_regions + ADD CONSTRAINT cms_company_regions_company_id_fkey FOREIGN KEY (company_id) REFERENCES companies(id) ON DELETE CASCADE; + + +-- +-- Name: cms_company_regions_region_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY cms_company_regions + ADD CONSTRAINT cms_company_regions_region_id_fkey FOREIGN KEY (region_id) REFERENCES regions(id) ON DELETE CASCADE; + + +-- +-- Name: company_background_images_company_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY company_background_images + ADD CONSTRAINT company_background_images_company_id_fk FOREIGN KEY (company_id) REFERENCES companies(id); + + +-- +-- Name: company_header_images_company_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY company_header_images + ADD CONSTRAINT company_header_images_company_id_fk FOREIGN KEY (company_id) REFERENCES companies(id); + + +-- +-- Name: company_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY company_videos + ADD CONSTRAINT company_id_fk FOREIGN KEY (company_id) REFERENCES companies(id) ON UPDATE CASCADE ON DELETE CASCADE; + + +-- +-- Name: company_moderations_company_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY company_moderations + ADD CONSTRAINT company_moderations_company_id_fk FOREIGN KEY (company_id) REFERENCES companies(id) ON DELETE CASCADE; + + +-- +-- Name: company_previous_statistics_company_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY company_previous_statistics + ADD CONSTRAINT company_previous_statistics_company_id_fk FOREIGN KEY (company_id) REFERENCES companies(id) ON DELETE CASCADE; + + +-- +-- Name: company_registration_sources_company_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY company_registration_sources + ADD CONSTRAINT company_registration_sources_company_id_fkey FOREIGN KEY (company_id) REFERENCES companies(id) ON DELETE CASCADE; + + +-- +-- Name: company_searcher_confirmations_company_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY company_searcher_confirmations + ADD CONSTRAINT company_searcher_confirmations_company_id_fkey FOREIGN KEY (company_id) REFERENCES companies(id) ON DELETE CASCADE; + + +-- +-- Name: created_user_fk; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY company_schedules + ADD CONSTRAINT created_user_fk FOREIGN KEY (created_user) REFERENCES users(id) ON UPDATE CASCADE ON DELETE SET NULL; + + +-- +-- Name: demand_items_demand_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY demand_items + ADD CONSTRAINT demand_items_demand_id_fkey FOREIGN KEY (demand_id) REFERENCES demands(id) ON UPDATE CASCADE ON DELETE CASCADE; + + +-- +-- Name: demands_company_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY demands + ADD CONSTRAINT demands_company_id_fkey FOREIGN KEY (company_id) REFERENCES companies(id) ON UPDATE CASCADE ON DELETE SET NULL; + + +-- +-- Name: demands_moderated_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY demands + ADD CONSTRAINT demands_moderated_by_fkey FOREIGN KEY (moderated_by) REFERENCES users(id) ON UPDATE CASCADE ON DELETE SET NULL; + + +-- +-- Name: demands_region_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY demands + ADD CONSTRAINT demands_region_id_fkey FOREIGN KEY (region_id) REFERENCES regions(id) ON UPDATE CASCADE ON DELETE SET NULL; + + +-- +-- Name: demands_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY demands + ADD CONSTRAINT demands_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id) ON UPDATE CASCADE ON DELETE SET NULL; + + +-- +-- Name: dialog_messages_dialog_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY dialog_messages + ADD CONSTRAINT dialog_messages_dialog_id_fkey FOREIGN KEY (dialog_id) REFERENCES dialogs(id) ON UPDATE CASCADE ON DELETE CASCADE; + + +-- +-- Name: dialog_messages_dialog_participant_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY dialog_messages + ADD CONSTRAINT dialog_messages_dialog_participant_id_fkey FOREIGN KEY (dialog_participant_id) REFERENCES dialog_participants(id); + + +-- +-- Name: dialog_messages_recipient_participant_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY dialog_messages + ADD CONSTRAINT dialog_messages_recipient_participant_id_fkey FOREIGN KEY (recipient_participant_id) REFERENCES dialog_participants(id); + + +-- +-- Name: dialog_participants_dialog_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY dialog_participants + ADD CONSTRAINT dialog_participants_dialog_id_fkey FOREIGN KEY (dialog_id) REFERENCES dialogs(id) ON UPDATE CASCADE ON DELETE CASCADE; + + +-- +-- Name: dirty_rubrics_parent_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY dirty_rubrics + ADD CONSTRAINT dirty_rubrics_parent_id_fk FOREIGN KEY (parent_id) REFERENCES dirty_rubrics(id) ON DELETE SET NULL; + + +-- +-- Name: dirty_rubrics_target_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY dirty_rubrics + ADD CONSTRAINT dirty_rubrics_target_id_fk FOREIGN KEY (target_id) REFERENCES dirty_rubrics(id) ON DELETE RESTRICT; + + +-- +-- Name: district_types_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY districts + ADD CONSTRAINT district_types_id_fk FOREIGN KEY (district_type_id) REFERENCES district_types(id) ON UPDATE CASCADE ON DELETE CASCADE; + + +-- +-- Name: dwelling_district_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY map_addresses + ADD CONSTRAINT dwelling_district_id_fk FOREIGN KEY (dwelling_district_id) REFERENCES districts(id) ON UPDATE CASCADE ON DELETE CASCADE; + + +-- +-- Name: feedbacks_feedback_category_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY feedbacks + ADD CONSTRAINT feedbacks_feedback_category_id_fk FOREIGN KEY (feedback_category_id) REFERENCES feedback_categories(id); + + +-- +-- Name: fk_addr_company_event_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY event_addresses + ADD CONSTRAINT fk_addr_company_event_id FOREIGN KEY (company_event_id) REFERENCES company_events(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE; + + +-- +-- Name: fk_addresses_city_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY addresses + ADD CONSTRAINT fk_addresses_city_id FOREIGN KEY (city_id) REFERENCES cities(id) DEFERRABLE; + + +-- +-- Name: fk_addresses_company_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY addresses + ADD CONSTRAINT fk_addresses_company_id FOREIGN KEY (company_id) REFERENCES companies(id) DEFERRABLE; + + +-- +-- Name: fk_addresses_street_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY addresses + ADD CONSTRAINT fk_addresses_street_id FOREIGN KEY (street_id) REFERENCES streets(id) DEFERRABLE; + + +-- +-- Name: fk_answers_company_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY answers + ADD CONSTRAINT fk_answers_company_id FOREIGN KEY (company_id) REFERENCES companies(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE; + + +-- +-- Name: fk_articles_company_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY articles + ADD CONSTRAINT fk_articles_company_id FOREIGN KEY (company_id) REFERENCES companies(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE; + + +-- +-- Name: fk_avatars_user_profile_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY avatars + ADD CONSTRAINT fk_avatars_user_profile_id FOREIGN KEY (user_profile_id) REFERENCES user_profiles(id) DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: fk_award_candidates_award_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY award_candidates + ADD CONSTRAINT fk_award_candidates_award_id FOREIGN KEY (award_id) REFERENCES awards(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE; + + +-- +-- Name: fk_award_candidates_user_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY award_candidates + ADD CONSTRAINT fk_award_candidates_user_id FOREIGN KEY (user_id) REFERENCES users(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE; + + +-- +-- Name: fk_award_nominee_votes_award_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY award_nominee_votes + ADD CONSTRAINT fk_award_nominee_votes_award_id FOREIGN KEY (award_id) REFERENCES awards(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE; + + +-- +-- Name: fk_award_nominee_votes_award_nominee_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY award_nominee_votes + ADD CONSTRAINT fk_award_nominee_votes_award_nominee_id FOREIGN KEY (award_nominee_id) REFERENCES award_nominees(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE; + + +-- +-- Name: fk_award_nominee_votes_user_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY award_nominee_votes + ADD CONSTRAINT fk_award_nominee_votes_user_id FOREIGN KEY (user_id) REFERENCES users(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE; + + +-- +-- Name: fk_award_nominees_award_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY award_nominees + ADD CONSTRAINT fk_award_nominees_award_id FOREIGN KEY (award_id) REFERENCES awards(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE; + + +-- +-- Name: fk_award_nominees_award_rubric_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY award_nominees + ADD CONSTRAINT fk_award_nominees_award_rubric_id FOREIGN KEY (award_rubric_id) REFERENCES award_rubrics(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE; + + +-- +-- Name: fk_award_nominees_company_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY award_nominees + ADD CONSTRAINT fk_award_nominees_company_id FOREIGN KEY (company_id) REFERENCES companies(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE; + + +-- +-- Name: fk_award_rubrics_award_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY award_rubrics + ADD CONSTRAINT fk_award_rubrics_award_id FOREIGN KEY (award_id) REFERENCES awards(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE; + + +-- +-- Name: fk_award_winner_nomination_votes_award_nomination_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY award_winner_nomination_votes + ADD CONSTRAINT fk_award_winner_nomination_votes_award_nomination_id FOREIGN KEY (award_nomination_id) REFERENCES award_nominations(id) ON UPDATE CASCADE ON DELETE CASCADE; + + +-- +-- Name: fk_award_winner_nomination_votes_award_winner_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY award_winner_nomination_votes + ADD CONSTRAINT fk_award_winner_nomination_votes_award_winner_id FOREIGN KEY (award_winner_id) REFERENCES award_winners(id) ON UPDATE CASCADE ON DELETE CASCADE; + + +-- +-- Name: fk_award_winner_nomination_votes_user_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY award_winner_nomination_votes + ADD CONSTRAINT fk_award_winner_nomination_votes_user_id FOREIGN KEY (user_id) REFERENCES users(id) ON UPDATE CASCADE ON DELETE CASCADE; + + +-- +-- Name: fk_award_winners_award_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY award_winners + ADD CONSTRAINT fk_award_winners_award_id FOREIGN KEY (award_id) REFERENCES awards(id) ON UPDATE CASCADE ON DELETE CASCADE; + + +-- +-- Name: fk_award_winners_company_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY award_winners + ADD CONSTRAINT fk_award_winners_company_id FOREIGN KEY (company_id) REFERENCES companies(id) ON UPDATE CASCADE ON DELETE CASCADE; + + +-- +-- Name: fk_blog_comments_blog_post_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY blog_comments + ADD CONSTRAINT fk_blog_comments_blog_post_id FOREIGN KEY (blog_post_id) REFERENCES blog_posts(id) ON UPDATE CASCADE ON DELETE CASCADE; + + +-- +-- Name: fk_blog_comments_user_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY blog_comments + ADD CONSTRAINT fk_blog_comments_user_id FOREIGN KEY (user_id) REFERENCES users(id) ON UPDATE CASCADE ON DELETE CASCADE; + + +-- +-- Name: fk_cities_province_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY cities + ADD CONSTRAINT fk_cities_province_id FOREIGN KEY (province_id) REFERENCES provinces(id) DEFERRABLE; + + +-- +-- Name: fk_cities_type_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY cities + ADD CONSTRAINT fk_cities_type_id FOREIGN KEY (type_id) REFERENCES city_types(id) DEFERRABLE; + + +-- +-- Name: fk_comp_event_company_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY company_events + ADD CONSTRAINT fk_comp_event_company_id FOREIGN KEY (company_id) REFERENCES companies(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE; + + +-- +-- Name: fk_comp_event_event_type_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY company_events + ADD CONSTRAINT fk_comp_event_event_type_id FOREIGN KEY (company_event_type_id) REFERENCES company_event_types(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE; + + +-- +-- Name: fk_comp_event_region_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY company_events + ADD CONSTRAINT fk_comp_event_region_id FOREIGN KEY (region_id) REFERENCES regions(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE; + + +-- +-- Name: fk_comp_event_thematic_rubric_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY company_events + ADD CONSTRAINT fk_comp_event_thematic_rubric_id FOREIGN KEY (event_thematic_rubric_id) REFERENCES event_thematic_rubrics(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE; + + +-- +-- Name: fk_comp_events_regions_event_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY company_events_publish_regions + ADD CONSTRAINT fk_comp_events_regions_event_id FOREIGN KEY (company_event_id) REFERENCES company_events(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE; + + +-- +-- Name: fk_comp_events_regions_region_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY company_events_publish_regions + ADD CONSTRAINT fk_comp_events_regions_region_id FOREIGN KEY (region_id) REFERENCES regions(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE; + + +-- +-- Name: fk_companies_main_company_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY companies + ADD CONSTRAINT fk_companies_main_company_id FOREIGN KEY (main_company_id) REFERENCES companies(id) ON UPDATE CASCADE ON DELETE SET NULL DEFERRABLE; + + +-- +-- Name: fk_companies_moderated_by; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY companies + ADD CONSTRAINT fk_companies_moderated_by FOREIGN KEY (moderated_by) REFERENCES users(id) DEFERRABLE; + + +-- +-- Name: fk_companies_products_region_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY companies + ADD CONSTRAINT fk_companies_products_region_id FOREIGN KEY (products_region_id) REFERENCES regions(id) ON UPDATE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: fk_companies_updated_by; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY companies + ADD CONSTRAINT fk_companies_updated_by FOREIGN KEY (updated_by) REFERENCES users(id) DEFERRABLE; + + +-- +-- Name: fk_company_abouts_company_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY company_abouts + ADD CONSTRAINT fk_company_abouts_company_id FOREIGN KEY (company_id) REFERENCES companies(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE; + + +-- +-- Name: fk_company_billings_company_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY company_billings + ADD CONSTRAINT fk_company_billings_company_id FOREIGN KEY (company_id) REFERENCES companies(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE; + + +-- +-- Name: fk_company_business_types_business_type_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY company_business_types + ADD CONSTRAINT fk_company_business_types_business_type_id FOREIGN KEY (business_type_id) REFERENCES business_types(id) DEFERRABLE; + + +-- +-- Name: fk_company_business_types_company_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY company_business_types + ADD CONSTRAINT fk_company_business_types_company_id FOREIGN KEY (company_id) REFERENCES companies(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE; + + +-- +-- Name: fk_company_domains_company_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY company_domains + ADD CONSTRAINT fk_company_domains_company_id FOREIGN KEY (company_id) REFERENCES companies(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE; + + +-- +-- Name: fk_company_domains_moderated_by; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY company_domains + ADD CONSTRAINT fk_company_domains_moderated_by FOREIGN KEY (moderated_by) REFERENCES users(id) DEFERRABLE; + + +-- +-- Name: fk_company_domains_updated_by; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY company_domains + ADD CONSTRAINT fk_company_domains_updated_by FOREIGN KEY (updated_by) REFERENCES users(id) DEFERRABLE; + + +-- +-- Name: fk_company_geo_denormalizations_company_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY company_geo_denormalizations + ADD CONSTRAINT fk_company_geo_denormalizations_company_id FOREIGN KEY (company_id) REFERENCES companies(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE; + + +-- +-- Name: fk_company_industries_company_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY company_industries + ADD CONSTRAINT fk_company_industries_company_id FOREIGN KEY (company_id) REFERENCES companies(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE; + + +-- +-- Name: fk_company_logos_company_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY company_logos + ADD CONSTRAINT fk_company_logos_company_id FOREIGN KEY (company_id) REFERENCES companies(id) DEFERRABLE; + + +-- +-- Name: fk_company_logos_parent_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY company_logos + ADD CONSTRAINT fk_company_logos_parent_id FOREIGN KEY (parent_id) REFERENCES company_logos(id) DEFERRABLE; + + +-- +-- Name: fk_company_main_rubrics_company_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY company_main_rubrics + ADD CONSTRAINT fk_company_main_rubrics_company_id FOREIGN KEY (company_id) REFERENCES companies(id); + + +-- +-- Name: fk_company_price_product_rubrics_company_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY company_price_product_rubrics + ADD CONSTRAINT fk_company_price_product_rubrics_company_id FOREIGN KEY (company_id) REFERENCES companies(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE; + + +-- +-- Name: fk_company_regions_company_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY company_regions + ADD CONSTRAINT fk_company_regions_company_id FOREIGN KEY (company_id) REFERENCES companies(id) DEFERRABLE; + + +-- +-- Name: fk_company_regions_department_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY company_regions + ADD CONSTRAINT fk_company_regions_department_id FOREIGN KEY (department_id) REFERENCES addresses(id) DEFERRABLE; + + +-- +-- Name: fk_company_regions_region_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY company_regions + ADD CONSTRAINT fk_company_regions_region_id FOREIGN KEY (region_id) REFERENCES regions(id) DEFERRABLE; + + +-- +-- Name: fk_company_rubrics_company_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY company_rubrics + ADD CONSTRAINT fk_company_rubrics_company_id FOREIGN KEY (company_id) REFERENCES companies(id) ON DELETE CASCADE DEFERRABLE; + + +-- +-- Name: fk_company_settings_company_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY company_settings + ADD CONSTRAINT fk_company_settings_company_id FOREIGN KEY (company_id) REFERENCES companies(id) DEFERRABLE; + + +-- +-- Name: fk_company_sites_company_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY company_sites + ADD CONSTRAINT fk_company_sites_company_id FOREIGN KEY (company_id) REFERENCES companies(id) DEFERRABLE; + + +-- +-- Name: fk_company_thematic_rubrics_company_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY company_thematic_rubrics + ADD CONSTRAINT fk_company_thematic_rubrics_company_id FOREIGN KEY (company_id) REFERENCES companies(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE; + + +-- +-- Name: fk_company_tokens_company_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY company_tokens + ADD CONSTRAINT fk_company_tokens_company_id FOREIGN KEY (company_id) REFERENCES companies(id) ON DELETE CASCADE DEFERRABLE; + + +-- +-- Name: fk_company_users_company_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY company_users + ADD CONSTRAINT fk_company_users_company_id FOREIGN KEY (company_id) REFERENCES companies(id) ON DELETE CASCADE DEFERRABLE; + + +-- +-- Name: fk_company_users_user_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY company_users + ADD CONSTRAINT fk_company_users_user_id FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE DEFERRABLE; + + +-- +-- Name: fk_company_widgets_company_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY company_widgets + ADD CONSTRAINT fk_company_widgets_company_id FOREIGN KEY (company_id) REFERENCES companies(id) ON DELETE CASCADE DEFERRABLE; + + +-- +-- Name: fk_company_yandex_rubrics_yandex_rubric_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY company_yandex_rubrics + ADD CONSTRAINT fk_company_yandex_rubrics_yandex_rubric_id FOREIGN KEY (yandex_rubric_id) REFERENCES yandex_rubrics(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE; + + +-- +-- Name: fk_contact_company_event_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY event_contacts + ADD CONSTRAINT fk_contact_company_event_id FOREIGN KEY (company_event_id) REFERENCES company_events(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE; + + +-- +-- Name: fk_contact_contact_type_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY event_contacts + ADD CONSTRAINT fk_contact_contact_type_id FOREIGN KEY (contact_type_id) REFERENCES contact_types(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE; + + +-- +-- Name: fk_contacts_address_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY contacts + ADD CONSTRAINT fk_contacts_address_id FOREIGN KEY (address_id) REFERENCES addresses(id) DEFERRABLE; + + +-- +-- Name: fk_contacts_contact_type_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY contacts + ADD CONSTRAINT fk_contacts_contact_type_id FOREIGN KEY (contact_type_id) REFERENCES contact_types(id) DEFERRABLE; + + +-- +-- Name: fk_dirty_company_industries_company_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY dirty_company_industries + ADD CONSTRAINT fk_dirty_company_industries_company_id FOREIGN KEY (company_id) REFERENCES companies(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE; + + +-- +-- Name: fk_dirty_company_industries_industry_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY dirty_company_industries + ADD CONSTRAINT fk_dirty_company_industries_industry_id FOREIGN KEY (industry_id) REFERENCES industries(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE; + + +-- +-- Name: fk_dirty_industries_parent_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY dirty_industries + ADD CONSTRAINT fk_dirty_industries_parent_id FOREIGN KEY (parent_id) REFERENCES dirty_industries(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE; + + +-- +-- Name: fk_dirty_thematic_rubric_industries_industry_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY dirty_thematic_rubric_industries + ADD CONSTRAINT fk_dirty_thematic_rubric_industries_industry_id FOREIGN KEY (industry_id) REFERENCES dirty_industries(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE; + + +-- +-- Name: fk_dirty_thematic_rubric_industries_thematic_rubric_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY dirty_thematic_rubric_industries + ADD CONSTRAINT fk_dirty_thematic_rubric_industries_thematic_rubric_id FOREIGN KEY (thematic_rubric_id) REFERENCES dirty_thematic_rubrics(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE; + + +-- +-- Name: fk_dirty_thematic_rubrics_parent_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY dirty_thematic_rubrics + ADD CONSTRAINT fk_dirty_thematic_rubrics_parent_id FOREIGN KEY (parent_id) REFERENCES dirty_thematic_rubrics(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE; + + +-- +-- Name: fk_dirty_thematic_rubrics_thematic_rubricator_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY dirty_thematic_rubrics + ADD CONSTRAINT fk_dirty_thematic_rubrics_thematic_rubricator_id FOREIGN KEY (thematic_rubricator_id) REFERENCES thematic_rubricators(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE; + + +-- +-- Name: fk_districts_map_address_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY districts + ADD CONSTRAINT fk_districts_map_address_id FOREIGN KEY (map_address_id) REFERENCES map_addresses(id); + + +-- +-- Name: fk_event_addr_city_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY event_addresses + ADD CONSTRAINT fk_event_addr_city_id FOREIGN KEY (city_id) REFERENCES cities(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE; + + +-- +-- Name: fk_event_addr_map_address_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY event_addresses + ADD CONSTRAINT fk_event_addr_map_address_id FOREIGN KEY (map_address_id) REFERENCES map_addresses(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE; + + +-- +-- Name: fk_event_addr_street_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY event_addresses + ADD CONSTRAINT fk_event_addr_street_id FOREIGN KEY (street_id) REFERENCES streets(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE; + + +-- +-- Name: fk_ip_infos_city_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY ip_infos + ADD CONSTRAINT fk_ip_infos_city_id FOREIGN KEY (city_id) REFERENCES cities(id) DEFERRABLE; + + +-- +-- Name: fk_news_company_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY news + ADD CONSTRAINT fk_news_company_id FOREIGN KEY (company_id) REFERENCES companies(id) DEFERRABLE; + + +-- +-- Name: fk_news_regions_region_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY news_regions + ADD CONSTRAINT fk_news_regions_region_id FOREIGN KEY (region_id) REFERENCES regions(id) DEFERRABLE; + + +-- +-- Name: fk_news_regions_zones_news_region_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY news_regions_zones + ADD CONSTRAINT fk_news_regions_zones_news_region_id FOREIGN KEY (news_region_id) REFERENCES news_regions(id) ON UPDATE CASCADE ON DELETE CASCADE; + + +-- +-- Name: fk_news_regions_zones_news_zone_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY news_regions_zones + ADD CONSTRAINT fk_news_regions_zones_news_zone_id FOREIGN KEY (news_zone_id) REFERENCES news_zones(id) ON UPDATE CASCADE ON DELETE CASCADE; + + +-- +-- Name: fk_news_updated_by; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY news + ADD CONSTRAINT fk_news_updated_by FOREIGN KEY (updated_by) REFERENCES users(id) DEFERRABLE; + + +-- +-- Name: fk_online_store_product_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY old_online_store_products_merge_errors + ADD CONSTRAINT fk_online_store_product_id FOREIGN KEY (online_store_product_id) REFERENCES old_online_store_products(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE; + + +-- +-- Name: fk_online_users_user_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY online_users + ADD CONSTRAINT fk_online_users_user_id FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE DEFERRABLE; + + +-- +-- Name: fk_packet_region_settings_packet_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY packet_region_settings + ADD CONSTRAINT fk_packet_region_settings_packet_id FOREIGN KEY (packet_id) REFERENCES packets(id) ON DELETE CASCADE; + + +-- +-- Name: fk_packet_region_settings_region_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY packet_region_settings + ADD CONSTRAINT fk_packet_region_settings_region_id FOREIGN KEY (region_id) REFERENCES regions(id) ON DELETE CASCADE; + + +-- +-- Name: fk_page_descriptions_region_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY page_descriptions + ADD CONSTRAINT fk_page_descriptions_region_id FOREIGN KEY (region_id) REFERENCES regions(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE; + + +-- +-- Name: fk_page_industries_industry_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY cms_page_industries_backup + ADD CONSTRAINT fk_page_industries_industry_id FOREIGN KEY (industry_id) REFERENCES industries_backup(id) DEFERRABLE; + + +-- +-- Name: fk_phone_company_event_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY event_phones + ADD CONSTRAINT fk_phone_company_event_id FOREIGN KEY (company_event_id) REFERENCES company_events(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE; + + +-- +-- Name: fk_phones_address_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY phones + ADD CONSTRAINT fk_phones_address_id FOREIGN KEY (address_id) REFERENCES addresses(id) DEFERRABLE; + + +-- +-- Name: fk_phones_type_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY phones + ADD CONSTRAINT fk_phones_type_id FOREIGN KEY (type_id) REFERENCES phone_types(id) DEFERRABLE; + + +-- +-- Name: fk_product_announce_pattern_category_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY product_announce_patterns + ADD CONSTRAINT fk_product_announce_pattern_category_id FOREIGN KEY (product_announce_category_id) REFERENCES product_announce_categories(id) DEFERRABLE; + + +-- +-- Name: fk_product_deltas_company_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY product_deltas + ADD CONSTRAINT fk_product_deltas_company_id FOREIGN KEY (company_id) REFERENCES companies(id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: fk_product_groups_company_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY product_groups + ADD CONSTRAINT fk_product_groups_company_id FOREIGN KEY (company_id) REFERENCES companies(id) DEFERRABLE; + + +-- +-- Name: fk_product_regions_region_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY product_regions + ADD CONSTRAINT fk_product_regions_region_id FOREIGN KEY (region_id) REFERENCES regions(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: fk_product_url_names_product_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY product_url_names + ADD CONSTRAINT fk_product_url_names_product_id FOREIGN KEY (product_id) REFERENCES products(id) ON DELETE CASCADE DEFERRABLE; + + +-- +-- Name: fk_products_335_company_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY products + ADD CONSTRAINT fk_products_335_company_id FOREIGN KEY (company_id) REFERENCES companies(id) DEFERRABLE; + + +-- +-- Name: fk_provinces_country_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY provinces + ADD CONSTRAINT fk_provinces_country_id FOREIGN KEY (country_id) REFERENCES countries(id) DEFERRABLE; + + +-- +-- Name: fk_provinces_region_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY provinces + ADD CONSTRAINT fk_provinces_region_id FOREIGN KEY (region_id) REFERENCES regions(id) DEFERRABLE; + + +-- +-- Name: fk_region_contacts_region_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY region_contacts + ADD CONSTRAINT fk_region_contacts_region_id FOREIGN KEY (region_id) REFERENCES regions(id); + + +-- +-- Name: fk_region_contacts_user_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY region_contacts + ADD CONSTRAINT fk_region_contacts_user_id FOREIGN KEY (user_id) REFERENCES users(id); + + +-- +-- Name: fk_region_packets_region_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY region_packets + ADD CONSTRAINT fk_region_packets_region_id FOREIGN KEY (region_id) REFERENCES regions(id); + + +-- +-- Name: fk_regions_capital_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY regions + ADD CONSTRAINT fk_regions_capital_id FOREIGN KEY (capital_id) REFERENCES cities(id) DEFERRABLE; + + +-- +-- Name: fk_regions_parent_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY regions + ADD CONSTRAINT fk_regions_parent_id FOREIGN KEY (parent_id) REFERENCES regions(id) DEFERRABLE; + + +-- +-- Name: fk_rubric_industries_industry_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY rubric_industries_backup + ADD CONSTRAINT fk_rubric_industries_industry_id FOREIGN KEY (industry_id) REFERENCES industries_backup(id) DEFERRABLE; + + +-- +-- Name: fk_rubric_statistics_paid_region_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY rubric_statistics_paid + ADD CONSTRAINT fk_rubric_statistics_paid_region_id FOREIGN KEY (region_id) REFERENCES regions(id) DEFERRABLE; + + +-- +-- Name: fk_rubric_statistics_region_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY rubric_statistics + ADD CONSTRAINT fk_rubric_statistics_region_id FOREIGN KEY (region_id) REFERENCES regions(id) DEFERRABLE; + + +-- +-- Name: fk_search_index_companies_company_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY search_index_companies + ADD CONSTRAINT fk_search_index_companies_company_id FOREIGN KEY (company_id) REFERENCES companies(id) ON DELETE CASCADE DEFERRABLE; + + +-- +-- Name: fk_search_index_demands_demand_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY search_index_demands + ADD CONSTRAINT fk_search_index_demands_demand_id FOREIGN KEY (demand_id) REFERENCES demands(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: fk_search_index_price_list_rows_price_list_row_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY search_index_price_list_rows + ADD CONSTRAINT fk_search_index_price_list_rows_price_list_row_id FOREIGN KEY (price_list_row_id) REFERENCES price_list_rows(id) ON DELETE CASCADE DEFERRABLE; + + +-- +-- Name: fk_seo_entities_region_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY seo_entities + ADD CONSTRAINT fk_seo_entities_region_id FOREIGN KEY (region_id) REFERENCES regions(id); + + +-- +-- Name: fk_seo_entities_rubric_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY seo_entities + ADD CONSTRAINT fk_seo_entities_rubric_id FOREIGN KEY (rubric_id) REFERENCES rubrics(id) DEFERRABLE; + + +-- +-- Name: fk_seo_entity_modifications_seo_entity_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY seo_entity_modifications + ADD CONSTRAINT fk_seo_entity_modifications_seo_entity_id FOREIGN KEY (seo_entity_id) REFERENCES seo_entities(id) MATCH FULL ON UPDATE CASCADE ON DELETE CASCADE; + + +-- +-- Name: fk_seo_entity_modifications_user_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY seo_entity_modifications + ADD CONSTRAINT fk_seo_entity_modifications_user_id FOREIGN KEY (user_id) REFERENCES users(id) MATCH FULL ON UPDATE CASCADE ON DELETE CASCADE; + + +-- +-- Name: fk_seo_entity_wordforms_seo_entity_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY seo_entity_wordforms + ADD CONSTRAINT fk_seo_entity_wordforms_seo_entity_id FOREIGN KEY (seo_entity_id) REFERENCES seo_entities(id); + + +-- +-- Name: fk_showcase_images_parent_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY showcase_images + ADD CONSTRAINT fk_showcase_images_parent_id FOREIGN KEY (parent_id) REFERENCES showcase_images(id) DEFERRABLE; + + +-- +-- Name: fk_showcase_images_showcase_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY showcase_images + ADD CONSTRAINT fk_showcase_images_showcase_id FOREIGN KEY (showcase_id) REFERENCES showcases(id) DEFERRABLE; + + +-- +-- Name: fk_showcase_order_periods_showcase_order_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY showcase_order_periods + ADD CONSTRAINT fk_showcase_order_periods_showcase_order_id FOREIGN KEY (showcase_order_id) REFERENCES showcase_orders(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE; + + +-- +-- Name: fk_showcase_order_regions_region_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY showcase_order_regions + ADD CONSTRAINT fk_showcase_order_regions_region_id FOREIGN KEY (region_id) REFERENCES regions(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE; + + +-- +-- Name: fk_showcase_order_regions_showcase_order_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY showcase_order_regions + ADD CONSTRAINT fk_showcase_order_regions_showcase_order_id FOREIGN KEY (showcase_order_id) REFERENCES showcase_orders(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE; + + +-- +-- Name: fk_showcase_order_stats_showcase_order_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY showcase_order_stats + ADD CONSTRAINT fk_showcase_order_stats_showcase_order_id FOREIGN KEY (showcase_order_id) REFERENCES showcase_orders(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE; + + +-- +-- Name: fk_showcase_orders_showcase_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY showcase_orders + ADD CONSTRAINT fk_showcase_orders_showcase_id FOREIGN KEY (showcase_id) REFERENCES showcases(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE; + + +-- +-- Name: fk_showcases_company_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY showcases + ADD CONSTRAINT fk_showcases_company_id FOREIGN KEY (company_id) REFERENCES companies(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE; + + +-- +-- Name: fk_showcases_user_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY showcases + ADD CONSTRAINT fk_showcases_user_id FOREIGN KEY (user_id) REFERENCES users(id) ON UPDATE CASCADE ON DELETE SET NULL DEFERRABLE; + + +-- +-- Name: fk_snippet_rubrics_snippet_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY snippet_rubrics + ADD CONSTRAINT fk_snippet_rubrics_snippet_id FOREIGN KEY (snippet_id) REFERENCES snippets(id) ON UPDATE CASCADE ON DELETE CASCADE; + + +-- +-- Name: fk_streets_city_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY streets + ADD CONSTRAINT fk_streets_city_id FOREIGN KEY (city_id) REFERENCES cities(id) DEFERRABLE; + + +-- +-- Name: fk_streets_type_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY streets + ADD CONSTRAINT fk_streets_type_id FOREIGN KEY (type_id) REFERENCES street_types(id) DEFERRABLE; + + +-- +-- Name: fk_thematic_rubric_industries_industry_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY thematic_rubric_industries + ADD CONSTRAINT fk_thematic_rubric_industries_industry_id FOREIGN KEY (industry_id) REFERENCES industries(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE; + + +-- +-- Name: fk_thematic_rubric_industries_thematic_rubric_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY thematic_rubric_industries + ADD CONSTRAINT fk_thematic_rubric_industries_thematic_rubric_id FOREIGN KEY (thematic_rubric_id) REFERENCES thematic_rubrics(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE; + + +-- +-- Name: fk_thematic_rubric_links_target_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY thematic_rubric_links + ADD CONSTRAINT fk_thematic_rubric_links_target_id FOREIGN KEY (target_id) REFERENCES thematic_rubrics(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE; + + +-- +-- Name: fk_thematic_rubric_links_thematic_rubric_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY thematic_rubric_links + ADD CONSTRAINT fk_thematic_rubric_links_thematic_rubric_id FOREIGN KEY (thematic_rubric_id) REFERENCES thematic_rubrics(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE; + + +-- +-- Name: fk_thematic_rubrics_thematic_rubricator_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY thematic_rubrics + ADD CONSTRAINT fk_thematic_rubrics_thematic_rubricator_id FOREIGN KEY (thematic_rubricator_id) REFERENCES thematic_rubricators(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE; + + +-- +-- Name: fk_trait_products_product_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY trait_products + ADD CONSTRAINT fk_trait_products_product_id FOREIGN KEY (product_id) REFERENCES products(id) DEFERRABLE; + + +-- +-- Name: fk_trait_products_trait_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY trait_products + ADD CONSTRAINT fk_trait_products_trait_id FOREIGN KEY (trait_id) REFERENCES traits(id) DEFERRABLE; + + +-- +-- Name: fk_trait_products_trait_value_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY trait_products + ADD CONSTRAINT fk_trait_products_trait_value_id FOREIGN KEY (trait_value_id) REFERENCES trait_values(id) DEFERRABLE; + + +-- +-- Name: fk_trait_rubrics_trait_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY trait_rubrics + ADD CONSTRAINT fk_trait_rubrics_trait_id FOREIGN KEY (trait_id) REFERENCES traits(id) DEFERRABLE; + + +-- +-- Name: fk_trait_values_created_by; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY trait_values + ADD CONSTRAINT fk_trait_values_created_by FOREIGN KEY (created_by) REFERENCES users(id) DEFERRABLE; + + +-- +-- Name: fk_trait_values_moderator; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY trait_values + ADD CONSTRAINT fk_trait_values_moderator FOREIGN KEY (moderator) REFERENCES users(id) DEFERRABLE; + + +-- +-- Name: fk_trait_values_trait_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY trait_values + ADD CONSTRAINT fk_trait_values_trait_id FOREIGN KEY (trait_id) REFERENCES traits(id) DEFERRABLE; + + +-- +-- Name: fk_user_profiles_user_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY user_profiles + ADD CONSTRAINT fk_user_profiles_user_id FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE DEFERRABLE; + + +-- +-- Name: fk_user_roles_user_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY user_roles + ADD CONSTRAINT fk_user_roles_user_id FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE DEFERRABLE; + + +-- +-- Name: fk_user_settings_user_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY user_settings + ADD CONSTRAINT fk_user_settings_user_id FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE DEFERRABLE; + + +-- +-- Name: fk_wiki_page_versions_created_by; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY wiki_page_versions + ADD CONSTRAINT fk_wiki_page_versions_created_by FOREIGN KEY (created_by) REFERENCES users(id) ON UPDATE CASCADE ON DELETE CASCADE; + + +-- +-- Name: fk_wiki_page_versions_moderated_by; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY wiki_page_versions + ADD CONSTRAINT fk_wiki_page_versions_moderated_by FOREIGN KEY (moderated_by) REFERENCES users(id) ON UPDATE CASCADE ON DELETE CASCADE; + + +-- +-- Name: fk_wiki_page_versions_wiki_page_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY wiki_page_versions + ADD CONSTRAINT fk_wiki_page_versions_wiki_page_id FOREIGN KEY (wiki_page_id) REFERENCES wiki_pages(id) ON UPDATE CASCADE ON DELETE CASCADE; + + +-- +-- Name: fk_wiki_pages_region_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY wiki_pages + ADD CONSTRAINT fk_wiki_pages_region_id FOREIGN KEY (region_id) REFERENCES regions(id) ON UPDATE CASCADE ON DELETE CASCADE; + + +-- +-- Name: fk_wiki_pages_seo_entity_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY wiki_pages + ADD CONSTRAINT fk_wiki_pages_seo_entity_id FOREIGN KEY (seo_entity_id) REFERENCES seo_entities(id) ON UPDATE CASCADE ON DELETE CASCADE; + + +-- +-- Name: fk_yandex_map_coordinates_address_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY yandex_map_coordinates + ADD CONSTRAINT fk_yandex_map_coordinates_address_id FOREIGN KEY (address_id) REFERENCES addresses(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE; + + +-- +-- Name: fk_yandex_rubrics_pc_rubrics_company_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY company_yandex_rubrics + ADD CONSTRAINT fk_yandex_rubrics_pc_rubrics_company_id FOREIGN KEY (company_id) REFERENCES companies(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE; + + +-- +-- Name: fk_yandex_rubrics_pc_rubrics_yandex_rubric_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY yandex_rubrics_pc_rubrics + ADD CONSTRAINT fk_yandex_rubrics_pc_rubrics_yandex_rubric_id FOREIGN KEY (yandex_rubric_id) REFERENCES yandex_rubrics(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE; + + +-- +-- Name: fk_yandex_search_widgets_region_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY yandex_search_widgets + ADD CONSTRAINT fk_yandex_search_widgets_region_id FOREIGN KEY (region_id) REFERENCES regions(id) ON UPDATE CASCADE ON DELETE SET NULL DEFERRABLE; + + +-- +-- Name: franchise_user_regions_region_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY franchise_user_regions + ADD CONSTRAINT franchise_user_regions_region_id_fk FOREIGN KEY (region_id) REFERENCES regions(id) ON DELETE CASCADE; + + +-- +-- Name: franchise_user_regions_user_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY franchise_user_regions + ADD CONSTRAINT franchise_user_regions_user_id_fk FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE; + + +-- +-- Name: industry_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY useful_link_categories_industries + ADD CONSTRAINT industry_id_fk FOREIGN KEY (industry_id) REFERENCES industries(id) ON UPDATE CASCADE ON DELETE CASCADE; + + +-- +-- Name: map_address_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY addresses + ADD CONSTRAINT map_address_id_fk FOREIGN KEY (map_address_id) REFERENCES map_addresses(id) ON UPDATE CASCADE ON DELETE SET NULL; + + +-- +-- Name: osp_regions_osp_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY old_online_store_product_regions + ADD CONSTRAINT osp_regions_osp_id_fk FOREIGN KEY (online_store_product_id) REFERENCES old_online_store_products(id) ON DELETE CASCADE; + + +-- +-- Name: osp_regions_region_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY old_online_store_product_regions + ADD CONSTRAINT osp_regions_region_id_fk FOREIGN KEY (region_id) REFERENCES regions(id) ON DELETE CASCADE; + + +-- +-- Name: product_group_images_product_group_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY product_group_images + ADD CONSTRAINT product_group_images_product_group_id_fk FOREIGN KEY (product_group_id) REFERENCES product_groups(id); + + +-- +-- Name: region_footer_contacts_region_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY region_footer_contacts + ADD CONSTRAINT region_footer_contacts_region_id_fk FOREIGN KEY (region_id) REFERENCES regions(id) DEFERRABLE; + + +-- +-- Name: schedule_brake_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY company_schedules + ADD CONSTRAINT schedule_brake_id_fk FOREIGN KEY (schedule_brake_id) REFERENCES schedule_brakes(id) ON UPDATE CASCADE ON DELETE CASCADE; + + +-- +-- Name: schedule_day_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY company_schedules + ADD CONSTRAINT schedule_day_id_fk FOREIGN KEY (schedule_day_id) REFERENCES schedule_days(id) ON UPDATE CASCADE ON DELETE CASCADE; + + +-- +-- Name: schedule_time_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY company_schedules + ADD CONSTRAINT schedule_time_id_fk FOREIGN KEY (schedule_time_id) REFERENCES schedule_times(id) ON UPDATE CASCADE ON DELETE CASCADE; + + +-- +-- Name: street_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY map_address_candidates + ADD CONSTRAINT street_id_fk FOREIGN KEY (street_id) REFERENCES streets(id) ON UPDATE CASCADE ON DELETE CASCADE; + + +-- +-- Name: template_schemes_template_category_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY template_schemes + ADD CONSTRAINT template_schemes_template_category_id_fk FOREIGN KEY (template_category_id) REFERENCES template_categories(id); + + +-- +-- Name: test_packets_company_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY test_packets + ADD CONSTRAINT test_packets_company_id_fkey FOREIGN KEY (company_id) REFERENCES companies(id) ON DELETE CASCADE; + + +-- +-- Name: thematic_rubric_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY useful_link_categories_thematic_rubrics + ADD CONSTRAINT thematic_rubric_id_fk FOREIGN KEY (thematic_rubric_id) REFERENCES thematic_rubrics(id) ON UPDATE CASCADE ON DELETE CASCADE; + + +-- +-- Name: updated_user_fk; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY company_schedules + ADD CONSTRAINT updated_user_fk FOREIGN KEY (updated_user) REFERENCES users(id) ON UPDATE CASCADE ON DELETE SET NULL; + + +-- +-- Name: useful_link_category_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY useful_links + ADD CONSTRAINT useful_link_category_id_fk FOREIGN KEY (useful_link_category_id) REFERENCES useful_link_categories(id) ON UPDATE CASCADE ON DELETE CASCADE; + + +-- +-- Name: useful_link_category_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY useful_link_categories_industries + ADD CONSTRAINT useful_link_category_id_fk FOREIGN KEY (useful_link_category_id) REFERENCES useful_link_categories(id) ON UPDATE CASCADE ON DELETE CASCADE; + + +-- +-- Name: useful_link_category_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY useful_link_categories_thematic_rubrics + ADD CONSTRAINT useful_link_category_id_fk FOREIGN KEY (useful_link_category_id) REFERENCES useful_link_categories(id) ON UPDATE CASCADE ON DELETE CASCADE; + + +-- +-- Name: useful_link_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY useful_link_statistics + ADD CONSTRAINT useful_link_id_fk FOREIGN KEY (useful_link_id) REFERENCES useful_links(id) ON UPDATE CASCADE ON DELETE CASCADE; + + +-- +-- Name: village_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY streets + ADD CONSTRAINT village_id_fk FOREIGN KEY (village_id) REFERENCES villages(id) ON UPDATE CASCADE ON DELETE CASCADE; + + +-- +-- Name: yandex_regions_city_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY yandex_regions + ADD CONSTRAINT yandex_regions_city_id_fk FOREIGN KEY (city_id) REFERENCES cities(id) ON UPDATE CASCADE ON DELETE CASCADE; + + +SET search_path = search_hints, pg_catalog; + +-- +-- Name: fk_form_rubrics_form; Type: FK CONSTRAINT; Schema: search_hints; Owner: - +-- + +ALTER TABLE ONLY form_rubrics + ADD CONSTRAINT fk_form_rubrics_form FOREIGN KEY (form_id) REFERENCES forms(id) ON DELETE CASCADE; + + +-- +-- Name: fk_form_rubrics_form; Type: FK CONSTRAINT; Schema: search_hints; Owner: - +-- + +ALTER TABLE ONLY form_frequency + ADD CONSTRAINT fk_form_rubrics_form FOREIGN KEY (form_id) REFERENCES forms(id) ON DELETE CASCADE; + + +-- +-- Name: fk_forms_main_form; Type: FK CONSTRAINT; Schema: search_hints; Owner: - +-- + +ALTER TABLE ONLY forms + ADD CONSTRAINT fk_forms_main_form FOREIGN KEY (main_form_id) REFERENCES forms(id) ON DELETE CASCADE; + + +-- +-- Name: fk_forms_request; Type: FK CONSTRAINT; Schema: search_hints; Owner: - +-- + +ALTER TABLE ONLY forms + ADD CONSTRAINT fk_forms_request FOREIGN KEY (request_id) REFERENCES requests(id); + + +-- +-- Name: fk_search_hints.form_rubrics_trait_value_id; Type: FK CONSTRAINT; Schema: search_hints; Owner: - +-- + +ALTER TABLE ONLY form_rubrics + ADD CONSTRAINT "fk_search_hints.form_rubrics_trait_value_id" FOREIGN KEY (trait_value_id) REFERENCES public.trait_values(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +SET search_path = service_box, pg_catalog; + +-- +-- Name: fk_web_searchers_cs_wsearch_id; Type: FK CONSTRAINT; Schema: service_box; Owner: - +-- + +ALTER TABLE ONLY web_searchers_codes_stats + ADD CONSTRAINT fk_web_searchers_cs_wsearch_id FOREIGN KEY (web_searcher_id) REFERENCES web_searchers(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE; + + +SET search_path = statistics, pg_catalog; + +-- +-- Name: fk_statistics.entities_statistic_by_region_region_id; Type: FK CONSTRAINT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY entities_statistic_by_region + ADD CONSTRAINT "fk_statistics.entities_statistic_by_region_region_id" FOREIGN KEY (region_id) REFERENCES public.regions(id) ON UPDATE CASCADE ON DELETE CASCADE; + + +-- +-- Name: fk_statistics.entities_statistic_by_region_seo_entity_id; Type: FK CONSTRAINT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY entities_statistic_by_region + ADD CONSTRAINT "fk_statistics.entities_statistic_by_region_seo_entity_id" FOREIGN KEY (seo_entity_id) REFERENCES public.seo_entities(id) ON UPDATE CASCADE ON DELETE CASCADE; + + +-- +-- Name: fk_statistics.news_statistic_mainpage_by_days_news_id; Type: FK CONSTRAINT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY news_statistic_mainpage_by_days + ADD CONSTRAINT "fk_statistics.news_statistic_mainpage_by_days_news_id" FOREIGN KEY (news_id) REFERENCES public.news(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE; + + +-- +-- Name: fk_statistics.news_statistic_total_by_regions_news_id; Type: FK CONSTRAINT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY news_statistic_total_by_regions + ADD CONSTRAINT "fk_statistics.news_statistic_total_by_regions_news_id" FOREIGN KEY (news_id) REFERENCES public.news(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE; + + +-- +-- Name: fk_statistics.news_statistic_total_by_regions_region_id; Type: FK CONSTRAINT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY news_statistic_total_by_regions + ADD CONSTRAINT "fk_statistics.news_statistic_total_by_regions_region_id" FOREIGN KEY (region_id) REFERENCES public.regions(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE; + + +-- +-- Name: fk_statistics.news_statistic_totals_news_id; Type: FK CONSTRAINT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY news_statistic_totals + ADD CONSTRAINT "fk_statistics.news_statistic_totals_news_id" FOREIGN KEY (news_id) REFERENCES public.news(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE; + + +-- +-- Name: news_statistic_referers_by_months_news_id; Type: FK CONSTRAINT; Schema: statistics; Owner: - +-- + +ALTER TABLE ONLY news_statistic_referers_by_months + ADD CONSTRAINT news_statistic_referers_by_months_news_id FOREIGN KEY (news_id) REFERENCES public.news(id) ON DELETE CASCADE DEFERRABLE; + + +SET search_path = xls_import, pg_catalog; + +-- +-- Name: fk_xls_import.deleted_products_transaction_id; Type: FK CONSTRAINT; Schema: xls_import; Owner: - +-- + +ALTER TABLE ONLY deleted_products + ADD CONSTRAINT "fk_xls_import.deleted_products_transaction_id" FOREIGN KEY (transaction_id) REFERENCES transactions(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: fk_xls_import.parsed_rows_image_id; Type: FK CONSTRAINT; Schema: xls_import; Owner: - +-- + +ALTER TABLE ONLY parsed_rows + ADD CONSTRAINT "fk_xls_import.parsed_rows_image_id" FOREIGN KEY (image_id) REFERENCES public.product_images(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: fk_xls_import.parsed_rows_transaction_id; Type: FK CONSTRAINT; Schema: xls_import; Owner: - +-- + +ALTER TABLE ONLY parsed_rows + ADD CONSTRAINT "fk_xls_import.parsed_rows_transaction_id" FOREIGN KEY (transaction_id) REFERENCES transactions(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: fk_xls_import.transactions_company_id; Type: FK CONSTRAINT; Schema: xls_import; Owner: - +-- + +ALTER TABLE ONLY transactions + ADD CONSTRAINT "fk_xls_import.transactions_company_id" FOREIGN KEY (company_id) REFERENCES public.companies(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: fk_xls_import.transactions_user_id; Type: FK CONSTRAINT; Schema: xls_import; Owner: - +-- + +ALTER TABLE ONLY transactions + ADD CONSTRAINT "fk_xls_import.transactions_user_id" FOREIGN KEY (user_id) REFERENCES public.users(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- PostgreSQL database dump complete +-- + diff --git a/2.2/db/structure/migrations_data.sql b/2.2/db/structure/migrations_data.sql new file mode 100644 index 0000000..14ec1bc --- /dev/null +++ b/2.2/db/structure/migrations_data.sql @@ -0,0 +1,628 @@ +-- +-- PostgreSQL database dump +-- + +SET statement_timeout = 0; +SET client_encoding = 'UTF8'; +SET standard_conforming_strings = on; +SET check_function_bodies = false; +SET client_min_messages = warning; + +SET search_path = public, pg_catalog; + +-- +-- Data for Name: schema_migrations; Type: TABLE DATA; Schema: public; Owner: - +-- + +COPY schema_migrations (version) FROM stdin; +20110921083243 +20101228120957-core_useful_links +20110325105851-core_useful_links +20110526112156-core_useful_links +20110623165934-core_useful_links +20101229180525-core_map_addresses +20110303064636-core_map_addresses +20110405160910-core_map_addresses +20110405162926-core_map_addresses +20110405195753-core_map_addresses +20110521055135-core_map_addresses +20110408070853-core_company_video +20110329060715-core_company_video +20110316110140-core_company_video +20110209164224-core_company_video +20110131100218-core_company_video +20110418104233-core_company_video +20110124122737-core_company_schedules +20110209161256-core_company_schedules +20110507044356-core_company_schedules +20110130171416-core_company_industry +20110509124308-core_company_industry +20110510043219-core_company_industry +20110131100036-core_company_industry_listing +20110201133629-core_company_thematic_rubric +20110201135809-core_company_thematic_rubric +20110201173054-core_industries +20110201173055-core_industries +20110202071841-core_industries +20110327141130-core_industries +20110414101110-core_industries +20110208075947-core_company_mainpage_products +20110329085020-core_atlas +20110303075342-core_atlas +20110214115033-core_atlas +20110211102607-core_atlas +20110214133817-core_company_billing +20110216111853-core_company_industry_leaders +20110311063114-core_company_main_office +20110327063140-core_industry_management +20110327063130-core_industry_management +20110328181243-core_industry_management +20110514142259-core_industry_management +20110512051513-core +20110329120000-core +20110512052955-core +20110512075514-core +20110512080213-core +20110526061156-core +20110527095449-core +20110606093156-core +20110624094605-core +20110411060454 +20110422054231 +20110422054244 +20110425110647 +20110425110725 +20110426120835 +20110427113233 +20110505132814 +20110519052800 +20110616112030 +20110505184932 +20110514141921 +20110629092858 +20110706124358-core_company_reviews +20110706124606-core_company_reviews +20110707095927-core_company_reviews +20110707104143-core_company_reviews +20110711130204-core_rss +20110719034647-core_oferta_import +20110720102456-core_company_pricelist +20110722094723-core_company_documents +20110722132456-core_company_documents +20110920060150 +20110921055200 +20111006122357 +20111010103141 +20111013145409 +20111013151040 +20111014103945 +20111014110937 +20111017094337 +20111019125712 +20111020121548 +20111021095223 +20110624074303 +20111024091720 +20111027161403 +20111101113731 +20111107111919 +20111109095816 +20111110124732 +20111114084751 +20111115085133 +20111116100821 +20111117090212 +20111117103046 +20110915180727 +20110928083437 +20111014100552 +20111117144812 +20111118142736 +20111125123126 +20111128090922 +20111125121753 +20111129104233 +20111031113342 +20111205092208 +20111207102944 +20111202084801 +20111201095926 +20111202072305 +20111214082305 +20111219110244 +20111226072141 +20111228104233 +20111228105305 +20120111123921 +20120116120526 +20120117062806 +20120118085128 +20120118091326 +20120118094959 +20120118105729 +20120118112412 +20120119043231 +20120119111600 +20120124100224 +20120201092620 +20120124041909 +20120201064437 +20120202054050 +20120203052538 +20120203061320 +20120206034152 +20120206070913 +20120206125244 +20120207111225 +20120210110815 +20120215040523 +20120214102128 +20120214201057 +20120227035132 +20120224102656 +20120229063710 +20120302064557 +20120306123724 +20120307054601 +20120311040233 +20120311064941 +20120306064454 +20120313055620 +20120313071123 +20120313083831 +20120313094350 +20120315070740 +20120221165136 +20120326081656 +20120326081959 +20120327085020 +20120330143024 +20120402101652 +20120405132548 +20120409125634 +20120410121805 +20120411101405 +20120413064235 +20120424060717 +20120424040918 +20120425061735 +20120424153849 +20120503075325 +20120503135510 +20120511051954 +20120511053444 +20120514112722 +20120516110138 +20120517110248 +20120529200524 +20120523065112 +20120524042455 +20120601051356 +20120605105428 +20120613064106 +20120614094125 +20120608102018 +20120613115358 +20120618035813 +20120618084219 +20120618100007 +20120619120443 +20120620064507 +20120622100303 +20120627092448 +20120627122725 +20120628085222 +20120705054159 +20120706055027 +20120710083605 +20110928075312 +20111017043010 +20111017052228 +20111017061637 +20111017101110 +20111018094254 +20111104081048 +20111104101607 +20111229120801 +20120111114106 +20120113053435 +20120113071242 +20120116061509 +20120116105620 +20120124085149 +20120125104651 +20120126032409 +20120130073800 +20120203122207 +20120213095710 +20120302102442 +20120305051504 +20120424104418 +20120425041131 +20120425102642 +20120518071924 +20120601054455 +20120607041238 +20120617035052 +20120130065053 +20120130065055 +20120201082321 +20120326115214 +20120723055131 +20120803063423 +20120803145320 +20120810091507 +20120814102630 +20120815063751 +20120820092626 +20120823064456 +20120820042615 +20120820044640 +20110523010000 +20110523114940 +20110523121235 +20120831100640 +20120831102035 +20120905145450 +20120907110236 +20120911065148 +20120912143400 +20120925081644 +20120927085152 +20120927123217 +20120927131803 +20121003064241 +20121009055637 +20121022082704 +20121011080727 +20111110035932 +20111111061127 +20111115101954 +20111118091209 +20111122043915 +20111122051144 +20111212055243 +20111216062331 +20111229100359 +20120127134915 +20120202113950 +20120206064633 +20120207052335 +20120207070038 +20120207080221 +20120208090506 +20120208124829 +20120208144011 +20120210072834 +20120210072835 +20120210072837 +20120213082025 +20120216083128 +20120220043539 +20120220054542 +20120220054543 +20120222062949 +20120229053737 +20120302050825 +20120312050135 +20120319041923 +20120330054427 +20120412071822 +20120412101959 +20120413114111 +20120514092928 +20120614070824 +20120709073752 +20120822054406 +20120909054857 +20120910081108 +20120921051136 +20120928064323 +20121010131150 +20121010135824 +20121031171500 +20121119041203 +20121127093915 +20121207102131 +20121130113947 +20121130114449 +20121217085015 +20121220110703 +20121214051224 +20121217064142 +20130109130836 +20130110061946 +20130122054344 +20130131035434 +20130201122833 +20130201123012 +20130122084049 +20130128100547 +20130218075319 +20130221131924 +20130227045418 +20130305101921 +20130306105619 +20130306105711 +20130318073707 +20130325120456 +20130402073233 +20130409085610 +20130411065718 +20130411100446 +20130403042021 +20130415060730 +20130417041422 +20130429064230 +20130520052700 +20130520085438 +20130521121514 +20130529072115 +20130626063237 +20130701120311 +20130719105705 +20130911082645 +20131001111038 +20100902064947 +20110519070125 +20110526091425 +20110527071907 +20110527094606 +20110720060059 +20110720122251 +20110729034435 +20110801070810 +20110914110732 +20110920084356 +20110920101616 +20110926102730 +20111014103313 +20111014103314 +20111027094016 +20111103102338 +20111115095013 +20111118063410 +20111212121541 +20111213171115 +20120119094900 +20120207091257 +20120210120031 +20120220040642 +20120315133316 +20120319084607 +20120320105756 +20120320110252 +20120321053202 +20120413095243 +20120426064258 +20120426133612 +20120428040441 +20120502124145 +20120505044255 +20120515095548 +20120517064515 +20120524072123 +20120524094705 +20120529125911 +20120601131525 +20120613154516 +20120625040954 +20120625062430 +20120628072258 +20120629064219 +20120813061927 +20120823101017 +20120825140255 +20120830125615 +20120831071142 +20120910092416 +20120912055755 +20120914084516 +20120919062634 +20120926050200 +20121015035618 +20121015074812 +20121015100609 +20121019094742 +20121022123326 +20121105034252 +20121105052449 +20121106111349 +20121108055013 +20121115101318 +20121211111605 +20121217084147 +20121219124851 +20130118055650 +20130129122430 +20130130095529 +20130130150803 +20130201105101 +20130205110449 +20130326034642 +20130416082450 +20130425091704 +20130429063500 +20130430040825 +20130513111436 +20130531081431 +20130619060656 +20130701102917 +20130704090644 +20130708143354 +20130709094309 +20130718055047 +20130722073718 +20130724044053 +20130729093336 +20130802000009 +20130806104843 +20130807131549 +20130808094204 +20130809000001 +20130809000002 +20130812090746 +20130812125623 +20130816104332 +20130820095802 +20130823095859 +20130826133244 +20130827073945 +20130827080934 +20130902124607 +20130906074411 +20130911084050 +20130912122510 +20130916060349 +20130918112852 +20130918121452 +20120130105529 +20120228083851 +20120305102913 +20120321081028 +20120609123150 +20120618095559 +20120808124856 +20120809110229 +20120810091943 +20120816072350 +20120821104713 +20120821113840 +20120821134424 +20120822102209 +20120912044910 +20120925105532 +20121010061616 +20121018110128 +20121029103110 +20121031073544 +20130310110850 +20130701113416 +20130709053503 +20130809092234 +20120313104136 +20120423113050 +20120719054041 +20120817081005 +20120821130256 +20120827073234 +20120910062049 +20120917135233 +20121015054230 +20121015095916 +20121023051922 +20121108122550 +20121115113906 +20121120071133 +20121120130859 +20121220072206 +20121220073316 +20121226124253 +20121226125500 +20130116054104 +20130121081910 +20130131123318 +20130204115409 +20130204124100 +20130213080549 +20130218063743 +20130219104659 +20130221062955 +20130221070456 +20130222055919 +20130225081303 +20130226062149 +20130226074548 +20130304095851 +20130312092232 +20130402060654 +20130402061309 +20130403110543 +20130410105131 +20130423033341 +20130423105904 +20130430063307 +20130504092311 +20130506052246 +20130508105632 +20130731081951 +20130910105614 +20130910105615 +20130911101859 +20131029073630 +20131031141134 +20131107060724 +20131127114258 +20131206105905 +20131213132004 +20131216035453 +20131220131522 +20140117072738 +20140122065009 +20140204084729 +20140130044020 +20140205080622 +20140213081703 +20140214063822 +20140505031208 +20140514095851 +20140515055343 +20140522054520 +20140623123554 +20140625125712 +20140704103436 +20140710071502 +20140715054139 +20140715065709 +20140715070123 +20140729125346 +20140826134622 +20140820105633 +20140820110345 +20131122084401 +20140512050327 +20141008135004 +20141015103739 +20141030071204 +20141113070123 +20141016105124 +20140311120910 +20140418051824 +20141202083658 +20141202142708 +20140707114548 +20141218142832 +20141219130052 +20141228112433 +20150130051732 +20150130114513 +20150213112411 +20150219103229 +20150316100106 +20150316134422 +20150331091315 +20150515071247 +20131115051823 +20131115051824 +20140130112641 +20140428051238 +20150622125228 +20150703074837 +20150630132117 +20150630083535 +20150129092323 +20150212113334 +20150218113140 +20150728033027 +20131225030659 +20140113044423 +20140404062010 +20150916131404 +20150919111737 +\. + + +-- +-- PostgreSQL database dump complete +-- + diff --git a/2.2/db/structure/table_partitions_data.sql b/2.2/db/structure/table_partitions_data.sql new file mode 100644 index 0000000..fb1fbc6 --- /dev/null +++ b/2.2/db/structure/table_partitions_data.sql @@ -0,0 +1,654 @@ +-- +-- PostgreSQL database dump +-- + +SET statement_timeout = 0; +SET client_encoding = 'UTF8'; +SET standard_conforming_strings = on; +SET check_function_bodies = false; +SET client_min_messages = warning; + +SET search_path = system, pg_catalog; + +-- +-- Data for Name: table_partitions; Type: TABLE DATA; Schema: system; Owner: - +-- + +COPY table_partitions (master_table, partition_table, range_check, time_added) FROM stdin; +statistics.company_statistic_geo_by_months statistics.company_statistic_geo_by_months_09_04 [date] >= TIMESTAMP '2009-04-01 00:00:00' AND [date] < TIMESTAMP '2009-05-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_geo_by_months statistics.company_statistic_geo_by_months_09_05 [date] >= TIMESTAMP '2009-05-01 00:00:00' AND [date] < TIMESTAMP '2009-06-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_geo_by_months statistics.company_statistic_geo_by_months_09_06 [date] >= TIMESTAMP '2009-06-01 00:00:00' AND [date] < TIMESTAMP '2009-07-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_geo_by_months statistics.company_statistic_geo_by_months_09_07 [date] >= TIMESTAMP '2009-07-01 00:00:00' AND [date] < TIMESTAMP '2009-08-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_geo_by_months statistics.company_statistic_geo_by_months_09_08 [date] >= TIMESTAMP '2009-08-01 00:00:00' AND [date] < TIMESTAMP '2009-09-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_geo_by_months statistics.company_statistic_geo_by_months_09_09 [date] >= TIMESTAMP '2009-09-01 00:00:00' AND [date] < TIMESTAMP '2009-10-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_geo_by_months statistics.company_statistic_geo_by_months_09_10 [date] >= TIMESTAMP '2009-10-01 00:00:00' AND [date] < TIMESTAMP '2009-11-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_geo_by_months statistics.company_statistic_geo_by_months_09_11 [date] >= TIMESTAMP '2009-11-01 00:00:00' AND [date] < TIMESTAMP '2009-12-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_geo_by_months statistics.company_statistic_geo_by_months_09_12 [date] >= TIMESTAMP '2009-12-01 00:00:00' AND [date] < TIMESTAMP '2010-01-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_geo_by_months statistics.company_statistic_geo_by_months_10_01 [date] >= TIMESTAMP '2010-01-01 00:00:00' AND [date] < TIMESTAMP '2010-02-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_geo_by_months statistics.company_statistic_geo_by_months_10_02 [date] >= TIMESTAMP '2010-02-01 00:00:00' AND [date] < TIMESTAMP '2010-03-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_geo_by_months statistics.company_statistic_geo_by_months_10_03 [date] >= TIMESTAMP '2010-03-01 00:00:00' AND [date] < TIMESTAMP '2010-04-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_geo_by_months statistics.company_statistic_geo_by_months_10_04 [date] >= TIMESTAMP '2010-04-01 00:00:00' AND [date] < TIMESTAMP '2010-05-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_geo_by_months statistics.company_statistic_geo_by_months_10_05 [date] >= TIMESTAMP '2010-05-01 00:00:00' AND [date] < TIMESTAMP '2010-06-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_geo_by_months statistics.company_statistic_geo_by_months_10_06 [date] >= TIMESTAMP '2010-06-01 00:00:00' AND [date] < TIMESTAMP '2010-07-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_geo_by_months statistics.company_statistic_geo_by_months_10_07 [date] >= TIMESTAMP '2010-07-01 00:00:00' AND [date] < TIMESTAMP '2010-08-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_geo_by_months statistics.company_statistic_geo_by_months_10_08 [date] >= TIMESTAMP '2010-08-01 00:00:00' AND [date] < TIMESTAMP '2010-09-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_geo_by_months statistics.company_statistic_geo_by_months_10_09 [date] >= TIMESTAMP '2010-09-01 00:00:00' AND [date] < TIMESTAMP '2010-10-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_geo_by_months statistics.company_statistic_geo_by_months_10_10 [date] >= TIMESTAMP '2010-10-01 00:00:00' AND [date] < TIMESTAMP '2010-11-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_geo_by_months statistics.company_statistic_geo_by_months_10_11 [date] >= TIMESTAMP '2010-11-01 00:00:00' AND [date] < TIMESTAMP '2010-12-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_geo_by_weeks statistics.company_statistic_geo_by_weeks_09_04 [first_week_day] >= TIMESTAMP '2009-04-01 00:00:00' AND [first_week_day] < TIMESTAMP '2009-05-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_geo_by_weeks statistics.company_statistic_geo_by_weeks_09_05 [first_week_day] >= TIMESTAMP '2009-05-01 00:00:00' AND [first_week_day] < TIMESTAMP '2009-06-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_geo_by_weeks statistics.company_statistic_geo_by_weeks_09_06 [first_week_day] >= TIMESTAMP '2009-06-01 00:00:00' AND [first_week_day] < TIMESTAMP '2009-07-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_geo_by_weeks statistics.company_statistic_geo_by_weeks_09_07 [first_week_day] >= TIMESTAMP '2009-07-01 00:00:00' AND [first_week_day] < TIMESTAMP '2009-08-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_geo_by_weeks statistics.company_statistic_geo_by_weeks_09_08 [first_week_day] >= TIMESTAMP '2009-08-01 00:00:00' AND [first_week_day] < TIMESTAMP '2009-09-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_geo_by_weeks statistics.company_statistic_geo_by_weeks_09_09 [first_week_day] >= TIMESTAMP '2009-09-01 00:00:00' AND [first_week_day] < TIMESTAMP '2009-10-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_geo_by_weeks statistics.company_statistic_geo_by_weeks_09_10 [first_week_day] >= TIMESTAMP '2009-10-01 00:00:00' AND [first_week_day] < TIMESTAMP '2009-11-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_geo_by_weeks statistics.company_statistic_geo_by_weeks_09_11 [first_week_day] >= TIMESTAMP '2009-11-01 00:00:00' AND [first_week_day] < TIMESTAMP '2009-12-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_geo_by_weeks statistics.company_statistic_geo_by_weeks_09_12 [first_week_day] >= TIMESTAMP '2009-12-01 00:00:00' AND [first_week_day] < TIMESTAMP '2010-01-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_geo_by_weeks statistics.company_statistic_geo_by_weeks_10_01 [first_week_day] >= TIMESTAMP '2010-01-01 00:00:00' AND [first_week_day] < TIMESTAMP '2010-02-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_geo_by_weeks statistics.company_statistic_geo_by_weeks_10_02 [first_week_day] >= TIMESTAMP '2010-02-01 00:00:00' AND [first_week_day] < TIMESTAMP '2010-03-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_geo_by_weeks statistics.company_statistic_geo_by_weeks_10_03 [first_week_day] >= TIMESTAMP '2010-03-01 00:00:00' AND [first_week_day] < TIMESTAMP '2010-04-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_geo_by_weeks statistics.company_statistic_geo_by_weeks_10_04 [first_week_day] >= TIMESTAMP '2010-04-01 00:00:00' AND [first_week_day] < TIMESTAMP '2010-05-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_geo_by_weeks statistics.company_statistic_geo_by_weeks_10_05 [first_week_day] >= TIMESTAMP '2010-05-01 00:00:00' AND [first_week_day] < TIMESTAMP '2010-06-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_geo_by_weeks statistics.company_statistic_geo_by_weeks_10_06 [first_week_day] >= TIMESTAMP '2010-06-01 00:00:00' AND [first_week_day] < TIMESTAMP '2010-07-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_total_by_months statistics.company_statistic_total_by_months_10_03 [date] >= TIMESTAMP '2010-03-01 00:00:00' AND [date] < TIMESTAMP '2010-04-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_geo_by_weeks statistics.company_statistic_geo_by_weeks_10_07 [first_week_day] >= TIMESTAMP '2010-07-01 00:00:00' AND [first_week_day] < TIMESTAMP '2010-08-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_geo_by_weeks statistics.company_statistic_geo_by_weeks_10_08 [first_week_day] >= TIMESTAMP '2010-08-01 00:00:00' AND [first_week_day] < TIMESTAMP '2010-09-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_geo_by_weeks statistics.company_statistic_geo_by_weeks_10_09 [first_week_day] >= TIMESTAMP '2010-09-01 00:00:00' AND [first_week_day] < TIMESTAMP '2010-10-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_geo_by_weeks statistics.company_statistic_geo_by_weeks_10_10 [first_week_day] >= TIMESTAMP '2010-10-01 00:00:00' AND [first_week_day] < TIMESTAMP '2010-11-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_geo_by_weeks statistics.company_statistic_geo_by_weeks_10_11 [first_week_day] >= TIMESTAMP '2010-11-01 00:00:00' AND [first_week_day] < TIMESTAMP '2010-12-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_pages_by_months statistics.company_statistic_pages_by_months_09_04 [date] >= TIMESTAMP '2009-04-01 00:00:00' AND [date] < TIMESTAMP '2009-05-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_pages_by_months statistics.company_statistic_pages_by_months_09_05 [date] >= TIMESTAMP '2009-05-01 00:00:00' AND [date] < TIMESTAMP '2009-06-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_pages_by_months statistics.company_statistic_pages_by_months_09_06 [date] >= TIMESTAMP '2009-06-01 00:00:00' AND [date] < TIMESTAMP '2009-07-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_pages_by_months statistics.company_statistic_pages_by_months_09_07 [date] >= TIMESTAMP '2009-07-01 00:00:00' AND [date] < TIMESTAMP '2009-08-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_pages_by_months statistics.company_statistic_pages_by_months_09_08 [date] >= TIMESTAMP '2009-08-01 00:00:00' AND [date] < TIMESTAMP '2009-09-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_pages_by_months statistics.company_statistic_pages_by_months_09_09 [date] >= TIMESTAMP '2009-09-01 00:00:00' AND [date] < TIMESTAMP '2009-10-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_pages_by_months statistics.company_statistic_pages_by_months_09_10 [date] >= TIMESTAMP '2009-10-01 00:00:00' AND [date] < TIMESTAMP '2009-11-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_pages_by_months statistics.company_statistic_pages_by_months_09_11 [date] >= TIMESTAMP '2009-11-01 00:00:00' AND [date] < TIMESTAMP '2009-12-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_pages_by_months statistics.company_statistic_pages_by_months_09_12 [date] >= TIMESTAMP '2009-12-01 00:00:00' AND [date] < TIMESTAMP '2010-01-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_pages_by_months statistics.company_statistic_pages_by_months_10_01 [date] >= TIMESTAMP '2010-01-01 00:00:00' AND [date] < TIMESTAMP '2010-02-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_pages_by_months statistics.company_statistic_pages_by_months_10_02 [date] >= TIMESTAMP '2010-02-01 00:00:00' AND [date] < TIMESTAMP '2010-03-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_pages_by_months statistics.company_statistic_pages_by_months_10_03 [date] >= TIMESTAMP '2010-03-01 00:00:00' AND [date] < TIMESTAMP '2010-04-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_pages_by_months statistics.company_statistic_pages_by_months_10_04 [date] >= TIMESTAMP '2010-04-01 00:00:00' AND [date] < TIMESTAMP '2010-05-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_pages_by_months statistics.company_statistic_pages_by_months_10_05 [date] >= TIMESTAMP '2010-05-01 00:00:00' AND [date] < TIMESTAMP '2010-06-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_pages_by_months statistics.company_statistic_pages_by_months_10_06 [date] >= TIMESTAMP '2010-06-01 00:00:00' AND [date] < TIMESTAMP '2010-07-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_pages_by_months statistics.company_statistic_pages_by_months_10_07 [date] >= TIMESTAMP '2010-07-01 00:00:00' AND [date] < TIMESTAMP '2010-08-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_pages_by_months statistics.company_statistic_pages_by_months_10_08 [date] >= TIMESTAMP '2010-08-01 00:00:00' AND [date] < TIMESTAMP '2010-09-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_pages_by_months statistics.company_statistic_pages_by_months_10_09 [date] >= TIMESTAMP '2010-09-01 00:00:00' AND [date] < TIMESTAMP '2010-10-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_pages_by_months statistics.company_statistic_pages_by_months_10_10 [date] >= TIMESTAMP '2010-10-01 00:00:00' AND [date] < TIMESTAMP '2010-11-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_pages_by_months statistics.company_statistic_pages_by_months_10_11 [date] >= TIMESTAMP '2010-11-01 00:00:00' AND [date] < TIMESTAMP '2010-12-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_pages_by_weeks statistics.company_statistic_pages_by_weeks_09_04 [first_week_day] >= TIMESTAMP '2009-04-01 00:00:00' AND [first_week_day] < TIMESTAMP '2009-05-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_pages_by_weeks statistics.company_statistic_pages_by_weeks_09_05 [first_week_day] >= TIMESTAMP '2009-05-01 00:00:00' AND [first_week_day] < TIMESTAMP '2009-06-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_pages_by_weeks statistics.company_statistic_pages_by_weeks_09_06 [first_week_day] >= TIMESTAMP '2009-06-01 00:00:00' AND [first_week_day] < TIMESTAMP '2009-07-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_pages_by_weeks statistics.company_statistic_pages_by_weeks_09_07 [first_week_day] >= TIMESTAMP '2009-07-01 00:00:00' AND [first_week_day] < TIMESTAMP '2009-08-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_pages_by_weeks statistics.company_statistic_pages_by_weeks_09_08 [first_week_day] >= TIMESTAMP '2009-08-01 00:00:00' AND [first_week_day] < TIMESTAMP '2009-09-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_pages_by_weeks statistics.company_statistic_pages_by_weeks_09_09 [first_week_day] >= TIMESTAMP '2009-09-01 00:00:00' AND [first_week_day] < TIMESTAMP '2009-10-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_pages_by_weeks statistics.company_statistic_pages_by_weeks_09_10 [first_week_day] >= TIMESTAMP '2009-10-01 00:00:00' AND [first_week_day] < TIMESTAMP '2009-11-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_pages_by_weeks statistics.company_statistic_pages_by_weeks_09_11 [first_week_day] >= TIMESTAMP '2009-11-01 00:00:00' AND [first_week_day] < TIMESTAMP '2009-12-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_pages_by_weeks statistics.company_statistic_pages_by_weeks_09_12 [first_week_day] >= TIMESTAMP '2009-12-01 00:00:00' AND [first_week_day] < TIMESTAMP '2010-01-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_pages_by_weeks statistics.company_statistic_pages_by_weeks_10_01 [first_week_day] >= TIMESTAMP '2010-01-01 00:00:00' AND [first_week_day] < TIMESTAMP '2010-02-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_pages_by_weeks statistics.company_statistic_pages_by_weeks_10_02 [first_week_day] >= TIMESTAMP '2010-02-01 00:00:00' AND [first_week_day] < TIMESTAMP '2010-03-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_pages_by_weeks statistics.company_statistic_pages_by_weeks_10_03 [first_week_day] >= TIMESTAMP '2010-03-01 00:00:00' AND [first_week_day] < TIMESTAMP '2010-04-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_pages_by_weeks statistics.company_statistic_pages_by_weeks_10_04 [first_week_day] >= TIMESTAMP '2010-04-01 00:00:00' AND [first_week_day] < TIMESTAMP '2010-05-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_pages_by_weeks statistics.company_statistic_pages_by_weeks_10_05 [first_week_day] >= TIMESTAMP '2010-05-01 00:00:00' AND [first_week_day] < TIMESTAMP '2010-06-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_pages_by_weeks statistics.company_statistic_pages_by_weeks_10_06 [first_week_day] >= TIMESTAMP '2010-06-01 00:00:00' AND [first_week_day] < TIMESTAMP '2010-07-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_pages_by_weeks statistics.company_statistic_pages_by_weeks_10_07 [first_week_day] >= TIMESTAMP '2010-07-01 00:00:00' AND [first_week_day] < TIMESTAMP '2010-08-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_pages_by_weeks statistics.company_statistic_pages_by_weeks_10_08 [first_week_day] >= TIMESTAMP '2010-08-01 00:00:00' AND [first_week_day] < TIMESTAMP '2010-09-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_pages_by_weeks statistics.company_statistic_pages_by_weeks_10_09 [first_week_day] >= TIMESTAMP '2010-09-01 00:00:00' AND [first_week_day] < TIMESTAMP '2010-10-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_pages_by_weeks statistics.company_statistic_pages_by_weeks_10_10 [first_week_day] >= TIMESTAMP '2010-10-01 00:00:00' AND [first_week_day] < TIMESTAMP '2010-11-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_pages_by_weeks statistics.company_statistic_pages_by_weeks_10_11 [first_week_day] >= TIMESTAMP '2010-11-01 00:00:00' AND [first_week_day] < TIMESTAMP '2010-12-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_referers_by_months statistics.company_statistic_referers_by_months_09_07 [date] >= TIMESTAMP '2009-07-01 00:00:00' AND [date] < TIMESTAMP '2009-08-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_referers_by_months statistics.company_statistic_referers_by_months_09_08 [date] >= TIMESTAMP '2009-08-01 00:00:00' AND [date] < TIMESTAMP '2009-09-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_referers_by_months statistics.company_statistic_referers_by_months_09_09 [date] >= TIMESTAMP '2009-09-01 00:00:00' AND [date] < TIMESTAMP '2009-10-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_referers_by_months statistics.company_statistic_referers_by_months_09_10 [date] >= TIMESTAMP '2009-10-01 00:00:00' AND [date] < TIMESTAMP '2009-11-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_referers_by_months statistics.company_statistic_referers_by_months_09_11 [date] >= TIMESTAMP '2009-11-01 00:00:00' AND [date] < TIMESTAMP '2009-12-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_referers_by_months statistics.company_statistic_referers_by_months_09_12 [date] >= TIMESTAMP '2009-12-01 00:00:00' AND [date] < TIMESTAMP '2010-01-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_referers_by_months statistics.company_statistic_referers_by_months_10_01 [date] >= TIMESTAMP '2010-01-01 00:00:00' AND [date] < TIMESTAMP '2010-02-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_referers_by_months statistics.company_statistic_referers_by_months_10_02 [date] >= TIMESTAMP '2010-02-01 00:00:00' AND [date] < TIMESTAMP '2010-03-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_referers_by_months statistics.company_statistic_referers_by_months_10_03 [date] >= TIMESTAMP '2010-03-01 00:00:00' AND [date] < TIMESTAMP '2010-04-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_referers_by_months statistics.company_statistic_referers_by_months_10_04 [date] >= TIMESTAMP '2010-04-01 00:00:00' AND [date] < TIMESTAMP '2010-05-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_referers_by_months statistics.company_statistic_referers_by_months_10_05 [date] >= TIMESTAMP '2010-05-01 00:00:00' AND [date] < TIMESTAMP '2010-06-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_referers_by_months statistics.company_statistic_referers_by_months_10_06 [date] >= TIMESTAMP '2010-06-01 00:00:00' AND [date] < TIMESTAMP '2010-07-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_referers_by_months statistics.company_statistic_referers_by_months_10_07 [date] >= TIMESTAMP '2010-07-01 00:00:00' AND [date] < TIMESTAMP '2010-08-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_referers_by_months statistics.company_statistic_referers_by_months_10_08 [date] >= TIMESTAMP '2010-08-01 00:00:00' AND [date] < TIMESTAMP '2010-09-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_referers_by_months statistics.company_statistic_referers_by_months_10_09 [date] >= TIMESTAMP '2010-09-01 00:00:00' AND [date] < TIMESTAMP '2010-10-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_referers_by_months statistics.company_statistic_referers_by_months_10_10 [date] >= TIMESTAMP '2010-10-01 00:00:00' AND [date] < TIMESTAMP '2010-11-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_referers_by_months statistics.company_statistic_referers_by_months_10_11 [date] >= TIMESTAMP '2010-11-01 00:00:00' AND [date] < TIMESTAMP '2010-12-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_referers_by_weeks statistics.company_statistic_referers_by_weeks_09_06 [first_week_day] >= TIMESTAMP '2009-06-01 00:00:00' AND [first_week_day] < TIMESTAMP '2009-07-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_referers_by_weeks statistics.company_statistic_referers_by_weeks_09_07 [first_week_day] >= TIMESTAMP '2009-07-01 00:00:00' AND [first_week_day] < TIMESTAMP '2009-08-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_referers_by_weeks statistics.company_statistic_referers_by_weeks_09_08 [first_week_day] >= TIMESTAMP '2009-08-01 00:00:00' AND [first_week_day] < TIMESTAMP '2009-09-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_referers_by_weeks statistics.company_statistic_referers_by_weeks_09_09 [first_week_day] >= TIMESTAMP '2009-09-01 00:00:00' AND [first_week_day] < TIMESTAMP '2009-10-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_referers_by_weeks statistics.company_statistic_referers_by_weeks_09_10 [first_week_day] >= TIMESTAMP '2009-10-01 00:00:00' AND [first_week_day] < TIMESTAMP '2009-11-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_referers_by_weeks statistics.company_statistic_referers_by_weeks_09_11 [first_week_day] >= TIMESTAMP '2009-11-01 00:00:00' AND [first_week_day] < TIMESTAMP '2009-12-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_referers_by_weeks statistics.company_statistic_referers_by_weeks_09_12 [first_week_day] >= TIMESTAMP '2009-12-01 00:00:00' AND [first_week_day] < TIMESTAMP '2010-01-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_referers_by_weeks statistics.company_statistic_referers_by_weeks_10_01 [first_week_day] >= TIMESTAMP '2010-01-01 00:00:00' AND [first_week_day] < TIMESTAMP '2010-02-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_referers_by_weeks statistics.company_statistic_referers_by_weeks_10_02 [first_week_day] >= TIMESTAMP '2010-02-01 00:00:00' AND [first_week_day] < TIMESTAMP '2010-03-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_referers_by_weeks statistics.company_statistic_referers_by_weeks_10_03 [first_week_day] >= TIMESTAMP '2010-03-01 00:00:00' AND [first_week_day] < TIMESTAMP '2010-04-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_referers_by_weeks statistics.company_statistic_referers_by_weeks_10_04 [first_week_day] >= TIMESTAMP '2010-04-01 00:00:00' AND [first_week_day] < TIMESTAMP '2010-05-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_referers_by_weeks statistics.company_statistic_referers_by_weeks_10_05 [first_week_day] >= TIMESTAMP '2010-05-01 00:00:00' AND [first_week_day] < TIMESTAMP '2010-06-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_referers_by_weeks statistics.company_statistic_referers_by_weeks_10_06 [first_week_day] >= TIMESTAMP '2010-06-01 00:00:00' AND [first_week_day] < TIMESTAMP '2010-07-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_referers_by_weeks statistics.company_statistic_referers_by_weeks_10_07 [first_week_day] >= TIMESTAMP '2010-07-01 00:00:00' AND [first_week_day] < TIMESTAMP '2010-08-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_referers_by_weeks statistics.company_statistic_referers_by_weeks_10_08 [first_week_day] >= TIMESTAMP '2010-08-01 00:00:00' AND [first_week_day] < TIMESTAMP '2010-09-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_referers_by_weeks statistics.company_statistic_referers_by_weeks_10_09 [first_week_day] >= TIMESTAMP '2010-09-01 00:00:00' AND [first_week_day] < TIMESTAMP '2010-10-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_referers_by_weeks statistics.company_statistic_referers_by_weeks_10_10 [first_week_day] >= TIMESTAMP '2010-10-01 00:00:00' AND [first_week_day] < TIMESTAMP '2010-11-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_referers_by_weeks statistics.company_statistic_referers_by_weeks_10_11 [first_week_day] >= TIMESTAMP '2010-11-01 00:00:00' AND [first_week_day] < TIMESTAMP '2010-12-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_total_by_days statistics.company_statistic_total_by_days_09_11 [date] >= TIMESTAMP '2009-11-01 00:00:00' AND [date] < TIMESTAMP '2009-12-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_total_by_days statistics.company_statistic_total_by_days_09_12 [date] >= TIMESTAMP '2009-12-01 00:00:00' AND [date] < TIMESTAMP '2010-01-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_total_by_days statistics.company_statistic_total_by_days_10_01 [date] >= TIMESTAMP '2010-01-01 00:00:00' AND [date] < TIMESTAMP '2010-02-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_total_by_days statistics.company_statistic_total_by_days_10_02 [date] >= TIMESTAMP '2010-02-01 00:00:00' AND [date] < TIMESTAMP '2010-03-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_total_by_days statistics.company_statistic_total_by_days_10_03 [date] >= TIMESTAMP '2010-03-01 00:00:00' AND [date] < TIMESTAMP '2010-04-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_total_by_days statistics.company_statistic_total_by_days_10_04 [date] >= TIMESTAMP '2010-04-01 00:00:00' AND [date] < TIMESTAMP '2010-05-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_total_by_days statistics.company_statistic_total_by_days_10_05 [date] >= TIMESTAMP '2010-05-01 00:00:00' AND [date] < TIMESTAMP '2010-06-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_total_by_days statistics.company_statistic_total_by_days_10_06 [date] >= TIMESTAMP '2010-06-01 00:00:00' AND [date] < TIMESTAMP '2010-07-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_total_by_days statistics.company_statistic_total_by_days_10_07 [date] >= TIMESTAMP '2010-07-01 00:00:00' AND [date] < TIMESTAMP '2010-08-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_total_by_days statistics.company_statistic_total_by_days_10_08 [date] >= TIMESTAMP '2010-08-01 00:00:00' AND [date] < TIMESTAMP '2010-09-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_total_by_days statistics.company_statistic_total_by_days_10_09 [date] >= TIMESTAMP '2010-09-01 00:00:00' AND [date] < TIMESTAMP '2010-10-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_total_by_days statistics.company_statistic_total_by_days_10_10 [date] >= TIMESTAMP '2010-10-01 00:00:00' AND [date] < TIMESTAMP '2010-11-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_total_by_days statistics.company_statistic_total_by_days_10_11 [date] >= TIMESTAMP '2010-11-01 00:00:00' AND [date] < TIMESTAMP '2010-12-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_total_by_months statistics.company_statistic_total_by_months_09_04 [date] >= TIMESTAMP '2009-04-01 00:00:00' AND [date] < TIMESTAMP '2009-05-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_total_by_months statistics.company_statistic_total_by_months_09_05 [date] >= TIMESTAMP '2009-05-01 00:00:00' AND [date] < TIMESTAMP '2009-06-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_total_by_months statistics.company_statistic_total_by_months_09_06 [date] >= TIMESTAMP '2009-06-01 00:00:00' AND [date] < TIMESTAMP '2009-07-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_total_by_months statistics.company_statistic_total_by_months_09_07 [date] >= TIMESTAMP '2009-07-01 00:00:00' AND [date] < TIMESTAMP '2009-08-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_total_by_months statistics.company_statistic_total_by_months_09_08 [date] >= TIMESTAMP '2009-08-01 00:00:00' AND [date] < TIMESTAMP '2009-09-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_total_by_months statistics.company_statistic_total_by_months_09_09 [date] >= TIMESTAMP '2009-09-01 00:00:00' AND [date] < TIMESTAMP '2009-10-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_total_by_months statistics.company_statistic_total_by_months_09_10 [date] >= TIMESTAMP '2009-10-01 00:00:00' AND [date] < TIMESTAMP '2009-11-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_total_by_months statistics.company_statistic_total_by_months_09_11 [date] >= TIMESTAMP '2009-11-01 00:00:00' AND [date] < TIMESTAMP '2009-12-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_total_by_months statistics.company_statistic_total_by_months_09_12 [date] >= TIMESTAMP '2009-12-01 00:00:00' AND [date] < TIMESTAMP '2010-01-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_total_by_months statistics.company_statistic_total_by_months_10_01 [date] >= TIMESTAMP '2010-01-01 00:00:00' AND [date] < TIMESTAMP '2010-02-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_total_by_months statistics.company_statistic_total_by_months_10_02 [date] >= TIMESTAMP '2010-02-01 00:00:00' AND [date] < TIMESTAMP '2010-03-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_total_by_months statistics.company_statistic_total_by_months_10_04 [date] >= TIMESTAMP '2010-04-01 00:00:00' AND [date] < TIMESTAMP '2010-05-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_total_by_months statistics.company_statistic_total_by_months_10_05 [date] >= TIMESTAMP '2010-05-01 00:00:00' AND [date] < TIMESTAMP '2010-06-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_total_by_months statistics.company_statistic_total_by_months_10_06 [date] >= TIMESTAMP '2010-06-01 00:00:00' AND [date] < TIMESTAMP '2010-07-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_total_by_months statistics.company_statistic_total_by_months_10_07 [date] >= TIMESTAMP '2010-07-01 00:00:00' AND [date] < TIMESTAMP '2010-08-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_total_by_months statistics.company_statistic_total_by_months_10_08 [date] >= TIMESTAMP '2010-08-01 00:00:00' AND [date] < TIMESTAMP '2010-09-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_total_by_months statistics.company_statistic_total_by_months_10_09 [date] >= TIMESTAMP '2010-09-01 00:00:00' AND [date] < TIMESTAMP '2010-10-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_total_by_months statistics.company_statistic_total_by_months_10_10 [date] >= TIMESTAMP '2010-10-01 00:00:00' AND [date] < TIMESTAMP '2010-11-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_total_by_months statistics.company_statistic_total_by_months_10_11 [date] >= TIMESTAMP '2010-11-01 00:00:00' AND [date] < TIMESTAMP '2010-12-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_total_by_weeks statistics.company_statistic_total_by_weeks_09_04 [first_week_day] >= TIMESTAMP '2009-04-01 00:00:00' AND [first_week_day] < TIMESTAMP '2009-05-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_total_by_weeks statistics.company_statistic_total_by_weeks_09_05 [first_week_day] >= TIMESTAMP '2009-05-01 00:00:00' AND [first_week_day] < TIMESTAMP '2009-06-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_total_by_weeks statistics.company_statistic_total_by_weeks_09_06 [first_week_day] >= TIMESTAMP '2009-06-01 00:00:00' AND [first_week_day] < TIMESTAMP '2009-07-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_total_by_weeks statistics.company_statistic_total_by_weeks_09_07 [first_week_day] >= TIMESTAMP '2009-07-01 00:00:00' AND [first_week_day] < TIMESTAMP '2009-08-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_total_by_weeks statistics.company_statistic_total_by_weeks_09_08 [first_week_day] >= TIMESTAMP '2009-08-01 00:00:00' AND [first_week_day] < TIMESTAMP '2009-09-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_total_by_weeks statistics.company_statistic_total_by_weeks_09_09 [first_week_day] >= TIMESTAMP '2009-09-01 00:00:00' AND [first_week_day] < TIMESTAMP '2009-10-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_total_by_weeks statistics.company_statistic_total_by_weeks_09_10 [first_week_day] >= TIMESTAMP '2009-10-01 00:00:00' AND [first_week_day] < TIMESTAMP '2009-11-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_total_by_weeks statistics.company_statistic_total_by_weeks_09_11 [first_week_day] >= TIMESTAMP '2009-11-01 00:00:00' AND [first_week_day] < TIMESTAMP '2009-12-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_total_by_weeks statistics.company_statistic_total_by_weeks_09_12 [first_week_day] >= TIMESTAMP '2009-12-01 00:00:00' AND [first_week_day] < TIMESTAMP '2010-01-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_total_by_weeks statistics.company_statistic_total_by_weeks_10_01 [first_week_day] >= TIMESTAMP '2010-01-01 00:00:00' AND [first_week_day] < TIMESTAMP '2010-02-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_total_by_weeks statistics.company_statistic_total_by_weeks_10_02 [first_week_day] >= TIMESTAMP '2010-02-01 00:00:00' AND [first_week_day] < TIMESTAMP '2010-03-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_total_by_weeks statistics.company_statistic_total_by_weeks_10_03 [first_week_day] >= TIMESTAMP '2010-03-01 00:00:00' AND [first_week_day] < TIMESTAMP '2010-04-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_total_by_weeks statistics.company_statistic_total_by_weeks_10_04 [first_week_day] >= TIMESTAMP '2010-04-01 00:00:00' AND [first_week_day] < TIMESTAMP '2010-05-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_total_by_weeks statistics.company_statistic_total_by_weeks_10_05 [first_week_day] >= TIMESTAMP '2010-05-01 00:00:00' AND [first_week_day] < TIMESTAMP '2010-06-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_total_by_weeks statistics.company_statistic_total_by_weeks_10_06 [first_week_day] >= TIMESTAMP '2010-06-01 00:00:00' AND [first_week_day] < TIMESTAMP '2010-07-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_total_by_weeks statistics.company_statistic_total_by_weeks_10_07 [first_week_day] >= TIMESTAMP '2010-07-01 00:00:00' AND [first_week_day] < TIMESTAMP '2010-08-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_total_by_weeks statistics.company_statistic_total_by_weeks_10_08 [first_week_day] >= TIMESTAMP '2010-08-01 00:00:00' AND [first_week_day] < TIMESTAMP '2010-09-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_total_by_weeks statistics.company_statistic_total_by_weeks_10_09 [first_week_day] >= TIMESTAMP '2010-09-01 00:00:00' AND [first_week_day] < TIMESTAMP '2010-10-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_total_by_weeks statistics.company_statistic_total_by_weeks_10_10 [first_week_day] >= TIMESTAMP '2010-10-01 00:00:00' AND [first_week_day] < TIMESTAMP '2010-11-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_total_by_weeks statistics.company_statistic_total_by_weeks_10_11 [first_week_day] >= TIMESTAMP '2010-11-01 00:00:00' AND [first_week_day] < TIMESTAMP '2010-12-01 00:00:00' 2010-11-28 11:37:32.938783 +statistics.company_statistic_total_by_weeks statistics.company_statistic_total_by_weeks_10_12 [first_week_day] >= TIMESTAMP '2010-12-01 00:00:00' AND [first_week_day] < TIMESTAMP '2011-01-01 00:00:00' 2010-11-30 02:25:20.31766 +statistics.company_statistic_geo_by_weeks statistics.company_statistic_geo_by_weeks_10_12 [first_week_day] >= TIMESTAMP '2010-12-01 00:00:00' AND [first_week_day] < TIMESTAMP '2011-01-01 00:00:00' 2010-11-30 02:25:20.31766 +statistics.company_statistic_pages_by_weeks statistics.company_statistic_pages_by_weeks_10_12 [first_week_day] >= TIMESTAMP '2010-12-01 00:00:00' AND [first_week_day] < TIMESTAMP '2011-01-01 00:00:00' 2010-11-30 02:25:20.31766 +statistics.company_statistic_referers_by_weeks statistics.company_statistic_referers_by_weeks_10_12 [first_week_day] >= TIMESTAMP '2010-12-01 00:00:00' AND [first_week_day] < TIMESTAMP '2011-01-01 00:00:00' 2010-11-30 02:25:20.31766 +statistics.company_statistic_total_by_days statistics.company_statistic_total_by_days_10_12 [date] >= TIMESTAMP '2010-12-01 00:00:00' AND [date] < TIMESTAMP '2011-01-01 00:00:00' 2010-12-02 02:34:53.879808 +statistics.company_statistic_total_by_months statistics.company_statistic_total_by_months_10_12 [date] >= TIMESTAMP '2010-12-01 00:00:00' AND [date] < TIMESTAMP '2011-01-01 00:00:00' 2010-12-02 02:34:53.879808 +statistics.company_statistic_geo_by_months statistics.company_statistic_geo_by_months_10_12 [date] >= TIMESTAMP '2010-12-01 00:00:00' AND [date] < TIMESTAMP '2011-01-01 00:00:00' 2010-12-02 02:34:53.879808 +statistics.company_statistic_pages_by_months statistics.company_statistic_pages_by_months_10_12 [date] >= TIMESTAMP '2010-12-01 00:00:00' AND [date] < TIMESTAMP '2011-01-01 00:00:00' 2010-12-02 02:34:53.879808 +statistics.company_statistic_referers_by_months statistics.company_statistic_referers_by_months_10_12 [date] >= TIMESTAMP '2010-12-01 00:00:00' AND [date] < TIMESTAMP '2011-01-01 00:00:00' 2010-12-02 02:34:53.879808 +statistics.query_log statistics.query_log_10_07 [created_at] >= TIMESTAMP '2010-07-01 00:00:00' AND [created_at] < TIMESTAMP '2010-08-01 00:00:00' 2010-12-16 20:33:11.089166 +statistics.query_log statistics.query_log_10_08 [created_at] >= TIMESTAMP '2010-08-01 00:00:00' AND [created_at] < TIMESTAMP '2010-09-01 00:00:00' 2010-12-16 20:33:11.089166 +statistics.query_log statistics.query_log_10_09 [created_at] >= TIMESTAMP '2010-09-01 00:00:00' AND [created_at] < TIMESTAMP '2010-10-01 00:00:00' 2010-12-16 20:33:11.089166 +statistics.query_log statistics.query_log_10_10 [created_at] >= TIMESTAMP '2010-10-01 00:00:00' AND [created_at] < TIMESTAMP '2010-11-01 00:00:00' 2010-12-16 20:33:11.089166 +statistics.query_log statistics.query_log_10_11 [created_at] >= TIMESTAMP '2010-11-01 00:00:00' AND [created_at] < TIMESTAMP '2010-12-01 00:00:00' 2010-12-16 20:33:11.089166 +statistics.query_log statistics.query_log_10_12 [created_at] >= TIMESTAMP '2010-12-01 00:00:00' AND [created_at] < TIMESTAMP '2011-01-01 00:00:00' 2010-12-16 20:33:11.089166 +statistics.company_statistic_total_by_weeks statistics.company_statistic_total_by_weeks_11_01 [first_week_day] >= TIMESTAMP '2011-01-01 00:00:00' AND [first_week_day] < TIMESTAMP '2011-02-01 00:00:00' 2010-12-28 02:24:21.966126 +statistics.company_statistic_geo_by_weeks statistics.company_statistic_geo_by_weeks_11_01 [first_week_day] >= TIMESTAMP '2011-01-01 00:00:00' AND [first_week_day] < TIMESTAMP '2011-02-01 00:00:00' 2010-12-28 02:24:21.966126 +statistics.company_statistic_pages_by_weeks statistics.company_statistic_pages_by_weeks_11_01 [first_week_day] >= TIMESTAMP '2011-01-01 00:00:00' AND [first_week_day] < TIMESTAMP '2011-02-01 00:00:00' 2010-12-28 02:24:21.966126 +statistics.company_statistic_referers_by_weeks statistics.company_statistic_referers_by_weeks_11_01 [first_week_day] >= TIMESTAMP '2011-01-01 00:00:00' AND [first_week_day] < TIMESTAMP '2011-02-01 00:00:00' 2010-12-28 02:24:21.966126 +statistics.query_log statistics.query_log_11_01 [created_at] >= TIMESTAMP '2011-01-01 00:00:00' AND [created_at] < TIMESTAMP '2011-02-01 00:00:00' 2011-01-01 00:01:22.334309 +statistics.company_statistic_total_by_days statistics.company_statistic_total_by_days_11_01 [date] >= TIMESTAMP '2011-01-01 00:00:00' AND [date] < TIMESTAMP '2011-02-01 00:00:00' 2011-01-02 02:22:32.08608 +statistics.company_statistic_total_by_months statistics.company_statistic_total_by_months_11_01 [date] >= TIMESTAMP '2011-01-01 00:00:00' AND [date] < TIMESTAMP '2011-02-01 00:00:00' 2011-01-02 02:22:32.08608 +statistics.company_statistic_geo_by_months statistics.company_statistic_geo_by_months_11_01 [date] >= TIMESTAMP '2011-01-01 00:00:00' AND [date] < TIMESTAMP '2011-02-01 00:00:00' 2011-01-02 02:22:32.08608 +statistics.company_statistic_pages_by_months statistics.company_statistic_pages_by_months_11_01 [date] >= TIMESTAMP '2011-01-01 00:00:00' AND [date] < TIMESTAMP '2011-02-01 00:00:00' 2011-01-02 02:22:32.08608 +statistics.company_statistic_referers_by_months statistics.company_statistic_referers_by_months_11_01 [date] >= TIMESTAMP '2011-01-01 00:00:00' AND [date] < TIMESTAMP '2011-02-01 00:00:00' 2011-01-02 02:22:32.08608 +statistics.query_log statistics.query_log_11_02 [created_at] >= TIMESTAMP '2011-02-01 00:00:00' AND [created_at] < TIMESTAMP '2011-03-01 00:00:00' 2011-01-31 23:59:58.633475 +statistics.company_statistic_total_by_weeks statistics.company_statistic_total_by_weeks_11_02 [first_week_day] >= TIMESTAMP '2011-02-01 00:00:00' AND [first_week_day] < TIMESTAMP '2011-03-01 00:00:00' 2011-02-01 02:32:20.883508 +statistics.company_statistic_geo_by_weeks statistics.company_statistic_geo_by_weeks_11_02 [first_week_day] >= TIMESTAMP '2011-02-01 00:00:00' AND [first_week_day] < TIMESTAMP '2011-03-01 00:00:00' 2011-02-01 02:32:20.883508 +statistics.company_statistic_pages_by_weeks statistics.company_statistic_pages_by_weeks_11_02 [first_week_day] >= TIMESTAMP '2011-02-01 00:00:00' AND [first_week_day] < TIMESTAMP '2011-03-01 00:00:00' 2011-02-01 02:32:20.883508 +statistics.company_statistic_referers_by_weeks statistics.company_statistic_referers_by_weeks_11_02 [first_week_day] >= TIMESTAMP '2011-02-01 00:00:00' AND [first_week_day] < TIMESTAMP '2011-03-01 00:00:00' 2011-02-01 02:32:20.883508 +statistics.company_statistic_total_by_days statistics.company_statistic_total_by_days_11_02 [date] >= TIMESTAMP '2011-02-01 00:00:00' AND [date] < TIMESTAMP '2011-03-01 00:00:00' 2011-02-02 02:26:36.593577 +statistics.company_statistic_total_by_months statistics.company_statistic_total_by_months_11_02 [date] >= TIMESTAMP '2011-02-01 00:00:00' AND [date] < TIMESTAMP '2011-03-01 00:00:00' 2011-02-02 02:26:36.593577 +statistics.company_statistic_geo_by_months statistics.company_statistic_geo_by_months_11_02 [date] >= TIMESTAMP '2011-02-01 00:00:00' AND [date] < TIMESTAMP '2011-03-01 00:00:00' 2011-02-02 02:26:36.593577 +statistics.company_statistic_pages_by_months statistics.company_statistic_pages_by_months_11_02 [date] >= TIMESTAMP '2011-02-01 00:00:00' AND [date] < TIMESTAMP '2011-03-01 00:00:00' 2011-02-02 02:26:36.593577 +statistics.company_statistic_referers_by_months statistics.company_statistic_referers_by_months_11_02 [date] >= TIMESTAMP '2011-02-01 00:00:00' AND [date] < TIMESTAMP '2011-03-01 00:00:00' 2011-02-02 02:26:36.593577 +statistics.query_log statistics.query_log_11_03 [created_at] >= TIMESTAMP '2011-03-01 00:00:00' AND [created_at] < TIMESTAMP '2011-04-01 00:00:00' 2011-02-28 23:59:58.174829 +statistics.company_statistic_total_by_weeks statistics.company_statistic_total_by_weeks_11_03 [first_week_day] >= TIMESTAMP '2011-03-01 00:00:00' AND [first_week_day] < TIMESTAMP '2011-04-01 00:00:00' 2011-03-01 02:29:43.080361 +statistics.company_statistic_geo_by_weeks statistics.company_statistic_geo_by_weeks_11_03 [first_week_day] >= TIMESTAMP '2011-03-01 00:00:00' AND [first_week_day] < TIMESTAMP '2011-04-01 00:00:00' 2011-03-01 02:29:43.080361 +statistics.company_statistic_pages_by_weeks statistics.company_statistic_pages_by_weeks_11_03 [first_week_day] >= TIMESTAMP '2011-03-01 00:00:00' AND [first_week_day] < TIMESTAMP '2011-04-01 00:00:00' 2011-03-01 02:29:43.080361 +statistics.company_statistic_referers_by_weeks statistics.company_statistic_referers_by_weeks_11_03 [first_week_day] >= TIMESTAMP '2011-03-01 00:00:00' AND [first_week_day] < TIMESTAMP '2011-04-01 00:00:00' 2011-03-01 02:29:43.080361 +statistics.company_statistic_total_by_days statistics.company_statistic_total_by_days_11_03 [date] >= TIMESTAMP '2011-03-01 00:00:00' AND [date] < TIMESTAMP '2011-04-01 00:00:00' 2011-03-02 02:27:25.542329 +statistics.company_statistic_total_by_months statistics.company_statistic_total_by_months_11_03 [date] >= TIMESTAMP '2011-03-01 00:00:00' AND [date] < TIMESTAMP '2011-04-01 00:00:00' 2011-03-02 02:27:25.542329 +statistics.company_statistic_geo_by_months statistics.company_statistic_geo_by_months_11_03 [date] >= TIMESTAMP '2011-03-01 00:00:00' AND [date] < TIMESTAMP '2011-04-01 00:00:00' 2011-03-02 02:27:25.542329 +statistics.company_statistic_pages_by_months statistics.company_statistic_pages_by_months_11_03 [date] >= TIMESTAMP '2011-03-01 00:00:00' AND [date] < TIMESTAMP '2011-04-01 00:00:00' 2011-03-02 02:27:25.542329 +statistics.company_statistic_referers_by_months statistics.company_statistic_referers_by_months_11_03 [date] >= TIMESTAMP '2011-03-01 00:00:00' AND [date] < TIMESTAMP '2011-04-01 00:00:00' 2011-03-02 02:27:25.542329 +statistics.news_statistic_mainpage_by_days statistics.news_statistic_mainpage_by_days_11_10 [date] >= TIMESTAMP '2011-10-01 00:00:00' AND [date] < TIMESTAMP '2011-11-01 00:00:00' 2011-10-24 06:09:28.515726 +statistics.news_statistic_mainpage_by_days statistics.news_statistic_mainpage_by_days_11_11 [date] >= TIMESTAMP '2011-11-01 00:00:00' AND [date] < TIMESTAMP '2011-12-01 00:00:00' 2011-11-22 07:02:08.819392 +statistics.news_statistic_mainpage_by_days statistics.news_statistic_mainpage_by_days_11_12 [date] >= TIMESTAMP '2011-12-01 00:00:00' AND [date] < TIMESTAMP '2012-01-01 00:00:00' 2011-11-30 18:00:26.316183 +statistics.company_statistic_total_by_days statistics.company_statistic_total_by_days_11_11 [date] >= TIMESTAMP '2011-11-01 00:00:00' AND [date] < TIMESTAMP '2011-12-01 00:00:00' 2011-11-30 20:20:24.056415 +statistics.company_statistic_total_by_weeks statistics.company_statistic_total_by_weeks_11_11 [first_week_day] >= TIMESTAMP '2011-11-01 00:00:00' AND [first_week_day] < TIMESTAMP '2011-12-01 00:00:00' 2011-11-30 20:20:24.056415 +statistics.company_statistic_total_by_weeks statistics.company_statistic_total_by_weeks_11_12 [first_week_day] >= TIMESTAMP '2011-12-01 00:00:00' AND [first_week_day] < TIMESTAMP '2012-01-01 00:00:00' 2011-11-30 20:20:24.056415 +statistics.company_statistic_total_by_months statistics.company_statistic_total_by_months_11_11 [date] >= TIMESTAMP '2011-11-01 00:00:00' AND [date] < TIMESTAMP '2011-12-01 00:00:00' 2011-11-30 20:20:24.056415 +statistics.company_statistic_geo_by_weeks statistics.company_statistic_geo_by_weeks_11_11 [first_week_day] >= TIMESTAMP '2011-11-01 00:00:00' AND [first_week_day] < TIMESTAMP '2011-12-01 00:00:00' 2011-11-30 20:20:24.056415 +statistics.company_statistic_geo_by_weeks statistics.company_statistic_geo_by_weeks_11_12 [first_week_day] >= TIMESTAMP '2011-12-01 00:00:00' AND [first_week_day] < TIMESTAMP '2012-01-01 00:00:00' 2011-11-30 20:20:24.056415 +statistics.company_statistic_geo_by_months statistics.company_statistic_geo_by_months_11_11 [date] >= TIMESTAMP '2011-11-01 00:00:00' AND [date] < TIMESTAMP '2011-12-01 00:00:00' 2011-11-30 20:20:24.056415 +statistics.company_statistic_pages_by_weeks statistics.company_statistic_pages_by_weeks_11_11 [first_week_day] >= TIMESTAMP '2011-11-01 00:00:00' AND [first_week_day] < TIMESTAMP '2011-12-01 00:00:00' 2011-11-30 20:20:24.056415 +statistics.company_statistic_pages_by_weeks statistics.company_statistic_pages_by_weeks_11_12 [first_week_day] >= TIMESTAMP '2011-12-01 00:00:00' AND [first_week_day] < TIMESTAMP '2012-01-01 00:00:00' 2011-11-30 20:20:24.056415 +statistics.company_statistic_pages_by_months statistics.company_statistic_pages_by_months_11_11 [date] >= TIMESTAMP '2011-11-01 00:00:00' AND [date] < TIMESTAMP '2011-12-01 00:00:00' 2011-11-30 20:20:24.056415 +statistics.company_statistic_referers_by_weeks statistics.company_statistic_referers_by_weeks_11_11 [first_week_day] >= TIMESTAMP '2011-11-01 00:00:00' AND [first_week_day] < TIMESTAMP '2011-12-01 00:00:00' 2011-11-30 20:20:24.056415 +statistics.company_statistic_referers_by_weeks statistics.company_statistic_referers_by_weeks_11_12 [first_week_day] >= TIMESTAMP '2011-12-01 00:00:00' AND [first_week_day] < TIMESTAMP '2012-01-01 00:00:00' 2011-11-30 20:20:24.056415 +statistics.company_statistic_referers_by_months statistics.company_statistic_referers_by_months_11_11 [date] >= TIMESTAMP '2011-11-01 00:00:00' AND [date] < TIMESTAMP '2011-12-01 00:00:00' 2011-11-30 20:20:24.056415 +statistics.company_statistic_total_by_days statistics.company_statistic_total_by_days_11_12 [date] >= TIMESTAMP '2011-12-01 00:00:00' AND [date] < TIMESTAMP '2012-01-01 00:00:00' 2011-12-01 20:20:26.070639 +statistics.company_statistic_total_by_months statistics.company_statistic_total_by_months_11_12 [date] >= TIMESTAMP '2011-12-01 00:00:00' AND [date] < TIMESTAMP '2012-01-01 00:00:00' 2011-12-01 20:20:26.070639 +statistics.company_statistic_geo_by_months statistics.company_statistic_geo_by_months_11_12 [date] >= TIMESTAMP '2011-12-01 00:00:00' AND [date] < TIMESTAMP '2012-01-01 00:00:00' 2011-12-01 20:20:26.070639 +statistics.company_statistic_pages_by_months statistics.company_statistic_pages_by_months_11_12 [date] >= TIMESTAMP '2011-12-01 00:00:00' AND [date] < TIMESTAMP '2012-01-01 00:00:00' 2011-12-01 20:20:26.070639 +statistics.company_statistic_referers_by_months statistics.company_statistic_referers_by_months_11_12 [date] >= TIMESTAMP '2011-12-01 00:00:00' AND [date] < TIMESTAMP '2012-01-01 00:00:00' 2011-12-01 20:20:26.070639 +statistics.company_statistic_total_by_weeks statistics.company_statistic_total_by_weeks_12_01 [first_week_day] >= TIMESTAMP '2012-01-01 00:00:00' AND [first_week_day] < TIMESTAMP '2012-02-01 00:00:00' 2011-12-26 20:20:26.002179 +statistics.company_statistic_geo_by_weeks statistics.company_statistic_geo_by_weeks_12_01 [first_week_day] >= TIMESTAMP '2012-01-01 00:00:00' AND [first_week_day] < TIMESTAMP '2012-02-01 00:00:00' 2011-12-26 20:20:26.002179 +statistics.company_statistic_pages_by_weeks statistics.company_statistic_pages_by_weeks_12_01 [first_week_day] >= TIMESTAMP '2012-01-01 00:00:00' AND [first_week_day] < TIMESTAMP '2012-02-01 00:00:00' 2011-12-26 20:20:26.002179 +statistics.company_statistic_referers_by_weeks statistics.company_statistic_referers_by_weeks_12_01 [first_week_day] >= TIMESTAMP '2012-01-01 00:00:00' AND [first_week_day] < TIMESTAMP '2012-02-01 00:00:00' 2011-12-26 20:20:26.002179 +statistics.news_statistic_mainpage_by_days statistics.news_statistic_mainpage_by_days_12_01 [date] >= TIMESTAMP '2012-01-01 00:00:00' AND [date] < TIMESTAMP '2012-02-01 00:00:00' 2011-12-31 18:00:27.325314 +statistics.company_statistic_total_by_days statistics.company_statistic_total_by_days_12_01 [date] >= TIMESTAMP '2012-01-01 00:00:00' AND [date] < TIMESTAMP '2012-02-01 00:00:00' 2012-01-01 20:20:25.505567 +statistics.company_statistic_total_by_months statistics.company_statistic_total_by_months_12_01 [date] >= TIMESTAMP '2012-01-01 00:00:00' AND [date] < TIMESTAMP '2012-02-01 00:00:00' 2012-01-01 20:20:25.505567 +statistics.company_statistic_geo_by_months statistics.company_statistic_geo_by_months_12_01 [date] >= TIMESTAMP '2012-01-01 00:00:00' AND [date] < TIMESTAMP '2012-02-01 00:00:00' 2012-01-01 20:20:25.505567 +statistics.company_statistic_pages_by_months statistics.company_statistic_pages_by_months_12_01 [date] >= TIMESTAMP '2012-01-01 00:00:00' AND [date] < TIMESTAMP '2012-02-01 00:00:00' 2012-01-01 20:20:25.505567 +statistics.company_statistic_referers_by_months statistics.company_statistic_referers_by_months_12_01 [date] >= TIMESTAMP '2012-01-01 00:00:00' AND [date] < TIMESTAMP '2012-02-01 00:00:00' 2012-01-01 20:20:25.505567 +statistics.company_statistic_total_by_weeks statistics.company_statistic_total_by_weeks_12_02 [first_week_day] >= TIMESTAMP '2012-02-01 00:00:00' AND [first_week_day] < TIMESTAMP '2012-03-01 00:00:00' 2012-01-30 20:20:25.687602 +statistics.company_statistic_geo_by_weeks statistics.company_statistic_geo_by_weeks_12_02 [first_week_day] >= TIMESTAMP '2012-02-01 00:00:00' AND [first_week_day] < TIMESTAMP '2012-03-01 00:00:00' 2012-01-30 20:20:25.687602 +statistics.company_statistic_pages_by_weeks statistics.company_statistic_pages_by_weeks_12_02 [first_week_day] >= TIMESTAMP '2012-02-01 00:00:00' AND [first_week_day] < TIMESTAMP '2012-03-01 00:00:00' 2012-01-30 20:20:25.687602 +statistics.company_statistic_referers_by_weeks statistics.company_statistic_referers_by_weeks_12_02 [first_week_day] >= TIMESTAMP '2012-02-01 00:00:00' AND [first_week_day] < TIMESTAMP '2012-03-01 00:00:00' 2012-01-30 20:20:25.687602 +statistics.news_statistic_mainpage_by_days statistics.news_statistic_mainpage_by_days_12_02 [date] >= TIMESTAMP '2012-02-01 00:00:00' AND [date] < TIMESTAMP '2012-03-01 00:00:00' 2012-01-31 18:00:30.898892 +statistics.company_statistic_total_by_days statistics.company_statistic_total_by_days_12_02 [date] >= TIMESTAMP '2012-02-01 00:00:00' AND [date] < TIMESTAMP '2012-03-01 00:00:00' 2012-02-01 20:20:24.567406 +statistics.company_statistic_total_by_months statistics.company_statistic_total_by_months_12_02 [date] >= TIMESTAMP '2012-02-01 00:00:00' AND [date] < TIMESTAMP '2012-03-01 00:00:00' 2012-02-01 20:20:24.567406 +statistics.company_statistic_geo_by_months statistics.company_statistic_geo_by_months_12_02 [date] >= TIMESTAMP '2012-02-01 00:00:00' AND [date] < TIMESTAMP '2012-03-01 00:00:00' 2012-02-01 20:20:24.567406 +statistics.company_statistic_pages_by_months statistics.company_statistic_pages_by_months_12_02 [date] >= TIMESTAMP '2012-02-01 00:00:00' AND [date] < TIMESTAMP '2012-03-01 00:00:00' 2012-02-01 20:20:24.567406 +statistics.company_statistic_referers_by_months statistics.company_statistic_referers_by_months_12_02 [date] >= TIMESTAMP '2012-02-01 00:00:00' AND [date] < TIMESTAMP '2012-03-01 00:00:00' 2012-02-01 20:20:24.567406 +statistics.company_statistic_total_by_weeks statistics.company_statistic_total_by_weeks_12_03 [first_week_day] >= TIMESTAMP '2012-03-01 00:00:00' AND [first_week_day] < TIMESTAMP '2012-04-01 00:00:00' 2012-02-27 20:20:24.24402 +statistics.company_statistic_geo_by_weeks statistics.company_statistic_geo_by_weeks_12_03 [first_week_day] >= TIMESTAMP '2012-03-01 00:00:00' AND [first_week_day] < TIMESTAMP '2012-04-01 00:00:00' 2012-02-27 20:20:24.24402 +statistics.company_statistic_pages_by_weeks statistics.company_statistic_pages_by_weeks_12_03 [first_week_day] >= TIMESTAMP '2012-03-01 00:00:00' AND [first_week_day] < TIMESTAMP '2012-04-01 00:00:00' 2012-02-27 20:20:24.24402 +statistics.company_statistic_referers_by_weeks statistics.company_statistic_referers_by_weeks_12_03 [first_week_day] >= TIMESTAMP '2012-03-01 00:00:00' AND [first_week_day] < TIMESTAMP '2012-04-01 00:00:00' 2012-02-27 20:20:24.24402 +statistics.news_statistic_mainpage_by_days statistics.news_statistic_mainpage_by_days_12_03 [date] >= TIMESTAMP '2012-03-01 00:00:00' AND [date] < TIMESTAMP '2012-04-01 00:00:00' 2012-02-29 18:00:25.853974 +statistics.company_statistic_total_by_days statistics.company_statistic_total_by_days_12_03 [date] >= TIMESTAMP '2012-03-01 00:00:00' AND [date] < TIMESTAMP '2012-04-01 00:00:00' 2012-03-01 20:20:24.614882 +statistics.company_statistic_total_by_months statistics.company_statistic_total_by_months_12_03 [date] >= TIMESTAMP '2012-03-01 00:00:00' AND [date] < TIMESTAMP '2012-04-01 00:00:00' 2012-03-01 20:20:24.614882 +statistics.company_statistic_geo_by_months statistics.company_statistic_geo_by_months_12_03 [date] >= TIMESTAMP '2012-03-01 00:00:00' AND [date] < TIMESTAMP '2012-04-01 00:00:00' 2012-03-01 20:20:24.614882 +statistics.company_statistic_pages_by_months statistics.company_statistic_pages_by_months_12_03 [date] >= TIMESTAMP '2012-03-01 00:00:00' AND [date] < TIMESTAMP '2012-04-01 00:00:00' 2012-03-01 20:20:24.614882 +statistics.company_statistic_referers_by_months statistics.company_statistic_referers_by_months_12_03 [date] >= TIMESTAMP '2012-03-01 00:00:00' AND [date] < TIMESTAMP '2012-04-01 00:00:00' 2012-03-01 20:20:24.614882 +statistics.company_statistic_total_by_weeks statistics.company_statistic_total_by_weeks_12_04 [first_week_day] >= TIMESTAMP '2012-04-01 00:00:00' AND [first_week_day] < TIMESTAMP '2012-05-01 00:00:00' 2012-03-26 20:20:24.098482 +statistics.company_statistic_geo_by_weeks statistics.company_statistic_geo_by_weeks_12_04 [first_week_day] >= TIMESTAMP '2012-04-01 00:00:00' AND [first_week_day] < TIMESTAMP '2012-05-01 00:00:00' 2012-03-26 20:20:24.098482 +statistics.company_statistic_pages_by_weeks statistics.company_statistic_pages_by_weeks_12_04 [first_week_day] >= TIMESTAMP '2012-04-01 00:00:00' AND [first_week_day] < TIMESTAMP '2012-05-01 00:00:00' 2012-03-26 20:20:24.098482 +statistics.company_statistic_referers_by_weeks statistics.company_statistic_referers_by_weeks_12_04 [first_week_day] >= TIMESTAMP '2012-04-01 00:00:00' AND [first_week_day] < TIMESTAMP '2012-05-01 00:00:00' 2012-03-26 20:20:24.098482 +statistics.news_statistic_mainpage_by_days statistics.news_statistic_mainpage_by_days_12_04 [date] >= TIMESTAMP '2012-04-01 00:00:00' AND [date] < TIMESTAMP '2012-05-01 00:00:00' 2012-03-31 18:00:27.241257 +statistics.company_statistic_total_by_days statistics.company_statistic_total_by_days_12_04 [date] >= TIMESTAMP '2012-04-01 00:00:00' AND [date] < TIMESTAMP '2012-05-01 00:00:00' 2012-04-01 20:20:25.716256 +statistics.company_statistic_total_by_months statistics.company_statistic_total_by_months_12_04 [date] >= TIMESTAMP '2012-04-01 00:00:00' AND [date] < TIMESTAMP '2012-05-01 00:00:00' 2012-04-01 20:20:25.716256 +statistics.company_statistic_geo_by_months statistics.company_statistic_geo_by_months_12_04 [date] >= TIMESTAMP '2012-04-01 00:00:00' AND [date] < TIMESTAMP '2012-05-01 00:00:00' 2012-04-01 20:20:25.716256 +statistics.company_statistic_pages_by_months statistics.company_statistic_pages_by_months_12_04 [date] >= TIMESTAMP '2012-04-01 00:00:00' AND [date] < TIMESTAMP '2012-05-01 00:00:00' 2012-04-01 20:20:25.716256 +statistics.company_statistic_referers_by_months statistics.company_statistic_referers_by_months_12_04 [date] >= TIMESTAMP '2012-04-01 00:00:00' AND [date] < TIMESTAMP '2012-05-01 00:00:00' 2012-04-01 20:20:25.716256 +statistics.news_statistic_mainpage_by_days statistics.news_statistic_mainpage_by_days_12_05 [date] >= TIMESTAMP '2012-05-01 00:00:00' AND [date] < TIMESTAMP '2012-06-01 00:00:00' 2012-04-30 18:00:32.781931 +statistics.company_statistic_total_by_days statistics.company_statistic_total_by_days_12_05 [date] >= TIMESTAMP '2012-05-01 00:00:00' AND [date] < TIMESTAMP '2012-06-01 00:00:00' 2012-05-02 20:20:29.276451 +statistics.company_statistic_total_by_weeks statistics.company_statistic_total_by_weeks_12_05 [first_week_day] >= TIMESTAMP '2012-05-01 00:00:00' AND [first_week_day] < TIMESTAMP '2012-06-01 00:00:00' 2012-05-02 20:20:29.276451 +statistics.company_statistic_total_by_months statistics.company_statistic_total_by_months_12_05 [date] >= TIMESTAMP '2012-05-01 00:00:00' AND [date] < TIMESTAMP '2012-06-01 00:00:00' 2012-05-02 20:20:29.276451 +statistics.company_statistic_geo_by_weeks statistics.company_statistic_geo_by_weeks_12_05 [first_week_day] >= TIMESTAMP '2012-05-01 00:00:00' AND [first_week_day] < TIMESTAMP '2012-06-01 00:00:00' 2012-05-02 20:20:29.276451 +statistics.company_statistic_geo_by_months statistics.company_statistic_geo_by_months_12_05 [date] >= TIMESTAMP '2012-05-01 00:00:00' AND [date] < TIMESTAMP '2012-06-01 00:00:00' 2012-05-02 20:20:29.276451 +statistics.company_statistic_pages_by_weeks statistics.company_statistic_pages_by_weeks_12_05 [first_week_day] >= TIMESTAMP '2012-05-01 00:00:00' AND [first_week_day] < TIMESTAMP '2012-06-01 00:00:00' 2012-05-02 20:20:29.276451 +statistics.company_statistic_pages_by_months statistics.company_statistic_pages_by_months_12_05 [date] >= TIMESTAMP '2012-05-01 00:00:00' AND [date] < TIMESTAMP '2012-06-01 00:00:00' 2012-05-02 20:20:29.276451 +statistics.company_statistic_referers_by_weeks statistics.company_statistic_referers_by_weeks_12_05 [first_week_day] >= TIMESTAMP '2012-05-01 00:00:00' AND [first_week_day] < TIMESTAMP '2012-06-01 00:00:00' 2012-05-02 20:20:29.276451 +statistics.company_statistic_referers_by_months statistics.company_statistic_referers_by_months_12_05 [date] >= TIMESTAMP '2012-05-01 00:00:00' AND [date] < TIMESTAMP '2012-06-01 00:00:00' 2012-05-02 20:20:29.276451 +statistics.company_statistic_total_by_weeks statistics.company_statistic_total_by_weeks_12_06 [first_week_day] >= TIMESTAMP '2012-06-01 00:00:00' AND [first_week_day] < TIMESTAMP '2012-07-01 00:00:00' 2012-05-28 20:20:26.623583 +statistics.company_statistic_geo_by_weeks statistics.company_statistic_geo_by_weeks_12_06 [first_week_day] >= TIMESTAMP '2012-06-01 00:00:00' AND [first_week_day] < TIMESTAMP '2012-07-01 00:00:00' 2012-05-28 20:20:26.623583 +statistics.company_statistic_pages_by_weeks statistics.company_statistic_pages_by_weeks_12_06 [first_week_day] >= TIMESTAMP '2012-06-01 00:00:00' AND [first_week_day] < TIMESTAMP '2012-07-01 00:00:00' 2012-05-28 20:20:26.623583 +statistics.company_statistic_referers_by_weeks statistics.company_statistic_referers_by_weeks_12_06 [first_week_day] >= TIMESTAMP '2012-06-01 00:00:00' AND [first_week_day] < TIMESTAMP '2012-07-01 00:00:00' 2012-05-28 20:20:26.623583 +statistics.news_statistic_mainpage_by_days statistics.news_statistic_mainpage_by_days_12_06 [date] >= TIMESTAMP '2012-06-01 00:00:00' AND [date] < TIMESTAMP '2012-07-01 00:00:00' 2012-05-31 18:00:35.776965 +statistics.company_statistic_total_by_days statistics.company_statistic_total_by_days_12_06 [date] >= TIMESTAMP '2012-06-01 00:00:00' AND [date] < TIMESTAMP '2012-07-01 00:00:00' 2012-06-01 20:20:25.931734 +statistics.company_statistic_total_by_months statistics.company_statistic_total_by_months_12_06 [date] >= TIMESTAMP '2012-06-01 00:00:00' AND [date] < TIMESTAMP '2012-07-01 00:00:00' 2012-06-01 20:20:25.931734 +statistics.company_statistic_geo_by_months statistics.company_statistic_geo_by_months_12_06 [date] >= TIMESTAMP '2012-06-01 00:00:00' AND [date] < TIMESTAMP '2012-07-01 00:00:00' 2012-06-01 20:20:25.931734 +statistics.company_statistic_pages_by_months statistics.company_statistic_pages_by_months_12_06 [date] >= TIMESTAMP '2012-06-01 00:00:00' AND [date] < TIMESTAMP '2012-07-01 00:00:00' 2012-06-01 20:20:25.931734 +statistics.company_statistic_referers_by_months statistics.company_statistic_referers_by_months_12_06 [date] >= TIMESTAMP '2012-06-01 00:00:00' AND [date] < TIMESTAMP '2012-07-01 00:00:00' 2012-06-01 20:20:25.931734 +statistics.company_statistic_total_by_weeks statistics.company_statistic_total_by_weeks_12_07 [first_week_day] >= TIMESTAMP '2012-07-01 00:00:00' AND [first_week_day] < TIMESTAMP '2012-08-01 00:00:00' 2012-06-25 20:20:26.611296 +statistics.company_statistic_geo_by_weeks statistics.company_statistic_geo_by_weeks_12_07 [first_week_day] >= TIMESTAMP '2012-07-01 00:00:00' AND [first_week_day] < TIMESTAMP '2012-08-01 00:00:00' 2012-06-25 20:20:26.611296 +statistics.company_statistic_pages_by_weeks statistics.company_statistic_pages_by_weeks_12_07 [first_week_day] >= TIMESTAMP '2012-07-01 00:00:00' AND [first_week_day] < TIMESTAMP '2012-08-01 00:00:00' 2012-06-25 20:20:26.611296 +statistics.company_statistic_referers_by_weeks statistics.company_statistic_referers_by_weeks_12_07 [first_week_day] >= TIMESTAMP '2012-07-01 00:00:00' AND [first_week_day] < TIMESTAMP '2012-08-01 00:00:00' 2012-06-25 20:20:26.611296 +statistics.news_statistic_mainpage_by_days statistics.news_statistic_mainpage_by_days_12_07 [date] >= TIMESTAMP '2012-07-01 00:00:00' AND [date] < TIMESTAMP '2012-08-01 00:00:00' 2012-06-30 18:00:28.768025 +statistics.company_statistic_total_by_days statistics.company_statistic_total_by_days_12_07 [date] >= TIMESTAMP '2012-07-01 00:00:00' AND [date] < TIMESTAMP '2012-08-01 00:00:00' 2012-07-01 20:20:25.217841 +statistics.company_statistic_total_by_months statistics.company_statistic_total_by_months_12_07 [date] >= TIMESTAMP '2012-07-01 00:00:00' AND [date] < TIMESTAMP '2012-08-01 00:00:00' 2012-07-01 20:20:25.217841 +statistics.company_statistic_geo_by_months statistics.company_statistic_geo_by_months_12_07 [date] >= TIMESTAMP '2012-07-01 00:00:00' AND [date] < TIMESTAMP '2012-08-01 00:00:00' 2012-07-01 20:20:25.217841 +statistics.company_statistic_pages_by_months statistics.company_statistic_pages_by_months_12_07 [date] >= TIMESTAMP '2012-07-01 00:00:00' AND [date] < TIMESTAMP '2012-08-01 00:00:00' 2012-07-01 20:20:25.217841 +statistics.company_statistic_referers_by_months statistics.company_statistic_referers_by_months_12_07 [date] >= TIMESTAMP '2012-07-01 00:00:00' AND [date] < TIMESTAMP '2012-08-01 00:00:00' 2012-07-01 20:20:25.217841 +statistics.company_statistic_total_by_weeks statistics.company_statistic_total_by_weeks_12_08 [first_week_day] >= TIMESTAMP '2012-08-01 00:00:00' AND [first_week_day] < TIMESTAMP '2012-09-01 00:00:00' 2012-07-30 20:20:30.231643 +statistics.company_statistic_geo_by_weeks statistics.company_statistic_geo_by_weeks_12_08 [first_week_day] >= TIMESTAMP '2012-08-01 00:00:00' AND [first_week_day] < TIMESTAMP '2012-09-01 00:00:00' 2012-07-30 20:20:30.231643 +statistics.company_statistic_pages_by_weeks statistics.company_statistic_pages_by_weeks_12_08 [first_week_day] >= TIMESTAMP '2012-08-01 00:00:00' AND [first_week_day] < TIMESTAMP '2012-09-01 00:00:00' 2012-07-30 20:20:30.231643 +statistics.company_statistic_referers_by_weeks statistics.company_statistic_referers_by_weeks_12_08 [first_week_day] >= TIMESTAMP '2012-08-01 00:00:00' AND [first_week_day] < TIMESTAMP '2012-09-01 00:00:00' 2012-07-30 20:20:30.231643 +statistics.news_statistic_mainpage_by_days statistics.news_statistic_mainpage_by_days_12_08 [date] >= TIMESTAMP '2012-08-01 00:00:00' AND [date] < TIMESTAMP '2012-09-01 00:00:00' 2012-07-31 18:00:52.714173 +statistics.company_statistic_total_by_days statistics.company_statistic_total_by_days_12_08 [date] >= TIMESTAMP '2012-08-01 00:00:00' AND [date] < TIMESTAMP '2012-09-01 00:00:00' 2012-08-01 20:20:30.935891 +statistics.company_statistic_total_by_months statistics.company_statistic_total_by_months_12_08 [date] >= TIMESTAMP '2012-08-01 00:00:00' AND [date] < TIMESTAMP '2012-09-01 00:00:00' 2012-08-01 20:20:30.935891 +statistics.company_statistic_geo_by_months statistics.company_statistic_geo_by_months_12_08 [date] >= TIMESTAMP '2012-08-01 00:00:00' AND [date] < TIMESTAMP '2012-09-01 00:00:00' 2012-08-01 20:20:30.935891 +statistics.company_statistic_pages_by_months statistics.company_statistic_pages_by_months_12_08 [date] >= TIMESTAMP '2012-08-01 00:00:00' AND [date] < TIMESTAMP '2012-09-01 00:00:00' 2012-08-01 20:20:30.935891 +statistics.company_statistic_referers_by_months statistics.company_statistic_referers_by_months_12_08 [date] >= TIMESTAMP '2012-08-01 00:00:00' AND [date] < TIMESTAMP '2012-09-01 00:00:00' 2012-08-01 20:20:30.935891 +statistics.company_statistic_total_by_weeks statistics.company_statistic_total_by_weeks_12_09 [first_week_day] >= TIMESTAMP '2012-09-01 00:00:00' AND [first_week_day] < TIMESTAMP '2012-10-01 00:00:00' 2012-08-27 20:20:31.851034 +statistics.company_statistic_geo_by_weeks statistics.company_statistic_geo_by_weeks_12_09 [first_week_day] >= TIMESTAMP '2012-09-01 00:00:00' AND [first_week_day] < TIMESTAMP '2012-10-01 00:00:00' 2012-08-27 20:20:31.851034 +statistics.company_statistic_pages_by_weeks statistics.company_statistic_pages_by_weeks_12_09 [first_week_day] >= TIMESTAMP '2012-09-01 00:00:00' AND [first_week_day] < TIMESTAMP '2012-10-01 00:00:00' 2012-08-27 20:20:31.851034 +statistics.company_statistic_referers_by_weeks statistics.company_statistic_referers_by_weeks_12_09 [first_week_day] >= TIMESTAMP '2012-09-01 00:00:00' AND [first_week_day] < TIMESTAMP '2012-10-01 00:00:00' 2012-08-27 20:20:31.851034 +statistics.news_statistic_mainpage_by_days statistics.news_statistic_mainpage_by_days_12_09 [date] >= TIMESTAMP '2012-09-01 00:00:00' AND [date] < TIMESTAMP '2012-10-01 00:00:00' 2012-08-31 18:01:17.543553 +statistics.company_statistic_total_by_days statistics.company_statistic_total_by_days_12_09 [date] >= TIMESTAMP '2012-09-01 00:00:00' AND [date] < TIMESTAMP '2012-10-01 00:00:00' 2012-09-01 20:20:30.607419 +statistics.company_statistic_total_by_months statistics.company_statistic_total_by_months_12_09 [date] >= TIMESTAMP '2012-09-01 00:00:00' AND [date] < TIMESTAMP '2012-10-01 00:00:00' 2012-09-01 20:20:30.607419 +statistics.company_statistic_geo_by_months statistics.company_statistic_geo_by_months_12_09 [date] >= TIMESTAMP '2012-09-01 00:00:00' AND [date] < TIMESTAMP '2012-10-01 00:00:00' 2012-09-01 20:20:30.607419 +statistics.company_statistic_pages_by_months statistics.company_statistic_pages_by_months_12_09 [date] >= TIMESTAMP '2012-09-01 00:00:00' AND [date] < TIMESTAMP '2012-10-01 00:00:00' 2012-09-01 20:20:30.607419 +statistics.company_statistic_referers_by_months statistics.company_statistic_referers_by_months_12_09 [date] >= TIMESTAMP '2012-09-01 00:00:00' AND [date] < TIMESTAMP '2012-10-01 00:00:00' 2012-09-01 20:20:30.607419 +statistics.news_statistic_mainpage_by_days statistics.news_statistic_mainpage_by_days_12_10 [date] >= TIMESTAMP '2012-10-01 00:00:00' AND [date] < TIMESTAMP '2012-11-01 00:00:00' 2012-09-30 18:01:15.027692 +statistics.company_statistic_total_by_days statistics.company_statistic_total_by_days_12_10 [date] >= TIMESTAMP '2012-10-01 00:00:00' AND [date] < TIMESTAMP '2012-11-01 00:00:00' 2012-10-01 20:20:34.984894 +statistics.company_statistic_total_by_weeks statistics.company_statistic_total_by_weeks_12_10 [first_week_day] >= TIMESTAMP '2012-10-01 00:00:00' AND [first_week_day] < TIMESTAMP '2012-11-01 00:00:00' 2012-10-01 20:20:34.984894 +statistics.company_statistic_total_by_months statistics.company_statistic_total_by_months_12_10 [date] >= TIMESTAMP '2012-10-01 00:00:00' AND [date] < TIMESTAMP '2012-11-01 00:00:00' 2012-10-01 20:20:34.984894 +statistics.company_statistic_geo_by_weeks statistics.company_statistic_geo_by_weeks_12_10 [first_week_day] >= TIMESTAMP '2012-10-01 00:00:00' AND [first_week_day] < TIMESTAMP '2012-11-01 00:00:00' 2012-10-01 20:20:34.984894 +statistics.company_statistic_geo_by_months statistics.company_statistic_geo_by_months_12_10 [date] >= TIMESTAMP '2012-10-01 00:00:00' AND [date] < TIMESTAMP '2012-11-01 00:00:00' 2012-10-01 20:20:34.984894 +statistics.company_statistic_pages_by_weeks statistics.company_statistic_pages_by_weeks_12_10 [first_week_day] >= TIMESTAMP '2012-10-01 00:00:00' AND [first_week_day] < TIMESTAMP '2012-11-01 00:00:00' 2012-10-01 20:20:34.984894 +statistics.company_statistic_pages_by_months statistics.company_statistic_pages_by_months_12_10 [date] >= TIMESTAMP '2012-10-01 00:00:00' AND [date] < TIMESTAMP '2012-11-01 00:00:00' 2012-10-01 20:20:34.984894 +statistics.company_statistic_referers_by_weeks statistics.company_statistic_referers_by_weeks_12_10 [first_week_day] >= TIMESTAMP '2012-10-01 00:00:00' AND [first_week_day] < TIMESTAMP '2012-11-01 00:00:00' 2012-10-01 20:20:34.984894 +statistics.company_statistic_referers_by_months statistics.company_statistic_referers_by_months_12_10 [date] >= TIMESTAMP '2012-10-01 00:00:00' AND [date] < TIMESTAMP '2012-11-01 00:00:00' 2012-10-01 20:20:34.984894 +statistics.company_statistic_total_by_weeks statistics.company_statistic_total_by_weeks_12_11 [first_week_day] >= TIMESTAMP '2012-11-01 00:00:00' AND [first_week_day] < TIMESTAMP '2012-12-01 00:00:00' 2012-10-29 20:20:34.29393 +statistics.company_statistic_geo_by_weeks statistics.company_statistic_geo_by_weeks_12_11 [first_week_day] >= TIMESTAMP '2012-11-01 00:00:00' AND [first_week_day] < TIMESTAMP '2012-12-01 00:00:00' 2012-10-29 20:20:34.29393 +statistics.company_statistic_pages_by_weeks statistics.company_statistic_pages_by_weeks_12_11 [first_week_day] >= TIMESTAMP '2012-11-01 00:00:00' AND [first_week_day] < TIMESTAMP '2012-12-01 00:00:00' 2012-10-29 20:20:34.29393 +statistics.company_statistic_referers_by_weeks statistics.company_statistic_referers_by_weeks_12_11 [first_week_day] >= TIMESTAMP '2012-11-01 00:00:00' AND [first_week_day] < TIMESTAMP '2012-12-01 00:00:00' 2012-10-29 20:20:34.29393 +statistics.news_statistic_mainpage_by_days statistics.news_statistic_mainpage_by_days_12_11 [date] >= TIMESTAMP '2012-11-01 00:00:00' AND [date] < TIMESTAMP '2012-12-01 00:00:00' 2012-10-31 18:01:40.120062 +statistics.company_statistic_total_by_days statistics.company_statistic_total_by_days_12_11 [date] >= TIMESTAMP '2012-11-01 00:00:00' AND [date] < TIMESTAMP '2012-12-01 00:00:00' 2012-11-01 20:20:36.00698 +statistics.company_statistic_total_by_months statistics.company_statistic_total_by_months_12_11 [date] >= TIMESTAMP '2012-11-01 00:00:00' AND [date] < TIMESTAMP '2012-12-01 00:00:00' 2012-11-01 20:20:36.00698 +statistics.company_statistic_geo_by_months statistics.company_statistic_geo_by_months_12_11 [date] >= TIMESTAMP '2012-11-01 00:00:00' AND [date] < TIMESTAMP '2012-12-01 00:00:00' 2012-11-01 20:20:36.00698 +statistics.company_statistic_pages_by_months statistics.company_statistic_pages_by_months_12_11 [date] >= TIMESTAMP '2012-11-01 00:00:00' AND [date] < TIMESTAMP '2012-12-01 00:00:00' 2012-11-01 20:20:36.00698 +statistics.company_statistic_referers_by_months statistics.company_statistic_referers_by_months_12_11 [date] >= TIMESTAMP '2012-11-01 00:00:00' AND [date] < TIMESTAMP '2012-12-01 00:00:00' 2012-11-01 20:20:36.00698 +statistics.company_statistic_total_by_weeks statistics.company_statistic_total_by_weeks_12_12 [first_week_day] >= TIMESTAMP '2012-12-01 00:00:00' AND [first_week_day] < TIMESTAMP '2013-01-01 00:00:00' 2012-11-26 20:23:22.473467 +statistics.company_statistic_geo_by_weeks statistics.company_statistic_geo_by_weeks_12_12 [first_week_day] >= TIMESTAMP '2012-12-01 00:00:00' AND [first_week_day] < TIMESTAMP '2013-01-01 00:00:00' 2012-11-26 20:23:22.473467 +statistics.company_statistic_pages_by_weeks statistics.company_statistic_pages_by_weeks_12_12 [first_week_day] >= TIMESTAMP '2012-12-01 00:00:00' AND [first_week_day] < TIMESTAMP '2013-01-01 00:00:00' 2012-11-26 20:23:22.473467 +statistics.company_statistic_referers_by_weeks statistics.company_statistic_referers_by_weeks_12_12 [first_week_day] >= TIMESTAMP '2012-12-01 00:00:00' AND [first_week_day] < TIMESTAMP '2013-01-01 00:00:00' 2012-11-26 20:23:22.473467 +statistics.news_statistic_mainpage_by_days statistics.news_statistic_mainpage_by_days_12_12 [date] >= TIMESTAMP '2012-12-01 00:00:00' AND [date] < TIMESTAMP '2013-01-01 00:00:00' 2012-11-30 18:01:00.749502 +statistics.company_statistic_total_by_days statistics.company_statistic_total_by_days_12_12 [date] >= TIMESTAMP '2012-12-01 00:00:00' AND [date] < TIMESTAMP '2013-01-01 00:00:00' 2012-12-01 20:25:19.785811 +statistics.company_statistic_total_by_months statistics.company_statistic_total_by_months_12_12 [date] >= TIMESTAMP '2012-12-01 00:00:00' AND [date] < TIMESTAMP '2013-01-01 00:00:00' 2012-12-01 20:25:19.785811 +statistics.company_statistic_geo_by_months statistics.company_statistic_geo_by_months_12_12 [date] >= TIMESTAMP '2012-12-01 00:00:00' AND [date] < TIMESTAMP '2013-01-01 00:00:00' 2012-12-01 20:25:19.785811 +statistics.company_statistic_pages_by_months statistics.company_statistic_pages_by_months_12_12 [date] >= TIMESTAMP '2012-12-01 00:00:00' AND [date] < TIMESTAMP '2013-01-01 00:00:00' 2012-12-01 20:25:19.785811 +statistics.company_statistic_referers_by_months statistics.company_statistic_referers_by_months_12_12 [date] >= TIMESTAMP '2012-12-01 00:00:00' AND [date] < TIMESTAMP '2013-01-01 00:00:00' 2012-12-01 20:25:19.785811 +statistics.news_statistic_mainpage_by_days statistics.news_statistic_mainpage_by_days_13_01 [date] >= TIMESTAMP '2013-01-01 00:00:00' AND [date] < TIMESTAMP '2013-02-01 00:00:00' 2012-12-31 18:01:53.242762 +statistics.company_statistic_total_by_weeks statistics.company_statistic_total_by_weeks_13_01 [first_week_day] >= TIMESTAMP '2013-01-01 00:00:00' AND [first_week_day] < TIMESTAMP '2013-02-01 00:00:00' 2012-12-31 20:21:24.13775 +statistics.company_statistic_geo_by_weeks statistics.company_statistic_geo_by_weeks_13_01 [first_week_day] >= TIMESTAMP '2013-01-01 00:00:00' AND [first_week_day] < TIMESTAMP '2013-02-01 00:00:00' 2012-12-31 20:21:24.13775 +statistics.company_statistic_pages_by_weeks statistics.company_statistic_pages_by_weeks_13_01 [first_week_day] >= TIMESTAMP '2013-01-01 00:00:00' AND [first_week_day] < TIMESTAMP '2013-02-01 00:00:00' 2012-12-31 20:21:24.13775 +statistics.company_statistic_referers_by_weeks statistics.company_statistic_referers_by_weeks_13_01 [first_week_day] >= TIMESTAMP '2013-01-01 00:00:00' AND [first_week_day] < TIMESTAMP '2013-02-01 00:00:00' 2012-12-31 20:21:24.13775 +statistics.company_statistic_total_by_days statistics.company_statistic_total_by_days_13_01 [date] >= TIMESTAMP '2013-01-01 00:00:00' AND [date] < TIMESTAMP '2013-02-01 00:00:00' 2013-01-01 20:21:05.498683 +statistics.company_statistic_total_by_months statistics.company_statistic_total_by_months_13_01 [date] >= TIMESTAMP '2013-01-01 00:00:00' AND [date] < TIMESTAMP '2013-02-01 00:00:00' 2013-01-01 20:21:05.498683 +statistics.company_statistic_geo_by_months statistics.company_statistic_geo_by_months_13_01 [date] >= TIMESTAMP '2013-01-01 00:00:00' AND [date] < TIMESTAMP '2013-02-01 00:00:00' 2013-01-01 20:21:05.498683 +statistics.company_statistic_pages_by_months statistics.company_statistic_pages_by_months_13_01 [date] >= TIMESTAMP '2013-01-01 00:00:00' AND [date] < TIMESTAMP '2013-02-01 00:00:00' 2013-01-01 20:21:05.498683 +statistics.company_statistic_referers_by_months statistics.company_statistic_referers_by_months_13_01 [date] >= TIMESTAMP '2013-01-01 00:00:00' AND [date] < TIMESTAMP '2013-02-01 00:00:00' 2013-01-01 20:21:05.498683 +statistics.company_statistic_total_by_weeks statistics.company_statistic_total_by_weeks_13_02 [first_week_day] >= TIMESTAMP '2013-02-01 00:00:00' AND [first_week_day] < TIMESTAMP '2013-03-01 00:00:00' 2013-01-28 20:21:13.566839 +statistics.company_statistic_geo_by_weeks statistics.company_statistic_geo_by_weeks_13_02 [first_week_day] >= TIMESTAMP '2013-02-01 00:00:00' AND [first_week_day] < TIMESTAMP '2013-03-01 00:00:00' 2013-01-28 20:21:13.566839 +statistics.company_statistic_pages_by_weeks statistics.company_statistic_pages_by_weeks_13_02 [first_week_day] >= TIMESTAMP '2013-02-01 00:00:00' AND [first_week_day] < TIMESTAMP '2013-03-01 00:00:00' 2013-01-28 20:21:13.566839 +statistics.company_statistic_referers_by_weeks statistics.company_statistic_referers_by_weeks_13_02 [first_week_day] >= TIMESTAMP '2013-02-01 00:00:00' AND [first_week_day] < TIMESTAMP '2013-03-01 00:00:00' 2013-01-28 20:21:13.566839 +statistics.news_statistic_mainpage_by_days statistics.news_statistic_mainpage_by_days_13_02 [date] >= TIMESTAMP '2013-02-01 00:00:00' AND [date] < TIMESTAMP '2013-03-01 00:00:00' 2013-01-31 18:01:03.453762 +statistics.company_statistic_total_by_days statistics.company_statistic_total_by_days_13_02 [date] >= TIMESTAMP '2013-02-01 00:00:00' AND [date] < TIMESTAMP '2013-03-01 00:00:00' 2013-02-01 20:21:12.317819 +statistics.company_statistic_total_by_months statistics.company_statistic_total_by_months_13_02 [date] >= TIMESTAMP '2013-02-01 00:00:00' AND [date] < TIMESTAMP '2013-03-01 00:00:00' 2013-02-01 20:21:12.317819 +statistics.company_statistic_geo_by_months statistics.company_statistic_geo_by_months_13_02 [date] >= TIMESTAMP '2013-02-01 00:00:00' AND [date] < TIMESTAMP '2013-03-01 00:00:00' 2013-02-01 20:21:12.317819 +statistics.company_statistic_pages_by_months statistics.company_statistic_pages_by_months_13_02 [date] >= TIMESTAMP '2013-02-01 00:00:00' AND [date] < TIMESTAMP '2013-03-01 00:00:00' 2013-02-01 20:21:12.317819 +statistics.company_statistic_referers_by_months statistics.company_statistic_referers_by_months_13_02 [date] >= TIMESTAMP '2013-02-01 00:00:00' AND [date] < TIMESTAMP '2013-03-01 00:00:00' 2013-02-01 20:21:12.317819 +statistics.company_statistic_total_by_weeks statistics.company_statistic_total_by_weeks_13_03 [first_week_day] >= TIMESTAMP '2013-03-01 00:00:00' AND [first_week_day] < TIMESTAMP '2013-04-01 00:00:00' 2013-02-25 20:22:44.555888 +statistics.company_statistic_geo_by_weeks statistics.company_statistic_geo_by_weeks_13_03 [first_week_day] >= TIMESTAMP '2013-03-01 00:00:00' AND [first_week_day] < TIMESTAMP '2013-04-01 00:00:00' 2013-02-25 20:22:44.555888 +statistics.company_statistic_pages_by_weeks statistics.company_statistic_pages_by_weeks_13_03 [first_week_day] >= TIMESTAMP '2013-03-01 00:00:00' AND [first_week_day] < TIMESTAMP '2013-04-01 00:00:00' 2013-02-25 20:22:44.555888 +statistics.company_statistic_referers_by_weeks statistics.company_statistic_referers_by_weeks_13_03 [first_week_day] >= TIMESTAMP '2013-03-01 00:00:00' AND [first_week_day] < TIMESTAMP '2013-04-01 00:00:00' 2013-02-25 20:22:44.555888 +statistics.news_statistic_mainpage_by_days statistics.news_statistic_mainpage_by_days_13_03 [date] >= TIMESTAMP '2013-03-01 00:00:00' AND [date] < TIMESTAMP '2013-04-01 00:00:00' 2013-02-28 18:00:34.042126 +statistics.company_statistic_total_by_days statistics.company_statistic_total_by_days_13_03 [date] >= TIMESTAMP '2013-03-01 00:00:00' AND [date] < TIMESTAMP '2013-04-01 00:00:00' 2013-03-01 20:21:25.425303 +statistics.company_statistic_total_by_months statistics.company_statistic_total_by_months_13_03 [date] >= TIMESTAMP '2013-03-01 00:00:00' AND [date] < TIMESTAMP '2013-04-01 00:00:00' 2013-03-01 20:21:25.425303 +statistics.company_statistic_geo_by_months statistics.company_statistic_geo_by_months_13_03 [date] >= TIMESTAMP '2013-03-01 00:00:00' AND [date] < TIMESTAMP '2013-04-01 00:00:00' 2013-03-01 20:21:25.425303 +statistics.company_statistic_pages_by_months statistics.company_statistic_pages_by_months_13_03 [date] >= TIMESTAMP '2013-03-01 00:00:00' AND [date] < TIMESTAMP '2013-04-01 00:00:00' 2013-03-01 20:21:25.425303 +statistics.company_statistic_referers_by_months statistics.company_statistic_referers_by_months_13_03 [date] >= TIMESTAMP '2013-03-01 00:00:00' AND [date] < TIMESTAMP '2013-04-01 00:00:00' 2013-03-01 20:21:25.425303 +statistics.news_statistic_mainpage_by_days statistics.news_statistic_mainpage_by_days_13_04 [date] >= TIMESTAMP '2013-04-01 00:00:00' AND [date] < TIMESTAMP '2013-05-01 00:00:00' 2013-03-31 18:00:30.50933 +statistics.company_statistic_total_by_days statistics.company_statistic_total_by_days_13_04 [date] >= TIMESTAMP '2013-04-01 00:00:00' AND [date] < TIMESTAMP '2013-05-01 00:00:00' 2013-04-01 20:21:25.713167 +statistics.company_statistic_total_by_weeks statistics.company_statistic_total_by_weeks_13_04 [first_week_day] >= TIMESTAMP '2013-04-01 00:00:00' AND [first_week_day] < TIMESTAMP '2013-05-01 00:00:00' 2013-04-01 20:21:25.713167 +statistics.company_statistic_total_by_months statistics.company_statistic_total_by_months_13_04 [date] >= TIMESTAMP '2013-04-01 00:00:00' AND [date] < TIMESTAMP '2013-05-01 00:00:00' 2013-04-01 20:21:25.713167 +statistics.company_statistic_geo_by_weeks statistics.company_statistic_geo_by_weeks_13_04 [first_week_day] >= TIMESTAMP '2013-04-01 00:00:00' AND [first_week_day] < TIMESTAMP '2013-05-01 00:00:00' 2013-04-01 20:21:25.713167 +statistics.company_statistic_geo_by_months statistics.company_statistic_geo_by_months_13_04 [date] >= TIMESTAMP '2013-04-01 00:00:00' AND [date] < TIMESTAMP '2013-05-01 00:00:00' 2013-04-01 20:21:25.713167 +statistics.company_statistic_pages_by_weeks statistics.company_statistic_pages_by_weeks_13_04 [first_week_day] >= TIMESTAMP '2013-04-01 00:00:00' AND [first_week_day] < TIMESTAMP '2013-05-01 00:00:00' 2013-04-01 20:21:25.713167 +statistics.company_statistic_pages_by_months statistics.company_statistic_pages_by_months_13_04 [date] >= TIMESTAMP '2013-04-01 00:00:00' AND [date] < TIMESTAMP '2013-05-01 00:00:00' 2013-04-01 20:21:25.713167 +statistics.company_statistic_referers_by_weeks statistics.company_statistic_referers_by_weeks_13_04 [first_week_day] >= TIMESTAMP '2013-04-01 00:00:00' AND [first_week_day] < TIMESTAMP '2013-05-01 00:00:00' 2013-04-01 20:21:25.713167 +statistics.company_statistic_referers_by_months statistics.company_statistic_referers_by_months_13_04 [date] >= TIMESTAMP '2013-04-01 00:00:00' AND [date] < TIMESTAMP '2013-05-01 00:00:00' 2013-04-01 20:21:25.713167 +statistics.company_statistic_total_by_weeks statistics.company_statistic_total_by_weeks_13_05 [first_week_day] >= TIMESTAMP '2013-05-01 00:00:00' AND [first_week_day] < TIMESTAMP '2013-06-01 00:00:00' 2013-04-29 20:20:25.735412 +statistics.company_statistic_geo_by_weeks statistics.company_statistic_geo_by_weeks_13_05 [first_week_day] >= TIMESTAMP '2013-05-01 00:00:00' AND [first_week_day] < TIMESTAMP '2013-06-01 00:00:00' 2013-04-29 20:20:25.735412 +statistics.company_statistic_pages_by_weeks statistics.company_statistic_pages_by_weeks_13_05 [first_week_day] >= TIMESTAMP '2013-05-01 00:00:00' AND [first_week_day] < TIMESTAMP '2013-06-01 00:00:00' 2013-04-29 20:20:25.735412 +statistics.company_statistic_referers_by_weeks statistics.company_statistic_referers_by_weeks_13_05 [first_week_day] >= TIMESTAMP '2013-05-01 00:00:00' AND [first_week_day] < TIMESTAMP '2013-06-01 00:00:00' 2013-04-29 20:20:25.735412 +statistics.news_statistic_mainpage_by_days statistics.news_statistic_mainpage_by_days_13_05 [date] >= TIMESTAMP '2013-05-01 00:00:00' AND [date] < TIMESTAMP '2013-06-01 00:00:00' 2013-04-30 18:00:38.030955 +statistics.company_statistic_total_by_days statistics.company_statistic_total_by_days_13_05 [date] >= TIMESTAMP '2013-05-01 00:00:00' AND [date] < TIMESTAMP '2013-06-01 00:00:00' 2013-05-01 20:20:25.234371 +statistics.company_statistic_total_by_months statistics.company_statistic_total_by_months_13_05 [date] >= TIMESTAMP '2013-05-01 00:00:00' AND [date] < TIMESTAMP '2013-06-01 00:00:00' 2013-05-01 20:20:25.234371 +statistics.company_statistic_geo_by_months statistics.company_statistic_geo_by_months_13_05 [date] >= TIMESTAMP '2013-05-01 00:00:00' AND [date] < TIMESTAMP '2013-06-01 00:00:00' 2013-05-01 20:20:25.234371 +statistics.company_statistic_pages_by_months statistics.company_statistic_pages_by_months_13_05 [date] >= TIMESTAMP '2013-05-01 00:00:00' AND [date] < TIMESTAMP '2013-06-01 00:00:00' 2013-05-01 20:20:25.234371 +statistics.company_statistic_referers_by_months statistics.company_statistic_referers_by_months_13_05 [date] >= TIMESTAMP '2013-05-01 00:00:00' AND [date] < TIMESTAMP '2013-06-01 00:00:00' 2013-05-01 20:20:25.234371 +statistics.company_statistic_total_by_weeks statistics.company_statistic_total_by_weeks_13_06 [first_week_day] >= TIMESTAMP '2013-06-01 00:00:00' AND [first_week_day] < TIMESTAMP '2013-07-01 00:00:00' 2013-05-27 20:20:27.337729 +statistics.company_statistic_geo_by_weeks statistics.company_statistic_geo_by_weeks_13_06 [first_week_day] >= TIMESTAMP '2013-06-01 00:00:00' AND [first_week_day] < TIMESTAMP '2013-07-01 00:00:00' 2013-05-27 20:20:27.337729 +statistics.company_statistic_pages_by_weeks statistics.company_statistic_pages_by_weeks_13_06 [first_week_day] >= TIMESTAMP '2013-06-01 00:00:00' AND [first_week_day] < TIMESTAMP '2013-07-01 00:00:00' 2013-05-27 20:20:27.337729 +statistics.company_statistic_referers_by_weeks statistics.company_statistic_referers_by_weeks_13_06 [first_week_day] >= TIMESTAMP '2013-06-01 00:00:00' AND [first_week_day] < TIMESTAMP '2013-07-01 00:00:00' 2013-05-27 20:20:27.337729 +statistics.news_statistic_mainpage_by_days statistics.news_statistic_mainpage_by_days_13_06 [date] >= TIMESTAMP '2013-06-01 00:00:00' AND [date] < TIMESTAMP '2013-07-01 00:00:00' 2013-05-31 18:00:57.584924 +statistics.company_statistic_total_by_days statistics.company_statistic_total_by_days_13_06 [date] >= TIMESTAMP '2013-06-01 00:00:00' AND [date] < TIMESTAMP '2013-07-01 00:00:00' 2013-06-01 20:20:24.072904 +statistics.company_statistic_total_by_months statistics.company_statistic_total_by_months_13_06 [date] >= TIMESTAMP '2013-06-01 00:00:00' AND [date] < TIMESTAMP '2013-07-01 00:00:00' 2013-06-01 20:20:24.072904 +statistics.company_statistic_geo_by_months statistics.company_statistic_geo_by_months_13_06 [date] >= TIMESTAMP '2013-06-01 00:00:00' AND [date] < TIMESTAMP '2013-07-01 00:00:00' 2013-06-01 20:20:24.072904 +statistics.company_statistic_pages_by_months statistics.company_statistic_pages_by_months_13_06 [date] >= TIMESTAMP '2013-06-01 00:00:00' AND [date] < TIMESTAMP '2013-07-01 00:00:00' 2013-06-01 20:20:24.072904 +statistics.company_statistic_referers_by_months statistics.company_statistic_referers_by_months_13_06 [date] >= TIMESTAMP '2013-06-01 00:00:00' AND [date] < TIMESTAMP '2013-07-01 00:00:00' 2013-06-01 20:20:24.072904 +statistics.news_statistic_mainpage_by_days statistics.news_statistic_mainpage_by_days_13_07 [date] >= TIMESTAMP '2013-07-01 00:00:00' AND [date] < TIMESTAMP '2013-08-01 00:00:00' 2013-06-30 18:00:34.849186 +statistics.company_statistic_total_by_days statistics.company_statistic_total_by_days_13_07 [date] >= TIMESTAMP '2013-07-01 00:00:00' AND [date] < TIMESTAMP '2013-08-01 00:00:00' 2013-07-01 20:20:27.223242 +statistics.company_statistic_total_by_weeks statistics.company_statistic_total_by_weeks_13_07 [first_week_day] >= TIMESTAMP '2013-07-01 00:00:00' AND [first_week_day] < TIMESTAMP '2013-08-01 00:00:00' 2013-07-01 20:20:27.223242 +statistics.company_statistic_total_by_months statistics.company_statistic_total_by_months_13_07 [date] >= TIMESTAMP '2013-07-01 00:00:00' AND [date] < TIMESTAMP '2013-08-01 00:00:00' 2013-07-01 20:20:27.223242 +statistics.company_statistic_geo_by_weeks statistics.company_statistic_geo_by_weeks_13_07 [first_week_day] >= TIMESTAMP '2013-07-01 00:00:00' AND [first_week_day] < TIMESTAMP '2013-08-01 00:00:00' 2013-07-01 20:20:27.223242 +statistics.company_statistic_geo_by_months statistics.company_statistic_geo_by_months_13_07 [date] >= TIMESTAMP '2013-07-01 00:00:00' AND [date] < TIMESTAMP '2013-08-01 00:00:00' 2013-07-01 20:20:27.223242 +statistics.company_statistic_pages_by_weeks statistics.company_statistic_pages_by_weeks_13_07 [first_week_day] >= TIMESTAMP '2013-07-01 00:00:00' AND [first_week_day] < TIMESTAMP '2013-08-01 00:00:00' 2013-07-01 20:20:27.223242 +statistics.company_statistic_pages_by_months statistics.company_statistic_pages_by_months_13_07 [date] >= TIMESTAMP '2013-07-01 00:00:00' AND [date] < TIMESTAMP '2013-08-01 00:00:00' 2013-07-01 20:20:27.223242 +statistics.company_statistic_referers_by_weeks statistics.company_statistic_referers_by_weeks_13_07 [first_week_day] >= TIMESTAMP '2013-07-01 00:00:00' AND [first_week_day] < TIMESTAMP '2013-08-01 00:00:00' 2013-07-01 20:20:27.223242 +statistics.company_statistic_referers_by_months statistics.company_statistic_referers_by_months_13_07 [date] >= TIMESTAMP '2013-07-01 00:00:00' AND [date] < TIMESTAMP '2013-08-01 00:00:00' 2013-07-01 20:20:27.223242 +statistics.company_statistic_total_by_weeks statistics.company_statistic_total_by_weeks_13_08 [first_week_day] >= TIMESTAMP '2013-08-01 00:00:00' AND [first_week_day] < TIMESTAMP '2013-09-01 00:00:00' 2013-07-29 20:20:31.417262 +statistics.company_statistic_geo_by_weeks statistics.company_statistic_geo_by_weeks_13_08 [first_week_day] >= TIMESTAMP '2013-08-01 00:00:00' AND [first_week_day] < TIMESTAMP '2013-09-01 00:00:00' 2013-07-29 20:20:31.417262 +statistics.company_statistic_pages_by_weeks statistics.company_statistic_pages_by_weeks_13_08 [first_week_day] >= TIMESTAMP '2013-08-01 00:00:00' AND [first_week_day] < TIMESTAMP '2013-09-01 00:00:00' 2013-07-29 20:20:31.417262 +statistics.company_statistic_referers_by_weeks statistics.company_statistic_referers_by_weeks_13_08 [first_week_day] >= TIMESTAMP '2013-08-01 00:00:00' AND [first_week_day] < TIMESTAMP '2013-09-01 00:00:00' 2013-07-29 20:20:31.417262 +statistics.news_statistic_mainpage_by_days statistics.news_statistic_mainpage_by_days_13_08 [date] >= TIMESTAMP '2013-08-01 00:00:00' AND [date] < TIMESTAMP '2013-09-01 00:00:00' 2013-07-31 18:00:49.267648 +statistics.company_statistic_total_by_days statistics.company_statistic_total_by_days_13_08 [date] >= TIMESTAMP '2013-08-01 00:00:00' AND [date] < TIMESTAMP '2013-09-01 00:00:00' 2013-08-01 20:20:28.995662 +statistics.company_statistic_total_by_months statistics.company_statistic_total_by_months_13_08 [date] >= TIMESTAMP '2013-08-01 00:00:00' AND [date] < TIMESTAMP '2013-09-01 00:00:00' 2013-08-01 20:20:28.995662 +statistics.company_statistic_geo_by_months statistics.company_statistic_geo_by_months_13_08 [date] >= TIMESTAMP '2013-08-01 00:00:00' AND [date] < TIMESTAMP '2013-09-01 00:00:00' 2013-08-01 20:20:28.995662 +statistics.company_statistic_pages_by_months statistics.company_statistic_pages_by_months_13_08 [date] >= TIMESTAMP '2013-08-01 00:00:00' AND [date] < TIMESTAMP '2013-09-01 00:00:00' 2013-08-01 20:20:28.995662 +statistics.company_statistic_referers_by_months statistics.company_statistic_referers_by_months_13_08 [date] >= TIMESTAMP '2013-08-01 00:00:00' AND [date] < TIMESTAMP '2013-09-01 00:00:00' 2013-08-01 20:20:28.995662 +statistics.company_statistic_total_by_weeks statistics.company_statistic_total_by_weeks_13_09 [first_week_day] >= TIMESTAMP '2013-09-01 00:00:00' AND [first_week_day] < TIMESTAMP '2013-10-01 00:00:00' 2013-08-26 20:20:32.550816 +statistics.company_statistic_geo_by_weeks statistics.company_statistic_geo_by_weeks_13_09 [first_week_day] >= TIMESTAMP '2013-09-01 00:00:00' AND [first_week_day] < TIMESTAMP '2013-10-01 00:00:00' 2013-08-26 20:20:32.550816 +statistics.company_statistic_pages_by_weeks statistics.company_statistic_pages_by_weeks_13_09 [first_week_day] >= TIMESTAMP '2013-09-01 00:00:00' AND [first_week_day] < TIMESTAMP '2013-10-01 00:00:00' 2013-08-26 20:20:32.550816 +statistics.company_statistic_referers_by_weeks statistics.company_statistic_referers_by_weeks_13_09 [first_week_day] >= TIMESTAMP '2013-09-01 00:00:00' AND [first_week_day] < TIMESTAMP '2013-10-01 00:00:00' 2013-08-26 20:20:32.550816 +statistics.news_statistic_mainpage_by_days statistics.news_statistic_mainpage_by_days_13_09 [date] >= TIMESTAMP '2013-09-01 00:00:00' AND [date] < TIMESTAMP '2013-10-01 00:00:00' 2013-08-31 18:00:41.05174 +statistics.company_statistic_total_by_days statistics.company_statistic_total_by_days_13_09 [date] >= TIMESTAMP '2013-09-01 00:00:00' AND [date] < TIMESTAMP '2013-10-01 00:00:00' 2013-09-01 20:20:28.295105 +statistics.company_statistic_total_by_months statistics.company_statistic_total_by_months_13_09 [date] >= TIMESTAMP '2013-09-01 00:00:00' AND [date] < TIMESTAMP '2013-10-01 00:00:00' 2013-09-01 20:20:28.295105 +statistics.company_statistic_geo_by_months statistics.company_statistic_geo_by_months_13_09 [date] >= TIMESTAMP '2013-09-01 00:00:00' AND [date] < TIMESTAMP '2013-10-01 00:00:00' 2013-09-01 20:20:28.295105 +statistics.company_statistic_pages_by_months statistics.company_statistic_pages_by_months_13_09 [date] >= TIMESTAMP '2013-09-01 00:00:00' AND [date] < TIMESTAMP '2013-10-01 00:00:00' 2013-09-01 20:20:28.295105 +statistics.company_statistic_referers_by_months statistics.company_statistic_referers_by_months_13_09 [date] >= TIMESTAMP '2013-09-01 00:00:00' AND [date] < TIMESTAMP '2013-10-01 00:00:00' 2013-09-01 20:20:28.295105 +statistics.news_statistic_mainpage_by_days statistics.news_statistic_mainpage_by_days_13_10 [date] >= TIMESTAMP '2013-10-01 00:00:00' AND [date] < TIMESTAMP '2013-11-01 00:00:00' 2013-09-30 18:00:37.730553 +statistics.company_statistic_total_by_weeks statistics.company_statistic_total_by_weeks_13_10 [first_week_day] >= TIMESTAMP '2013-10-01 00:00:00' AND [first_week_day] < TIMESTAMP '2013-11-01 00:00:00' 2013-09-30 20:20:33.094808 +statistics.company_statistic_geo_by_weeks statistics.company_statistic_geo_by_weeks_13_10 [first_week_day] >= TIMESTAMP '2013-10-01 00:00:00' AND [first_week_day] < TIMESTAMP '2013-11-01 00:00:00' 2013-09-30 20:20:33.094808 +statistics.company_statistic_pages_by_weeks statistics.company_statistic_pages_by_weeks_13_10 [first_week_day] >= TIMESTAMP '2013-10-01 00:00:00' AND [first_week_day] < TIMESTAMP '2013-11-01 00:00:00' 2013-09-30 20:20:33.094808 +statistics.company_statistic_referers_by_weeks statistics.company_statistic_referers_by_weeks_13_10 [first_week_day] >= TIMESTAMP '2013-10-01 00:00:00' AND [first_week_day] < TIMESTAMP '2013-11-01 00:00:00' 2013-09-30 20:20:33.094808 +statistics.company_statistic_total_by_days statistics.company_statistic_total_by_days_13_10 [date] >= TIMESTAMP '2013-10-01 00:00:00' AND [date] < TIMESTAMP '2013-11-01 00:00:00' 2013-10-01 20:20:31.349124 +statistics.company_statistic_total_by_months statistics.company_statistic_total_by_months_13_10 [date] >= TIMESTAMP '2013-10-01 00:00:00' AND [date] < TIMESTAMP '2013-11-01 00:00:00' 2013-10-01 20:20:31.349124 +statistics.company_statistic_geo_by_months statistics.company_statistic_geo_by_months_13_10 [date] >= TIMESTAMP '2013-10-01 00:00:00' AND [date] < TIMESTAMP '2013-11-01 00:00:00' 2013-10-01 20:20:31.349124 +statistics.company_statistic_pages_by_months statistics.company_statistic_pages_by_months_13_10 [date] >= TIMESTAMP '2013-10-01 00:00:00' AND [date] < TIMESTAMP '2013-11-01 00:00:00' 2013-10-01 20:20:31.349124 +statistics.company_statistic_referers_by_months statistics.company_statistic_referers_by_months_13_10 [date] >= TIMESTAMP '2013-10-01 00:00:00' AND [date] < TIMESTAMP '2013-11-01 00:00:00' 2013-10-01 20:20:31.349124 +statistics.company_statistic_total_by_weeks statistics.company_statistic_total_by_weeks_13_11 [first_week_day] >= TIMESTAMP '2013-11-01 00:00:00' AND [first_week_day] < TIMESTAMP '2013-12-01 00:00:00' 2013-10-28 20:20:47.583687 +statistics.company_statistic_geo_by_weeks statistics.company_statistic_geo_by_weeks_13_11 [first_week_day] >= TIMESTAMP '2013-11-01 00:00:00' AND [first_week_day] < TIMESTAMP '2013-12-01 00:00:00' 2013-10-28 20:20:47.583687 +statistics.company_statistic_pages_by_weeks statistics.company_statistic_pages_by_weeks_13_11 [first_week_day] >= TIMESTAMP '2013-11-01 00:00:00' AND [first_week_day] < TIMESTAMP '2013-12-01 00:00:00' 2013-10-28 20:20:47.583687 +statistics.company_statistic_referers_by_weeks statistics.company_statistic_referers_by_weeks_13_11 [first_week_day] >= TIMESTAMP '2013-11-01 00:00:00' AND [first_week_day] < TIMESTAMP '2013-12-01 00:00:00' 2013-10-28 20:20:47.583687 +statistics.news_statistic_mainpage_by_days statistics.news_statistic_mainpage_by_days_13_11 [date] >= TIMESTAMP '2013-11-01 00:00:00' AND [date] < TIMESTAMP '2013-12-01 00:00:00' 2013-10-31 18:00:43.785373 +statistics.company_statistic_total_by_days statistics.company_statistic_total_by_days_13_11 [date] >= TIMESTAMP '2013-11-01 00:00:00' AND [date] < TIMESTAMP '2013-12-01 00:00:00' 2013-11-01 20:20:46.078847 +statistics.company_statistic_total_by_months statistics.company_statistic_total_by_months_13_11 [date] >= TIMESTAMP '2013-11-01 00:00:00' AND [date] < TIMESTAMP '2013-12-01 00:00:00' 2013-11-01 20:20:46.078847 +statistics.company_statistic_geo_by_months statistics.company_statistic_geo_by_months_13_11 [date] >= TIMESTAMP '2013-11-01 00:00:00' AND [date] < TIMESTAMP '2013-12-01 00:00:00' 2013-11-01 20:20:46.078847 +statistics.company_statistic_pages_by_months statistics.company_statistic_pages_by_months_13_11 [date] >= TIMESTAMP '2013-11-01 00:00:00' AND [date] < TIMESTAMP '2013-12-01 00:00:00' 2013-11-01 20:20:46.078847 +statistics.company_statistic_referers_by_months statistics.company_statistic_referers_by_months_13_11 [date] >= TIMESTAMP '2013-11-01 00:00:00' AND [date] < TIMESTAMP '2013-12-01 00:00:00' 2013-11-01 20:20:46.078847 +statistics.company_statistic_total_by_weeks statistics.company_statistic_total_by_weeks_13_12 [first_week_day] >= TIMESTAMP '2013-12-01 00:00:00' AND [first_week_day] < TIMESTAMP '2014-01-01 00:00:00' 2013-11-25 20:20:54.553988 +statistics.company_statistic_geo_by_weeks statistics.company_statistic_geo_by_weeks_13_12 [first_week_day] >= TIMESTAMP '2013-12-01 00:00:00' AND [first_week_day] < TIMESTAMP '2014-01-01 00:00:00' 2013-11-25 20:20:54.553988 +statistics.company_statistic_pages_by_weeks statistics.company_statistic_pages_by_weeks_13_12 [first_week_day] >= TIMESTAMP '2013-12-01 00:00:00' AND [first_week_day] < TIMESTAMP '2014-01-01 00:00:00' 2013-11-25 20:20:54.553988 +statistics.company_statistic_referers_by_weeks statistics.company_statistic_referers_by_weeks_13_12 [first_week_day] >= TIMESTAMP '2013-12-01 00:00:00' AND [first_week_day] < TIMESTAMP '2014-01-01 00:00:00' 2013-11-25 20:20:54.553988 +statistics.news_statistic_mainpage_by_days statistics.news_statistic_mainpage_by_days_13_12 [date] >= TIMESTAMP '2013-12-01 00:00:00' AND [date] < TIMESTAMP '2014-01-01 00:00:00' 2013-11-30 18:00:49.347919 +statistics.company_statistic_total_by_days statistics.company_statistic_total_by_days_13_12 [date] >= TIMESTAMP '2013-12-01 00:00:00' AND [date] < TIMESTAMP '2014-01-01 00:00:00' 2013-12-01 20:20:48.282386 +statistics.company_statistic_total_by_months statistics.company_statistic_total_by_months_13_12 [date] >= TIMESTAMP '2013-12-01 00:00:00' AND [date] < TIMESTAMP '2014-01-01 00:00:00' 2013-12-01 20:20:48.282386 +statistics.company_statistic_geo_by_months statistics.company_statistic_geo_by_months_13_12 [date] >= TIMESTAMP '2013-12-01 00:00:00' AND [date] < TIMESTAMP '2014-01-01 00:00:00' 2013-12-01 20:20:48.282386 +statistics.company_statistic_pages_by_months statistics.company_statistic_pages_by_months_13_12 [date] >= TIMESTAMP '2013-12-01 00:00:00' AND [date] < TIMESTAMP '2014-01-01 00:00:00' 2013-12-01 20:20:48.282386 +statistics.company_statistic_referers_by_months statistics.company_statistic_referers_by_months_13_12 [date] >= TIMESTAMP '2013-12-01 00:00:00' AND [date] < TIMESTAMP '2014-01-01 00:00:00' 2013-12-01 20:20:48.282386 +statistics.company_statistic_total_by_weeks statistics.company_statistic_total_by_weeks_14_01 [first_week_day] >= TIMESTAMP '2014-01-01 00:00:00' AND [first_week_day] < TIMESTAMP '2014-02-01 00:00:00' 2013-12-30 20:20:48.095569 +statistics.company_statistic_geo_by_weeks statistics.company_statistic_geo_by_weeks_14_01 [first_week_day] >= TIMESTAMP '2014-01-01 00:00:00' AND [first_week_day] < TIMESTAMP '2014-02-01 00:00:00' 2013-12-30 20:20:48.095569 +statistics.company_statistic_pages_by_weeks statistics.company_statistic_pages_by_weeks_14_01 [first_week_day] >= TIMESTAMP '2014-01-01 00:00:00' AND [first_week_day] < TIMESTAMP '2014-02-01 00:00:00' 2013-12-30 20:20:48.095569 +statistics.company_statistic_referers_by_weeks statistics.company_statistic_referers_by_weeks_14_01 [first_week_day] >= TIMESTAMP '2014-01-01 00:00:00' AND [first_week_day] < TIMESTAMP '2014-02-01 00:00:00' 2013-12-30 20:20:48.095569 +statistics.news_statistic_mainpage_by_days statistics.news_statistic_mainpage_by_days_14_01 [date] >= TIMESTAMP '2014-01-01 00:00:00' AND [date] < TIMESTAMP '2014-02-01 00:00:00' 2013-12-31 18:00:47.981206 +statistics.company_statistic_total_by_days statistics.company_statistic_total_by_days_14_01 [date] >= TIMESTAMP '2014-01-01 00:00:00' AND [date] < TIMESTAMP '2014-02-01 00:00:00' 2014-01-01 20:20:44.897552 +statistics.company_statistic_total_by_months statistics.company_statistic_total_by_months_14_01 [date] >= TIMESTAMP '2014-01-01 00:00:00' AND [date] < TIMESTAMP '2014-02-01 00:00:00' 2014-01-01 20:20:44.897552 +statistics.company_statistic_geo_by_months statistics.company_statistic_geo_by_months_14_01 [date] >= TIMESTAMP '2014-01-01 00:00:00' AND [date] < TIMESTAMP '2014-02-01 00:00:00' 2014-01-01 20:20:44.897552 +statistics.company_statistic_pages_by_months statistics.company_statistic_pages_by_months_14_01 [date] >= TIMESTAMP '2014-01-01 00:00:00' AND [date] < TIMESTAMP '2014-02-01 00:00:00' 2014-01-01 20:20:44.897552 +statistics.company_statistic_referers_by_months statistics.company_statistic_referers_by_months_14_01 [date] >= TIMESTAMP '2014-01-01 00:00:00' AND [date] < TIMESTAMP '2014-02-01 00:00:00' 2014-01-01 20:20:44.897552 +statistics.company_statistic_total_by_weeks statistics.company_statistic_total_by_weeks_14_02 [first_week_day] >= TIMESTAMP '2014-02-01 00:00:00' AND [first_week_day] < TIMESTAMP '2014-03-01 00:00:00' 2014-01-27 20:20:49.84553 +statistics.company_statistic_geo_by_weeks statistics.company_statistic_geo_by_weeks_14_02 [first_week_day] >= TIMESTAMP '2014-02-01 00:00:00' AND [first_week_day] < TIMESTAMP '2014-03-01 00:00:00' 2014-01-27 20:20:49.84553 +statistics.company_statistic_pages_by_weeks statistics.company_statistic_pages_by_weeks_14_02 [first_week_day] >= TIMESTAMP '2014-02-01 00:00:00' AND [first_week_day] < TIMESTAMP '2014-03-01 00:00:00' 2014-01-27 20:20:49.84553 +statistics.company_statistic_referers_by_weeks statistics.company_statistic_referers_by_weeks_14_02 [first_week_day] >= TIMESTAMP '2014-02-01 00:00:00' AND [first_week_day] < TIMESTAMP '2014-03-01 00:00:00' 2014-01-27 20:20:49.84553 +statistics.news_statistic_mainpage_by_days statistics.news_statistic_mainpage_by_days_14_02 [date] >= TIMESTAMP '2014-02-01 00:00:00' AND [date] < TIMESTAMP '2014-03-01 00:00:00' 2014-01-31 18:00:59.318783 +statistics.company_statistic_total_by_days statistics.company_statistic_total_by_days_14_02 [date] >= TIMESTAMP '2014-02-01 00:00:00' AND [date] < TIMESTAMP '2014-03-01 00:00:00' 2014-02-01 20:20:45.119933 +statistics.company_statistic_total_by_months statistics.company_statistic_total_by_months_14_02 [date] >= TIMESTAMP '2014-02-01 00:00:00' AND [date] < TIMESTAMP '2014-03-01 00:00:00' 2014-02-01 20:20:45.119933 +statistics.company_statistic_geo_by_months statistics.company_statistic_geo_by_months_14_02 [date] >= TIMESTAMP '2014-02-01 00:00:00' AND [date] < TIMESTAMP '2014-03-01 00:00:00' 2014-02-01 20:20:45.119933 +statistics.company_statistic_pages_by_months statistics.company_statistic_pages_by_months_14_02 [date] >= TIMESTAMP '2014-02-01 00:00:00' AND [date] < TIMESTAMP '2014-03-01 00:00:00' 2014-02-01 20:20:45.119933 +statistics.company_statistic_referers_by_months statistics.company_statistic_referers_by_months_14_02 [date] >= TIMESTAMP '2014-02-01 00:00:00' AND [date] < TIMESTAMP '2014-03-01 00:00:00' 2014-02-01 20:20:45.119933 +statistics.company_statistic_total_by_weeks statistics.company_statistic_total_by_weeks_14_03 [first_week_day] >= TIMESTAMP '2014-03-01 00:00:00' AND [first_week_day] < TIMESTAMP '2014-04-01 00:00:00' 2014-02-24 20:20:50.642596 +statistics.company_statistic_geo_by_weeks statistics.company_statistic_geo_by_weeks_14_03 [first_week_day] >= TIMESTAMP '2014-03-01 00:00:00' AND [first_week_day] < TIMESTAMP '2014-04-01 00:00:00' 2014-02-24 20:20:50.642596 +statistics.company_statistic_pages_by_weeks statistics.company_statistic_pages_by_weeks_14_03 [first_week_day] >= TIMESTAMP '2014-03-01 00:00:00' AND [first_week_day] < TIMESTAMP '2014-04-01 00:00:00' 2014-02-24 20:20:50.642596 +statistics.company_statistic_referers_by_weeks statistics.company_statistic_referers_by_weeks_14_03 [first_week_day] >= TIMESTAMP '2014-03-01 00:00:00' AND [first_week_day] < TIMESTAMP '2014-04-01 00:00:00' 2014-02-24 20:20:50.642596 +statistics.news_statistic_mainpage_by_days statistics.news_statistic_mainpage_by_days_14_03 [date] >= TIMESTAMP '2014-03-01 00:00:00' AND [date] < TIMESTAMP '2014-04-01 00:00:00' 2014-02-28 18:00:57.487593 +statistics.company_statistic_total_by_days statistics.company_statistic_total_by_days_14_03 [date] >= TIMESTAMP '2014-03-01 00:00:00' AND [date] < TIMESTAMP '2014-04-01 00:00:00' 2014-03-01 20:20:47.137533 +statistics.company_statistic_total_by_months statistics.company_statistic_total_by_months_14_03 [date] >= TIMESTAMP '2014-03-01 00:00:00' AND [date] < TIMESTAMP '2014-04-01 00:00:00' 2014-03-01 20:20:47.137533 +statistics.company_statistic_geo_by_months statistics.company_statistic_geo_by_months_14_03 [date] >= TIMESTAMP '2014-03-01 00:00:00' AND [date] < TIMESTAMP '2014-04-01 00:00:00' 2014-03-01 20:20:47.137533 +statistics.company_statistic_pages_by_months statistics.company_statistic_pages_by_months_14_03 [date] >= TIMESTAMP '2014-03-01 00:00:00' AND [date] < TIMESTAMP '2014-04-01 00:00:00' 2014-03-01 20:20:47.137533 +statistics.company_statistic_referers_by_months statistics.company_statistic_referers_by_months_14_03 [date] >= TIMESTAMP '2014-03-01 00:00:00' AND [date] < TIMESTAMP '2014-04-01 00:00:00' 2014-03-01 20:20:47.137533 +statistics.news_statistic_mainpage_by_days statistics.news_statistic_mainpage_by_days_14_04 [date] >= TIMESTAMP '2014-04-01 00:00:00' AND [date] < TIMESTAMP '2014-05-01 00:00:00' 2014-03-31 18:00:49.702111 +statistics.company_statistic_total_by_weeks statistics.company_statistic_total_by_weeks_14_04 [first_week_day] >= TIMESTAMP '2014-04-01 00:00:00' AND [first_week_day] < TIMESTAMP '2014-05-01 00:00:00' 2014-03-31 20:20:53.799505 +statistics.company_statistic_geo_by_weeks statistics.company_statistic_geo_by_weeks_14_04 [first_week_day] >= TIMESTAMP '2014-04-01 00:00:00' AND [first_week_day] < TIMESTAMP '2014-05-01 00:00:00' 2014-03-31 20:20:53.799505 +statistics.company_statistic_pages_by_weeks statistics.company_statistic_pages_by_weeks_14_04 [first_week_day] >= TIMESTAMP '2014-04-01 00:00:00' AND [first_week_day] < TIMESTAMP '2014-05-01 00:00:00' 2014-03-31 20:20:53.799505 +statistics.company_statistic_referers_by_weeks statistics.company_statistic_referers_by_weeks_14_04 [first_week_day] >= TIMESTAMP '2014-04-01 00:00:00' AND [first_week_day] < TIMESTAMP '2014-05-01 00:00:00' 2014-03-31 20:20:53.799505 +statistics.company_statistic_total_by_days statistics.company_statistic_total_by_days_14_04 [date] >= TIMESTAMP '2014-04-01 00:00:00' AND [date] < TIMESTAMP '2014-05-01 00:00:00' 2014-04-01 20:20:51.870493 +statistics.company_statistic_total_by_months statistics.company_statistic_total_by_months_14_04 [date] >= TIMESTAMP '2014-04-01 00:00:00' AND [date] < TIMESTAMP '2014-05-01 00:00:00' 2014-04-01 20:20:51.870493 +statistics.company_statistic_geo_by_months statistics.company_statistic_geo_by_months_14_04 [date] >= TIMESTAMP '2014-04-01 00:00:00' AND [date] < TIMESTAMP '2014-05-01 00:00:00' 2014-04-01 20:20:51.870493 +statistics.company_statistic_pages_by_months statistics.company_statistic_pages_by_months_14_04 [date] >= TIMESTAMP '2014-04-01 00:00:00' AND [date] < TIMESTAMP '2014-05-01 00:00:00' 2014-04-01 20:20:51.870493 +statistics.company_statistic_referers_by_months statistics.company_statistic_referers_by_months_14_04 [date] >= TIMESTAMP '2014-04-01 00:00:00' AND [date] < TIMESTAMP '2014-05-01 00:00:00' 2014-04-01 20:20:51.870493 +statistics.company_statistic_total_by_weeks statistics.company_statistic_total_by_weeks_14_05 [first_week_day] >= TIMESTAMP '2014-05-01 00:00:00' AND [first_week_day] < TIMESTAMP '2014-06-01 00:00:00' 2014-04-28 20:20:50.827483 +statistics.company_statistic_geo_by_weeks statistics.company_statistic_geo_by_weeks_14_05 [first_week_day] >= TIMESTAMP '2014-05-01 00:00:00' AND [first_week_day] < TIMESTAMP '2014-06-01 00:00:00' 2014-04-28 20:20:50.827483 +statistics.company_statistic_pages_by_weeks statistics.company_statistic_pages_by_weeks_14_05 [first_week_day] >= TIMESTAMP '2014-05-01 00:00:00' AND [first_week_day] < TIMESTAMP '2014-06-01 00:00:00' 2014-04-28 20:20:50.827483 +statistics.company_statistic_referers_by_weeks statistics.company_statistic_referers_by_weeks_14_05 [first_week_day] >= TIMESTAMP '2014-05-01 00:00:00' AND [first_week_day] < TIMESTAMP '2014-06-01 00:00:00' 2014-04-28 20:20:50.827483 +statistics.news_statistic_mainpage_by_days statistics.news_statistic_mainpage_by_days_14_05 [date] >= TIMESTAMP '2014-05-01 00:00:00' AND [date] < TIMESTAMP '2014-06-01 00:00:00' 2014-04-30 18:01:01.707672 +statistics.company_statistic_total_by_days statistics.company_statistic_total_by_days_14_05 [date] >= TIMESTAMP '2014-05-01 00:00:00' AND [date] < TIMESTAMP '2014-06-01 00:00:00' 2014-05-01 20:20:47.59769 +statistics.company_statistic_total_by_months statistics.company_statistic_total_by_months_14_05 [date] >= TIMESTAMP '2014-05-01 00:00:00' AND [date] < TIMESTAMP '2014-06-01 00:00:00' 2014-05-01 20:20:47.59769 +statistics.company_statistic_geo_by_months statistics.company_statistic_geo_by_months_14_05 [date] >= TIMESTAMP '2014-05-01 00:00:00' AND [date] < TIMESTAMP '2014-06-01 00:00:00' 2014-05-01 20:20:47.59769 +statistics.company_statistic_pages_by_months statistics.company_statistic_pages_by_months_14_05 [date] >= TIMESTAMP '2014-05-01 00:00:00' AND [date] < TIMESTAMP '2014-06-01 00:00:00' 2014-05-01 20:20:47.59769 +statistics.company_statistic_referers_by_months statistics.company_statistic_referers_by_months_14_05 [date] >= TIMESTAMP '2014-05-01 00:00:00' AND [date] < TIMESTAMP '2014-06-01 00:00:00' 2014-05-01 20:20:47.59769 +statistics.company_statistic_total_by_weeks statistics.company_statistic_total_by_weeks_14_06 [first_week_day] >= TIMESTAMP '2014-06-01 00:00:00' AND [first_week_day] < TIMESTAMP '2014-07-01 00:00:00' 2014-05-26 20:20:51.86298 +statistics.company_statistic_geo_by_weeks statistics.company_statistic_geo_by_weeks_14_06 [first_week_day] >= TIMESTAMP '2014-06-01 00:00:00' AND [first_week_day] < TIMESTAMP '2014-07-01 00:00:00' 2014-05-26 20:20:51.86298 +statistics.company_statistic_pages_by_weeks statistics.company_statistic_pages_by_weeks_14_06 [first_week_day] >= TIMESTAMP '2014-06-01 00:00:00' AND [first_week_day] < TIMESTAMP '2014-07-01 00:00:00' 2014-05-26 20:20:51.86298 +statistics.company_statistic_referers_by_weeks statistics.company_statistic_referers_by_weeks_14_06 [first_week_day] >= TIMESTAMP '2014-06-01 00:00:00' AND [first_week_day] < TIMESTAMP '2014-07-01 00:00:00' 2014-05-26 20:20:51.86298 +statistics.news_statistic_mainpage_by_days statistics.news_statistic_mainpage_by_days_14_06 [date] >= TIMESTAMP '2014-06-01 00:00:00' AND [date] < TIMESTAMP '2014-07-01 00:00:00' 2014-05-31 18:00:55.239287 +statistics.company_statistic_total_by_days statistics.company_statistic_total_by_days_14_06 [date] >= TIMESTAMP '2014-06-01 00:00:00' AND [date] < TIMESTAMP '2014-07-01 00:00:00' 2014-06-01 20:20:48.525613 +statistics.company_statistic_total_by_months statistics.company_statistic_total_by_months_14_06 [date] >= TIMESTAMP '2014-06-01 00:00:00' AND [date] < TIMESTAMP '2014-07-01 00:00:00' 2014-06-01 20:20:48.525613 +statistics.company_statistic_geo_by_months statistics.company_statistic_geo_by_months_14_06 [date] >= TIMESTAMP '2014-06-01 00:00:00' AND [date] < TIMESTAMP '2014-07-01 00:00:00' 2014-06-01 20:20:48.525613 +statistics.company_statistic_pages_by_months statistics.company_statistic_pages_by_months_14_06 [date] >= TIMESTAMP '2014-06-01 00:00:00' AND [date] < TIMESTAMP '2014-07-01 00:00:00' 2014-06-01 20:20:48.525613 +statistics.company_statistic_referers_by_months statistics.company_statistic_referers_by_months_14_06 [date] >= TIMESTAMP '2014-06-01 00:00:00' AND [date] < TIMESTAMP '2014-07-01 00:00:00' 2014-06-01 20:20:48.525613 +statistics.news_statistic_mainpage_by_days statistics.news_statistic_mainpage_by_days_14_07 [date] >= TIMESTAMP '2014-07-01 00:00:00' AND [date] < TIMESTAMP '2014-08-01 00:00:00' 2014-06-30 18:00:51.411667 +statistics.company_statistic_total_by_weeks statistics.company_statistic_total_by_weeks_14_07 [first_week_day] >= TIMESTAMP '2014-07-01 00:00:00' AND [first_week_day] < TIMESTAMP '2014-08-01 00:00:00' 2014-06-30 20:21:01.179275 +statistics.company_statistic_geo_by_weeks statistics.company_statistic_geo_by_weeks_14_07 [first_week_day] >= TIMESTAMP '2014-07-01 00:00:00' AND [first_week_day] < TIMESTAMP '2014-08-01 00:00:00' 2014-06-30 20:21:01.179275 +statistics.company_statistic_pages_by_weeks statistics.company_statistic_pages_by_weeks_14_07 [first_week_day] >= TIMESTAMP '2014-07-01 00:00:00' AND [first_week_day] < TIMESTAMP '2014-08-01 00:00:00' 2014-06-30 20:21:01.179275 +statistics.company_statistic_referers_by_weeks statistics.company_statistic_referers_by_weeks_14_07 [first_week_day] >= TIMESTAMP '2014-07-01 00:00:00' AND [first_week_day] < TIMESTAMP '2014-08-01 00:00:00' 2014-06-30 20:21:01.179275 +statistics.company_statistic_total_by_days statistics.company_statistic_total_by_days_14_07 [date] >= TIMESTAMP '2014-07-01 00:00:00' AND [date] < TIMESTAMP '2014-08-01 00:00:00' 2014-07-01 20:20:55.261719 +statistics.company_statistic_total_by_months statistics.company_statistic_total_by_months_14_07 [date] >= TIMESTAMP '2014-07-01 00:00:00' AND [date] < TIMESTAMP '2014-08-01 00:00:00' 2014-07-01 20:20:55.261719 +statistics.company_statistic_geo_by_months statistics.company_statistic_geo_by_months_14_07 [date] >= TIMESTAMP '2014-07-01 00:00:00' AND [date] < TIMESTAMP '2014-08-01 00:00:00' 2014-07-01 20:20:55.261719 +statistics.company_statistic_pages_by_months statistics.company_statistic_pages_by_months_14_07 [date] >= TIMESTAMP '2014-07-01 00:00:00' AND [date] < TIMESTAMP '2014-08-01 00:00:00' 2014-07-01 20:20:55.261719 +statistics.company_statistic_referers_by_months statistics.company_statistic_referers_by_months_14_07 [date] >= TIMESTAMP '2014-07-01 00:00:00' AND [date] < TIMESTAMP '2014-08-01 00:00:00' 2014-07-01 20:20:55.261719 +statistics.blog_post_statistic_total_by_days statistics.blog_post_statistic_total_by_days_14_07 [date] >= TIMESTAMP '2014-07-01 00:00:00' AND [date] < TIMESTAMP '2014-08-01 00:00:00' 2014-07-24 14:06:41.760237 +statistics.company_statistic_total_by_weeks statistics.company_statistic_total_by_weeks_14_08 [first_week_day] >= TIMESTAMP '2014-08-01 00:00:00' AND [first_week_day] < TIMESTAMP '2014-09-01 00:00:00' 2014-07-28 20:20:52.153971 +statistics.company_statistic_geo_by_weeks statistics.company_statistic_geo_by_weeks_14_08 [first_week_day] >= TIMESTAMP '2014-08-01 00:00:00' AND [first_week_day] < TIMESTAMP '2014-09-01 00:00:00' 2014-07-28 20:20:52.153971 +statistics.company_statistic_pages_by_weeks statistics.company_statistic_pages_by_weeks_14_08 [first_week_day] >= TIMESTAMP '2014-08-01 00:00:00' AND [first_week_day] < TIMESTAMP '2014-09-01 00:00:00' 2014-07-28 20:20:52.153971 +statistics.company_statistic_referers_by_weeks statistics.company_statistic_referers_by_weeks_14_08 [first_week_day] >= TIMESTAMP '2014-08-01 00:00:00' AND [first_week_day] < TIMESTAMP '2014-09-01 00:00:00' 2014-07-28 20:20:52.153971 +statistics.news_statistic_mainpage_by_days statistics.news_statistic_mainpage_by_days_14_08 [date] >= TIMESTAMP '2014-08-01 00:00:00' AND [date] < TIMESTAMP '2014-09-01 00:00:00' 2014-07-31 18:00:53.029017 +statistics.blog_post_statistic_total_by_days statistics.blog_post_statistic_total_by_days_14_08 [date] >= TIMESTAMP '2014-08-01 00:00:00' AND [date] < TIMESTAMP '2014-09-01 00:00:00' 2014-07-31 18:06:45.214428 +statistics.company_statistic_total_by_days statistics.company_statistic_total_by_days_14_08 [date] >= TIMESTAMP '2014-08-01 00:00:00' AND [date] < TIMESTAMP '2014-09-01 00:00:00' 2014-08-01 20:20:52.644511 +statistics.company_statistic_total_by_months statistics.company_statistic_total_by_months_14_08 [date] >= TIMESTAMP '2014-08-01 00:00:00' AND [date] < TIMESTAMP '2014-09-01 00:00:00' 2014-08-01 20:20:52.644511 +statistics.company_statistic_geo_by_months statistics.company_statistic_geo_by_months_14_08 [date] >= TIMESTAMP '2014-08-01 00:00:00' AND [date] < TIMESTAMP '2014-09-01 00:00:00' 2014-08-01 20:20:52.644511 +statistics.company_statistic_pages_by_months statistics.company_statistic_pages_by_months_14_08 [date] >= TIMESTAMP '2014-08-01 00:00:00' AND [date] < TIMESTAMP '2014-09-01 00:00:00' 2014-08-01 20:20:52.644511 +statistics.company_statistic_referers_by_months statistics.company_statistic_referers_by_months_14_08 [date] >= TIMESTAMP '2014-08-01 00:00:00' AND [date] < TIMESTAMP '2014-09-01 00:00:00' 2014-08-01 20:20:52.644511 +statistics.news_statistic_mainpage_by_days statistics.news_statistic_mainpage_by_days_14_09 [date] >= TIMESTAMP '2014-09-01 00:00:00' AND [date] < TIMESTAMP '2014-10-01 00:00:00' 2014-08-31 18:00:54.209977 +statistics.blog_post_statistic_total_by_days statistics.blog_post_statistic_total_by_days_14_09 [date] >= TIMESTAMP '2014-09-01 00:00:00' AND [date] < TIMESTAMP '2014-10-01 00:00:00' 2014-08-31 18:06:46.03336 +statistics.company_statistic_total_by_days statistics.company_statistic_total_by_days_14_09 [date] >= TIMESTAMP '2014-09-01 00:00:00' AND [date] < TIMESTAMP '2014-10-01 00:00:00' 2014-09-01 20:20:53.449119 +statistics.company_statistic_total_by_weeks statistics.company_statistic_total_by_weeks_14_09 [first_week_day] >= TIMESTAMP '2014-09-01 00:00:00' AND [first_week_day] < TIMESTAMP '2014-10-01 00:00:00' 2014-09-01 20:20:53.449119 +statistics.company_statistic_total_by_months statistics.company_statistic_total_by_months_14_09 [date] >= TIMESTAMP '2014-09-01 00:00:00' AND [date] < TIMESTAMP '2014-10-01 00:00:00' 2014-09-01 20:20:53.449119 +statistics.company_statistic_geo_by_weeks statistics.company_statistic_geo_by_weeks_14_09 [first_week_day] >= TIMESTAMP '2014-09-01 00:00:00' AND [first_week_day] < TIMESTAMP '2014-10-01 00:00:00' 2014-09-01 20:20:53.449119 +statistics.company_statistic_geo_by_months statistics.company_statistic_geo_by_months_14_09 [date] >= TIMESTAMP '2014-09-01 00:00:00' AND [date] < TIMESTAMP '2014-10-01 00:00:00' 2014-09-01 20:20:53.449119 +statistics.company_statistic_pages_by_weeks statistics.company_statistic_pages_by_weeks_14_09 [first_week_day] >= TIMESTAMP '2014-09-01 00:00:00' AND [first_week_day] < TIMESTAMP '2014-10-01 00:00:00' 2014-09-01 20:20:53.449119 +statistics.company_statistic_pages_by_months statistics.company_statistic_pages_by_months_14_09 [date] >= TIMESTAMP '2014-09-01 00:00:00' AND [date] < TIMESTAMP '2014-10-01 00:00:00' 2014-09-01 20:20:53.449119 +statistics.company_statistic_referers_by_weeks statistics.company_statistic_referers_by_weeks_14_09 [first_week_day] >= TIMESTAMP '2014-09-01 00:00:00' AND [first_week_day] < TIMESTAMP '2014-10-01 00:00:00' 2014-09-01 20:20:53.449119 +statistics.company_statistic_referers_by_months statistics.company_statistic_referers_by_months_14_09 [date] >= TIMESTAMP '2014-09-01 00:00:00' AND [date] < TIMESTAMP '2014-10-01 00:00:00' 2014-09-01 20:20:53.449119 +statistics.company_statistic_total_by_weeks statistics.company_statistic_total_by_weeks_14_10 [first_week_day] >= TIMESTAMP '2014-10-01 00:00:00' AND [first_week_day] < TIMESTAMP '2014-11-01 00:00:00' 2014-09-29 20:21:05.652233 +statistics.company_statistic_geo_by_weeks statistics.company_statistic_geo_by_weeks_14_10 [first_week_day] >= TIMESTAMP '2014-10-01 00:00:00' AND [first_week_day] < TIMESTAMP '2014-11-01 00:00:00' 2014-09-29 20:21:05.652233 +statistics.company_statistic_pages_by_weeks statistics.company_statistic_pages_by_weeks_14_10 [first_week_day] >= TIMESTAMP '2014-10-01 00:00:00' AND [first_week_day] < TIMESTAMP '2014-11-01 00:00:00' 2014-09-29 20:21:05.652233 +statistics.company_statistic_referers_by_weeks statistics.company_statistic_referers_by_weeks_14_10 [first_week_day] >= TIMESTAMP '2014-10-01 00:00:00' AND [first_week_day] < TIMESTAMP '2014-11-01 00:00:00' 2014-09-29 20:21:05.652233 +statistics.news_statistic_mainpage_by_days statistics.news_statistic_mainpage_by_days_14_10 [date] >= TIMESTAMP '2014-10-01 00:00:00' AND [date] < TIMESTAMP '2014-11-01 00:00:00' 2014-09-30 18:01:04.374586 +statistics.blog_post_statistic_total_by_days statistics.blog_post_statistic_total_by_days_14_10 [date] >= TIMESTAMP '2014-10-01 00:00:00' AND [date] < TIMESTAMP '2014-11-01 00:00:00' 2014-09-30 18:06:51.674872 +statistics.company_statistic_total_by_days statistics.company_statistic_total_by_days_14_10 [date] >= TIMESTAMP '2014-10-01 00:00:00' AND [date] < TIMESTAMP '2014-11-01 00:00:00' 2014-10-01 20:21:06.88415 +statistics.company_statistic_total_by_months statistics.company_statistic_total_by_months_14_10 [date] >= TIMESTAMP '2014-10-01 00:00:00' AND [date] < TIMESTAMP '2014-11-01 00:00:00' 2014-10-01 20:21:06.88415 +statistics.company_statistic_geo_by_months statistics.company_statistic_geo_by_months_14_10 [date] >= TIMESTAMP '2014-10-01 00:00:00' AND [date] < TIMESTAMP '2014-11-01 00:00:00' 2014-10-01 20:21:06.88415 +statistics.company_statistic_pages_by_months statistics.company_statistic_pages_by_months_14_10 [date] >= TIMESTAMP '2014-10-01 00:00:00' AND [date] < TIMESTAMP '2014-11-01 00:00:00' 2014-10-01 20:21:06.88415 +statistics.company_statistic_referers_by_months statistics.company_statistic_referers_by_months_14_10 [date] >= TIMESTAMP '2014-10-01 00:00:00' AND [date] < TIMESTAMP '2014-11-01 00:00:00' 2014-10-01 20:21:06.88415 +statistics.company_statistic_total_by_weeks statistics.company_statistic_total_by_weeks_14_11 [first_week_day] >= TIMESTAMP '2014-11-01 00:00:00' AND [first_week_day] < TIMESTAMP '2014-12-01 00:00:00' 2014-10-27 20:21:07.416625 +statistics.company_statistic_geo_by_weeks statistics.company_statistic_geo_by_weeks_14_11 [first_week_day] >= TIMESTAMP '2014-11-01 00:00:00' AND [first_week_day] < TIMESTAMP '2014-12-01 00:00:00' 2014-10-27 20:21:07.416625 +statistics.company_statistic_pages_by_weeks statistics.company_statistic_pages_by_weeks_14_11 [first_week_day] >= TIMESTAMP '2014-11-01 00:00:00' AND [first_week_day] < TIMESTAMP '2014-12-01 00:00:00' 2014-10-27 20:21:07.416625 +statistics.company_statistic_referers_by_weeks statistics.company_statistic_referers_by_weeks_14_11 [first_week_day] >= TIMESTAMP '2014-11-01 00:00:00' AND [first_week_day] < TIMESTAMP '2014-12-01 00:00:00' 2014-10-27 20:21:07.416625 +statistics.news_statistic_mainpage_by_days statistics.news_statistic_mainpage_by_days_14_11 [date] >= TIMESTAMP '2014-11-01 00:00:00' AND [date] < TIMESTAMP '2014-12-01 00:00:00' 2014-10-31 19:01:21.11582 +statistics.blog_post_statistic_total_by_days statistics.blog_post_statistic_total_by_days_14_11 [date] >= TIMESTAMP '2014-11-01 00:00:00' AND [date] < TIMESTAMP '2014-12-01 00:00:00' 2014-10-31 19:06:55.081127 +statistics.company_statistic_total_by_days statistics.company_statistic_total_by_days_14_11 [date] >= TIMESTAMP '2014-11-01 00:00:00' AND [date] < TIMESTAMP '2014-12-01 00:00:00' 2014-11-01 21:21:07.216241 +statistics.company_statistic_total_by_months statistics.company_statistic_total_by_months_14_11 [date] >= TIMESTAMP '2014-11-01 00:00:00' AND [date] < TIMESTAMP '2014-12-01 00:00:00' 2014-11-01 21:21:07.216241 +statistics.company_statistic_geo_by_months statistics.company_statistic_geo_by_months_14_11 [date] >= TIMESTAMP '2014-11-01 00:00:00' AND [date] < TIMESTAMP '2014-12-01 00:00:00' 2014-11-01 21:21:07.216241 +statistics.company_statistic_pages_by_months statistics.company_statistic_pages_by_months_14_11 [date] >= TIMESTAMP '2014-11-01 00:00:00' AND [date] < TIMESTAMP '2014-12-01 00:00:00' 2014-11-01 21:21:07.216241 +statistics.company_statistic_referers_by_months statistics.company_statistic_referers_by_months_14_11 [date] >= TIMESTAMP '2014-11-01 00:00:00' AND [date] < TIMESTAMP '2014-12-01 00:00:00' 2014-11-01 21:21:07.216241 +statistics.news_statistic_mainpage_by_days statistics.news_statistic_mainpage_by_days_14_12 [date] >= TIMESTAMP '2014-12-01 00:00:00' AND [date] < TIMESTAMP '2015-01-01 00:00:00' 2014-11-30 19:01:11.26989 +statistics.blog_post_statistic_total_by_days statistics.blog_post_statistic_total_by_days_14_12 [date] >= TIMESTAMP '2014-12-01 00:00:00' AND [date] < TIMESTAMP '2015-01-01 00:00:00' 2014-11-30 19:06:54.187853 +statistics.company_statistic_total_by_days statistics.company_statistic_total_by_days_14_12 [date] >= TIMESTAMP '2014-12-01 00:00:00' AND [date] < TIMESTAMP '2015-01-01 00:00:00' 2014-12-01 21:21:07.343028 +statistics.company_statistic_total_by_weeks statistics.company_statistic_total_by_weeks_14_12 [first_week_day] >= TIMESTAMP '2014-12-01 00:00:00' AND [first_week_day] < TIMESTAMP '2015-01-01 00:00:00' 2014-12-01 21:21:07.343028 +statistics.company_statistic_total_by_months statistics.company_statistic_total_by_months_14_12 [date] >= TIMESTAMP '2014-12-01 00:00:00' AND [date] < TIMESTAMP '2015-01-01 00:00:00' 2014-12-01 21:21:07.343028 +statistics.company_statistic_geo_by_weeks statistics.company_statistic_geo_by_weeks_14_12 [first_week_day] >= TIMESTAMP '2014-12-01 00:00:00' AND [first_week_day] < TIMESTAMP '2015-01-01 00:00:00' 2014-12-01 21:21:07.343028 +statistics.company_statistic_geo_by_months statistics.company_statistic_geo_by_months_14_12 [date] >= TIMESTAMP '2014-12-01 00:00:00' AND [date] < TIMESTAMP '2015-01-01 00:00:00' 2014-12-01 21:21:07.343028 +statistics.company_statistic_pages_by_weeks statistics.company_statistic_pages_by_weeks_14_12 [first_week_day] >= TIMESTAMP '2014-12-01 00:00:00' AND [first_week_day] < TIMESTAMP '2015-01-01 00:00:00' 2014-12-01 21:21:07.343028 +statistics.company_statistic_pages_by_months statistics.company_statistic_pages_by_months_14_12 [date] >= TIMESTAMP '2014-12-01 00:00:00' AND [date] < TIMESTAMP '2015-01-01 00:00:00' 2014-12-01 21:21:07.343028 +statistics.company_statistic_referers_by_weeks statistics.company_statistic_referers_by_weeks_14_12 [first_week_day] >= TIMESTAMP '2014-12-01 00:00:00' AND [first_week_day] < TIMESTAMP '2015-01-01 00:00:00' 2014-12-01 21:21:07.343028 +statistics.company_statistic_referers_by_months statistics.company_statistic_referers_by_months_14_12 [date] >= TIMESTAMP '2014-12-01 00:00:00' AND [date] < TIMESTAMP '2015-01-01 00:00:00' 2014-12-01 21:21:07.343028 +statistics.company_statistic_total_by_weeks statistics.company_statistic_total_by_weeks_15_01 [first_week_day] >= TIMESTAMP '2015-01-01 00:00:00' AND [first_week_day] < TIMESTAMP '2015-02-01 00:00:00' 2014-12-29 21:21:10.766518 +statistics.company_statistic_geo_by_weeks statistics.company_statistic_geo_by_weeks_15_01 [first_week_day] >= TIMESTAMP '2015-01-01 00:00:00' AND [first_week_day] < TIMESTAMP '2015-02-01 00:00:00' 2014-12-29 21:21:10.766518 +statistics.company_statistic_pages_by_weeks statistics.company_statistic_pages_by_weeks_15_01 [first_week_day] >= TIMESTAMP '2015-01-01 00:00:00' AND [first_week_day] < TIMESTAMP '2015-02-01 00:00:00' 2014-12-29 21:21:10.766518 +statistics.company_statistic_referers_by_weeks statistics.company_statistic_referers_by_weeks_15_01 [first_week_day] >= TIMESTAMP '2015-01-01 00:00:00' AND [first_week_day] < TIMESTAMP '2015-02-01 00:00:00' 2014-12-29 21:21:10.766518 +statistics.news_statistic_mainpage_by_days statistics.news_statistic_mainpage_by_days_15_01 [date] >= TIMESTAMP '2015-01-01 00:00:00' AND [date] < TIMESTAMP '2015-02-01 00:00:00' 2014-12-31 19:01:16.582548 +statistics.blog_post_statistic_total_by_days statistics.blog_post_statistic_total_by_days_15_01 [date] >= TIMESTAMP '2015-01-01 00:00:00' AND [date] < TIMESTAMP '2015-02-01 00:00:00' 2014-12-31 19:06:53.299937 +statistics.company_statistic_total_by_days statistics.company_statistic_total_by_days_15_01 [date] >= TIMESTAMP '2015-01-01 00:00:00' AND [date] < TIMESTAMP '2015-02-01 00:00:00' 2015-01-01 21:21:07.253841 +statistics.company_statistic_total_by_months statistics.company_statistic_total_by_months_15_01 [date] >= TIMESTAMP '2015-01-01 00:00:00' AND [date] < TIMESTAMP '2015-02-01 00:00:00' 2015-01-01 21:21:07.253841 +statistics.company_statistic_geo_by_months statistics.company_statistic_geo_by_months_15_01 [date] >= TIMESTAMP '2015-01-01 00:00:00' AND [date] < TIMESTAMP '2015-02-01 00:00:00' 2015-01-01 21:21:07.253841 +statistics.company_statistic_pages_by_months statistics.company_statistic_pages_by_months_15_01 [date] >= TIMESTAMP '2015-01-01 00:00:00' AND [date] < TIMESTAMP '2015-02-01 00:00:00' 2015-01-01 21:21:07.253841 +statistics.company_statistic_referers_by_months statistics.company_statistic_referers_by_months_15_01 [date] >= TIMESTAMP '2015-01-01 00:00:00' AND [date] < TIMESTAMP '2015-02-01 00:00:00' 2015-01-01 21:21:07.253841 +statistics.news_statistic_referers_by_months statistics.news_statistic_referers_by_months_15_08 [date] >= TIMESTAMP '2015-08-01 00:00:00' AND [date] < TIMESTAMP '2015-09-01 00:00:00' 2015-08-03 09:34:21.34853 +statistics.news_statistic_referers_by_months statistics.news_statistic_referers_by_months_15_09 [date] >= TIMESTAMP '2015-09-01 00:00:00' AND [date] < TIMESTAMP '2015-10-01 00:00:00' 2015-09-11 14:24:05.676399 +statistics.company_statistic_referers_by_months statistics.company_statistic_referers_by_months_15_09 [date] >= TIMESTAMP '2015-09-01 00:00:00' AND [date] < TIMESTAMP '2015-10-01 00:00:00' 2015-09-17 13:35:30.602515 +statistics.company_statistic_referers_by_months statistics.company_statistic_referers_by_months_15_08 [date] >= TIMESTAMP '2015-08-01 00:00:00' AND [date] < TIMESTAMP '2015-09-01 00:00:00' 2015-09-17 13:35:32.104311 +statistics.company_statistic_referers_by_weeks statistics.company_statistic_referers_by_weeks_15_08 [first_week_day] >= TIMESTAMP '2015-08-01 00:00:00' AND [first_week_day] < TIMESTAMP '2015-09-01 00:00:00' 2015-09-17 13:36:44.71544 +statistics.company_statistic_referers_by_weeks statistics.company_statistic_referers_by_weeks_15_09 [first_week_day] >= TIMESTAMP '2015-09-01 00:00:00' AND [first_week_day] < TIMESTAMP '2015-10-01 00:00:00' 2015-09-17 13:36:45.340469 +statistics.company_statistic_total_by_months statistics.company_statistic_total_by_months_15_08 [date] >= TIMESTAMP '2015-08-01 00:00:00' AND [date] < TIMESTAMP '2015-09-01 00:00:00' 2015-09-18 09:40:52.074497 +statistics.company_statistic_total_by_weeks statistics.company_statistic_total_by_weeks_15_08 [first_week_day] >= TIMESTAMP '2015-08-01 00:00:00' AND [first_week_day] < TIMESTAMP '2015-09-01 00:00:00' 2015-09-18 09:40:53.784492 +statistics.company_statistic_total_by_days statistics.company_statistic_total_by_days_15_08 [date] >= TIMESTAMP '2015-08-01 00:00:00' AND [date] < TIMESTAMP '2015-09-01 00:00:00' 2015-09-18 09:40:54.111145 +statistics.company_statistic_total_by_months statistics.company_statistic_total_by_months_15_09 [date] >= TIMESTAMP '2015-09-01 00:00:00' AND [date] < TIMESTAMP '2015-10-01 00:00:00' 2015-09-18 09:40:54.352385 +statistics.company_statistic_total_by_weeks statistics.company_statistic_total_by_weeks_15_09 [first_week_day] >= TIMESTAMP '2015-09-01 00:00:00' AND [first_week_day] < TIMESTAMP '2015-10-01 00:00:00' 2015-09-18 09:40:54.626925 +statistics.company_statistic_total_by_days statistics.company_statistic_total_by_days_15_09 [date] >= TIMESTAMP '2015-09-01 00:00:00' AND [date] < TIMESTAMP '2015-10-01 00:00:00' 2015-09-18 09:40:54.886983 +statistics.company_statistic_pages_by_weeks statistics.company_statistic_pages_by_weeks_15_09 [first_week_day] >= TIMESTAMP '2015-09-01 00:00:00' AND [first_week_day] < TIMESTAMP '2015-10-01 00:00:00' 2015-09-19 12:18:20.687087 +statistics.company_statistic_pages_by_months statistics.company_statistic_pages_by_months_15_09 [date] >= TIMESTAMP '2015-09-01 00:00:00' AND [date] < TIMESTAMP '2015-10-01 00:00:00' 2015-09-19 12:18:20.687087 +statistics.company_statistic_geo_by_weeks statistics.company_statistic_geo_by_weeks_15_09 [first_week_day] >= TIMESTAMP '2015-09-01 00:00:00' AND [first_week_day] < TIMESTAMP '2015-10-01 00:00:00' 2015-09-19 12:18:22.240557 +statistics.company_statistic_geo_by_months statistics.company_statistic_geo_by_months_15_09 [date] >= TIMESTAMP '2015-09-01 00:00:00' AND [date] < TIMESTAMP '2015-10-01 00:00:00' 2015-09-19 12:18:22.240557 +statistics.company_statistic_activities_by_days statistics.company_statistic_activities_by_days_15_09 [date] >= TIMESTAMP '2015-09-01 00:00:00' AND [date] < TIMESTAMP '2015-10-01 00:00:00' 2015-09-22 13:52:07.09333 +statistics.company_statistic_activities_by_weeks statistics.company_statistic_activities_by_weeks_15_09 [first_week_day] >= TIMESTAMP '2015-09-01 00:00:00' AND [first_week_day] < TIMESTAMP '2015-10-01 00:00:00' 2015-09-22 13:52:07.09333 +statistics.company_statistic_activities_by_months statistics.company_statistic_activities_by_months_15_09 [date] >= TIMESTAMP '2015-09-01 00:00:00' AND [date] < TIMESTAMP '2015-10-01 00:00:00' 2015-09-22 13:52:07.09333 +\. + + +-- +-- PostgreSQL database dump complete +-- +