--
-- PostgreSQL database dump
--

\restrict p8JD9GasGaebtFp8BKgzK7l8DwZ7APkKsTnZV2aOY6thmYoUHLF5Lz8l8pc1Wad

-- Dumped from database version 18.0
-- Dumped by pg_dump version 18.0

-- Started on 2025-11-19 07:06:32

SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
SET transaction_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SELECT pg_catalog.set_config('search_path', '', false);
SET check_function_bodies = false;
SET xmloption = content;
SET client_min_messages = warning;
SET row_security = off;

--
-- TOC entry 8 (class 2615 OID 21923)
-- Name: XCX; Type: SCHEMA; Schema: -; Owner: postgres
--

CREATE SCHEMA "XCX";


ALTER SCHEMA "XCX" OWNER TO postgres;

--
-- TOC entry 6 (class 2615 OID 20228)
-- Name: billiards; Type: SCHEMA; Schema: -; Owner: postgres
--

CREATE SCHEMA billiards;


ALTER SCHEMA billiards OWNER TO postgres;

--
-- TOC entry 7 (class 2615 OID 20229)
-- Name: etl_admin; Type: SCHEMA; Schema: -; Owner: postgres
--

CREATE SCHEMA etl_admin;


ALTER SCHEMA etl_admin OWNER TO postgres;

--
-- TOC entry 5605 (class 0 OID 0)
-- Dependencies: 7
-- Name: SCHEMA etl_admin; Type: COMMENT; Schema: -; Owner: postgres
--

COMMENT ON SCHEMA etl_admin IS 'ETL 元数据与运行控制专用 Schema，区分于业务表 billiards';


--
-- TOC entry 2 (class 3079 OID 20230)
-- Name: btree_gist; Type: EXTENSION; Schema: -; Owner: -
--

CREATE EXTENSION IF NOT EXISTS btree_gist WITH SCHEMA billiards;


--
-- TOC entry 5606 (class 0 OID 0)
-- Dependencies: 2
-- Name: EXTENSION btree_gist; Type: COMMENT; Schema: -; Owner: 
--

COMMENT ON EXTENSION btree_gist IS 'support for indexing common datatypes in GiST';


--
-- TOC entry 1109 (class 1247 OID 20995)
-- Name: run_status_enum; Type: TYPE; Schema: etl_admin; Owner: postgres
--

CREATE TYPE etl_admin.run_status_enum AS ENUM (
    'SUCC',
    'FAIL',
    'PARTIAL'
);


ALTER TYPE etl_admin.run_status_enum OWNER TO postgres;

SET default_tablespace = '';

SET default_table_access_method = heap;

--
-- TOC entry 222 (class 1259 OID 21001)
-- Name: dim_assistant; Type: TABLE; Schema: billiards; Owner: postgres
--

CREATE TABLE billiards.dim_assistant (
    store_id bigint NOT NULL,
    assistant_id bigint NOT NULL,
    assistant_name character varying(100),
    nickname character varying(100),
    level_name character varying(50),
    skill_name character varying(100),
    team_id bigint,
    status character varying(20),
    entry_date date,
    leave_date date,
    raw_data jsonb
);


ALTER TABLE billiards.dim_assistant OWNER TO postgres;

--
-- TOC entry 5819 (class 0 OID 0)
-- Dependencies: 222
-- Name: TABLE dim_assistant; Type: COMMENT; Schema: billiards; Owner: postgres
--

COMMENT ON TABLE billiards.dim_assistant IS '助教维度（账号/基础资料）';


--
-- TOC entry 5820 (class 0 OID 0)
-- Dependencies: 222
-- Name: COLUMN dim_assistant.store_id; Type: COMMENT; Schema: billiards; Owner: postgres
--

COMMENT ON COLUMN billiards.dim_assistant.store_id IS '门店ID';


--
-- TOC entry 5821 (class 0 OID 0)
-- Dependencies: 222
-- Name: COLUMN dim_assistant.assistant_id; Type: COMMENT; Schema: billiards; Owner: postgres
--

COMMENT ON COLUMN billiards.dim_assistant.assistant_id IS '助教ID（上游 siteAssistantId）';


--
-- TOC entry 5822 (class 0 OID 0)
-- Dependencies: 222
-- Name: COLUMN dim_assistant.assistant_name; Type: COMMENT; Schema: billiards; Owner: postgres
--

COMMENT ON COLUMN billiards.dim_assistant.assistant_name IS '姓名';


--
-- TOC entry 5823 (class 0 OID 0)
-- Dependencies: 222
-- Name: COLUMN dim_assistant.nickname; Type: COMMENT; Schema: billiards; Owner: postgres
--

COMMENT ON COLUMN billiards.dim_assistant.nickname IS '昵称';


--
-- TOC entry 5824 (class 0 OID 0)
-- Dependencies: 222
-- Name: COLUMN dim_assistant.level_name; Type: COMMENT; Schema: billiards; Owner: postgres
--

COMMENT ON COLUMN billiards.dim_assistant.level_name IS '当前等级名（历史变更放 SCD2）';


--
-- TOC entry 5825 (class 0 OID 0)
-- Dependencies: 222
-- Name: COLUMN dim_assistant.skill_name; Type: COMMENT; Schema: billiards; Owner: postgres
--

COMMENT ON COLUMN billiards.dim_assistant.skill_name IS '技能标签（花式/九球等）';


--
-- TOC entry 5826 (class 0 OID 0)
-- Dependencies: 222
-- Name: COLUMN dim_assistant.team_id; Type: COMMENT; Schema: billiards; Owner: postgres
--

COMMENT ON COLUMN billiards.dim_assistant.team_id IS '团队/班组ID';


--
-- TOC entry 5827 (class 0 OID 0)
-- Dependencies: 222
-- Name: COLUMN dim_assistant.status; Type: COMMENT; Schema: billiards; Owner: postgres
--

COMMENT ON COLUMN billiards.dim_assistant.status IS '状态（在职/离职）';


--
-- TOC entry 5828 (class 0 OID 0)
-- Dependencies: 222
-- Name: COLUMN dim_assistant.entry_date; Type: COMMENT; Schema: billiards; Owner: postgres
--

COMMENT ON COLUMN billiards.dim_assistant.entry_date IS '入职日期';


--
-- TOC entry 5829 (class 0 OID 0)
-- Dependencies: 222
-- Name: COLUMN dim_assistant.leave_date; Type: COMMENT; Schema: billiards; Owner: postgres
--

COMMENT ON COLUMN billiards.dim_assistant.leave_date IS '离职日期';


--
-- TOC entry 5830 (class 0 OID 0)
-- Dependencies: 222
-- Name: COLUMN dim_assistant.raw_data; Type: COMMENT; Schema: billiards; Owner: postgres
--

COMMENT ON COLUMN billiards.dim_assistant.raw_data IS '原始JSON快照';


--
-- TOC entry 223 (class 1259 OID 21008)
-- Name: dim_assistant_scd; Type: TABLE; Schema: billiards; Owner: postgres
--

CREATE TABLE billiards.dim_assistant_scd (
    assistant_scd_id bigint NOT NULL,
    store_id bigint NOT NULL,
    assistant_id bigint NOT NULL,
    assistant_name character varying(100),
    level_name character varying(50),
    skill_name character varying(100),
    team_id bigint,
    status character varying(20),
    valid_from timestamp with time zone NOT NULL,
    valid_to timestamp with time zone DEFAULT '10000-01-01 07:59:59+08'::timestamp with time zone NOT NULL,
    is_current boolean DEFAULT true NOT NULL,
    raw_data jsonb,
    CONSTRAINT ck_das_range CHECK ((valid_from < valid_to))
);


ALTER TABLE billiards.dim_assistant_scd OWNER TO postgres;

--
-- TOC entry 5832 (class 0 OID 0)
-- Dependencies: 223
-- Name: TABLE dim_assistant_scd; Type: COMMENT; Schema: billiards; Owner: postgres
--

COMMENT ON TABLE billiards.dim_assistant_scd IS '助教维度 SCD2：等级/团队等历史版本';


--
-- TOC entry 224 (class 1259 OID 21022)
-- Name: dim_assistant_current; Type: VIEW; Schema: billiards; Owner: postgres
--

CREATE VIEW billiards.dim_assistant_current AS
 SELECT assistant_scd_id,
    store_id,
    assistant_id,
    assistant_name,
    level_name,
    skill_name,
    team_id,
    status,
    valid_from,
    valid_to,
    is_current,
    raw_data
   FROM billiards.dim_assistant_scd
  WHERE (is_current = true);


ALTER VIEW billiards.dim_assistant_current OWNER TO postgres;

--
-- TOC entry 225 (class 1259 OID 21026)
-- Name: dim_assistant_scd_assistant_scd_id_seq; Type: SEQUENCE; Schema: billiards; Owner: postgres
--

CREATE SEQUENCE billiards.dim_assistant_scd_assistant_scd_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE billiards.dim_assistant_scd_assistant_scd_id_seq OWNER TO postgres;

--
-- TOC entry 5835 (class 0 OID 0)
-- Dependencies: 225
-- Name: dim_assistant_scd_assistant_scd_id_seq; Type: SEQUENCE OWNED BY; Schema: billiards; Owner: postgres
--

ALTER SEQUENCE billiards.dim_assistant_scd_assistant_scd_id_seq OWNED BY billiards.dim_assistant_scd.assistant_scd_id;


--
-- TOC entry 226 (class 1259 OID 21027)
-- Name: dim_member; Type: TABLE; Schema: billiards; Owner: postgres
--

CREATE TABLE billiards.dim_member (
    store_id bigint NOT NULL,
    member_id bigint NOT NULL,
    member_name character varying(100),
    mobile character varying(30),
    register_time timestamp with time zone,
    member_level_code character varying(50),
    member_level_name character varying(100),
    status character varying(20),
    referrer_id bigint,
    birth_date date,
    gender character varying(10),
    point_balance numeric(12,2),
    raw_data jsonb
);


ALTER TABLE billiards.dim_member OWNER TO postgres;

--
-- TOC entry 5837 (class 0 OID 0)
-- Dependencies: 226
-- Name: TABLE dim_member; Type: COMMENT; Schema: billiards; Owner: postgres
--

COMMENT ON TABLE billiards.dim_member IS '会员维度；等级历史在 SCD2 保留';


--
-- TOC entry 5838 (class 0 OID 0)
-- Dependencies: 226
-- Name: COLUMN dim_member.store_id; Type: COMMENT; Schema: billiards; Owner: postgres
--

COMMENT ON COLUMN billiards.dim_member.store_id IS '门店ID';


--
-- TOC entry 5839 (class 0 OID 0)
-- Dependencies: 226
-- Name: COLUMN dim_member.member_id; Type: COMMENT; Schema: billiards; Owner: postgres
--

COMMENT ON COLUMN billiards.dim_member.member_id IS '会员ID（tenantMemberId/systemMemberId）';


--
-- TOC entry 5840 (class 0 OID 0)
-- Dependencies: 226
-- Name: COLUMN dim_member.member_name; Type: COMMENT; Schema: billiards; Owner: postgres
--

COMMENT ON COLUMN billiards.dim_member.member_name IS '会员姓名';


--
-- TOC entry 5841 (class 0 OID 0)
-- Dependencies: 226
-- Name: COLUMN dim_member.mobile; Type: COMMENT; Schema: billiards; Owner: postgres
--

COMMENT ON COLUMN billiards.dim_member.mobile IS '手机号';


--
-- TOC entry 5842 (class 0 OID 0)
-- Dependencies: 226
-- Name: COLUMN dim_member.register_time; Type: COMMENT; Schema: billiards; Owner: postgres
--

COMMENT ON COLUMN billiards.dim_member.register_time IS '注册时间';


--
-- TOC entry 5843 (class 0 OID 0)
-- Dependencies: 226
-- Name: COLUMN dim_member.member_level_code; Type: COMMENT; Schema: billiards; Owner: postgres
--

COMMENT ON COLUMN billiards.dim_member.member_level_code IS '会员等级代码';


--
-- TOC entry 5844 (class 0 OID 0)
-- Dependencies: 226
-- Name: COLUMN dim_member.member_level_name; Type: COMMENT; Schema: billiards; Owner: postgres
--

COMMENT ON COLUMN billiards.dim_member.member_level_name IS '会员等级名称';


--
-- TOC entry 5845 (class 0 OID 0)
-- Dependencies: 226
-- Name: COLUMN dim_member.status; Type: COMMENT; Schema: billiards; Owner: postgres
--

COMMENT ON COLUMN billiards.dim_member.status IS '状态';


--
-- TOC entry 5846 (class 0 OID 0)
-- Dependencies: 226
-- Name: COLUMN dim_member.referrer_id; Type: COMMENT; Schema: billiards; Owner: postgres
--

COMMENT ON COLUMN billiards.dim_member.referrer_id IS '推荐人会员ID';


--
-- TOC entry 5847 (class 0 OID 0)
-- Dependencies: 226
-- Name: COLUMN dim_member.birth_date; Type: COMMENT; Schema: billiards; Owner: postgres
--

COMMENT ON COLUMN billiards.dim_member.birth_date IS '生日';


--
-- TOC entry 5848 (class 0 OID 0)
-- Dependencies: 226
-- Name: COLUMN dim_member.gender; Type: COMMENT; Schema: billiards; Owner: postgres
--

COMMENT ON COLUMN billiards.dim_member.gender IS '性别';


--
-- TOC entry 5849 (class 0 OID 0)
-- Dependencies: 226
-- Name: COLUMN dim_member.point_balance; Type: COMMENT; Schema: billiards; Owner: postgres
--

COMMENT ON COLUMN billiards.dim_member.point_balance IS '积分余额（如有积分）';


--
-- TOC entry 5850 (class 0 OID 0)
-- Dependencies: 226
-- Name: COLUMN dim_member.raw_data; Type: COMMENT; Schema: billiards; Owner: postgres
--

COMMENT ON COLUMN billiards.dim_member.raw_data IS '原始JSON快照';


--
-- TOC entry 227 (class 1259 OID 21034)
-- Name: dim_member_scd; Type: TABLE; Schema: billiards; Owner: postgres
--

CREATE TABLE billiards.dim_member_scd (
    member_scd_id bigint NOT NULL,
    store_id bigint NOT NULL,
    member_id bigint NOT NULL,
    member_level_code character varying(50),
    member_level_name character varying(100),
    member_name character varying(100),
    mobile character varying(30),
    status character varying(20),
    valid_from timestamp with time zone NOT NULL,
    valid_to timestamp with time zone DEFAULT '10000-01-01 07:59:59+08'::timestamp with time zone NOT NULL,
    is_current boolean DEFAULT true NOT NULL,
    raw_data jsonb,
    CONSTRAINT ck_dms_range CHECK ((valid_from < valid_to))
);


ALTER TABLE billiards.dim_member_scd OWNER TO postgres;

--
-- TOC entry 5852 (class 0 OID 0)
-- Dependencies: 227
-- Name: TABLE dim_member_scd; Type: COMMENT; Schema: billiards; Owner: postgres
--

COMMENT ON TABLE billiards.dim_member_scd IS '会员维度 SCD2：保留等级等属性的历史版本';


--
-- TOC entry 228 (class 1259 OID 21048)
-- Name: dim_member_current; Type: VIEW; Schema: billiards; Owner: postgres
--

CREATE VIEW billiards.dim_member_current AS
 SELECT member_scd_id,
    store_id,
    member_id,
    member_level_code,
    member_level_name,
    member_name,
    mobile,
    status,
    valid_from,
    valid_to,
    is_current,
    raw_data
   FROM billiards.dim_member_scd
  WHERE (is_current = true);


ALTER VIEW billiards.dim_member_current OWNER TO postgres;

--
-- TOC entry 229 (class 1259 OID 21052)
-- Name: dim_member_scd_member_scd_id_seq; Type: SEQUENCE; Schema: billiards; Owner: postgres
--

CREATE SEQUENCE billiards.dim_member_scd_member_scd_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE billiards.dim_member_scd_member_scd_id_seq OWNER TO postgres;

--
-- TOC entry 5855 (class 0 OID 0)
-- Dependencies: 229
-- Name: dim_member_scd_member_scd_id_seq; Type: SEQUENCE OWNED BY; Schema: billiards; Owner: postgres
--

ALTER SEQUENCE billiards.dim_member_scd_member_scd_id_seq OWNED BY billiards.dim_member_scd.member_scd_id;


--
-- TOC entry 230 (class 1259 OID 21053)
-- Name: dim_package; Type: TABLE; Schema: billiards; Owner: postgres
--

CREATE TABLE billiards.dim_package (
    store_id bigint NOT NULL,
    package_id bigint NOT NULL,
    package_name character varying(200),
    content_desc character varying(500),
    sale_price numeric(12,2),
    valid_from date,
    valid_to date,
    status character varying(20),
    raw_data jsonb
);


ALTER TABLE billiards.dim_package OWNER TO postgres;

--
-- TOC entry 5857 (class 0 OID 0)
-- Dependencies: 230
-- Name: TABLE dim_package; Type: COMMENT; Schema: billiards; Owner: postgres
--

COMMENT ON TABLE billiards.dim_package IS '套餐/团购定义';


--
-- TOC entry 5858 (class 0 OID 0)
-- Dependencies: 230
-- Name: COLUMN dim_package.store_id; Type: COMMENT; Schema: billiards; Owner: postgres
--

COMMENT ON COLUMN billiards.dim_package.store_id IS '门店ID';


--
-- TOC entry 5859 (class 0 OID 0)
-- Dependencies: 230
-- Name: COLUMN dim_package.package_id; Type: COMMENT; Schema: billiards; Owner: postgres
--

COMMENT ON COLUMN billiards.dim_package.package_id IS '套餐ID';


--
-- TOC entry 5860 (class 0 OID 0)
-- Dependencies: 230
-- Name: COLUMN dim_package.package_name; Type: COMMENT; Schema: billiards; Owner: postgres
--

COMMENT ON COLUMN billiards.dim_package.package_name IS '套餐名称';


--
-- TOC entry 5861 (class 0 OID 0)
-- Dependencies: 230
-- Name: COLUMN dim_package.content_desc; Type: COMMENT; Schema: billiards; Owner: postgres
--

COMMENT ON COLUMN billiards.dim_package.content_desc IS '包含内容/说明';


--
-- TOC entry 5862 (class 0 OID 0)
-- Dependencies: 230
-- Name: COLUMN dim_package.sale_price; Type: COMMENT; Schema: billiards; Owner: postgres
--

COMMENT ON COLUMN billiards.dim_package.sale_price IS '标价';


--
-- TOC entry 5863 (class 0 OID 0)
-- Dependencies: 230
-- Name: COLUMN dim_package.valid_from; Type: COMMENT; Schema: billiards; Owner: postgres
--

COMMENT ON COLUMN billiards.dim_package.valid_from IS '有效期起';


--
-- TOC entry 5864 (class 0 OID 0)
-- Dependencies: 230
-- Name: COLUMN dim_package.valid_to; Type: COMMENT; Schema: billiards; Owner: postgres
--

COMMENT ON COLUMN billiards.dim_package.valid_to IS '有效期止';


--
-- TOC entry 5865 (class 0 OID 0)
-- Dependencies: 230
-- Name: COLUMN dim_package.status; Type: COMMENT; Schema: billiards; Owner: postgres
--

COMMENT ON COLUMN billiards.dim_package.status IS '状态';


--
-- TOC entry 5866 (class 0 OID 0)
-- Dependencies: 230
-- Name: COLUMN dim_package.raw_data; Type: COMMENT; Schema: billiards; Owner: postgres
--

COMMENT ON COLUMN billiards.dim_package.raw_data IS '原始JSON快照';


--
-- TOC entry 231 (class 1259 OID 21060)
-- Name: dim_product; Type: TABLE; Schema: billiards; Owner: postgres
--

CREATE TABLE billiards.dim_product (
    store_id bigint NOT NULL,
    product_id bigint NOT NULL,
    site_product_id bigint,
    product_name character varying(200) NOT NULL,
    category_id bigint,
    category_name character varying(100),
    second_category_id bigint,
    unit character varying(20),
    cost_price numeric(12,2),
    sale_price numeric(12,2),
    allow_discount boolean,
    status character varying(20),
    supplier_id bigint,
    barcode character varying(64),
    is_combo boolean,
    created_time timestamp with time zone,
    updated_time timestamp with time zone,
    raw_data jsonb
);


ALTER TABLE billiards.dim_product OWNER TO postgres;

--
-- TOC entry 5868 (class 0 OID 0)
-- Dependencies: 231
-- Name: TABLE dim_product; Type: COMMENT; Schema: billiards; Owner: postgres
--

COMMENT ON TABLE billiards.dim_product IS '商品维度（含门店价/状态等）';


--
-- TOC entry 5869 (class 0 OID 0)
-- Dependencies: 231
-- Name: COLUMN dim_product.store_id; Type: COMMENT; Schema: billiards; Owner: postgres
--

COMMENT ON COLUMN billiards.dim_product.store_id IS '门店ID';


--
-- TOC entry 5870 (class 0 OID 0)
-- Dependencies: 231
-- Name: COLUMN dim_product.product_id; Type: COMMENT; Schema: billiards; Owner: postgres
--

COMMENT ON COLUMN billiards.dim_product.product_id IS '商品ID（tenantGoodsId或统一ID）';


--
-- TOC entry 5871 (class 0 OID 0)
-- Dependencies: 231
-- Name: COLUMN dim_product.site_product_id; Type: COMMENT; Schema: billiards; Owner: postgres
--

COMMENT ON COLUMN billiards.dim_product.site_product_id IS '门店商品ID（siteGoodsId）';


--
-- TOC entry 5872 (class 0 OID 0)
-- Dependencies: 231
-- Name: COLUMN dim_product.product_name; Type: COMMENT; Schema: billiards; Owner: postgres
--

COMMENT ON COLUMN billiards.dim_product.product_name IS '商品名称';


--
-- TOC entry 5873 (class 0 OID 0)
-- Dependencies: 231
-- Name: COLUMN dim_product.category_id; Type: COMMENT; Schema: billiards; Owner: postgres
--

COMMENT ON COLUMN billiards.dim_product.category_id IS '一级类目ID';


--
-- TOC entry 5874 (class 0 OID 0)
-- Dependencies: 231
-- Name: COLUMN dim_product.category_name; Type: COMMENT; Schema: billiards; Owner: postgres
--

COMMENT ON COLUMN billiards.dim_product.category_name IS '一级类目名称';


--
-- TOC entry 5875 (class 0 OID 0)
-- Dependencies: 231
-- Name: COLUMN dim_product.second_category_id; Type: COMMENT; Schema: billiards; Owner: postgres
--

COMMENT ON COLUMN billiards.dim_product.second_category_id IS '二级类目ID';


--
-- TOC entry 5876 (class 0 OID 0)
-- Dependencies: 231
-- Name: COLUMN dim_product.unit; Type: COMMENT; Schema: billiards; Owner: postgres
--

COMMENT ON COLUMN billiards.dim_product.unit IS '计量单位（瓶/盒/份）';


--
-- TOC entry 5877 (class 0 OID 0)
-- Dependencies: 231
-- Name: COLUMN dim_product.cost_price; Type: COMMENT; Schema: billiards; Owner: postgres
--

COMMENT ON COLUMN billiards.dim_product.cost_price IS '成本价（用于毛利分析）';


--
-- TOC entry 5878 (class 0 OID 0)
-- Dependencies: 231
-- Name: COLUMN dim_product.sale_price; Type: COMMENT; Schema: billiards; Owner: postgres
--

COMMENT ON COLUMN billiards.dim_product.sale_price IS '标准售价/门店售价';


--
-- TOC entry 5879 (class 0 OID 0)
-- Dependencies: 231
-- Name: COLUMN dim_product.allow_discount; Type: COMMENT; Schema: billiards; Owner: postgres
--

COMMENT ON COLUMN billiards.dim_product.allow_discount IS '是否允许打折';


--
-- TOC entry 5880 (class 0 OID 0)
-- Dependencies: 231
-- Name: COLUMN dim_product.status; Type: COMMENT; Schema: billiards; Owner: postgres
--

COMMENT ON COLUMN billiards.dim_product.status IS '状态（上/下架）';


--
-- TOC entry 5881 (class 0 OID 0)
-- Dependencies: 231
-- Name: COLUMN dim_product.supplier_id; Type: COMMENT; Schema: billiards; Owner: postgres
--

COMMENT ON COLUMN billiards.dim_product.supplier_id IS '供应商ID（如有）';


--
-- TOC entry 5882 (class 0 OID 0)
-- Dependencies: 231
-- Name: COLUMN dim_product.barcode; Type: COMMENT; Schema: billiards; Owner: postgres
--

COMMENT ON COLUMN billiards.dim_product.barcode IS '条码';


--
-- TOC entry 5883 (class 0 OID 0)
-- Dependencies: 231
-- Name: COLUMN dim_product.is_combo; Type: COMMENT; Schema: billiards; Owner: postgres
--

COMMENT ON COLUMN billiards.dim_product.is_combo IS '是否组合/套餐商品';


--
-- TOC entry 5884 (class 0 OID 0)
-- Dependencies: 231
-- Name: COLUMN dim_product.created_time; Type: COMMENT; Schema: billiards; Owner: postgres
--

COMMENT ON COLUMN billiards.dim_product.created_time IS '创建时间';


--
-- TOC entry 5885 (class 0 OID 0)
-- Dependencies: 231
-- Name: COLUMN dim_product.updated_time; Type: COMMENT; Schema: billiards; Owner: postgres
--

COMMENT ON COLUMN billiards.dim_product.updated_time IS '最近更新时间';


--
-- TOC entry 5886 (class 0 OID 0)
-- Dependencies: 231
-- Name: COLUMN dim_product.raw_data; Type: COMMENT; Schema: billiards; Owner: postgres
--

COMMENT ON COLUMN billiards.dim_product.raw_data IS '原始JSON快照';


--
-- TOC entry 232 (class 1259 OID 21068)
-- Name: dim_product_price_scd; Type: TABLE; Schema: billiards; Owner: postgres
--

CREATE TABLE billiards.dim_product_price_scd (
    product_scd_id bigint NOT NULL,
    store_id bigint NOT NULL,
    product_id bigint NOT NULL,
    product_name character varying(200),
    category_id bigint,
    category_name character varying(100),
    second_category_id bigint,
    cost_price numeric(12,2),
    sale_price numeric(12,2),
    allow_discount boolean,
    status character varying(20),
    valid_from timestamp with time zone NOT NULL,
    valid_to timestamp with time zone DEFAULT '10000-01-01 07:59:59+08'::timestamp with time zone NOT NULL,
    is_current boolean DEFAULT true NOT NULL,
    raw_data jsonb,
    CONSTRAINT ck_dpps_range CHECK ((valid_from < valid_to))
);


ALTER TABLE billiards.dim_product_price_scd OWNER TO postgres;

--
-- TOC entry 5888 (class 0 OID 0)
-- Dependencies: 232
-- Name: TABLE dim_product_price_scd; Type: COMMENT; Schema: billiards; Owner: postgres
--

COMMENT ON TABLE billiards.dim_product_price_scd IS '商品维度 SCD2：价格/分类等历史版本';


--
-- TOC entry 233 (class 1259 OID 21082)
-- Name: dim_product_price_current; Type: VIEW; Schema: billiards; Owner: postgres
--

CREATE VIEW billiards.dim_product_price_current AS
 SELECT product_scd_id,
    store_id,
    product_id,
    product_name,
    category_id,
    category_name,
    second_category_id,
    cost_price,
    sale_price,
    allow_discount,
    status,
    valid_from,
    valid_to,
    is_current,
    raw_data
   FROM billiards.dim_product_price_scd
  WHERE (is_current = true);


ALTER VIEW billiards.dim_product_price_current OWNER TO postgres;

--
-- TOC entry 234 (class 1259 OID 21086)
-- Name: dim_product_price_scd_product_scd_id_seq; Type: SEQUENCE; Schema: billiards; Owner: postgres
--

CREATE SEQUENCE billiards.dim_product_price_scd_product_scd_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE billiards.dim_product_price_scd_product_scd_id_seq OWNER TO postgres;

--
-- TOC entry 5891 (class 0 OID 0)
-- Dependencies: 234
-- Name: dim_product_price_scd_product_scd_id_seq; Type: SEQUENCE OWNED BY; Schema: billiards; Owner: postgres
--

ALTER SEQUENCE billiards.dim_product_price_scd_product_scd_id_seq OWNED BY billiards.dim_product_price_scd.product_scd_id;


--
-- TOC entry 235 (class 1259 OID 21087)
-- Name: dim_store; Type: TABLE; Schema: billiards; Owner: postgres
--

CREATE TABLE billiards.dim_store (
    store_id bigint NOT NULL,
    store_name character varying(100) NOT NULL,
    tenant_id bigint,
    created_time timestamp with time zone,
    updated_time timestamp with time zone,
    remark character varying(255)
);


ALTER TABLE billiards.dim_store OWNER TO postgres;

--
-- TOC entry 5893 (class 0 OID 0)
-- Dependencies: 235
-- Name: TABLE dim_store; Type: COMMENT; Schema: billiards; Owner: postgres
--

COMMENT ON TABLE billiards.dim_store IS '门店维度；预留多门店扩展';


--
-- TOC entry 5894 (class 0 OID 0)
-- Dependencies: 235
-- Name: COLUMN dim_store.store_id; Type: COMMENT; Schema: billiards; Owner: postgres
--

COMMENT ON COLUMN billiards.dim_store.store_id IS '门店ID（上游 siteId）';


--
-- TOC entry 5895 (class 0 OID 0)
-- Dependencies: 235
-- Name: COLUMN dim_store.store_name; Type: COMMENT; Schema: billiards; Owner: postgres
--

COMMENT ON COLUMN billiards.dim_store.store_name IS '门店名称';


--
-- TOC entry 5896 (class 0 OID 0)
-- Dependencies: 235
-- Name: COLUMN dim_store.tenant_id; Type: COMMENT; Schema: billiards; Owner: postgres
--

COMMENT ON COLUMN billiards.dim_store.tenant_id IS '租户ID（平台商户）';


--
-- TOC entry 5897 (class 0 OID 0)
-- Dependencies: 235
-- Name: COLUMN dim_store.created_time; Type: COMMENT; Schema: billiards; Owner: postgres
--

COMMENT ON COLUMN billiards.dim_store.created_time IS '创建时间';


--
-- TOC entry 5898 (class 0 OID 0)
-- Dependencies: 235
-- Name: COLUMN dim_store.updated_time; Type: COMMENT; Schema: billiards; Owner: postgres
--

COMMENT ON COLUMN billiards.dim_store.updated_time IS '最近更新时间';


--
-- TOC entry 5899 (class 0 OID 0)
-- Dependencies: 235
-- Name: COLUMN dim_store.remark; Type: COMMENT; Schema: billiards; Owner: postgres
--

COMMENT ON COLUMN billiards.dim_store.remark IS '备注';


--
-- TOC entry 236 (class 1259 OID 21092)
-- Name: dim_table; Type: TABLE; Schema: billiards; Owner: postgres
--

CREATE TABLE billiards.dim_table (
    store_id bigint NOT NULL,
    table_id bigint NOT NULL,
    table_name character varying(100) NOT NULL,
    table_area_id bigint,
    table_area_name character varying(100),
    is_vip boolean,
    charge_free boolean,
    status character varying(20),
    created_time timestamp with time zone,
    last_used_time timestamp with time zone,
    raw_data jsonb
);


ALTER TABLE billiards.dim_table OWNER TO postgres;

--
-- TOC entry 5901 (class 0 OID 0)
-- Dependencies: 236
-- Name: TABLE dim_table; Type: COMMENT; Schema: billiards; Owner: postgres
--

COMMENT ON TABLE billiards.dim_table IS '球台维度';


--
-- TOC entry 5902 (class 0 OID 0)
-- Dependencies: 236
-- Name: COLUMN dim_table.store_id; Type: COMMENT; Schema: billiards; Owner: postgres
--

COMMENT ON COLUMN billiards.dim_table.store_id IS '门店ID';


--
-- TOC entry 5903 (class 0 OID 0)
-- Dependencies: 236
-- Name: COLUMN dim_table.table_id; Type: COMMENT; Schema: billiards; Owner: postgres
--

COMMENT ON COLUMN billiards.dim_table.table_id IS '球台ID';


--
-- TOC entry 5904 (class 0 OID 0)
-- Dependencies: 236
-- Name: COLUMN dim_table.table_name; Type: COMMENT; Schema: billiards; Owner: postgres
--

COMMENT ON COLUMN billiards.dim_table.table_name IS '球台名称/编号';


--
-- TOC entry 5905 (class 0 OID 0)
-- Dependencies: 236
-- Name: COLUMN dim_table.table_area_id; Type: COMMENT; Schema: billiards; Owner: postgres
--

COMMENT ON COLUMN billiards.dim_table.table_area_id IS '区域ID（大厅/包厢等）';


--
-- TOC entry 5906 (class 0 OID 0)
-- Dependencies: 236
-- Name: COLUMN dim_table.table_area_name; Type: COMMENT; Schema: billiards; Owner: postgres
--

COMMENT ON COLUMN billiards.dim_table.table_area_name IS '区域名称';


--
-- TOC entry 5907 (class 0 OID 0)
-- Dependencies: 236
-- Name: COLUMN dim_table.is_vip; Type: COMMENT; Schema: billiards; Owner: postgres
--

COMMENT ON COLUMN billiards.dim_table.is_vip IS '是否VIP专用';


--
-- TOC entry 5908 (class 0 OID 0)
-- Dependencies: 236
-- Name: COLUMN dim_table.charge_free; Type: COMMENT; Schema: billiards; Owner: postgres
--

COMMENT ON COLUMN billiards.dim_table.charge_free IS '是否免台费';


--
-- TOC entry 5909 (class 0 OID 0)
-- Dependencies: 236
-- Name: COLUMN dim_table.status; Type: COMMENT; Schema: billiards; Owner: postgres
--

COMMENT ON COLUMN billiards.dim_table.status IS '状态（启用/停用等）';


--
-- TOC entry 5910 (class 0 OID 0)
-- Dependencies: 236
-- Name: COLUMN dim_table.created_time; Type: COMMENT; Schema: billiards; Owner: postgres
--

COMMENT ON COLUMN billiards.dim_table.created_time IS '创建时间';


--
-- TOC entry 5911 (class 0 OID 0)
-- Dependencies: 236
-- Name: COLUMN dim_table.last_used_time; Type: COMMENT; Schema: billiards; Owner: postgres
--

COMMENT ON COLUMN billiards.dim_table.last_used_time IS '最近使用时间';


--
-- TOC entry 5912 (class 0 OID 0)
-- Dependencies: 236
-- Name: COLUMN dim_table.raw_data; Type: COMMENT; Schema: billiards; Owner: postgres
--

COMMENT ON COLUMN billiards.dim_table.raw_data IS '原始JSON快照';


--
-- TOC entry 237 (class 1259 OID 21100)
-- Name: fact_assistant_abolish; Type: TABLE; Schema: billiards; Owner: postgres
--

CREATE TABLE billiards.fact_assistant_abolish (
    store_id bigint NOT NULL,
    abolish_id bigint NOT NULL,
    order_id bigint,
    table_id bigint,
    table_area_name character varying(100),
    assistant_id bigint,
    assistant_name character varying(100),
    start_time timestamp with time zone,
    end_time timestamp with time zone,
    pd_charge_minutes integer,
    assistant_abolish_amount numeric(14,2),
    trash_reason character varying(255),
    create_time timestamp with time zone
);


ALTER TABLE billiards.fact_assistant_abolish OWNER TO postgres;

--
-- TOC entry 5914 (class 0 OID 0)
-- Dependencies: 237
-- Name: TABLE fact_assistant_abolish; Type: COMMENT; Schema: billiards; Owner: postgres
--

COMMENT ON TABLE billiards.fact_assistant_abolish IS '助教服务作废/取消记录';


--
-- TOC entry 238 (class 1259 OID 21105)
-- Name: fact_inventory_change; Type: TABLE; Schema: billiards; Owner: postgres
--

CREATE TABLE billiards.fact_inventory_change (
    store_id bigint NOT NULL,
    change_id bigint NOT NULL,
    product_id bigint,
    change_type character varying(50),
    change_quantity numeric(12,2),
    start_stock numeric(12,2),
    end_stock numeric(12,2),
    unit character varying(20),
    price numeric(12,2),
    operator_name character varying(100),
    change_time timestamp with time zone,
    remark character varying(255)
);


ALTER TABLE billiards.fact_inventory_change OWNER TO postgres;

--
-- TOC entry 5916 (class 0 OID 0)
-- Dependencies: 238
-- Name: TABLE fact_inventory_change; Type: COMMENT; Schema: billiards; Owner: postgres
--

COMMENT ON TABLE billiards.fact_inventory_change IS '库存变动流水（进/销/退/盘点）';


--
-- TOC entry 239 (class 1259 OID 21110)
-- Name: fact_ledger_entry; Type: TABLE; Schema: billiards; Owner: postgres
--

CREATE TABLE billiards.fact_ledger_entry (
    store_id bigint NOT NULL,
    entry_id bigint NOT NULL,
    entry_time timestamp with time zone,
    transaction_type character varying(50),
    transaction_id character varying(100),
    account_debit character varying(100),
    account_credit character varying(100),
    amount numeric(14,2),
    memo character varying(255),
    CONSTRAINT ck_fle_amount_pos CHECK ((COALESCE(amount, (0)::numeric) >= (0)::numeric))
);


ALTER TABLE billiards.fact_ledger_entry OWNER TO postgres;

--
-- TOC entry 5918 (class 0 OID 0)
-- Dependencies: 239
-- Name: TABLE fact_ledger_entry; Type: COMMENT; Schema: billiards; Owner: postgres
--

COMMENT ON TABLE billiards.fact_ledger_entry IS '双分录总账（资金与收入科目平衡核对）';


--
-- TOC entry 240 (class 1259 OID 21118)
-- Name: fact_order; Type: TABLE; Schema: billiards; Owner: postgres
--

CREATE TABLE billiards.fact_order (
    store_id bigint NOT NULL,
    order_id bigint NOT NULL,
    order_no character varying(64),
    member_id bigint,
    open_table_time timestamp with time zone,
    close_time timestamp with time zone,
    total_amount numeric(14,2),
    payable_amount numeric(14,2),
    discount_amount numeric(14,2),
    pay_amount numeric(14,2),
    pay_status character varying(20),
    payment_method character varying(50),
    assistant_count integer,
    table_time_minutes integer,
    salesman_id bigint,
    salesman_name character varying(100),
    created_time timestamp with time zone,
    table_id bigint
);


ALTER TABLE billiards.fact_order OWNER TO postgres;

--
-- TOC entry 5920 (class 0 OID 0)
-- Dependencies: 240
-- Name: TABLE fact_order; Type: COMMENT; Schema: billiards; Owner: postgres
--

COMMENT ON TABLE billiards.fact_order IS '订单/结账事实（一次离场结账为一单）';


--
-- TOC entry 5921 (class 0 OID 0)
-- Dependencies: 240
-- Name: COLUMN fact_order.store_id; Type: COMMENT; Schema: billiards; Owner: postgres
--

COMMENT ON COLUMN billiards.fact_order.store_id IS '门店ID';


--
-- TOC entry 5922 (class 0 OID 0)
-- Dependencies: 240
-- Name: COLUMN fact_order.order_id; Type: COMMENT; Schema: billiards; Owner: postgres
--

COMMENT ON COLUMN billiards.fact_order.order_id IS '订单ID（orderSettleId）';


--
-- TOC entry 5923 (class 0 OID 0)
-- Dependencies: 240
-- Name: COLUMN fact_order.order_no; Type: COMMENT; Schema: billiards; Owner: postgres
--

COMMENT ON COLUMN billiards.fact_order.order_no IS '交易号（orderTradeNo）';


--
-- TOC entry 5924 (class 0 OID 0)
-- Dependencies: 240
-- Name: COLUMN fact_order.member_id; Type: COMMENT; Schema: billiards; Owner: postgres
--

COMMENT ON COLUMN billiards.fact_order.member_id IS '会员ID（如有）';


--
-- TOC entry 5925 (class 0 OID 0)
-- Dependencies: 240
-- Name: COLUMN fact_order.open_table_time; Type: COMMENT; Schema: billiards; Owner: postgres
--

COMMENT ON COLUMN billiards.fact_order.open_table_time IS '开台时间';


--
-- TOC entry 5926 (class 0 OID 0)
-- Dependencies: 240
-- Name: COLUMN fact_order.close_time; Type: COMMENT; Schema: billiards; Owner: postgres
--

COMMENT ON COLUMN billiards.fact_order.close_time IS '结账时间';


--
-- TOC entry 5927 (class 0 OID 0)
-- Dependencies: 240
-- Name: COLUMN fact_order.total_amount; Type: COMMENT; Schema: billiards; Owner: postgres
--

COMMENT ON COLUMN billiards.fact_order.total_amount IS '订单总金额（含所有项目）';


--
-- TOC entry 5928 (class 0 OID 0)
-- Dependencies: 240
-- Name: COLUMN fact_order.payable_amount; Type: COMMENT; Schema: billiards; Owner: postgres
--

COMMENT ON COLUMN billiards.fact_order.payable_amount IS '应收金额（折前）';


--
-- TOC entry 5929 (class 0 OID 0)
-- Dependencies: 240
-- Name: COLUMN fact_order.discount_amount; Type: COMMENT; Schema: billiards; Owner: postgres
--

COMMENT ON COLUMN billiards.fact_order.discount_amount IS '总优惠金额（会员/手工/券）';


--
-- TOC entry 5930 (class 0 OID 0)
-- Dependencies: 240
-- Name: COLUMN fact_order.pay_amount; Type: COMMENT; Schema: billiards; Owner: postgres
--

COMMENT ON COLUMN billiards.fact_order.pay_amount IS '实收金额';


--
-- TOC entry 5931 (class 0 OID 0)
-- Dependencies: 240
-- Name: COLUMN fact_order.pay_status; Type: COMMENT; Schema: billiards; Owner: postgres
--

COMMENT ON COLUMN billiards.fact_order.pay_status IS '支付状态';


--
-- TOC entry 5932 (class 0 OID 0)
-- Dependencies: 240
-- Name: COLUMN fact_order.payment_method; Type: COMMENT; Schema: billiards; Owner: postgres
--

COMMENT ON COLUMN billiards.fact_order.payment_method IS '主支付方式（聚合口径）';


--
-- TOC entry 5933 (class 0 OID 0)
-- Dependencies: 240
-- Name: COLUMN fact_order.assistant_count; Type: COMMENT; Schema: billiards; Owner: postgres
--

COMMENT ON COLUMN billiards.fact_order.assistant_count IS '助教服务次数/人数估计';


--
-- TOC entry 5934 (class 0 OID 0)
-- Dependencies: 240
-- Name: COLUMN fact_order.table_time_minutes; Type: COMMENT; Schema: billiards; Owner: postgres
--

COMMENT ON COLUMN billiards.fact_order.table_time_minutes IS '台费累计分钟';


--
-- TOC entry 5935 (class 0 OID 0)
-- Dependencies: 240
-- Name: COLUMN fact_order.salesman_id; Type: COMMENT; Schema: billiards; Owner: postgres
--

COMMENT ON COLUMN billiards.fact_order.salesman_id IS '开单/营业员ID';


--
-- TOC entry 5936 (class 0 OID 0)
-- Dependencies: 240
-- Name: COLUMN fact_order.salesman_name; Type: COMMENT; Schema: billiards; Owner: postgres
--

COMMENT ON COLUMN billiards.fact_order.salesman_name IS '开单/营业员姓名';


--
-- TOC entry 5937 (class 0 OID 0)
-- Dependencies: 240
-- Name: COLUMN fact_order.created_time; Type: COMMENT; Schema: billiards; Owner: postgres
--

COMMENT ON COLUMN billiards.fact_order.created_time IS '订单创建时间/入库时间';


--
-- TOC entry 241 (class 1259 OID 21124)
-- Name: fact_order_detail; Type: TABLE; Schema: billiards; Owner: postgres
--

CREATE TABLE billiards.fact_order_detail (
    store_id bigint NOT NULL,
    order_id bigint NOT NULL,
    detail_id bigint NOT NULL,
    detail_type character varying(20) NOT NULL,
    item_id bigint,
    item_name character varying(200),
    quantity numeric(12,2),
    unit_price numeric(12,2),
    amount numeric(14,2),
    original_amount numeric(14,2),
    discount numeric(14,2),
    start_time timestamp with time zone,
    end_time timestamp with time zone,
    duration_seconds integer,
    assistant_id bigint,
    assistant_level character varying(50),
    table_id bigint,
    table_area character varying(100),
    product_id bigint,
    salesman_id bigint,
    salesman_name character varying(100),
    notes character varying(255),
    CONSTRAINT ck_fod_amount_pos CHECK (((COALESCE(amount, (0)::numeric) >= (0)::numeric) AND (COALESCE(original_amount, (0)::numeric) >= (0)::numeric) AND (COALESCE(discount, (0)::numeric) >= (0)::numeric)))
);


ALTER TABLE billiards.fact_order_detail OWNER TO postgres;

--
-- TOC entry 5939 (class 0 OID 0)
-- Dependencies: 241
-- Name: TABLE fact_order_detail; Type: COMMENT; Schema: billiards; Owner: postgres
--

COMMENT ON TABLE billiards.fact_order_detail IS '订单明细（台费/助教费/商品）';


--
-- TOC entry 5940 (class 0 OID 0)
-- Dependencies: 241
-- Name: COLUMN fact_order_detail.detail_id; Type: COMMENT; Schema: billiards; Owner: postgres
--

COMMENT ON COLUMN billiards.fact_order_detail.detail_id IS '明细ID（上游明细主键或生成ID）';


--
-- TOC entry 5941 (class 0 OID 0)
-- Dependencies: 241
-- Name: COLUMN fact_order_detail.detail_type; Type: COMMENT; Schema: billiards; Owner: postgres
--

COMMENT ON COLUMN billiards.fact_order_detail.detail_type IS '明细类别：TABLE/ASSISTANT/PRODUCT/OTHER';


--
-- TOC entry 5942 (class 0 OID 0)
-- Dependencies: 241
-- Name: COLUMN fact_order_detail.item_id; Type: COMMENT; Schema: billiards; Owner: postgres
--

COMMENT ON COLUMN billiards.fact_order_detail.item_id IS '项目ID（商品/助教/球台）';


--
-- TOC entry 5943 (class 0 OID 0)
-- Dependencies: 241
-- Name: COLUMN fact_order_detail.item_name; Type: COMMENT; Schema: billiards; Owner: postgres
--

COMMENT ON COLUMN billiards.fact_order_detail.item_name IS '项目名称（商品名/助教名/球台号）';


--
-- TOC entry 5944 (class 0 OID 0)
-- Dependencies: 241
-- Name: COLUMN fact_order_detail.quantity; Type: COMMENT; Schema: billiards; Owner: postgres
--

COMMENT ON COLUMN billiards.fact_order_detail.quantity IS '数量（商品件数或时长转化）';


--
-- TOC entry 5945 (class 0 OID 0)
-- Dependencies: 241
-- Name: COLUMN fact_order_detail.unit_price; Type: COMMENT; Schema: billiards; Owner: postgres
--

COMMENT ON COLUMN billiards.fact_order_detail.unit_price IS '单价';


--
-- TOC entry 5946 (class 0 OID 0)
-- Dependencies: 241
-- Name: COLUMN fact_order_detail.amount; Type: COMMENT; Schema: billiards; Owner: postgres
--

COMMENT ON COLUMN billiards.fact_order_detail.amount IS '折后金额';


--
-- TOC entry 5947 (class 0 OID 0)
-- Dependencies: 241
-- Name: COLUMN fact_order_detail.original_amount; Type: COMMENT; Schema: billiards; Owner: postgres
--

COMMENT ON COLUMN billiards.fact_order_detail.original_amount IS '原价金额';


--
-- TOC entry 5948 (class 0 OID 0)
-- Dependencies: 241
-- Name: COLUMN fact_order_detail.discount; Type: COMMENT; Schema: billiards; Owner: postgres
--

COMMENT ON COLUMN billiards.fact_order_detail.discount IS '折扣金额';


--
-- TOC entry 5949 (class 0 OID 0)
-- Dependencies: 241
-- Name: COLUMN fact_order_detail.start_time; Type: COMMENT; Schema: billiards; Owner: postgres
--

COMMENT ON COLUMN billiards.fact_order_detail.start_time IS '开始时间（按时计费使用）';


--
-- TOC entry 5950 (class 0 OID 0)
-- Dependencies: 241
-- Name: COLUMN fact_order_detail.end_time; Type: COMMENT; Schema: billiards; Owner: postgres
--

COMMENT ON COLUMN billiards.fact_order_detail.end_time IS '结束时间';


--
-- TOC entry 5951 (class 0 OID 0)
-- Dependencies: 241
-- Name: COLUMN fact_order_detail.duration_seconds; Type: COMMENT; Schema: billiards; Owner: postgres
--

COMMENT ON COLUMN billiards.fact_order_detail.duration_seconds IS '服务/台费时长（秒）';


--
-- TOC entry 5952 (class 0 OID 0)
-- Dependencies: 241
-- Name: COLUMN fact_order_detail.assistant_id; Type: COMMENT; Schema: billiards; Owner: postgres
--

COMMENT ON COLUMN billiards.fact_order_detail.assistant_id IS '助教ID（助教费）';


--
-- TOC entry 5953 (class 0 OID 0)
-- Dependencies: 241
-- Name: COLUMN fact_order_detail.assistant_level; Type: COMMENT; Schema: billiards; Owner: postgres
--

COMMENT ON COLUMN billiards.fact_order_detail.assistant_level IS '服务当时助教等级';


--
-- TOC entry 5954 (class 0 OID 0)
-- Dependencies: 241
-- Name: COLUMN fact_order_detail.table_id; Type: COMMENT; Schema: billiards; Owner: postgres
--

COMMENT ON COLUMN billiards.fact_order_detail.table_id IS '球台ID（台费）';


--
-- TOC entry 5955 (class 0 OID 0)
-- Dependencies: 241
-- Name: COLUMN fact_order_detail.table_area; Type: COMMENT; Schema: billiards; Owner: postgres
--

COMMENT ON COLUMN billiards.fact_order_detail.table_area IS '球台区域名';


--
-- TOC entry 5956 (class 0 OID 0)
-- Dependencies: 241
-- Name: COLUMN fact_order_detail.product_id; Type: COMMENT; Schema: billiards; Owner: postgres
--

COMMENT ON COLUMN billiards.fact_order_detail.product_id IS '商品ID（商品明细）';


--
-- TOC entry 5957 (class 0 OID 0)
-- Dependencies: 241
-- Name: COLUMN fact_order_detail.salesman_id; Type: COMMENT; Schema: billiards; Owner: postgres
--

COMMENT ON COLUMN billiards.fact_order_detail.salesman_id IS '销售员ID';


--
-- TOC entry 5958 (class 0 OID 0)
-- Dependencies: 241
-- Name: COLUMN fact_order_detail.salesman_name; Type: COMMENT; Schema: billiards; Owner: postgres
--

COMMENT ON COLUMN billiards.fact_order_detail.salesman_name IS '销售员姓名';


--
-- TOC entry 5959 (class 0 OID 0)
-- Dependencies: 241
-- Name: COLUMN fact_order_detail.notes; Type: COMMENT; Schema: billiards; Owner: postgres
--

COMMENT ON COLUMN billiards.fact_order_detail.notes IS '备注（选项/退换信息等）';


--
-- TOC entry 242 (class 1259 OID 21134)
-- Name: fact_package_usage; Type: TABLE; Schema: billiards; Owner: postgres
--

CREATE TABLE billiards.fact_package_usage (
    store_id bigint NOT NULL,
    usage_id bigint NOT NULL,
    package_id bigint,
    order_id bigint,
    member_id bigint,
    redeem_time timestamp with time zone
);


ALTER TABLE billiards.fact_package_usage OWNER TO postgres;

--
-- TOC entry 5961 (class 0 OID 0)
-- Dependencies: 242
-- Name: TABLE fact_package_usage; Type: COMMENT; Schema: billiards; Owner: postgres
--

COMMENT ON TABLE billiards.fact_package_usage IS '套餐/团购核销流水';


--
-- TOC entry 243 (class 1259 OID 21139)
-- Name: fact_payment; Type: TABLE; Schema: billiards; Owner: postgres
--

CREATE TABLE billiards.fact_payment (
    store_id bigint NOT NULL,
    pay_id bigint NOT NULL,
    order_id bigint,
    pay_trade_no character varying(100),
    pay_amount numeric(14,2),
    pay_method character varying(50),
    pay_time timestamp with time zone,
    pay_status character varying(20),
    operator_id bigint,
    create_time timestamp with time zone,
    CONSTRAINT ck_fp_amount_pos CHECK ((pay_amount >= (0)::numeric))
);


ALTER TABLE billiards.fact_payment OWNER TO postgres;

--
-- TOC entry 5963 (class 0 OID 0)
-- Dependencies: 243
-- Name: TABLE fact_payment; Type: COMMENT; Schema: billiards; Owner: postgres
--

COMMENT ON TABLE billiards.fact_payment IS '支付流水（可能一单多次支付）';


--
-- TOC entry 244 (class 1259 OID 21145)
-- Name: fact_refund; Type: TABLE; Schema: billiards; Owner: postgres
--

CREATE TABLE billiards.fact_refund (
    store_id bigint NOT NULL,
    refund_id bigint NOT NULL,
    order_id bigint,
    pay_id bigint,
    refund_amount numeric(14,2),
    refund_time timestamp with time zone,
    refund_method character varying(50),
    operator_id bigint,
    reason character varying(255),
    CONSTRAINT ck_fr_amount_pos CHECK ((refund_amount >= (0)::numeric))
);


ALTER TABLE billiards.fact_refund OWNER TO postgres;

--
-- TOC entry 5965 (class 0 OID 0)
-- Dependencies: 244
-- Name: TABLE fact_refund; Type: COMMENT; Schema: billiards; Owner: postgres
--

COMMENT ON TABLE billiards.fact_refund IS '退款流水';


--
-- TOC entry 245 (class 1259 OID 21151)
-- Name: fact_table_discount; Type: TABLE; Schema: billiards; Owner: postgres
--

CREATE TABLE billiards.fact_table_discount (
    store_id bigint NOT NULL,
    discount_id bigint NOT NULL,
    order_id bigint,
    table_id bigint,
    applicant_id bigint,
    applicant_name character varying(100),
    operator_id bigint,
    operator_name character varying(100),
    adjust_type character varying(50),
    ledger_count numeric(12,2),
    ledger_amount numeric(14,2),
    create_time timestamp with time zone,
    reason character varying(255)
);


ALTER TABLE billiards.fact_table_discount OWNER TO postgres;

--
-- TOC entry 5967 (class 0 OID 0)
-- Dependencies: 245
-- Name: TABLE fact_table_discount; Type: COMMENT; Schema: billiards; Owner: postgres
--

COMMENT ON TABLE billiards.fact_table_discount IS '台费打折/减免记录';


--
-- TOC entry 5968 (class 0 OID 0)
-- Dependencies: 245
-- Name: COLUMN fact_table_discount.ledger_count; Type: COMMENT; Schema: billiards; Owner: postgres
--

COMMENT ON COLUMN billiards.fact_table_discount.ledger_count IS '减免费用数量（如分钟）';


--
-- TOC entry 5969 (class 0 OID 0)
-- Dependencies: 245
-- Name: COLUMN fact_table_discount.ledger_amount; Type: COMMENT; Schema: billiards; Owner: postgres
--

COMMENT ON COLUMN billiards.fact_table_discount.ledger_amount IS '减免金额';


--
-- TOC entry 246 (class 1259 OID 21158)
-- Name: fact_topup; Type: TABLE; Schema: billiards; Owner: postgres
--

CREATE TABLE billiards.fact_topup (
    store_id bigint NOT NULL,
    topup_id bigint NOT NULL,
    member_id bigint,
    order_id bigint,
    amount_recharge numeric(14,2),
    amount_bonus numeric(14,2),
    pay_method character varying(50),
    pay_time timestamp with time zone,
    operator_id bigint,
    remark character varying(255),
    CONSTRAINT ck_ft_amount_pos CHECK (((COALESCE(amount_recharge, (0)::numeric) >= (0)::numeric) AND (COALESCE(amount_bonus, (0)::numeric) >= (0)::numeric)))
);


ALTER TABLE billiards.fact_topup OWNER TO postgres;

--
-- TOC entry 5971 (class 0 OID 0)
-- Dependencies: 246
-- Name: TABLE fact_topup; Type: COMMENT; Schema: billiards; Owner: postgres
--

COMMENT ON TABLE billiards.fact_topup IS '会员充值记录（含赠送）';


--
-- TOC entry 247 (class 1259 OID 21164)
-- Name: etl_cursor; Type: TABLE; Schema: etl_admin; Owner: postgres
--

CREATE TABLE etl_admin.etl_cursor (
    cursor_id bigint NOT NULL,
    task_id bigint NOT NULL,
    store_id bigint NOT NULL,
    last_start timestamp with time zone,
    last_end timestamp with time zone,
    last_id bigint,
    extra jsonb DEFAULT '{}'::jsonb NOT NULL,
    last_run_id bigint,
    updated_at timestamp with time zone DEFAULT now() NOT NULL,
    lock_token uuid,
    lock_at timestamp with time zone,
    CONSTRAINT ck_cursor_range CHECK (((last_start IS NULL) OR (last_end IS NULL) OR (last_start <= last_end)))
);


ALTER TABLE etl_admin.etl_cursor OWNER TO postgres;

--
-- TOC entry 5973 (class 0 OID 0)
-- Dependencies: 247
-- Name: TABLE etl_cursor; Type: COMMENT; Schema: etl_admin; Owner: postgres
--

COMMENT ON TABLE etl_admin.etl_cursor IS 'ETL 任务时间/ID 水位；支撑增量抓取的断点续传';


--
-- TOC entry 5974 (class 0 OID 0)
-- Dependencies: 247
-- Name: COLUMN etl_cursor.task_id; Type: COMMENT; Schema: etl_admin; Owner: postgres
--

COMMENT ON COLUMN etl_admin.etl_cursor.task_id IS '关联 etl_task.task_id';


--
-- TOC entry 5975 (class 0 OID 0)
-- Dependencies: 247
-- Name: COLUMN etl_cursor.store_id; Type: COMMENT; Schema: etl_admin; Owner: postgres
--

COMMENT ON COLUMN etl_admin.etl_cursor.store_id IS '门店ID（与任务维度一致，便于过滤）';


--
-- TOC entry 5976 (class 0 OID 0)
-- Dependencies: 247
-- Name: COLUMN etl_cursor.last_start; Type: COMMENT; Schema: etl_admin; Owner: postgres
--

COMMENT ON COLUMN etl_admin.etl_cursor.last_start IS '上次成功抓取窗口起点（含）';


--
-- TOC entry 5977 (class 0 OID 0)
-- Dependencies: 247
-- Name: COLUMN etl_cursor.last_end; Type: COMMENT; Schema: etl_admin; Owner: postgres
--

COMMENT ON COLUMN etl_admin.etl_cursor.last_end IS '上次成功抓取窗口终点（含）';


--
-- TOC entry 5978 (class 0 OID 0)
-- Dependencies: 247
-- Name: COLUMN etl_cursor.last_id; Type: COMMENT; Schema: etl_admin; Owner: postgres
--

COMMENT ON COLUMN etl_admin.etl_cursor.last_id IS '上次成功抓取到的最大ID（如接口支持按ID增量）';


--
-- TOC entry 5979 (class 0 OID 0)
-- Dependencies: 247
-- Name: COLUMN etl_cursor.extra; Type: COMMENT; Schema: etl_admin; Owner: postgres
--

COMMENT ON COLUMN etl_admin.etl_cursor.extra IS '附加游标数据（JSON）：如页码、标志位等';


--
-- TOC entry 5980 (class 0 OID 0)
-- Dependencies: 247
-- Name: COLUMN etl_cursor.last_run_id; Type: COMMENT; Schema: etl_admin; Owner: postgres
--

COMMENT ON COLUMN etl_admin.etl_cursor.last_run_id IS '最近一次成功运行的 etl_run.run_id';


--
-- TOC entry 5981 (class 0 OID 0)
-- Dependencies: 247
-- Name: COLUMN etl_cursor.updated_at; Type: COMMENT; Schema: etl_admin; Owner: postgres
--

COMMENT ON COLUMN etl_admin.etl_cursor.updated_at IS '最近更新时间';


--
-- TOC entry 5982 (class 0 OID 0)
-- Dependencies: 247
-- Name: COLUMN etl_cursor.lock_token; Type: COMMENT; Schema: etl_admin; Owner: postgres
--

COMMENT ON COLUMN etl_admin.etl_cursor.lock_token IS '并发抢占锁的 token，防重入';


--
-- TOC entry 5983 (class 0 OID 0)
-- Dependencies: 247
-- Name: COLUMN etl_cursor.lock_at; Type: COMMENT; Schema: etl_admin; Owner: postgres
--

COMMENT ON COLUMN etl_admin.etl_cursor.lock_at IS '加锁时间戳';


--
-- TOC entry 248 (class 1259 OID 21177)
-- Name: etl_cursor_cursor_id_seq; Type: SEQUENCE; Schema: etl_admin; Owner: postgres
--

CREATE SEQUENCE etl_admin.etl_cursor_cursor_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE etl_admin.etl_cursor_cursor_id_seq OWNER TO postgres;

--
-- TOC entry 5985 (class 0 OID 0)
-- Dependencies: 248
-- Name: etl_cursor_cursor_id_seq; Type: SEQUENCE OWNED BY; Schema: etl_admin; Owner: postgres
--

ALTER SEQUENCE etl_admin.etl_cursor_cursor_id_seq OWNED BY etl_admin.etl_cursor.cursor_id;


--
-- TOC entry 249 (class 1259 OID 21178)
-- Name: etl_run; Type: TABLE; Schema: etl_admin; Owner: postgres
--

CREATE TABLE etl_admin.etl_run (
    run_id bigint NOT NULL,
    run_uuid uuid DEFAULT gen_random_uuid() NOT NULL,
    task_id bigint NOT NULL,
    store_id bigint NOT NULL,
    status etl_admin.run_status_enum NOT NULL,
    started_at timestamp with time zone DEFAULT now() NOT NULL,
    ended_at timestamp with time zone,
    window_start timestamp with time zone,
    window_end timestamp with time zone,
    window_minutes integer,
    overlap_seconds integer,
    fetched_count integer DEFAULT 0 NOT NULL,
    loaded_count integer DEFAULT 0 NOT NULL,
    updated_count integer DEFAULT 0 NOT NULL,
    skipped_count integer DEFAULT 0 NOT NULL,
    error_count integer DEFAULT 0 NOT NULL,
    unknown_fields integer DEFAULT 0 NOT NULL,
    export_dir text,
    log_path text,
    request_params jsonb,
    manifest jsonb,
    error_message text,
    extra jsonb DEFAULT '{}'::jsonb NOT NULL,
    created_at timestamp with time zone DEFAULT now() NOT NULL,
    CONSTRAINT ck_run_counts CHECK (((fetched_count >= 0) AND (loaded_count >= 0) AND (updated_count >= 0) AND (skipped_count >= 0) AND (error_count >= 0) AND (unknown_fields >= 0))),
    CONSTRAINT ck_run_time CHECK (((ended_at IS NULL) OR (ended_at >= started_at)))
);


ALTER TABLE etl_admin.etl_run OWNER TO postgres;

--
-- TOC entry 5987 (class 0 OID 0)
-- Dependencies: 249
-- Name: TABLE etl_run; Type: COMMENT; Schema: etl_admin; Owner: postgres
--

COMMENT ON TABLE etl_admin.etl_run IS 'ETL 运行流水；记录每次任务运行的窗口、计数、导出与日志位置';


--
-- TOC entry 5988 (class 0 OID 0)
-- Dependencies: 249
-- Name: COLUMN etl_run.run_uuid; Type: COMMENT; Schema: etl_admin; Owner: postgres
--

COMMENT ON COLUMN etl_admin.etl_run.run_uuid IS '运行 UUID；建议与导出目录名中的 run_id 对齐';


--
-- TOC entry 5989 (class 0 OID 0)
-- Dependencies: 249
-- Name: COLUMN etl_run.task_id; Type: COMMENT; Schema: etl_admin; Owner: postgres
--

COMMENT ON COLUMN etl_admin.etl_run.task_id IS '关联 etl_task.task_id';


--
-- TOC entry 5990 (class 0 OID 0)
-- Dependencies: 249
-- Name: COLUMN etl_run.store_id; Type: COMMENT; Schema: etl_admin; Owner: postgres
--

COMMENT ON COLUMN etl_admin.etl_run.store_id IS '门店ID（与任务维度一致）';


--
-- TOC entry 5991 (class 0 OID 0)
-- Dependencies: 249
-- Name: COLUMN etl_run.status; Type: COMMENT; Schema: etl_admin; Owner: postgres
--

COMMENT ON COLUMN etl_admin.etl_run.status IS '运行状态：SUCC/FAIL/PARTIAL';


--
-- TOC entry 5992 (class 0 OID 0)
-- Dependencies: 249
-- Name: COLUMN etl_run.started_at; Type: COMMENT; Schema: etl_admin; Owner: postgres
--

COMMENT ON COLUMN etl_admin.etl_run.started_at IS '开始时间';


--
-- TOC entry 5993 (class 0 OID 0)
-- Dependencies: 249
-- Name: COLUMN etl_run.ended_at; Type: COMMENT; Schema: etl_admin; Owner: postgres
--

COMMENT ON COLUMN etl_admin.etl_run.ended_at IS '结束时间';


--
-- TOC entry 5994 (class 0 OID 0)
-- Dependencies: 249
-- Name: COLUMN etl_run.window_start; Type: COMMENT; Schema: etl_admin; Owner: postgres
--

COMMENT ON COLUMN etl_admin.etl_run.window_start IS '此次抓取窗口起点（请求侧）';


--
-- TOC entry 5995 (class 0 OID 0)
-- Dependencies: 249
-- Name: COLUMN etl_run.window_end; Type: COMMENT; Schema: etl_admin; Owner: postgres
--

COMMENT ON COLUMN etl_admin.etl_run.window_end IS '此次抓取窗口终点（请求侧）';


--
-- TOC entry 5996 (class 0 OID 0)
-- Dependencies: 249
-- Name: COLUMN etl_run.window_minutes; Type: COMMENT; Schema: etl_admin; Owner: postgres
--

COMMENT ON COLUMN etl_admin.etl_run.window_minutes IS '窗口大小（分钟）';


--
-- TOC entry 5997 (class 0 OID 0)
-- Dependencies: 249
-- Name: COLUMN etl_run.overlap_seconds; Type: COMMENT; Schema: etl_admin; Owner: postgres
--

COMMENT ON COLUMN etl_admin.etl_run.overlap_seconds IS '窗口冗余（秒）';


--
-- TOC entry 5998 (class 0 OID 0)
-- Dependencies: 249
-- Name: COLUMN etl_run.fetched_count; Type: COMMENT; Schema: etl_admin; Owner: postgres
--

COMMENT ON COLUMN etl_admin.etl_run.fetched_count IS '拉取条数（原始响应合计）';


--
-- TOC entry 5999 (class 0 OID 0)
-- Dependencies: 249
-- Name: COLUMN etl_run.loaded_count; Type: COMMENT; Schema: etl_admin; Owner: postgres
--

COMMENT ON COLUMN etl_admin.etl_run.loaded_count IS '入库新增数';


--
-- TOC entry 6000 (class 0 OID 0)
-- Dependencies: 249
-- Name: COLUMN etl_run.updated_count; Type: COMMENT; Schema: etl_admin; Owner: postgres
--

COMMENT ON COLUMN etl_admin.etl_run.updated_count IS '入库更新数';


--
-- TOC entry 6001 (class 0 OID 0)
-- Dependencies: 249
-- Name: COLUMN etl_run.skipped_count; Type: COMMENT; Schema: etl_admin; Owner: postgres
--

COMMENT ON COLUMN etl_admin.etl_run.skipped_count IS '因幂等已存在而跳过的条数';


--
-- TOC entry 6002 (class 0 OID 0)
-- Dependencies: 249
-- Name: COLUMN etl_run.error_count; Type: COMMENT; Schema: etl_admin; Owner: postgres
--

COMMENT ON COLUMN etl_admin.etl_run.error_count IS '处理失败条数';


--
-- TOC entry 6003 (class 0 OID 0)
-- Dependencies: 249
-- Name: COLUMN etl_run.unknown_fields; Type: COMMENT; Schema: etl_admin; Owner: postgres
--

COMMENT ON COLUMN etl_admin.etl_run.unknown_fields IS '清洗过程中识别为未知的字段数量';


--
-- TOC entry 6004 (class 0 OID 0)
-- Dependencies: 249
-- Name: COLUMN etl_run.export_dir; Type: COMMENT; Schema: etl_admin; Owner: postgres
--

COMMENT ON COLUMN etl_admin.etl_run.export_dir IS '导出目录绝对路径（与 manifest.json 配对）';


--
-- TOC entry 6005 (class 0 OID 0)
-- Dependencies: 249
-- Name: COLUMN etl_run.log_path; Type: COMMENT; Schema: etl_admin; Owner: postgres
--

COMMENT ON COLUMN etl_admin.etl_run.log_path IS '日志文件路径';


--
-- TOC entry 6006 (class 0 OID 0)
-- Dependencies: 249
-- Name: COLUMN etl_run.request_params; Type: COMMENT; Schema: etl_admin; Owner: postgres
--

COMMENT ON COLUMN etl_admin.etl_run.request_params IS '关键请求参数（JSON）；不含敏感 token';


--
-- TOC entry 6007 (class 0 OID 0)
-- Dependencies: 249
-- Name: COLUMN etl_run.manifest; Type: COMMENT; Schema: etl_admin; Owner: postgres
--

COMMENT ON COLUMN etl_admin.etl_run.manifest IS 'manifest.json 内容冗余（JSON）';


--
-- TOC entry 6008 (class 0 OID 0)
-- Dependencies: 249
-- Name: COLUMN etl_run.error_message; Type: COMMENT; Schema: etl_admin; Owner: postgres
--

COMMENT ON COLUMN etl_admin.etl_run.error_message IS '错误摘要信息';


--
-- TOC entry 6009 (class 0 OID 0)
-- Dependencies: 249
-- Name: COLUMN etl_run.extra; Type: COMMENT; Schema: etl_admin; Owner: postgres
--

COMMENT ON COLUMN etl_admin.etl_run.extra IS '其他补充键值对（JSON）';


--
-- TOC entry 6010 (class 0 OID 0)
-- Dependencies: 249
-- Name: COLUMN etl_run.created_at; Type: COMMENT; Schema: etl_admin; Owner: postgres
--

COMMENT ON COLUMN etl_admin.etl_run.created_at IS '记录创建时间';


--
-- TOC entry 250 (class 1259 OID 21209)
-- Name: etl_run_run_id_seq; Type: SEQUENCE; Schema: etl_admin; Owner: postgres
--

CREATE SEQUENCE etl_admin.etl_run_run_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE etl_admin.etl_run_run_id_seq OWNER TO postgres;

--
-- TOC entry 6012 (class 0 OID 0)
-- Dependencies: 250
-- Name: etl_run_run_id_seq; Type: SEQUENCE OWNED BY; Schema: etl_admin; Owner: postgres
--

ALTER SEQUENCE etl_admin.etl_run_run_id_seq OWNED BY etl_admin.etl_run.run_id;


--
-- TOC entry 251 (class 1259 OID 21210)
-- Name: etl_task; Type: TABLE; Schema: etl_admin; Owner: postgres
--

CREATE TABLE etl_admin.etl_task (
    task_id bigint NOT NULL,
    task_code character varying(64) NOT NULL,
    store_id bigint NOT NULL,
    enabled boolean DEFAULT true NOT NULL,
    cursor_field character varying(64),
    cursor_field_fallback character varying(64),
    window_minutes_default integer DEFAULT 180 NOT NULL,
    overlap_seconds integer DEFAULT 120 NOT NULL,
    page_size integer DEFAULT 200 NOT NULL,
    retry_max integer DEFAULT 3 NOT NULL,
    params jsonb DEFAULT '{}'::jsonb NOT NULL,
    description character varying(255),
    created_at timestamp with time zone DEFAULT now() NOT NULL,
    updated_at timestamp with time zone DEFAULT now() NOT NULL,
    CONSTRAINT ck_task_overlap CHECK ((overlap_seconds >= 0)),
    CONSTRAINT ck_task_pagesize CHECK ((page_size > 0)),
    CONSTRAINT ck_task_retry CHECK ((retry_max >= 0)),
    CONSTRAINT ck_task_window CHECK ((window_minutes_default > 0))
);


ALTER TABLE etl_admin.etl_task OWNER TO postgres;

--
-- TOC entry 6014 (class 0 OID 0)
-- Dependencies: 251
-- Name: TABLE etl_task; Type: COMMENT; Schema: etl_admin; Owner: postgres
--

COMMENT ON TABLE etl_admin.etl_task IS 'ETL 任务注册与默认配置；按 task_code + store_id 唯一';


--
-- TOC entry 6015 (class 0 OID 0)
-- Dependencies: 251
-- Name: COLUMN etl_task.task_code; Type: COMMENT; Schema: etl_admin; Owner: postgres
--

COMMENT ON COLUMN etl_admin.etl_task.task_code IS '任务代码：ORDERS / PAYMENTS / REFUNDS / INVENTORY_CHANGE / COUPON_USAGE 等';


--
-- TOC entry 6016 (class 0 OID 0)
-- Dependencies: 251
-- Name: COLUMN etl_task.store_id; Type: COMMENT; Schema: etl_admin; Owner: postgres
--

COMMENT ON COLUMN etl_admin.etl_task.store_id IS '门店ID（与业务数据同维度隔离）';


--
-- TOC entry 6017 (class 0 OID 0)
-- Dependencies: 251
-- Name: COLUMN etl_task.enabled; Type: COMMENT; Schema: etl_admin; Owner: postgres
--

COMMENT ON COLUMN etl_admin.etl_task.enabled IS '任务是否启用';


--
-- TOC entry 6018 (class 0 OID 0)
-- Dependencies: 251
-- Name: COLUMN etl_task.cursor_field; Type: COMMENT; Schema: etl_admin; Owner: postgres
--

COMMENT ON COLUMN etl_admin.etl_task.cursor_field IS '主游标字段名（上游返回的时间字段名）';


--
-- TOC entry 6019 (class 0 OID 0)
-- Dependencies: 251
-- Name: COLUMN etl_task.cursor_field_fallback; Type: COMMENT; Schema: etl_admin; Owner: postgres
--

COMMENT ON COLUMN etl_admin.etl_task.cursor_field_fallback IS '备选游标字段名（主字段缺失时回退）';


--
-- TOC entry 6020 (class 0 OID 0)
-- Dependencies: 251
-- Name: COLUMN etl_task.window_minutes_default; Type: COMMENT; Schema: etl_admin; Owner: postgres
--

COMMENT ON COLUMN etl_admin.etl_task.window_minutes_default IS '默认拉取窗口（分钟），闲忙时可由外部调度覆盖';


--
-- TOC entry 6021 (class 0 OID 0)
-- Dependencies: 251
-- Name: COLUMN etl_task.overlap_seconds; Type: COMMENT; Schema: etl_admin; Owner: postgres
--

COMMENT ON COLUMN etl_admin.etl_task.overlap_seconds IS '窗口冗余秒数，防止边界遗漏';


--
-- TOC entry 6022 (class 0 OID 0)
-- Dependencies: 251
-- Name: COLUMN etl_task.page_size; Type: COMMENT; Schema: etl_admin; Owner: postgres
--

COMMENT ON COLUMN etl_admin.etl_task.page_size IS '上游接口分页大小';


--
-- TOC entry 6023 (class 0 OID 0)
-- Dependencies: 251
-- Name: COLUMN etl_task.retry_max; Type: COMMENT; Schema: etl_admin; Owner: postgres
--

COMMENT ON COLUMN etl_admin.etl_task.retry_max IS '失败重试次数上限';


--
-- TOC entry 6024 (class 0 OID 0)
-- Dependencies: 251
-- Name: COLUMN etl_task.params; Type: COMMENT; Schema: etl_admin; Owner: postgres
--

COMMENT ON COLUMN etl_admin.etl_task.params IS '任务级自定义参数（JSON）';


--
-- TOC entry 6025 (class 0 OID 0)
-- Dependencies: 251
-- Name: COLUMN etl_task.description; Type: COMMENT; Schema: etl_admin; Owner: postgres
--

COMMENT ON COLUMN etl_admin.etl_task.description IS '任务描述';


--
-- TOC entry 6026 (class 0 OID 0)
-- Dependencies: 251
-- Name: COLUMN etl_task.created_at; Type: COMMENT; Schema: etl_admin; Owner: postgres
--

COMMENT ON COLUMN etl_admin.etl_task.created_at IS '创建时间';


--
-- TOC entry 6027 (class 0 OID 0)
-- Dependencies: 251
-- Name: COLUMN etl_task.updated_at; Type: COMMENT; Schema: etl_admin; Owner: postgres
--

COMMENT ON COLUMN etl_admin.etl_task.updated_at IS '最近更新时间';


--
-- TOC entry 252 (class 1259 OID 21238)
-- Name: etl_task_task_id_seq; Type: SEQUENCE; Schema: etl_admin; Owner: postgres
--

CREATE SEQUENCE etl_admin.etl_task_task_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE etl_admin.etl_task_task_id_seq OWNER TO postgres;

--
-- TOC entry 6029 (class 0 OID 0)
-- Dependencies: 252
-- Name: etl_task_task_id_seq; Type: SEQUENCE OWNED BY; Schema: etl_admin; Owner: postgres
--

ALTER SEQUENCE etl_admin.etl_task_task_id_seq OWNED BY etl_admin.etl_task.task_id;


--
-- TOC entry 5251 (class 2604 OID 21378)
-- Name: dim_assistant_scd assistant_scd_id; Type: DEFAULT; Schema: billiards; Owner: postgres
--

ALTER TABLE ONLY billiards.dim_assistant_scd ALTER COLUMN assistant_scd_id SET DEFAULT nextval('billiards.dim_assistant_scd_assistant_scd_id_seq'::regclass);


--
-- TOC entry 5254 (class 2604 OID 21379)
-- Name: dim_member_scd member_scd_id; Type: DEFAULT; Schema: billiards; Owner: postgres
--

ALTER TABLE ONLY billiards.dim_member_scd ALTER COLUMN member_scd_id SET DEFAULT nextval('billiards.dim_member_scd_member_scd_id_seq'::regclass);


--
-- TOC entry 5257 (class 2604 OID 21380)
-- Name: dim_product_price_scd product_scd_id; Type: DEFAULT; Schema: billiards; Owner: postgres
--

ALTER TABLE ONLY billiards.dim_product_price_scd ALTER COLUMN product_scd_id SET DEFAULT nextval('billiards.dim_product_price_scd_product_scd_id_seq'::regclass);


--
-- TOC entry 5260 (class 2604 OID 21381)
-- Name: etl_cursor cursor_id; Type: DEFAULT; Schema: etl_admin; Owner: postgres
--

ALTER TABLE ONLY etl_admin.etl_cursor ALTER COLUMN cursor_id SET DEFAULT nextval('etl_admin.etl_cursor_cursor_id_seq'::regclass);


--
-- TOC entry 5263 (class 2604 OID 21382)
-- Name: etl_run run_id; Type: DEFAULT; Schema: etl_admin; Owner: postgres
--

ALTER TABLE ONLY etl_admin.etl_run ALTER COLUMN run_id SET DEFAULT nextval('etl_admin.etl_run_run_id_seq'::regclass);


--
-- TOC entry 5274 (class 2604 OID 21383)
-- Name: etl_task task_id; Type: DEFAULT; Schema: etl_admin; Owner: postgres
--

ALTER TABLE ONLY etl_admin.etl_task ALTER COLUMN task_id SET DEFAULT nextval('etl_admin.etl_task_task_id_seq'::regclass);


--
-- TOC entry 5571 (class 0 OID 21001)
-- Dependencies: 222
-- Data for Name: dim_assistant; Type: TABLE DATA; Schema: billiards; Owner: postgres
--

COPY billiards.dim_assistant (store_id, assistant_id, assistant_name, nickname, level_name, skill_name, team_id, status, entry_date, leave_date, raw_data) FROM stdin;
\.


--
-- TOC entry 5572 (class 0 OID 21008)
-- Dependencies: 223
-- Data for Name: dim_assistant_scd; Type: TABLE DATA; Schema: billiards; Owner: postgres
--

COPY billiards.dim_assistant_scd (assistant_scd_id, store_id, assistant_id, assistant_name, level_name, skill_name, team_id, status, valid_from, valid_to, is_current, raw_data) FROM stdin;
\.


--
-- TOC entry 5574 (class 0 OID 21027)
-- Dependencies: 226
-- Data for Name: dim_member; Type: TABLE DATA; Schema: billiards; Owner: postgres
--

COPY billiards.dim_member (store_id, member_id, member_name, mobile, register_time, member_level_code, member_level_name, status, referrer_id, birth_date, gender, point_balance, raw_data) FROM stdin;
\.


--
-- TOC entry 5575 (class 0 OID 21034)
-- Dependencies: 227
-- Data for Name: dim_member_scd; Type: TABLE DATA; Schema: billiards; Owner: postgres
--

COPY billiards.dim_member_scd (member_scd_id, store_id, member_id, member_level_code, member_level_name, member_name, mobile, status, valid_from, valid_to, is_current, raw_data) FROM stdin;
\.


--
-- TOC entry 5577 (class 0 OID 21053)
-- Dependencies: 230
-- Data for Name: dim_package; Type: TABLE DATA; Schema: billiards; Owner: postgres
--

COPY billiards.dim_package (store_id, package_id, package_name, content_desc, sale_price, valid_from, valid_to, status, raw_data) FROM stdin;
\.


--
-- TOC entry 5578 (class 0 OID 21060)
-- Dependencies: 231
-- Data for Name: dim_product; Type: TABLE DATA; Schema: billiards; Owner: postgres
--

COPY billiards.dim_product (store_id, product_id, site_product_id, product_name, category_id, category_name, second_category_id, unit, cost_price, sale_price, allow_discount, status, supplier_id, barcode, is_combo, created_time, updated_time, raw_data) FROM stdin;
\.


--
-- TOC entry 5579 (class 0 OID 21068)
-- Dependencies: 232
-- Data for Name: dim_product_price_scd; Type: TABLE DATA; Schema: billiards; Owner: postgres
--

COPY billiards.dim_product_price_scd (product_scd_id, store_id, product_id, product_name, category_id, category_name, second_category_id, cost_price, sale_price, allow_discount, status, valid_from, valid_to, is_current, raw_data) FROM stdin;
\.


--
-- TOC entry 5581 (class 0 OID 21087)
-- Dependencies: 235
-- Data for Name: dim_store; Type: TABLE DATA; Schema: billiards; Owner: postgres
--

COPY billiards.dim_store (store_id, store_name, tenant_id, created_time, updated_time, remark) FROM stdin;
\.


--
-- TOC entry 5582 (class 0 OID 21092)
-- Dependencies: 236
-- Data for Name: dim_table; Type: TABLE DATA; Schema: billiards; Owner: postgres
--

COPY billiards.dim_table (store_id, table_id, table_name, table_area_id, table_area_name, is_vip, charge_free, status, created_time, last_used_time, raw_data) FROM stdin;
\.


--
-- TOC entry 5583 (class 0 OID 21100)
-- Dependencies: 237
-- Data for Name: fact_assistant_abolish; Type: TABLE DATA; Schema: billiards; Owner: postgres
--

COPY billiards.fact_assistant_abolish (store_id, abolish_id, order_id, table_id, table_area_name, assistant_id, assistant_name, start_time, end_time, pd_charge_minutes, assistant_abolish_amount, trash_reason, create_time) FROM stdin;
\.


--
-- TOC entry 5584 (class 0 OID 21105)
-- Dependencies: 238
-- Data for Name: fact_inventory_change; Type: TABLE DATA; Schema: billiards; Owner: postgres
--

COPY billiards.fact_inventory_change (store_id, change_id, product_id, change_type, change_quantity, start_stock, end_stock, unit, price, operator_name, change_time, remark) FROM stdin;
\.


--
-- TOC entry 5585 (class 0 OID 21110)
-- Dependencies: 239
-- Data for Name: fact_ledger_entry; Type: TABLE DATA; Schema: billiards; Owner: postgres
--

COPY billiards.fact_ledger_entry (store_id, entry_id, entry_time, transaction_type, transaction_id, account_debit, account_credit, amount, memo) FROM stdin;
\.


--
-- TOC entry 5586 (class 0 OID 21118)
-- Dependencies: 240
-- Data for Name: fact_order; Type: TABLE DATA; Schema: billiards; Owner: postgres
--

COPY billiards.fact_order (store_id, order_id, order_no, member_id, open_table_time, close_time, total_amount, payable_amount, discount_amount, pay_amount, pay_status, payment_method, assistant_count, table_time_minutes, salesman_id, salesman_name, created_time, table_id) FROM stdin;
\.


--
-- TOC entry 5587 (class 0 OID 21124)
-- Dependencies: 241
-- Data for Name: fact_order_detail; Type: TABLE DATA; Schema: billiards; Owner: postgres
--

COPY billiards.fact_order_detail (store_id, order_id, detail_id, detail_type, item_id, item_name, quantity, unit_price, amount, original_amount, discount, start_time, end_time, duration_seconds, assistant_id, assistant_level, table_id, table_area, product_id, salesman_id, salesman_name, notes) FROM stdin;
\.


--
-- TOC entry 5588 (class 0 OID 21134)
-- Dependencies: 242
-- Data for Name: fact_package_usage; Type: TABLE DATA; Schema: billiards; Owner: postgres
--

COPY billiards.fact_package_usage (store_id, usage_id, package_id, order_id, member_id, redeem_time) FROM stdin;
\.


--
-- TOC entry 5589 (class 0 OID 21139)
-- Dependencies: 243
-- Data for Name: fact_payment; Type: TABLE DATA; Schema: billiards; Owner: postgres
--

COPY billiards.fact_payment (store_id, pay_id, order_id, pay_trade_no, pay_amount, pay_method, pay_time, pay_status, operator_id, create_time) FROM stdin;
\.


--
-- TOC entry 5590 (class 0 OID 21145)
-- Dependencies: 244
-- Data for Name: fact_refund; Type: TABLE DATA; Schema: billiards; Owner: postgres
--

COPY billiards.fact_refund (store_id, refund_id, order_id, pay_id, refund_amount, refund_time, refund_method, operator_id, reason) FROM stdin;
\.


--
-- TOC entry 5591 (class 0 OID 21151)
-- Dependencies: 245
-- Data for Name: fact_table_discount; Type: TABLE DATA; Schema: billiards; Owner: postgres
--

COPY billiards.fact_table_discount (store_id, discount_id, order_id, table_id, applicant_id, applicant_name, operator_id, operator_name, adjust_type, ledger_count, ledger_amount, create_time, reason) FROM stdin;
\.


--
-- TOC entry 5592 (class 0 OID 21158)
-- Dependencies: 246
-- Data for Name: fact_topup; Type: TABLE DATA; Schema: billiards; Owner: postgres
--

COPY billiards.fact_topup (store_id, topup_id, member_id, order_id, amount_recharge, amount_bonus, pay_method, pay_time, operator_id, remark) FROM stdin;
\.


--
-- TOC entry 5593 (class 0 OID 21164)
-- Dependencies: 247
-- Data for Name: etl_cursor; Type: TABLE DATA; Schema: etl_admin; Owner: postgres
--

COPY etl_admin.etl_cursor (cursor_id, task_id, store_id, last_start, last_end, last_id, extra, last_run_id, updated_at, lock_token, lock_at) FROM stdin;
1	29	2790685415443269	\N	\N	\N	{}	\N	2025-11-11 10:09:34.540566+08	\N	\N
2	44	2790685415443269	\N	\N	\N	{}	\N	2025-11-11 10:09:34.540566+08	\N	\N
3	45	2790685415443269	\N	\N	\N	{}	\N	2025-11-11 10:09:34.540566+08	\N	\N
4	46	2790685415443269	\N	\N	\N	{}	\N	2025-11-11 10:09:34.540566+08	\N	\N
5	47	2790685415443269	\N	\N	\N	{}	\N	2025-11-11 10:09:34.540566+08	\N	\N
6	48	2790685415443269	\N	\N	\N	{}	\N	2025-11-11 10:09:34.540566+08	\N	\N
7	49	2790685415443269	\N	\N	\N	{}	\N	2025-11-11 10:09:34.540566+08	\N	\N
8	50	2790685415443269	\N	\N	\N	{}	\N	2025-11-11 10:09:34.540566+08	\N	\N
9	51	2790685415443269	\N	\N	\N	{}	\N	2025-11-11 10:09:34.540566+08	\N	\N
10	52	2790685415443269	\N	\N	\N	{}	\N	2025-11-11 10:09:34.540566+08	\N	\N
11	53	2790685415443269	\N	\N	\N	{}	\N	2025-11-11 10:09:34.540566+08	\N	\N
12	54	2790685415443269	\N	\N	\N	{}	\N	2025-11-11 10:09:34.540566+08	\N	\N
13	55	2790685415443269	\N	\N	\N	{}	\N	2025-11-11 10:09:34.540566+08	\N	\N
14	56	2790685415443269	\N	\N	\N	{}	\N	2025-11-11 10:09:34.540566+08	\N	\N
\.


--
-- TOC entry 5595 (class 0 OID 21178)
-- Dependencies: 249
-- Data for Name: etl_run; Type: TABLE DATA; Schema: etl_admin; Owner: postgres
--

COPY etl_admin.etl_run (run_id, run_uuid, task_id, store_id, status, started_at, ended_at, window_start, window_end, window_minutes, overlap_seconds, fetched_count, loaded_count, updated_count, skipped_count, error_count, unknown_fields, export_dir, log_path, request_params, manifest, error_message, extra, created_at) FROM stdin;
\.


--
-- TOC entry 5597 (class 0 OID 21210)
-- Dependencies: 251
-- Data for Name: etl_task; Type: TABLE DATA; Schema: etl_admin; Owner: postgres
--

COPY etl_admin.etl_task (task_id, task_code, store_id, enabled, cursor_field, cursor_field_fallback, window_minutes_default, overlap_seconds, page_size, retry_max, params, description, created_at, updated_at) FROM stdin;
44	ORDERS	2790685415443269	t	payTime	closeTime	180	180	200	3	{"endpoint_list": "/order/settle/list", "endpoint_detail": "/order/settle/detail"}	订单/结账与明细（台费/助教/商品）	2025-11-11 10:09:34.540566+08	2025-11-11 10:09:34.540566+08
45	PAYMENTS	2790685415443269	t	payTime	createTime	180	180	200	3	{"endpoint": "/pay/records"}	支付流水	2025-11-11 10:09:34.540566+08	2025-11-11 10:09:34.540566+08
46	REFUNDS	2790685415443269	t	refundTime	payTime	180	180	200	3	{"endpoint": "/refund/records"}	退款流水	2025-11-11 10:09:34.540566+08	2025-11-11 10:09:34.540566+08
47	INVENTORY_CHANGE	2790685415443269	t	createTime	\N	180	180	200	3	{"endpoint": "/inventory/change", "list_key": "queryDeliveryRecordsList"}	库存变动流水（进/销/退/盘点）	2025-11-11 10:09:34.540566+08	2025-11-11 10:09:34.540566+08
48	COUPON_USAGE	2790685415443269	t	consumeTime	redeemTime	180	180	200	3	{"endpoint": "/coupon/usage"}	套餐/团购核销流水	2025-11-11 10:09:34.540566+08	2025-11-11 10:09:34.540566+08
49	MEMBERS	2790685415443269	t	updateTime	registerTime	180	180	500	3	{"endpoint": "/MemberProfile/GetTenantMemberList"}	会员档案（含等级等属性，SCD2）	2025-11-11 10:09:34.540566+08	2025-11-11 10:09:34.540566+08
50	ASSISTANTS	2790685415443269	t	updateTime	entryTime	180	180	500	3	{"endpoint": "/PersonnelManagement/SearchAssistantInfo"}	助教档案（等级/团队等属性，SCD2）	2025-11-11 10:09:34.540566+08	2025-11-11 10:09:34.540566+08
51	PRODUCTS	2790685415443269	t	updateTime	createTime	180	180	500	3	{"endpoint": "/TenantGoods/QueryTenantGoods"}	商品档案（含分类/价格属性，SCD2）	2025-11-11 10:09:34.540566+08	2025-11-11 10:09:34.540566+08
52	TABLES	2790685415443269	t	lastUseTime	createTime	180	180	200	3	{"endpoint": "/Table/GetSiteTables"}	球台档案（名称/区域/状态）	2025-11-11 10:09:34.540566+08	2025-11-11 10:09:34.540566+08
53	PACKAGES_DEF	2790685415443269	t	updateTime	validFrom	180	180	200	3	{"endpoint": "/PackageCoupon/QueryPackageCouponList"}	套餐/团购定义	2025-11-11 10:09:34.540566+08	2025-11-11 10:09:34.540566+08
54	TOPUPS	2790685415443269	t	payTime	createTime	180	180	200	3	{"endpoint": "/Site/GetRechargeSettleList"}	会员充值记录（含赠送）	2025-11-11 10:09:34.540566+08	2025-11-11 10:09:34.540566+08
55	TABLE_DISCOUNT	2790685415443269	t	createTime	\N	180	180	200	3	{"endpoint": "/Site/GetTaiFeeAdjustList"}	台费打折/减免记录	2025-11-11 10:09:34.540566+08	2025-11-11 10:09:34.540566+08
56	ASSISTANT_ABOLISH	2790685415443269	t	createTime	endTime	180	180	200	3	{"endpoint": "/AssistantPerformance/GetAbolitionAssistant"}	助教服务作废/取消记录	2025-11-11 10:09:34.540566+08	2025-11-11 10:09:34.540566+08
29	LEDGER	2790685415443269	t	\N	\N	180	0	1	0	{}	由事实表派生的双分录总账	2025-11-11 09:53:06.423242+08	2025-11-11 10:09:34.540566+08
\.


--
-- TOC entry 6031 (class 0 OID 0)
-- Dependencies: 225
-- Name: dim_assistant_scd_assistant_scd_id_seq; Type: SEQUENCE SET; Schema: billiards; Owner: postgres
--

SELECT pg_catalog.setval('billiards.dim_assistant_scd_assistant_scd_id_seq', 1, false);


--
-- TOC entry 6032 (class 0 OID 0)
-- Dependencies: 229
-- Name: dim_member_scd_member_scd_id_seq; Type: SEQUENCE SET; Schema: billiards; Owner: postgres
--

SELECT pg_catalog.setval('billiards.dim_member_scd_member_scd_id_seq', 1, false);


--
-- TOC entry 6033 (class 0 OID 0)
-- Dependencies: 234
-- Name: dim_product_price_scd_product_scd_id_seq; Type: SEQUENCE SET; Schema: billiards; Owner: postgres
--

SELECT pg_catalog.setval('billiards.dim_product_price_scd_product_scd_id_seq', 1, false);


--
-- TOC entry 6034 (class 0 OID 0)
-- Dependencies: 248
-- Name: etl_cursor_cursor_id_seq; Type: SEQUENCE SET; Schema: etl_admin; Owner: postgres
--

SELECT pg_catalog.setval('etl_admin.etl_cursor_cursor_id_seq', 15, true);


--
-- TOC entry 6035 (class 0 OID 0)
-- Dependencies: 250
-- Name: etl_run_run_id_seq; Type: SEQUENCE SET; Schema: etl_admin; Owner: postgres
--

SELECT pg_catalog.setval('etl_admin.etl_run_run_id_seq', 1, false);


--
-- TOC entry 6036 (class 0 OID 0)
-- Dependencies: 252
-- Name: etl_task_task_id_seq; Type: SEQUENCE SET; Schema: etl_admin; Owner: postgres
--

SELECT pg_catalog.setval('etl_admin.etl_task_task_id_seq', 57, true);


--
-- TOC entry 5299 (class 2606 OID 21388)
-- Name: dim_assistant dim_assistant_pkey; Type: CONSTRAINT; Schema: billiards; Owner: postgres
--

ALTER TABLE ONLY billiards.dim_assistant
    ADD CONSTRAINT dim_assistant_pkey PRIMARY KEY (store_id, assistant_id);


--
-- TOC entry 5301 (class 2606 OID 21390)
-- Name: dim_assistant_scd dim_assistant_scd_pkey; Type: CONSTRAINT; Schema: billiards; Owner: postgres
--

ALTER TABLE ONLY billiards.dim_assistant_scd
    ADD CONSTRAINT dim_assistant_scd_pkey PRIMARY KEY (assistant_scd_id);


--
-- TOC entry 5306 (class 2606 OID 21392)
-- Name: dim_member dim_member_pkey; Type: CONSTRAINT; Schema: billiards; Owner: postgres
--

ALTER TABLE ONLY billiards.dim_member
    ADD CONSTRAINT dim_member_pkey PRIMARY KEY (store_id, member_id);


--
-- TOC entry 5309 (class 2606 OID 21394)
-- Name: dim_member_scd dim_member_scd_pkey; Type: CONSTRAINT; Schema: billiards; Owner: postgres
--

ALTER TABLE ONLY billiards.dim_member_scd
    ADD CONSTRAINT dim_member_scd_pkey PRIMARY KEY (member_scd_id);


--
-- TOC entry 5314 (class 2606 OID 21396)
-- Name: dim_package dim_package_pkey; Type: CONSTRAINT; Schema: billiards; Owner: postgres
--

ALTER TABLE ONLY billiards.dim_package
    ADD CONSTRAINT dim_package_pkey PRIMARY KEY (store_id, package_id);


--
-- TOC entry 5316 (class 2606 OID 21398)
-- Name: dim_product dim_product_pkey; Type: CONSTRAINT; Schema: billiards; Owner: postgres
--

ALTER TABLE ONLY billiards.dim_product
    ADD CONSTRAINT dim_product_pkey PRIMARY KEY (store_id, product_id);


--
-- TOC entry 5319 (class 2606 OID 21400)
-- Name: dim_product_price_scd dim_product_price_scd_pkey; Type: CONSTRAINT; Schema: billiards; Owner: postgres
--

ALTER TABLE ONLY billiards.dim_product_price_scd
    ADD CONSTRAINT dim_product_price_scd_pkey PRIMARY KEY (product_scd_id);


--
-- TOC entry 5324 (class 2606 OID 21402)
-- Name: dim_store dim_store_pkey; Type: CONSTRAINT; Schema: billiards; Owner: postgres
--

ALTER TABLE ONLY billiards.dim_store
    ADD CONSTRAINT dim_store_pkey PRIMARY KEY (store_id);


--
-- TOC entry 5326 (class 2606 OID 21404)
-- Name: dim_table dim_table_pkey; Type: CONSTRAINT; Schema: billiards; Owner: postgres
--

ALTER TABLE ONLY billiards.dim_table
    ADD CONSTRAINT dim_table_pkey PRIMARY KEY (store_id, table_id);


--
-- TOC entry 5303 (class 2606 OID 21406)
-- Name: dim_assistant_scd ex_assistant_scd_no_overlap; Type: CONSTRAINT; Schema: billiards; Owner: postgres
--

ALTER TABLE ONLY billiards.dim_assistant_scd
    ADD CONSTRAINT ex_assistant_scd_no_overlap EXCLUDE USING gist (store_id WITH =, assistant_id WITH =, tstzrange(valid_from, COALESCE(valid_to, 'infinity'::timestamp with time zone), '[)'::text) WITH &&) DEFERRABLE;


--
-- TOC entry 5311 (class 2606 OID 21409)
-- Name: dim_member_scd ex_member_scd_no_overlap; Type: CONSTRAINT; Schema: billiards; Owner: postgres
--

ALTER TABLE ONLY billiards.dim_member_scd
    ADD CONSTRAINT ex_member_scd_no_overlap EXCLUDE USING gist (store_id WITH =, member_id WITH =, tstzrange(valid_from, COALESCE(valid_to, 'infinity'::timestamp with time zone), '[)'::text) WITH &&) DEFERRABLE;


--
-- TOC entry 5321 (class 2606 OID 21412)
-- Name: dim_product_price_scd ex_product_scd_no_overlap; Type: CONSTRAINT; Schema: billiards; Owner: postgres
--

ALTER TABLE ONLY billiards.dim_product_price_scd
    ADD CONSTRAINT ex_product_scd_no_overlap EXCLUDE USING gist (store_id WITH =, product_id WITH =, tstzrange(valid_from, COALESCE(valid_to, 'infinity'::timestamp with time zone), '[)'::text) WITH &&) DEFERRABLE;


--
-- TOC entry 5328 (class 2606 OID 21415)
-- Name: fact_assistant_abolish fact_assistant_abolish_pkey; Type: CONSTRAINT; Schema: billiards; Owner: postgres
--

ALTER TABLE ONLY billiards.fact_assistant_abolish
    ADD CONSTRAINT fact_assistant_abolish_pkey PRIMARY KEY (store_id, abolish_id);


--
-- TOC entry 5331 (class 2606 OID 21417)
-- Name: fact_inventory_change fact_inventory_change_pkey; Type: CONSTRAINT; Schema: billiards; Owner: postgres
--

ALTER TABLE ONLY billiards.fact_inventory_change
    ADD CONSTRAINT fact_inventory_change_pkey PRIMARY KEY (store_id, change_id);


--
-- TOC entry 5335 (class 2606 OID 21419)
-- Name: fact_ledger_entry fact_ledger_entry_pkey; Type: CONSTRAINT; Schema: billiards; Owner: postgres
--

ALTER TABLE ONLY billiards.fact_ledger_entry
    ADD CONSTRAINT fact_ledger_entry_pkey PRIMARY KEY (store_id, entry_id);


--
-- TOC entry 5342 (class 2606 OID 21421)
-- Name: fact_order_detail fact_order_detail_pkey; Type: CONSTRAINT; Schema: billiards; Owner: postgres
--

ALTER TABLE ONLY billiards.fact_order_detail
    ADD CONSTRAINT fact_order_detail_pkey PRIMARY KEY (store_id, order_id, detail_id);


--
-- TOC entry 5337 (class 2606 OID 21423)
-- Name: fact_order fact_order_pkey; Type: CONSTRAINT; Schema: billiards; Owner: postgres
--

ALTER TABLE ONLY billiards.fact_order
    ADD CONSTRAINT fact_order_pkey PRIMARY KEY (store_id, order_id);


--
-- TOC entry 5348 (class 2606 OID 21425)
-- Name: fact_package_usage fact_package_usage_pkey; Type: CONSTRAINT; Schema: billiards; Owner: postgres
--

ALTER TABLE ONLY billiards.fact_package_usage
    ADD CONSTRAINT fact_package_usage_pkey PRIMARY KEY (store_id, usage_id);


--
-- TOC entry 5351 (class 2606 OID 21427)
-- Name: fact_payment fact_payment_pkey; Type: CONSTRAINT; Schema: billiards; Owner: postgres
--

ALTER TABLE ONLY billiards.fact_payment
    ADD CONSTRAINT fact_payment_pkey PRIMARY KEY (store_id, pay_id);


--
-- TOC entry 5355 (class 2606 OID 21429)
-- Name: fact_refund fact_refund_pkey; Type: CONSTRAINT; Schema: billiards; Owner: postgres
--

ALTER TABLE ONLY billiards.fact_refund
    ADD CONSTRAINT fact_refund_pkey PRIMARY KEY (store_id, refund_id);


--
-- TOC entry 5359 (class 2606 OID 21431)
-- Name: fact_table_discount fact_table_discount_pkey; Type: CONSTRAINT; Schema: billiards; Owner: postgres
--

ALTER TABLE ONLY billiards.fact_table_discount
    ADD CONSTRAINT fact_table_discount_pkey PRIMARY KEY (store_id, discount_id);


--
-- TOC entry 5362 (class 2606 OID 21433)
-- Name: fact_topup fact_topup_pkey; Type: CONSTRAINT; Schema: billiards; Owner: postgres
--

ALTER TABLE ONLY billiards.fact_topup
    ADD CONSTRAINT fact_topup_pkey PRIMARY KEY (store_id, topup_id);


--
-- TOC entry 5365 (class 2606 OID 21435)
-- Name: etl_cursor etl_cursor_pkey; Type: CONSTRAINT; Schema: etl_admin; Owner: postgres
--

ALTER TABLE ONLY etl_admin.etl_cursor
    ADD CONSTRAINT etl_cursor_pkey PRIMARY KEY (cursor_id);


--
-- TOC entry 5371 (class 2606 OID 21437)
-- Name: etl_run etl_run_pkey; Type: CONSTRAINT; Schema: etl_admin; Owner: postgres
--

ALTER TABLE ONLY etl_admin.etl_run
    ADD CONSTRAINT etl_run_pkey PRIMARY KEY (run_id);


--
-- TOC entry 5377 (class 2606 OID 21439)
-- Name: etl_task etl_task_pkey; Type: CONSTRAINT; Schema: etl_admin; Owner: postgres
--

ALTER TABLE ONLY etl_admin.etl_task
    ADD CONSTRAINT etl_task_pkey PRIMARY KEY (task_id);


--
-- TOC entry 5369 (class 2606 OID 21441)
-- Name: etl_cursor ux_cursor_task; Type: CONSTRAINT; Schema: etl_admin; Owner: postgres
--

ALTER TABLE ONLY etl_admin.etl_cursor
    ADD CONSTRAINT ux_cursor_task UNIQUE (task_id, store_id);


--
-- TOC entry 5380 (class 2606 OID 21443)
-- Name: etl_task ux_task_store; Type: CONSTRAINT; Schema: etl_admin; Owner: postgres
--

ALTER TABLE ONLY etl_admin.etl_task
    ADD CONSTRAINT ux_task_store UNIQUE (task_code, store_id);


--
-- TOC entry 5329 (class 1259 OID 21482)
-- Name: ix_faa_order; Type: INDEX; Schema: billiards; Owner: postgres
--

CREATE INDEX ix_faa_order ON billiards.fact_assistant_abolish USING btree (store_id, order_id);


--
-- TOC entry 5332 (class 1259 OID 21483)
-- Name: ix_fic_change_time; Type: INDEX; Schema: billiards; Owner: postgres
--

CREATE INDEX ix_fic_change_time ON billiards.fact_inventory_change USING btree (store_id, change_time);


--
-- TOC entry 5343 (class 1259 OID 21484)
-- Name: ix_fod_assistant; Type: INDEX; Schema: billiards; Owner: postgres
--

CREATE INDEX ix_fod_assistant ON billiards.fact_order_detail USING btree (store_id, assistant_id);


--
-- TOC entry 5344 (class 1259 OID 21485)
-- Name: ix_fod_order; Type: INDEX; Schema: billiards; Owner: postgres
--

CREATE INDEX ix_fod_order ON billiards.fact_order_detail USING btree (store_id, order_id);


--
-- TOC entry 5345 (class 1259 OID 21486)
-- Name: ix_fod_product; Type: INDEX; Schema: billiards; Owner: postgres
--

CREATE INDEX ix_fod_product ON billiards.fact_order_detail USING btree (store_id, product_id);


--
-- TOC entry 5346 (class 1259 OID 21487)
-- Name: ix_fod_table; Type: INDEX; Schema: billiards; Owner: postgres
--

CREATE INDEX ix_fod_table ON billiards.fact_order_detail USING btree (store_id, table_id);


--
-- TOC entry 5349 (class 1259 OID 21488)
-- Name: ix_fpu_member; Type: INDEX; Schema: billiards; Owner: postgres
--

CREATE INDEX ix_fpu_member ON billiards.fact_package_usage USING btree (store_id, member_id);


--
-- TOC entry 5360 (class 1259 OID 21489)
-- Name: ix_ftd_order; Type: INDEX; Schema: billiards; Owner: postgres
--

CREATE INDEX ix_ftd_order ON billiards.fact_table_discount USING btree (store_id, order_id);


--
-- TOC entry 5333 (class 1259 OID 21490)
-- Name: ix_invchg_product; Type: INDEX; Schema: billiards; Owner: postgres
--

CREATE INDEX ix_invchg_product ON billiards.fact_inventory_change USING btree (store_id, product_id);


--
-- TOC entry 5307 (class 1259 OID 21491)
-- Name: ix_member_mobile; Type: INDEX; Schema: billiards; Owner: postgres
--

CREATE INDEX ix_member_mobile ON billiards.dim_member USING btree (store_id, mobile);


--
-- TOC entry 5338 (class 1259 OID 21492)
-- Name: ix_order_close_ts; Type: INDEX; Schema: billiards; Owner: postgres
--

CREATE INDEX ix_order_close_ts ON billiards.fact_order USING btree (store_id, close_time DESC);


--
-- TOC entry 5339 (class 1259 OID 21493)
-- Name: ix_order_member; Type: INDEX; Schema: billiards; Owner: postgres
--

CREATE INDEX ix_order_member ON billiards.fact_order USING btree (store_id, member_id);


--
-- TOC entry 5352 (class 1259 OID 21494)
-- Name: ix_pay_order; Type: INDEX; Schema: billiards; Owner: postgres
--

CREATE INDEX ix_pay_order ON billiards.fact_payment USING btree (store_id, order_id);


--
-- TOC entry 5317 (class 1259 OID 21495)
-- Name: ix_product_barcode; Type: INDEX; Schema: billiards; Owner: postgres
--

CREATE INDEX ix_product_barcode ON billiards.dim_product USING btree (store_id, barcode);


--
-- TOC entry 5356 (class 1259 OID 21496)
-- Name: ix_refund_order; Type: INDEX; Schema: billiards; Owner: postgres
--

CREATE INDEX ix_refund_order ON billiards.fact_refund USING btree (store_id, order_id);


--
-- TOC entry 5357 (class 1259 OID 21497)
-- Name: ix_refund_pay; Type: INDEX; Schema: billiards; Owner: postgres
--

CREATE INDEX ix_refund_pay ON billiards.fact_refund USING btree (store_id, pay_id);


--
-- TOC entry 5363 (class 1259 OID 21498)
-- Name: ix_topup_member; Type: INDEX; Schema: billiards; Owner: postgres
--

CREATE INDEX ix_topup_member ON billiards.fact_topup USING btree (store_id, member_id);


--
-- TOC entry 5304 (class 1259 OID 21499)
-- Name: ux_assistant_scd_current; Type: INDEX; Schema: billiards; Owner: postgres
--

CREATE UNIQUE INDEX ux_assistant_scd_current ON billiards.dim_assistant_scd USING btree (store_id, assistant_id) WHERE (is_current = true);


--
-- TOC entry 5312 (class 1259 OID 21500)
-- Name: ux_member_scd_current; Type: INDEX; Schema: billiards; Owner: postgres
--

CREATE UNIQUE INDEX ux_member_scd_current ON billiards.dim_member_scd USING btree (store_id, member_id) WHERE (is_current = true);


--
-- TOC entry 5340 (class 1259 OID 21501)
-- Name: ux_order_no; Type: INDEX; Schema: billiards; Owner: postgres
--

CREATE UNIQUE INDEX ux_order_no ON billiards.fact_order USING btree (store_id, order_no) WHERE (order_no IS NOT NULL);


--
-- TOC entry 5353 (class 1259 OID 21502)
-- Name: ux_pay_trade_no_norm; Type: INDEX; Schema: billiards; Owner: postgres
--

CREATE UNIQUE INDEX ux_pay_trade_no_norm ON billiards.fact_payment USING btree (store_id, lower(regexp_replace((pay_trade_no)::text, '\s+'::text, ''::text, 'g'::text))) WHERE (pay_trade_no IS NOT NULL);


--
-- TOC entry 5322 (class 1259 OID 21503)
-- Name: ux_product_scd_current; Type: INDEX; Schema: billiards; Owner: postgres
--

CREATE UNIQUE INDEX ux_product_scd_current ON billiards.dim_product_price_scd USING btree (store_id, product_id) WHERE (is_current = true);


--
-- TOC entry 5366 (class 1259 OID 21504)
-- Name: ix_cursor_store; Type: INDEX; Schema: etl_admin; Owner: postgres
--

CREATE INDEX ix_cursor_store ON etl_admin.etl_cursor USING btree (store_id);


--
-- TOC entry 5367 (class 1259 OID 21505)
-- Name: ix_cursor_updated; Type: INDEX; Schema: etl_admin; Owner: postgres
--

CREATE INDEX ix_cursor_updated ON etl_admin.etl_cursor USING btree (updated_at DESC);


--
-- TOC entry 5372 (class 1259 OID 21506)
-- Name: ix_run_status_time; Type: INDEX; Schema: etl_admin; Owner: postgres
--

CREATE INDEX ix_run_status_time ON etl_admin.etl_run USING btree (status, started_at DESC);


--
-- TOC entry 5373 (class 1259 OID 21507)
-- Name: ix_run_store_time; Type: INDEX; Schema: etl_admin; Owner: postgres
--

CREATE INDEX ix_run_store_time ON etl_admin.etl_run USING btree (store_id, started_at DESC);


--
-- TOC entry 5374 (class 1259 OID 21508)
-- Name: ix_run_task_time; Type: INDEX; Schema: etl_admin; Owner: postgres
--

CREATE INDEX ix_run_task_time ON etl_admin.etl_run USING btree (task_id, started_at DESC);


--
-- TOC entry 5375 (class 1259 OID 21509)
-- Name: ix_run_window_end; Type: INDEX; Schema: etl_admin; Owner: postgres
--

CREATE INDEX ix_run_window_end ON etl_admin.etl_run USING btree (window_end DESC);


--
-- TOC entry 5378 (class 1259 OID 21510)
-- Name: ix_task_store_enabled; Type: INDEX; Schema: etl_admin; Owner: postgres
--

CREATE INDEX ix_task_store_enabled ON etl_admin.etl_task USING btree (store_id, enabled);


--
-- TOC entry 5381 (class 2606 OID 21511)
-- Name: dim_assistant_scd fk_das_assistant; Type: FK CONSTRAINT; Schema: billiards; Owner: postgres
--

ALTER TABLE ONLY billiards.dim_assistant_scd
    ADD CONSTRAINT fk_das_assistant FOREIGN KEY (store_id, assistant_id) REFERENCES billiards.dim_assistant(store_id, assistant_id);


--
-- TOC entry 5382 (class 2606 OID 21516)
-- Name: dim_assistant_scd fk_das_store; Type: FK CONSTRAINT; Schema: billiards; Owner: postgres
--

ALTER TABLE ONLY billiards.dim_assistant_scd
    ADD CONSTRAINT fk_das_store FOREIGN KEY (store_id) REFERENCES billiards.dim_store(store_id);


--
-- TOC entry 5383 (class 2606 OID 21526)
-- Name: dim_member fk_dim_member_store; Type: FK CONSTRAINT; Schema: billiards; Owner: postgres
--

ALTER TABLE ONLY billiards.dim_member
    ADD CONSTRAINT fk_dim_member_store FOREIGN KEY (store_id) REFERENCES billiards.dim_store(store_id) ON DELETE RESTRICT;


--
-- TOC entry 5386 (class 2606 OID 21531)
-- Name: dim_package fk_dim_package_store; Type: FK CONSTRAINT; Schema: billiards; Owner: postgres
--

ALTER TABLE ONLY billiards.dim_package
    ADD CONSTRAINT fk_dim_package_store FOREIGN KEY (store_id) REFERENCES billiards.dim_store(store_id) ON DELETE RESTRICT;


--
-- TOC entry 5387 (class 2606 OID 21536)
-- Name: dim_product fk_dim_product_store; Type: FK CONSTRAINT; Schema: billiards; Owner: postgres
--

ALTER TABLE ONLY billiards.dim_product
    ADD CONSTRAINT fk_dim_product_store FOREIGN KEY (store_id) REFERENCES billiards.dim_store(store_id) ON DELETE RESTRICT;


--
-- TOC entry 5390 (class 2606 OID 21541)
-- Name: dim_table fk_dim_table_store; Type: FK CONSTRAINT; Schema: billiards; Owner: postgres
--

ALTER TABLE ONLY billiards.dim_table
    ADD CONSTRAINT fk_dim_table_store FOREIGN KEY (store_id) REFERENCES billiards.dim_store(store_id) ON DELETE RESTRICT;


--
-- TOC entry 5384 (class 2606 OID 21546)
-- Name: dim_member_scd fk_dms_member; Type: FK CONSTRAINT; Schema: billiards; Owner: postgres
--

ALTER TABLE ONLY billiards.dim_member_scd
    ADD CONSTRAINT fk_dms_member FOREIGN KEY (store_id, member_id) REFERENCES billiards.dim_member(store_id, member_id);


--
-- TOC entry 5385 (class 2606 OID 21551)
-- Name: dim_member_scd fk_dms_store; Type: FK CONSTRAINT; Schema: billiards; Owner: postgres
--

ALTER TABLE ONLY billiards.dim_member_scd
    ADD CONSTRAINT fk_dms_store FOREIGN KEY (store_id) REFERENCES billiards.dim_store(store_id);


--
-- TOC entry 5388 (class 2606 OID 21556)
-- Name: dim_product_price_scd fk_dpps_product; Type: FK CONSTRAINT; Schema: billiards; Owner: postgres
--

ALTER TABLE ONLY billiards.dim_product_price_scd
    ADD CONSTRAINT fk_dpps_product FOREIGN KEY (store_id, product_id) REFERENCES billiards.dim_product(store_id, product_id);


--
-- TOC entry 5389 (class 2606 OID 21561)
-- Name: dim_product_price_scd fk_dpps_store; Type: FK CONSTRAINT; Schema: billiards; Owner: postgres
--

ALTER TABLE ONLY billiards.dim_product_price_scd
    ADD CONSTRAINT fk_dpps_store FOREIGN KEY (store_id) REFERENCES billiards.dim_store(store_id);


--
-- TOC entry 5391 (class 2606 OID 21566)
-- Name: fact_assistant_abolish fk_faa_assistant; Type: FK CONSTRAINT; Schema: billiards; Owner: postgres
--

ALTER TABLE ONLY billiards.fact_assistant_abolish
    ADD CONSTRAINT fk_faa_assistant FOREIGN KEY (store_id, assistant_id) REFERENCES billiards.dim_assistant(store_id, assistant_id) ON DELETE SET NULL;


--
-- TOC entry 5392 (class 2606 OID 21571)
-- Name: fact_assistant_abolish fk_faa_order; Type: FK CONSTRAINT; Schema: billiards; Owner: postgres
--

ALTER TABLE ONLY billiards.fact_assistant_abolish
    ADD CONSTRAINT fk_faa_order FOREIGN KEY (store_id, order_id) REFERENCES billiards.fact_order(store_id, order_id) ON DELETE CASCADE;


--
-- TOC entry 5393 (class 2606 OID 21576)
-- Name: fact_assistant_abolish fk_faa_store; Type: FK CONSTRAINT; Schema: billiards; Owner: postgres
--

ALTER TABLE ONLY billiards.fact_assistant_abolish
    ADD CONSTRAINT fk_faa_store FOREIGN KEY (store_id) REFERENCES billiards.dim_store(store_id) ON DELETE RESTRICT;


--
-- TOC entry 5394 (class 2606 OID 21581)
-- Name: fact_assistant_abolish fk_faa_table; Type: FK CONSTRAINT; Schema: billiards; Owner: postgres
--

ALTER TABLE ONLY billiards.fact_assistant_abolish
    ADD CONSTRAINT fk_faa_table FOREIGN KEY (store_id, table_id) REFERENCES billiards.dim_table(store_id, table_id) ON DELETE SET NULL;


--
-- TOC entry 5398 (class 2606 OID 21586)
-- Name: fact_order fk_fact_order_member; Type: FK CONSTRAINT; Schema: billiards; Owner: postgres
--

ALTER TABLE ONLY billiards.fact_order
    ADD CONSTRAINT fk_fact_order_member FOREIGN KEY (store_id, member_id) REFERENCES billiards.dim_member(store_id, member_id) ON DELETE SET NULL;


--
-- TOC entry 5399 (class 2606 OID 21591)
-- Name: fact_order fk_fact_order_store; Type: FK CONSTRAINT; Schema: billiards; Owner: postgres
--

ALTER TABLE ONLY billiards.fact_order
    ADD CONSTRAINT fk_fact_order_store FOREIGN KEY (store_id) REFERENCES billiards.dim_store(store_id) ON DELETE RESTRICT;


--
-- TOC entry 5395 (class 2606 OID 21596)
-- Name: fact_inventory_change fk_fic_product; Type: FK CONSTRAINT; Schema: billiards; Owner: postgres
--

ALTER TABLE ONLY billiards.fact_inventory_change
    ADD CONSTRAINT fk_fic_product FOREIGN KEY (store_id, product_id) REFERENCES billiards.dim_product(store_id, product_id) ON DELETE SET NULL;


--
-- TOC entry 5396 (class 2606 OID 21601)
-- Name: fact_inventory_change fk_fic_store; Type: FK CONSTRAINT; Schema: billiards; Owner: postgres
--

ALTER TABLE ONLY billiards.fact_inventory_change
    ADD CONSTRAINT fk_fic_store FOREIGN KEY (store_id) REFERENCES billiards.dim_store(store_id) ON DELETE RESTRICT;


--
-- TOC entry 5397 (class 2606 OID 21606)
-- Name: fact_ledger_entry fk_fle_store; Type: FK CONSTRAINT; Schema: billiards; Owner: postgres
--

ALTER TABLE ONLY billiards.fact_ledger_entry
    ADD CONSTRAINT fk_fle_store FOREIGN KEY (store_id) REFERENCES billiards.dim_store(store_id) ON DELETE RESTRICT;


--
-- TOC entry 5400 (class 2606 OID 21611)
-- Name: fact_order_detail fk_fod_assistant; Type: FK CONSTRAINT; Schema: billiards; Owner: postgres
--

ALTER TABLE ONLY billiards.fact_order_detail
    ADD CONSTRAINT fk_fod_assistant FOREIGN KEY (store_id, assistant_id) REFERENCES billiards.dim_assistant(store_id, assistant_id) ON DELETE SET NULL;


--
-- TOC entry 5401 (class 2606 OID 21616)
-- Name: fact_order_detail fk_fod_order; Type: FK CONSTRAINT; Schema: billiards; Owner: postgres
--

ALTER TABLE ONLY billiards.fact_order_detail
    ADD CONSTRAINT fk_fod_order FOREIGN KEY (store_id, order_id) REFERENCES billiards.fact_order(store_id, order_id) ON DELETE CASCADE;


--
-- TOC entry 5402 (class 2606 OID 21621)
-- Name: fact_order_detail fk_fod_product; Type: FK CONSTRAINT; Schema: billiards; Owner: postgres
--

ALTER TABLE ONLY billiards.fact_order_detail
    ADD CONSTRAINT fk_fod_product FOREIGN KEY (store_id, product_id) REFERENCES billiards.dim_product(store_id, product_id) ON DELETE SET NULL;


--
-- TOC entry 5403 (class 2606 OID 21626)
-- Name: fact_order_detail fk_fod_table; Type: FK CONSTRAINT; Schema: billiards; Owner: postgres
--

ALTER TABLE ONLY billiards.fact_order_detail
    ADD CONSTRAINT fk_fod_table FOREIGN KEY (store_id, table_id) REFERENCES billiards.dim_table(store_id, table_id) ON DELETE SET NULL;


--
-- TOC entry 5408 (class 2606 OID 21631)
-- Name: fact_payment fk_fp_order; Type: FK CONSTRAINT; Schema: billiards; Owner: postgres
--

ALTER TABLE ONLY billiards.fact_payment
    ADD CONSTRAINT fk_fp_order FOREIGN KEY (store_id, order_id) REFERENCES billiards.fact_order(store_id, order_id) ON DELETE CASCADE;


--
-- TOC entry 5409 (class 2606 OID 21636)
-- Name: fact_payment fk_fp_store; Type: FK CONSTRAINT; Schema: billiards; Owner: postgres
--

ALTER TABLE ONLY billiards.fact_payment
    ADD CONSTRAINT fk_fp_store FOREIGN KEY (store_id) REFERENCES billiards.dim_store(store_id) ON DELETE RESTRICT;


--
-- TOC entry 5404 (class 2606 OID 21641)
-- Name: fact_package_usage fk_fpu_member; Type: FK CONSTRAINT; Schema: billiards; Owner: postgres
--

ALTER TABLE ONLY billiards.fact_package_usage
    ADD CONSTRAINT fk_fpu_member FOREIGN KEY (store_id, member_id) REFERENCES billiards.dim_member(store_id, member_id) ON DELETE SET NULL;


--
-- TOC entry 5405 (class 2606 OID 21646)
-- Name: fact_package_usage fk_fpu_order; Type: FK CONSTRAINT; Schema: billiards; Owner: postgres
--

ALTER TABLE ONLY billiards.fact_package_usage
    ADD CONSTRAINT fk_fpu_order FOREIGN KEY (store_id, order_id) REFERENCES billiards.fact_order(store_id, order_id) ON DELETE SET NULL;


--
-- TOC entry 5406 (class 2606 OID 21651)
-- Name: fact_package_usage fk_fpu_package; Type: FK CONSTRAINT; Schema: billiards; Owner: postgres
--

ALTER TABLE ONLY billiards.fact_package_usage
    ADD CONSTRAINT fk_fpu_package FOREIGN KEY (store_id, package_id) REFERENCES billiards.dim_package(store_id, package_id) ON DELETE SET NULL;


--
-- TOC entry 5407 (class 2606 OID 21656)
-- Name: fact_package_usage fk_fpu_store; Type: FK CONSTRAINT; Schema: billiards; Owner: postgres
--

ALTER TABLE ONLY billiards.fact_package_usage
    ADD CONSTRAINT fk_fpu_store FOREIGN KEY (store_id) REFERENCES billiards.dim_store(store_id) ON DELETE RESTRICT;


--
-- TOC entry 5410 (class 2606 OID 21661)
-- Name: fact_refund fk_fr_order; Type: FK CONSTRAINT; Schema: billiards; Owner: postgres
--

ALTER TABLE ONLY billiards.fact_refund
    ADD CONSTRAINT fk_fr_order FOREIGN KEY (store_id, order_id) REFERENCES billiards.fact_order(store_id, order_id) ON DELETE CASCADE;


--
-- TOC entry 5411 (class 2606 OID 21666)
-- Name: fact_refund fk_fr_pay; Type: FK CONSTRAINT; Schema: billiards; Owner: postgres
--

ALTER TABLE ONLY billiards.fact_refund
    ADD CONSTRAINT fk_fr_pay FOREIGN KEY (store_id, pay_id) REFERENCES billiards.fact_payment(store_id, pay_id) ON DELETE SET NULL;


--
-- TOC entry 5412 (class 2606 OID 21671)
-- Name: fact_refund fk_fr_store; Type: FK CONSTRAINT; Schema: billiards; Owner: postgres
--

ALTER TABLE ONLY billiards.fact_refund
    ADD CONSTRAINT fk_fr_store FOREIGN KEY (store_id) REFERENCES billiards.dim_store(store_id) ON DELETE RESTRICT;


--
-- TOC entry 5416 (class 2606 OID 21676)
-- Name: fact_topup fk_ft_member; Type: FK CONSTRAINT; Schema: billiards; Owner: postgres
--

ALTER TABLE ONLY billiards.fact_topup
    ADD CONSTRAINT fk_ft_member FOREIGN KEY (store_id, member_id) REFERENCES billiards.dim_member(store_id, member_id) ON DELETE SET NULL;


--
-- TOC entry 5417 (class 2606 OID 21681)
-- Name: fact_topup fk_ft_order; Type: FK CONSTRAINT; Schema: billiards; Owner: postgres
--

ALTER TABLE ONLY billiards.fact_topup
    ADD CONSTRAINT fk_ft_order FOREIGN KEY (store_id, order_id) REFERENCES billiards.fact_order(store_id, order_id) ON DELETE SET NULL;


--
-- TOC entry 5418 (class 2606 OID 21686)
-- Name: fact_topup fk_ft_store; Type: FK CONSTRAINT; Schema: billiards; Owner: postgres
--

ALTER TABLE ONLY billiards.fact_topup
    ADD CONSTRAINT fk_ft_store FOREIGN KEY (store_id) REFERENCES billiards.dim_store(store_id) ON DELETE RESTRICT;


--
-- TOC entry 5413 (class 2606 OID 21691)
-- Name: fact_table_discount fk_ftd_order; Type: FK CONSTRAINT; Schema: billiards; Owner: postgres
--

ALTER TABLE ONLY billiards.fact_table_discount
    ADD CONSTRAINT fk_ftd_order FOREIGN KEY (store_id, order_id) REFERENCES billiards.fact_order(store_id, order_id) ON DELETE CASCADE;


--
-- TOC entry 5414 (class 2606 OID 21696)
-- Name: fact_table_discount fk_ftd_store; Type: FK CONSTRAINT; Schema: billiards; Owner: postgres
--

ALTER TABLE ONLY billiards.fact_table_discount
    ADD CONSTRAINT fk_ftd_store FOREIGN KEY (store_id) REFERENCES billiards.dim_store(store_id) ON DELETE RESTRICT;


--
-- TOC entry 5415 (class 2606 OID 21701)
-- Name: fact_table_discount fk_ftd_table; Type: FK CONSTRAINT; Schema: billiards; Owner: postgres
--

ALTER TABLE ONLY billiards.fact_table_discount
    ADD CONSTRAINT fk_ftd_table FOREIGN KEY (store_id, table_id) REFERENCES billiards.dim_table(store_id, table_id) ON DELETE SET NULL;


--
-- TOC entry 5419 (class 2606 OID 21706)
-- Name: etl_cursor etl_cursor_task_id_fkey; Type: FK CONSTRAINT; Schema: etl_admin; Owner: postgres
--

ALTER TABLE ONLY etl_admin.etl_cursor
    ADD CONSTRAINT etl_cursor_task_id_fkey FOREIGN KEY (task_id) REFERENCES etl_admin.etl_task(task_id) ON DELETE CASCADE;


--
-- TOC entry 5420 (class 2606 OID 21711)
-- Name: etl_run etl_run_task_id_fkey; Type: FK CONSTRAINT; Schema: etl_admin; Owner: postgres
--

ALTER TABLE ONLY etl_admin.etl_run
    ADD CONSTRAINT etl_run_task_id_fkey FOREIGN KEY (task_id) REFERENCES etl_admin.etl_task(task_id) ON DELETE CASCADE;


--
-- TOC entry 5604 (class 0 OID 0)
-- Dependencies: 8
-- Name: SCHEMA "XCX"; Type: ACL; Schema: -; Owner: postgres
--

GRANT ALL ON SCHEMA "XCX" TO "local-Python" WITH GRANT OPTION;


--
-- TOC entry 5607 (class 0 OID 0)
-- Dependencies: 395
-- Name: FUNCTION gbtreekey16_in(cstring); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbtreekey16_in(cstring) TO "local-Python";


--
-- TOC entry 5608 (class 0 OID 0)
-- Dependencies: 391
-- Name: FUNCTION gbtreekey16_out(billiards.gbtreekey16); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbtreekey16_out(billiards.gbtreekey16) TO "local-Python";


--
-- TOC entry 5609 (class 0 OID 0)
-- Dependencies: 380
-- Name: FUNCTION gbtreekey2_in(cstring); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbtreekey2_in(cstring) TO "local-Python";


--
-- TOC entry 5610 (class 0 OID 0)
-- Dependencies: 308
-- Name: FUNCTION gbtreekey2_out(billiards.gbtreekey2); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbtreekey2_out(billiards.gbtreekey2) TO "local-Python";


--
-- TOC entry 5611 (class 0 OID 0)
-- Dependencies: 309
-- Name: FUNCTION gbtreekey32_in(cstring); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbtreekey32_in(cstring) TO "local-Python";


--
-- TOC entry 5612 (class 0 OID 0)
-- Dependencies: 416
-- Name: FUNCTION gbtreekey32_out(billiards.gbtreekey32); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbtreekey32_out(billiards.gbtreekey32) TO "local-Python";


--
-- TOC entry 5613 (class 0 OID 0)
-- Dependencies: 342
-- Name: FUNCTION gbtreekey4_in(cstring); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbtreekey4_in(cstring) TO "local-Python";


--
-- TOC entry 5614 (class 0 OID 0)
-- Dependencies: 455
-- Name: FUNCTION gbtreekey4_out(billiards.gbtreekey4); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbtreekey4_out(billiards.gbtreekey4) TO "local-Python";


--
-- TOC entry 5615 (class 0 OID 0)
-- Dependencies: 464
-- Name: FUNCTION gbtreekey8_in(cstring); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbtreekey8_in(cstring) TO "local-Python";


--
-- TOC entry 5616 (class 0 OID 0)
-- Dependencies: 382
-- Name: FUNCTION gbtreekey8_out(billiards.gbtreekey8); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbtreekey8_out(billiards.gbtreekey8) TO "local-Python";


--
-- TOC entry 5617 (class 0 OID 0)
-- Dependencies: 262
-- Name: FUNCTION gbtreekey_var_in(cstring); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbtreekey_var_in(cstring) TO "local-Python";


--
-- TOC entry 5618 (class 0 OID 0)
-- Dependencies: 407
-- Name: FUNCTION gbtreekey_var_out(billiards.gbtreekey_var); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbtreekey_var_out(billiards.gbtreekey_var) TO "local-Python";


--
-- TOC entry 5619 (class 0 OID 0)
-- Dependencies: 450
-- Name: FUNCTION cash_dist(money, money); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.cash_dist(money, money) TO "local-Python";


--
-- TOC entry 5620 (class 0 OID 0)
-- Dependencies: 266
-- Name: FUNCTION date_dist(date, date); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.date_dist(date, date) TO "local-Python";


--
-- TOC entry 5621 (class 0 OID 0)
-- Dependencies: 304
-- Name: FUNCTION float4_dist(real, real); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.float4_dist(real, real) TO "local-Python";


--
-- TOC entry 5622 (class 0 OID 0)
-- Dependencies: 412
-- Name: FUNCTION float8_dist(double precision, double precision); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.float8_dist(double precision, double precision) TO "local-Python";


--
-- TOC entry 5623 (class 0 OID 0)
-- Dependencies: 424
-- Name: FUNCTION gbt_bit_compress(internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_bit_compress(internal) TO "local-Python";


--
-- TOC entry 5624 (class 0 OID 0)
-- Dependencies: 457
-- Name: FUNCTION gbt_bit_consistent(internal, bit, smallint, oid, internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_bit_consistent(internal, bit, smallint, oid, internal) TO "local-Python";


--
-- TOC entry 5625 (class 0 OID 0)
-- Dependencies: 435
-- Name: FUNCTION gbt_bit_penalty(internal, internal, internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_bit_penalty(internal, internal, internal) TO "local-Python";


--
-- TOC entry 5626 (class 0 OID 0)
-- Dependencies: 273
-- Name: FUNCTION gbt_bit_picksplit(internal, internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_bit_picksplit(internal, internal) TO "local-Python";


--
-- TOC entry 5627 (class 0 OID 0)
-- Dependencies: 475
-- Name: FUNCTION gbt_bit_same(billiards.gbtreekey_var, billiards.gbtreekey_var, internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_bit_same(billiards.gbtreekey_var, billiards.gbtreekey_var, internal) TO "local-Python";


--
-- TOC entry 5628 (class 0 OID 0)
-- Dependencies: 288
-- Name: FUNCTION gbt_bit_sortsupport(internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_bit_sortsupport(internal) TO "local-Python";


--
-- TOC entry 5629 (class 0 OID 0)
-- Dependencies: 448
-- Name: FUNCTION gbt_bit_union(internal, internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_bit_union(internal, internal) TO "local-Python";


--
-- TOC entry 5630 (class 0 OID 0)
-- Dependencies: 397
-- Name: FUNCTION gbt_bool_compress(internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_bool_compress(internal) TO "local-Python";


--
-- TOC entry 5631 (class 0 OID 0)
-- Dependencies: 422
-- Name: FUNCTION gbt_bool_consistent(internal, boolean, smallint, oid, internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_bool_consistent(internal, boolean, smallint, oid, internal) TO "local-Python";


--
-- TOC entry 5632 (class 0 OID 0)
-- Dependencies: 256
-- Name: FUNCTION gbt_bool_fetch(internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_bool_fetch(internal) TO "local-Python";


--
-- TOC entry 5633 (class 0 OID 0)
-- Dependencies: 319
-- Name: FUNCTION gbt_bool_penalty(internal, internal, internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_bool_penalty(internal, internal, internal) TO "local-Python";


--
-- TOC entry 5634 (class 0 OID 0)
-- Dependencies: 411
-- Name: FUNCTION gbt_bool_picksplit(internal, internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_bool_picksplit(internal, internal) TO "local-Python";


--
-- TOC entry 5635 (class 0 OID 0)
-- Dependencies: 453
-- Name: FUNCTION gbt_bool_same(billiards.gbtreekey2, billiards.gbtreekey2, internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_bool_same(billiards.gbtreekey2, billiards.gbtreekey2, internal) TO "local-Python";


--
-- TOC entry 5636 (class 0 OID 0)
-- Dependencies: 290
-- Name: FUNCTION gbt_bool_sortsupport(internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_bool_sortsupport(internal) TO "local-Python";


--
-- TOC entry 5637 (class 0 OID 0)
-- Dependencies: 257
-- Name: FUNCTION gbt_bool_union(internal, internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_bool_union(internal, internal) TO "local-Python";


--
-- TOC entry 5638 (class 0 OID 0)
-- Dependencies: 396
-- Name: FUNCTION gbt_bpchar_compress(internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_bpchar_compress(internal) TO "local-Python";


--
-- TOC entry 5639 (class 0 OID 0)
-- Dependencies: 466
-- Name: FUNCTION gbt_bpchar_consistent(internal, character, smallint, oid, internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_bpchar_consistent(internal, character, smallint, oid, internal) TO "local-Python";


--
-- TOC entry 5640 (class 0 OID 0)
-- Dependencies: 332
-- Name: FUNCTION gbt_bpchar_sortsupport(internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_bpchar_sortsupport(internal) TO "local-Python";


--
-- TOC entry 5641 (class 0 OID 0)
-- Dependencies: 399
-- Name: FUNCTION gbt_bytea_compress(internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_bytea_compress(internal) TO "local-Python";


--
-- TOC entry 5642 (class 0 OID 0)
-- Dependencies: 302
-- Name: FUNCTION gbt_bytea_consistent(internal, bytea, smallint, oid, internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_bytea_consistent(internal, bytea, smallint, oid, internal) TO "local-Python";


--
-- TOC entry 5643 (class 0 OID 0)
-- Dependencies: 458
-- Name: FUNCTION gbt_bytea_penalty(internal, internal, internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_bytea_penalty(internal, internal, internal) TO "local-Python";


--
-- TOC entry 5644 (class 0 OID 0)
-- Dependencies: 404
-- Name: FUNCTION gbt_bytea_picksplit(internal, internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_bytea_picksplit(internal, internal) TO "local-Python";


--
-- TOC entry 5645 (class 0 OID 0)
-- Dependencies: 426
-- Name: FUNCTION gbt_bytea_same(billiards.gbtreekey_var, billiards.gbtreekey_var, internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_bytea_same(billiards.gbtreekey_var, billiards.gbtreekey_var, internal) TO "local-Python";


--
-- TOC entry 5646 (class 0 OID 0)
-- Dependencies: 398
-- Name: FUNCTION gbt_bytea_sortsupport(internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_bytea_sortsupport(internal) TO "local-Python";


--
-- TOC entry 5647 (class 0 OID 0)
-- Dependencies: 313
-- Name: FUNCTION gbt_bytea_union(internal, internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_bytea_union(internal, internal) TO "local-Python";


--
-- TOC entry 5648 (class 0 OID 0)
-- Dependencies: 421
-- Name: FUNCTION gbt_cash_compress(internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_cash_compress(internal) TO "local-Python";


--
-- TOC entry 5649 (class 0 OID 0)
-- Dependencies: 414
-- Name: FUNCTION gbt_cash_consistent(internal, money, smallint, oid, internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_cash_consistent(internal, money, smallint, oid, internal) TO "local-Python";


--
-- TOC entry 5650 (class 0 OID 0)
-- Dependencies: 324
-- Name: FUNCTION gbt_cash_distance(internal, money, smallint, oid, internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_cash_distance(internal, money, smallint, oid, internal) TO "local-Python";


--
-- TOC entry 5651 (class 0 OID 0)
-- Dependencies: 297
-- Name: FUNCTION gbt_cash_fetch(internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_cash_fetch(internal) TO "local-Python";


--
-- TOC entry 5652 (class 0 OID 0)
-- Dependencies: 255
-- Name: FUNCTION gbt_cash_penalty(internal, internal, internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_cash_penalty(internal, internal, internal) TO "local-Python";


--
-- TOC entry 5653 (class 0 OID 0)
-- Dependencies: 296
-- Name: FUNCTION gbt_cash_picksplit(internal, internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_cash_picksplit(internal, internal) TO "local-Python";


--
-- TOC entry 5654 (class 0 OID 0)
-- Dependencies: 442
-- Name: FUNCTION gbt_cash_same(billiards.gbtreekey16, billiards.gbtreekey16, internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_cash_same(billiards.gbtreekey16, billiards.gbtreekey16, internal) TO "local-Python";


--
-- TOC entry 5655 (class 0 OID 0)
-- Dependencies: 293
-- Name: FUNCTION gbt_cash_sortsupport(internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_cash_sortsupport(internal) TO "local-Python";


--
-- TOC entry 5656 (class 0 OID 0)
-- Dependencies: 271
-- Name: FUNCTION gbt_cash_union(internal, internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_cash_union(internal, internal) TO "local-Python";


--
-- TOC entry 5657 (class 0 OID 0)
-- Dependencies: 260
-- Name: FUNCTION gbt_date_compress(internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_date_compress(internal) TO "local-Python";


--
-- TOC entry 5658 (class 0 OID 0)
-- Dependencies: 400
-- Name: FUNCTION gbt_date_consistent(internal, date, smallint, oid, internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_date_consistent(internal, date, smallint, oid, internal) TO "local-Python";


--
-- TOC entry 5659 (class 0 OID 0)
-- Dependencies: 374
-- Name: FUNCTION gbt_date_distance(internal, date, smallint, oid, internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_date_distance(internal, date, smallint, oid, internal) TO "local-Python";


--
-- TOC entry 5660 (class 0 OID 0)
-- Dependencies: 368
-- Name: FUNCTION gbt_date_fetch(internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_date_fetch(internal) TO "local-Python";


--
-- TOC entry 5661 (class 0 OID 0)
-- Dependencies: 378
-- Name: FUNCTION gbt_date_penalty(internal, internal, internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_date_penalty(internal, internal, internal) TO "local-Python";


--
-- TOC entry 5662 (class 0 OID 0)
-- Dependencies: 410
-- Name: FUNCTION gbt_date_picksplit(internal, internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_date_picksplit(internal, internal) TO "local-Python";


--
-- TOC entry 5663 (class 0 OID 0)
-- Dependencies: 389
-- Name: FUNCTION gbt_date_same(billiards.gbtreekey8, billiards.gbtreekey8, internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_date_same(billiards.gbtreekey8, billiards.gbtreekey8, internal) TO "local-Python";


--
-- TOC entry 5664 (class 0 OID 0)
-- Dependencies: 330
-- Name: FUNCTION gbt_date_sortsupport(internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_date_sortsupport(internal) TO "local-Python";


--
-- TOC entry 5665 (class 0 OID 0)
-- Dependencies: 409
-- Name: FUNCTION gbt_date_union(internal, internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_date_union(internal, internal) TO "local-Python";


--
-- TOC entry 5666 (class 0 OID 0)
-- Dependencies: 387
-- Name: FUNCTION gbt_decompress(internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_decompress(internal) TO "local-Python";


--
-- TOC entry 5667 (class 0 OID 0)
-- Dependencies: 467
-- Name: FUNCTION gbt_enum_compress(internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_enum_compress(internal) TO "local-Python";


--
-- TOC entry 5668 (class 0 OID 0)
-- Dependencies: 367
-- Name: FUNCTION gbt_enum_consistent(internal, anyenum, smallint, oid, internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_enum_consistent(internal, anyenum, smallint, oid, internal) TO "local-Python";


--
-- TOC entry 5669 (class 0 OID 0)
-- Dependencies: 340
-- Name: FUNCTION gbt_enum_fetch(internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_enum_fetch(internal) TO "local-Python";


--
-- TOC entry 5670 (class 0 OID 0)
-- Dependencies: 440
-- Name: FUNCTION gbt_enum_penalty(internal, internal, internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_enum_penalty(internal, internal, internal) TO "local-Python";


--
-- TOC entry 5671 (class 0 OID 0)
-- Dependencies: 451
-- Name: FUNCTION gbt_enum_picksplit(internal, internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_enum_picksplit(internal, internal) TO "local-Python";


--
-- TOC entry 5672 (class 0 OID 0)
-- Dependencies: 363
-- Name: FUNCTION gbt_enum_same(billiards.gbtreekey8, billiards.gbtreekey8, internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_enum_same(billiards.gbtreekey8, billiards.gbtreekey8, internal) TO "local-Python";


--
-- TOC entry 5673 (class 0 OID 0)
-- Dependencies: 472
-- Name: FUNCTION gbt_enum_sortsupport(internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_enum_sortsupport(internal) TO "local-Python";


--
-- TOC entry 5674 (class 0 OID 0)
-- Dependencies: 376
-- Name: FUNCTION gbt_enum_union(internal, internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_enum_union(internal, internal) TO "local-Python";


--
-- TOC entry 5675 (class 0 OID 0)
-- Dependencies: 388
-- Name: FUNCTION gbt_float4_compress(internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_float4_compress(internal) TO "local-Python";


--
-- TOC entry 5676 (class 0 OID 0)
-- Dependencies: 268
-- Name: FUNCTION gbt_float4_consistent(internal, real, smallint, oid, internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_float4_consistent(internal, real, smallint, oid, internal) TO "local-Python";


--
-- TOC entry 5677 (class 0 OID 0)
-- Dependencies: 471
-- Name: FUNCTION gbt_float4_distance(internal, real, smallint, oid, internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_float4_distance(internal, real, smallint, oid, internal) TO "local-Python";


--
-- TOC entry 5678 (class 0 OID 0)
-- Dependencies: 277
-- Name: FUNCTION gbt_float4_fetch(internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_float4_fetch(internal) TO "local-Python";


--
-- TOC entry 5679 (class 0 OID 0)
-- Dependencies: 413
-- Name: FUNCTION gbt_float4_penalty(internal, internal, internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_float4_penalty(internal, internal, internal) TO "local-Python";


--
-- TOC entry 5680 (class 0 OID 0)
-- Dependencies: 364
-- Name: FUNCTION gbt_float4_picksplit(internal, internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_float4_picksplit(internal, internal) TO "local-Python";


--
-- TOC entry 5681 (class 0 OID 0)
-- Dependencies: 352
-- Name: FUNCTION gbt_float4_same(billiards.gbtreekey8, billiards.gbtreekey8, internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_float4_same(billiards.gbtreekey8, billiards.gbtreekey8, internal) TO "local-Python";


--
-- TOC entry 5682 (class 0 OID 0)
-- Dependencies: 381
-- Name: FUNCTION gbt_float4_sortsupport(internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_float4_sortsupport(internal) TO "local-Python";


--
-- TOC entry 5683 (class 0 OID 0)
-- Dependencies: 307
-- Name: FUNCTION gbt_float4_union(internal, internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_float4_union(internal, internal) TO "local-Python";


--
-- TOC entry 5684 (class 0 OID 0)
-- Dependencies: 278
-- Name: FUNCTION gbt_float8_compress(internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_float8_compress(internal) TO "local-Python";


--
-- TOC entry 5685 (class 0 OID 0)
-- Dependencies: 284
-- Name: FUNCTION gbt_float8_consistent(internal, double precision, smallint, oid, internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_float8_consistent(internal, double precision, smallint, oid, internal) TO "local-Python";


--
-- TOC entry 5686 (class 0 OID 0)
-- Dependencies: 315
-- Name: FUNCTION gbt_float8_distance(internal, double precision, smallint, oid, internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_float8_distance(internal, double precision, smallint, oid, internal) TO "local-Python";


--
-- TOC entry 5687 (class 0 OID 0)
-- Dependencies: 334
-- Name: FUNCTION gbt_float8_fetch(internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_float8_fetch(internal) TO "local-Python";


--
-- TOC entry 5688 (class 0 OID 0)
-- Dependencies: 415
-- Name: FUNCTION gbt_float8_penalty(internal, internal, internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_float8_penalty(internal, internal, internal) TO "local-Python";


--
-- TOC entry 5689 (class 0 OID 0)
-- Dependencies: 463
-- Name: FUNCTION gbt_float8_picksplit(internal, internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_float8_picksplit(internal, internal) TO "local-Python";


--
-- TOC entry 5690 (class 0 OID 0)
-- Dependencies: 474
-- Name: FUNCTION gbt_float8_same(billiards.gbtreekey16, billiards.gbtreekey16, internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_float8_same(billiards.gbtreekey16, billiards.gbtreekey16, internal) TO "local-Python";


--
-- TOC entry 5691 (class 0 OID 0)
-- Dependencies: 437
-- Name: FUNCTION gbt_float8_sortsupport(internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_float8_sortsupport(internal) TO "local-Python";


--
-- TOC entry 5692 (class 0 OID 0)
-- Dependencies: 465
-- Name: FUNCTION gbt_float8_union(internal, internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_float8_union(internal, internal) TO "local-Python";


--
-- TOC entry 5693 (class 0 OID 0)
-- Dependencies: 384
-- Name: FUNCTION gbt_inet_compress(internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_inet_compress(internal) TO "local-Python";


--
-- TOC entry 5694 (class 0 OID 0)
-- Dependencies: 357
-- Name: FUNCTION gbt_inet_consistent(internal, inet, smallint, oid, internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_inet_consistent(internal, inet, smallint, oid, internal) TO "local-Python";


--
-- TOC entry 5695 (class 0 OID 0)
-- Dependencies: 306
-- Name: FUNCTION gbt_inet_penalty(internal, internal, internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_inet_penalty(internal, internal, internal) TO "local-Python";


--
-- TOC entry 5696 (class 0 OID 0)
-- Dependencies: 417
-- Name: FUNCTION gbt_inet_picksplit(internal, internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_inet_picksplit(internal, internal) TO "local-Python";


--
-- TOC entry 5697 (class 0 OID 0)
-- Dependencies: 401
-- Name: FUNCTION gbt_inet_same(billiards.gbtreekey16, billiards.gbtreekey16, internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_inet_same(billiards.gbtreekey16, billiards.gbtreekey16, internal) TO "local-Python";


--
-- TOC entry 5698 (class 0 OID 0)
-- Dependencies: 428
-- Name: FUNCTION gbt_inet_sortsupport(internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_inet_sortsupport(internal) TO "local-Python";


--
-- TOC entry 5699 (class 0 OID 0)
-- Dependencies: 318
-- Name: FUNCTION gbt_inet_union(internal, internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_inet_union(internal, internal) TO "local-Python";


--
-- TOC entry 5700 (class 0 OID 0)
-- Dependencies: 283
-- Name: FUNCTION gbt_int2_compress(internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_int2_compress(internal) TO "local-Python";


--
-- TOC entry 5701 (class 0 OID 0)
-- Dependencies: 393
-- Name: FUNCTION gbt_int2_consistent(internal, smallint, smallint, oid, internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_int2_consistent(internal, smallint, smallint, oid, internal) TO "local-Python";


--
-- TOC entry 5702 (class 0 OID 0)
-- Dependencies: 314
-- Name: FUNCTION gbt_int2_distance(internal, smallint, smallint, oid, internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_int2_distance(internal, smallint, smallint, oid, internal) TO "local-Python";


--
-- TOC entry 5703 (class 0 OID 0)
-- Dependencies: 358
-- Name: FUNCTION gbt_int2_fetch(internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_int2_fetch(internal) TO "local-Python";


--
-- TOC entry 5704 (class 0 OID 0)
-- Dependencies: 452
-- Name: FUNCTION gbt_int2_penalty(internal, internal, internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_int2_penalty(internal, internal, internal) TO "local-Python";


--
-- TOC entry 5705 (class 0 OID 0)
-- Dependencies: 405
-- Name: FUNCTION gbt_int2_picksplit(internal, internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_int2_picksplit(internal, internal) TO "local-Python";


--
-- TOC entry 5706 (class 0 OID 0)
-- Dependencies: 259
-- Name: FUNCTION gbt_int2_same(billiards.gbtreekey4, billiards.gbtreekey4, internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_int2_same(billiards.gbtreekey4, billiards.gbtreekey4, internal) TO "local-Python";


--
-- TOC entry 5707 (class 0 OID 0)
-- Dependencies: 350
-- Name: FUNCTION gbt_int2_sortsupport(internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_int2_sortsupport(internal) TO "local-Python";


--
-- TOC entry 5708 (class 0 OID 0)
-- Dependencies: 267
-- Name: FUNCTION gbt_int2_union(internal, internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_int2_union(internal, internal) TO "local-Python";


--
-- TOC entry 5709 (class 0 OID 0)
-- Dependencies: 333
-- Name: FUNCTION gbt_int4_compress(internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_int4_compress(internal) TO "local-Python";


--
-- TOC entry 5710 (class 0 OID 0)
-- Dependencies: 253
-- Name: FUNCTION gbt_int4_consistent(internal, integer, smallint, oid, internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_int4_consistent(internal, integer, smallint, oid, internal) TO "local-Python";


--
-- TOC entry 5711 (class 0 OID 0)
-- Dependencies: 373
-- Name: FUNCTION gbt_int4_distance(internal, integer, smallint, oid, internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_int4_distance(internal, integer, smallint, oid, internal) TO "local-Python";


--
-- TOC entry 5712 (class 0 OID 0)
-- Dependencies: 359
-- Name: FUNCTION gbt_int4_fetch(internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_int4_fetch(internal) TO "local-Python";


--
-- TOC entry 5713 (class 0 OID 0)
-- Dependencies: 265
-- Name: FUNCTION gbt_int4_penalty(internal, internal, internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_int4_penalty(internal, internal, internal) TO "local-Python";


--
-- TOC entry 5714 (class 0 OID 0)
-- Dependencies: 275
-- Name: FUNCTION gbt_int4_picksplit(internal, internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_int4_picksplit(internal, internal) TO "local-Python";


--
-- TOC entry 5715 (class 0 OID 0)
-- Dependencies: 390
-- Name: FUNCTION gbt_int4_same(billiards.gbtreekey8, billiards.gbtreekey8, internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_int4_same(billiards.gbtreekey8, billiards.gbtreekey8, internal) TO "local-Python";


--
-- TOC entry 5716 (class 0 OID 0)
-- Dependencies: 383
-- Name: FUNCTION gbt_int4_sortsupport(internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_int4_sortsupport(internal) TO "local-Python";


--
-- TOC entry 5717 (class 0 OID 0)
-- Dependencies: 473
-- Name: FUNCTION gbt_int4_union(internal, internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_int4_union(internal, internal) TO "local-Python";


--
-- TOC entry 5718 (class 0 OID 0)
-- Dependencies: 429
-- Name: FUNCTION gbt_int8_compress(internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_int8_compress(internal) TO "local-Python";


--
-- TOC entry 5719 (class 0 OID 0)
-- Dependencies: 276
-- Name: FUNCTION gbt_int8_consistent(internal, bigint, smallint, oid, internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_int8_consistent(internal, bigint, smallint, oid, internal) TO "local-Python";


--
-- TOC entry 5720 (class 0 OID 0)
-- Dependencies: 337
-- Name: FUNCTION gbt_int8_distance(internal, bigint, smallint, oid, internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_int8_distance(internal, bigint, smallint, oid, internal) TO "local-Python";


--
-- TOC entry 5721 (class 0 OID 0)
-- Dependencies: 377
-- Name: FUNCTION gbt_int8_fetch(internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_int8_fetch(internal) TO "local-Python";


--
-- TOC entry 5722 (class 0 OID 0)
-- Dependencies: 280
-- Name: FUNCTION gbt_int8_penalty(internal, internal, internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_int8_penalty(internal, internal, internal) TO "local-Python";


--
-- TOC entry 5723 (class 0 OID 0)
-- Dependencies: 325
-- Name: FUNCTION gbt_int8_picksplit(internal, internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_int8_picksplit(internal, internal) TO "local-Python";


--
-- TOC entry 5724 (class 0 OID 0)
-- Dependencies: 379
-- Name: FUNCTION gbt_int8_same(billiards.gbtreekey16, billiards.gbtreekey16, internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_int8_same(billiards.gbtreekey16, billiards.gbtreekey16, internal) TO "local-Python";


--
-- TOC entry 5725 (class 0 OID 0)
-- Dependencies: 432
-- Name: FUNCTION gbt_int8_sortsupport(internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_int8_sortsupport(internal) TO "local-Python";


--
-- TOC entry 5726 (class 0 OID 0)
-- Dependencies: 274
-- Name: FUNCTION gbt_int8_union(internal, internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_int8_union(internal, internal) TO "local-Python";


--
-- TOC entry 5727 (class 0 OID 0)
-- Dependencies: 289
-- Name: FUNCTION gbt_intv_compress(internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_intv_compress(internal) TO "local-Python";


--
-- TOC entry 5728 (class 0 OID 0)
-- Dependencies: 305
-- Name: FUNCTION gbt_intv_consistent(internal, interval, smallint, oid, internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_intv_consistent(internal, interval, smallint, oid, internal) TO "local-Python";


--
-- TOC entry 5729 (class 0 OID 0)
-- Dependencies: 320
-- Name: FUNCTION gbt_intv_decompress(internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_intv_decompress(internal) TO "local-Python";


--
-- TOC entry 5730 (class 0 OID 0)
-- Dependencies: 346
-- Name: FUNCTION gbt_intv_distance(internal, interval, smallint, oid, internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_intv_distance(internal, interval, smallint, oid, internal) TO "local-Python";


--
-- TOC entry 5731 (class 0 OID 0)
-- Dependencies: 341
-- Name: FUNCTION gbt_intv_fetch(internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_intv_fetch(internal) TO "local-Python";


--
-- TOC entry 5732 (class 0 OID 0)
-- Dependencies: 355
-- Name: FUNCTION gbt_intv_penalty(internal, internal, internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_intv_penalty(internal, internal, internal) TO "local-Python";


--
-- TOC entry 5733 (class 0 OID 0)
-- Dependencies: 281
-- Name: FUNCTION gbt_intv_picksplit(internal, internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_intv_picksplit(internal, internal) TO "local-Python";


--
-- TOC entry 5734 (class 0 OID 0)
-- Dependencies: 354
-- Name: FUNCTION gbt_intv_same(billiards.gbtreekey32, billiards.gbtreekey32, internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_intv_same(billiards.gbtreekey32, billiards.gbtreekey32, internal) TO "local-Python";


--
-- TOC entry 5735 (class 0 OID 0)
-- Dependencies: 436
-- Name: FUNCTION gbt_intv_sortsupport(internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_intv_sortsupport(internal) TO "local-Python";


--
-- TOC entry 5736 (class 0 OID 0)
-- Dependencies: 298
-- Name: FUNCTION gbt_intv_union(internal, internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_intv_union(internal, internal) TO "local-Python";


--
-- TOC entry 5737 (class 0 OID 0)
-- Dependencies: 439
-- Name: FUNCTION gbt_macad8_compress(internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_macad8_compress(internal) TO "local-Python";


--
-- TOC entry 5738 (class 0 OID 0)
-- Dependencies: 339
-- Name: FUNCTION gbt_macad8_consistent(internal, macaddr8, smallint, oid, internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_macad8_consistent(internal, macaddr8, smallint, oid, internal) TO "local-Python";


--
-- TOC entry 5739 (class 0 OID 0)
-- Dependencies: 434
-- Name: FUNCTION gbt_macad8_fetch(internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_macad8_fetch(internal) TO "local-Python";


--
-- TOC entry 5740 (class 0 OID 0)
-- Dependencies: 312
-- Name: FUNCTION gbt_macad8_penalty(internal, internal, internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_macad8_penalty(internal, internal, internal) TO "local-Python";


--
-- TOC entry 5741 (class 0 OID 0)
-- Dependencies: 294
-- Name: FUNCTION gbt_macad8_picksplit(internal, internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_macad8_picksplit(internal, internal) TO "local-Python";


--
-- TOC entry 5742 (class 0 OID 0)
-- Dependencies: 372
-- Name: FUNCTION gbt_macad8_same(billiards.gbtreekey16, billiards.gbtreekey16, internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_macad8_same(billiards.gbtreekey16, billiards.gbtreekey16, internal) TO "local-Python";


--
-- TOC entry 5743 (class 0 OID 0)
-- Dependencies: 371
-- Name: FUNCTION gbt_macad8_sortsupport(internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_macad8_sortsupport(internal) TO "local-Python";


--
-- TOC entry 5744 (class 0 OID 0)
-- Dependencies: 258
-- Name: FUNCTION gbt_macad8_union(internal, internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_macad8_union(internal, internal) TO "local-Python";


--
-- TOC entry 5745 (class 0 OID 0)
-- Dependencies: 419
-- Name: FUNCTION gbt_macad_compress(internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_macad_compress(internal) TO "local-Python";


--
-- TOC entry 5746 (class 0 OID 0)
-- Dependencies: 454
-- Name: FUNCTION gbt_macad_consistent(internal, macaddr, smallint, oid, internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_macad_consistent(internal, macaddr, smallint, oid, internal) TO "local-Python";


--
-- TOC entry 5747 (class 0 OID 0)
-- Dependencies: 438
-- Name: FUNCTION gbt_macad_fetch(internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_macad_fetch(internal) TO "local-Python";


--
-- TOC entry 5748 (class 0 OID 0)
-- Dependencies: 287
-- Name: FUNCTION gbt_macad_penalty(internal, internal, internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_macad_penalty(internal, internal, internal) TO "local-Python";


--
-- TOC entry 5749 (class 0 OID 0)
-- Dependencies: 406
-- Name: FUNCTION gbt_macad_picksplit(internal, internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_macad_picksplit(internal, internal) TO "local-Python";


--
-- TOC entry 5750 (class 0 OID 0)
-- Dependencies: 362
-- Name: FUNCTION gbt_macad_same(billiards.gbtreekey16, billiards.gbtreekey16, internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_macad_same(billiards.gbtreekey16, billiards.gbtreekey16, internal) TO "local-Python";


--
-- TOC entry 5751 (class 0 OID 0)
-- Dependencies: 360
-- Name: FUNCTION gbt_macad_union(internal, internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_macad_union(internal, internal) TO "local-Python";


--
-- TOC entry 5752 (class 0 OID 0)
-- Dependencies: 254
-- Name: FUNCTION gbt_macaddr_sortsupport(internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_macaddr_sortsupport(internal) TO "local-Python";


--
-- TOC entry 5753 (class 0 OID 0)
-- Dependencies: 369
-- Name: FUNCTION gbt_numeric_compress(internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_numeric_compress(internal) TO "local-Python";


--
-- TOC entry 5754 (class 0 OID 0)
-- Dependencies: 292
-- Name: FUNCTION gbt_numeric_consistent(internal, numeric, smallint, oid, internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_numeric_consistent(internal, numeric, smallint, oid, internal) TO "local-Python";


--
-- TOC entry 5755 (class 0 OID 0)
-- Dependencies: 310
-- Name: FUNCTION gbt_numeric_penalty(internal, internal, internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_numeric_penalty(internal, internal, internal) TO "local-Python";


--
-- TOC entry 5756 (class 0 OID 0)
-- Dependencies: 461
-- Name: FUNCTION gbt_numeric_picksplit(internal, internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_numeric_picksplit(internal, internal) TO "local-Python";


--
-- TOC entry 5757 (class 0 OID 0)
-- Dependencies: 430
-- Name: FUNCTION gbt_numeric_same(billiards.gbtreekey_var, billiards.gbtreekey_var, internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_numeric_same(billiards.gbtreekey_var, billiards.gbtreekey_var, internal) TO "local-Python";


--
-- TOC entry 5758 (class 0 OID 0)
-- Dependencies: 433
-- Name: FUNCTION gbt_numeric_sortsupport(internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_numeric_sortsupport(internal) TO "local-Python";


--
-- TOC entry 5759 (class 0 OID 0)
-- Dependencies: 431
-- Name: FUNCTION gbt_numeric_union(internal, internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_numeric_union(internal, internal) TO "local-Python";


--
-- TOC entry 5760 (class 0 OID 0)
-- Dependencies: 323
-- Name: FUNCTION gbt_oid_compress(internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_oid_compress(internal) TO "local-Python";


--
-- TOC entry 5761 (class 0 OID 0)
-- Dependencies: 370
-- Name: FUNCTION gbt_oid_consistent(internal, oid, smallint, oid, internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_oid_consistent(internal, oid, smallint, oid, internal) TO "local-Python";


--
-- TOC entry 5762 (class 0 OID 0)
-- Dependencies: 459
-- Name: FUNCTION gbt_oid_distance(internal, oid, smallint, oid, internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_oid_distance(internal, oid, smallint, oid, internal) TO "local-Python";


--
-- TOC entry 5763 (class 0 OID 0)
-- Dependencies: 356
-- Name: FUNCTION gbt_oid_fetch(internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_oid_fetch(internal) TO "local-Python";


--
-- TOC entry 5764 (class 0 OID 0)
-- Dependencies: 282
-- Name: FUNCTION gbt_oid_penalty(internal, internal, internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_oid_penalty(internal, internal, internal) TO "local-Python";


--
-- TOC entry 5765 (class 0 OID 0)
-- Dependencies: 303
-- Name: FUNCTION gbt_oid_picksplit(internal, internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_oid_picksplit(internal, internal) TO "local-Python";


--
-- TOC entry 5766 (class 0 OID 0)
-- Dependencies: 449
-- Name: FUNCTION gbt_oid_same(billiards.gbtreekey8, billiards.gbtreekey8, internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_oid_same(billiards.gbtreekey8, billiards.gbtreekey8, internal) TO "local-Python";


--
-- TOC entry 5767 (class 0 OID 0)
-- Dependencies: 347
-- Name: FUNCTION gbt_oid_sortsupport(internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_oid_sortsupport(internal) TO "local-Python";


--
-- TOC entry 5768 (class 0 OID 0)
-- Dependencies: 365
-- Name: FUNCTION gbt_oid_union(internal, internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_oid_union(internal, internal) TO "local-Python";


--
-- TOC entry 5769 (class 0 OID 0)
-- Dependencies: 285
-- Name: FUNCTION gbt_text_compress(internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_text_compress(internal) TO "local-Python";


--
-- TOC entry 5770 (class 0 OID 0)
-- Dependencies: 261
-- Name: FUNCTION gbt_text_consistent(internal, text, smallint, oid, internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_text_consistent(internal, text, smallint, oid, internal) TO "local-Python";


--
-- TOC entry 5771 (class 0 OID 0)
-- Dependencies: 348
-- Name: FUNCTION gbt_text_penalty(internal, internal, internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_text_penalty(internal, internal, internal) TO "local-Python";


--
-- TOC entry 5772 (class 0 OID 0)
-- Dependencies: 322
-- Name: FUNCTION gbt_text_picksplit(internal, internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_text_picksplit(internal, internal) TO "local-Python";


--
-- TOC entry 5773 (class 0 OID 0)
-- Dependencies: 402
-- Name: FUNCTION gbt_text_same(billiards.gbtreekey_var, billiards.gbtreekey_var, internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_text_same(billiards.gbtreekey_var, billiards.gbtreekey_var, internal) TO "local-Python";


--
-- TOC entry 5774 (class 0 OID 0)
-- Dependencies: 301
-- Name: FUNCTION gbt_text_sortsupport(internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_text_sortsupport(internal) TO "local-Python";


--
-- TOC entry 5775 (class 0 OID 0)
-- Dependencies: 295
-- Name: FUNCTION gbt_text_union(internal, internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_text_union(internal, internal) TO "local-Python";


--
-- TOC entry 5776 (class 0 OID 0)
-- Dependencies: 375
-- Name: FUNCTION gbt_time_compress(internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_time_compress(internal) TO "local-Python";


--
-- TOC entry 5777 (class 0 OID 0)
-- Dependencies: 321
-- Name: FUNCTION gbt_time_consistent(internal, time without time zone, smallint, oid, internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_time_consistent(internal, time without time zone, smallint, oid, internal) TO "local-Python";


--
-- TOC entry 5778 (class 0 OID 0)
-- Dependencies: 403
-- Name: FUNCTION gbt_time_distance(internal, time without time zone, smallint, oid, internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_time_distance(internal, time without time zone, smallint, oid, internal) TO "local-Python";


--
-- TOC entry 5779 (class 0 OID 0)
-- Dependencies: 423
-- Name: FUNCTION gbt_time_fetch(internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_time_fetch(internal) TO "local-Python";


--
-- TOC entry 5780 (class 0 OID 0)
-- Dependencies: 326
-- Name: FUNCTION gbt_time_penalty(internal, internal, internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_time_penalty(internal, internal, internal) TO "local-Python";


--
-- TOC entry 5781 (class 0 OID 0)
-- Dependencies: 446
-- Name: FUNCTION gbt_time_picksplit(internal, internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_time_picksplit(internal, internal) TO "local-Python";


--
-- TOC entry 5782 (class 0 OID 0)
-- Dependencies: 299
-- Name: FUNCTION gbt_time_same(billiards.gbtreekey16, billiards.gbtreekey16, internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_time_same(billiards.gbtreekey16, billiards.gbtreekey16, internal) TO "local-Python";


--
-- TOC entry 5783 (class 0 OID 0)
-- Dependencies: 328
-- Name: FUNCTION gbt_time_sortsupport(internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_time_sortsupport(internal) TO "local-Python";


--
-- TOC entry 5784 (class 0 OID 0)
-- Dependencies: 443
-- Name: FUNCTION gbt_time_union(internal, internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_time_union(internal, internal) TO "local-Python";


--
-- TOC entry 5785 (class 0 OID 0)
-- Dependencies: 394
-- Name: FUNCTION gbt_timetz_compress(internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_timetz_compress(internal) TO "local-Python";


--
-- TOC entry 5786 (class 0 OID 0)
-- Dependencies: 444
-- Name: FUNCTION gbt_timetz_consistent(internal, time with time zone, smallint, oid, internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_timetz_consistent(internal, time with time zone, smallint, oid, internal) TO "local-Python";


--
-- TOC entry 5787 (class 0 OID 0)
-- Dependencies: 336
-- Name: FUNCTION gbt_ts_compress(internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_ts_compress(internal) TO "local-Python";


--
-- TOC entry 5788 (class 0 OID 0)
-- Dependencies: 462
-- Name: FUNCTION gbt_ts_consistent(internal, timestamp without time zone, smallint, oid, internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_ts_consistent(internal, timestamp without time zone, smallint, oid, internal) TO "local-Python";


--
-- TOC entry 5789 (class 0 OID 0)
-- Dependencies: 338
-- Name: FUNCTION gbt_ts_distance(internal, timestamp without time zone, smallint, oid, internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_ts_distance(internal, timestamp without time zone, smallint, oid, internal) TO "local-Python";


--
-- TOC entry 5790 (class 0 OID 0)
-- Dependencies: 418
-- Name: FUNCTION gbt_ts_fetch(internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_ts_fetch(internal) TO "local-Python";


--
-- TOC entry 5791 (class 0 OID 0)
-- Dependencies: 345
-- Name: FUNCTION gbt_ts_penalty(internal, internal, internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_ts_penalty(internal, internal, internal) TO "local-Python";


--
-- TOC entry 5792 (class 0 OID 0)
-- Dependencies: 351
-- Name: FUNCTION gbt_ts_picksplit(internal, internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_ts_picksplit(internal, internal) TO "local-Python";


--
-- TOC entry 5793 (class 0 OID 0)
-- Dependencies: 327
-- Name: FUNCTION gbt_ts_same(billiards.gbtreekey16, billiards.gbtreekey16, internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_ts_same(billiards.gbtreekey16, billiards.gbtreekey16, internal) TO "local-Python";


--
-- TOC entry 5794 (class 0 OID 0)
-- Dependencies: 353
-- Name: FUNCTION gbt_ts_sortsupport(internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_ts_sortsupport(internal) TO "local-Python";


--
-- TOC entry 5795 (class 0 OID 0)
-- Dependencies: 441
-- Name: FUNCTION gbt_ts_union(internal, internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_ts_union(internal, internal) TO "local-Python";


--
-- TOC entry 5796 (class 0 OID 0)
-- Dependencies: 311
-- Name: FUNCTION gbt_tstz_compress(internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_tstz_compress(internal) TO "local-Python";


--
-- TOC entry 5797 (class 0 OID 0)
-- Dependencies: 317
-- Name: FUNCTION gbt_tstz_consistent(internal, timestamp with time zone, smallint, oid, internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_tstz_consistent(internal, timestamp with time zone, smallint, oid, internal) TO "local-Python";


--
-- TOC entry 5798 (class 0 OID 0)
-- Dependencies: 269
-- Name: FUNCTION gbt_tstz_distance(internal, timestamp with time zone, smallint, oid, internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_tstz_distance(internal, timestamp with time zone, smallint, oid, internal) TO "local-Python";


--
-- TOC entry 5799 (class 0 OID 0)
-- Dependencies: 270
-- Name: FUNCTION gbt_uuid_compress(internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_uuid_compress(internal) TO "local-Python";


--
-- TOC entry 5800 (class 0 OID 0)
-- Dependencies: 343
-- Name: FUNCTION gbt_uuid_consistent(internal, uuid, smallint, oid, internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_uuid_consistent(internal, uuid, smallint, oid, internal) TO "local-Python";


--
-- TOC entry 5801 (class 0 OID 0)
-- Dependencies: 468
-- Name: FUNCTION gbt_uuid_fetch(internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_uuid_fetch(internal) TO "local-Python";


--
-- TOC entry 5802 (class 0 OID 0)
-- Dependencies: 300
-- Name: FUNCTION gbt_uuid_penalty(internal, internal, internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_uuid_penalty(internal, internal, internal) TO "local-Python";


--
-- TOC entry 5803 (class 0 OID 0)
-- Dependencies: 331
-- Name: FUNCTION gbt_uuid_picksplit(internal, internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_uuid_picksplit(internal, internal) TO "local-Python";


--
-- TOC entry 5804 (class 0 OID 0)
-- Dependencies: 291
-- Name: FUNCTION gbt_uuid_same(billiards.gbtreekey32, billiards.gbtreekey32, internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_uuid_same(billiards.gbtreekey32, billiards.gbtreekey32, internal) TO "local-Python";


--
-- TOC entry 5805 (class 0 OID 0)
-- Dependencies: 316
-- Name: FUNCTION gbt_uuid_sortsupport(internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_uuid_sortsupport(internal) TO "local-Python";


--
-- TOC entry 5806 (class 0 OID 0)
-- Dependencies: 361
-- Name: FUNCTION gbt_uuid_union(internal, internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_uuid_union(internal, internal) TO "local-Python";


--
-- TOC entry 5807 (class 0 OID 0)
-- Dependencies: 408
-- Name: FUNCTION gbt_var_decompress(internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_var_decompress(internal) TO "local-Python";


--
-- TOC entry 5808 (class 0 OID 0)
-- Dependencies: 349
-- Name: FUNCTION gbt_var_fetch(internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_var_fetch(internal) TO "local-Python";


--
-- TOC entry 5809 (class 0 OID 0)
-- Dependencies: 427
-- Name: FUNCTION gbt_varbit_sortsupport(internal); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gbt_varbit_sortsupport(internal) TO "local-Python";


--
-- TOC entry 5810 (class 0 OID 0)
-- Dependencies: 329
-- Name: FUNCTION gist_translate_cmptype_btree(integer); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.gist_translate_cmptype_btree(integer) TO "local-Python";


--
-- TOC entry 5811 (class 0 OID 0)
-- Dependencies: 386
-- Name: FUNCTION int2_dist(smallint, smallint); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.int2_dist(smallint, smallint) TO "local-Python";


--
-- TOC entry 5812 (class 0 OID 0)
-- Dependencies: 385
-- Name: FUNCTION int4_dist(integer, integer); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.int4_dist(integer, integer) TO "local-Python";


--
-- TOC entry 5813 (class 0 OID 0)
-- Dependencies: 420
-- Name: FUNCTION int8_dist(bigint, bigint); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.int8_dist(bigint, bigint) TO "local-Python";


--
-- TOC entry 5814 (class 0 OID 0)
-- Dependencies: 279
-- Name: FUNCTION interval_dist(interval, interval); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.interval_dist(interval, interval) TO "local-Python";


--
-- TOC entry 5815 (class 0 OID 0)
-- Dependencies: 286
-- Name: FUNCTION oid_dist(oid, oid); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.oid_dist(oid, oid) TO "local-Python";


--
-- TOC entry 5816 (class 0 OID 0)
-- Dependencies: 460
-- Name: FUNCTION time_dist(time without time zone, time without time zone); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.time_dist(time without time zone, time without time zone) TO "local-Python";


--
-- TOC entry 5817 (class 0 OID 0)
-- Dependencies: 344
-- Name: FUNCTION ts_dist(timestamp without time zone, timestamp without time zone); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.ts_dist(timestamp without time zone, timestamp without time zone) TO "local-Python";


--
-- TOC entry 5818 (class 0 OID 0)
-- Dependencies: 272
-- Name: FUNCTION tstz_dist(timestamp with time zone, timestamp with time zone); Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON FUNCTION billiards.tstz_dist(timestamp with time zone, timestamp with time zone) TO "local-Python";


--
-- TOC entry 5831 (class 0 OID 0)
-- Dependencies: 222
-- Name: TABLE dim_assistant; Type: ACL; Schema: billiards; Owner: postgres
--

GRANT SELECT,INSERT,REFERENCES,DELETE,TRIGGER,TRUNCATE,UPDATE ON TABLE billiards.dim_assistant TO "local-Python";


--
-- TOC entry 5833 (class 0 OID 0)
-- Dependencies: 223
-- Name: TABLE dim_assistant_scd; Type: ACL; Schema: billiards; Owner: postgres
--

GRANT SELECT,INSERT,REFERENCES,DELETE,TRIGGER,TRUNCATE,UPDATE ON TABLE billiards.dim_assistant_scd TO "local-Python";


--
-- TOC entry 5834 (class 0 OID 0)
-- Dependencies: 224
-- Name: TABLE dim_assistant_current; Type: ACL; Schema: billiards; Owner: postgres
--

GRANT SELECT,INSERT,REFERENCES,DELETE,TRIGGER,TRUNCATE,UPDATE ON TABLE billiards.dim_assistant_current TO "local-Python";


--
-- TOC entry 5836 (class 0 OID 0)
-- Dependencies: 225
-- Name: SEQUENCE dim_assistant_scd_assistant_scd_id_seq; Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON SEQUENCE billiards.dim_assistant_scd_assistant_scd_id_seq TO "local-Python";


--
-- TOC entry 5851 (class 0 OID 0)
-- Dependencies: 226
-- Name: TABLE dim_member; Type: ACL; Schema: billiards; Owner: postgres
--

GRANT SELECT,INSERT,REFERENCES,DELETE,TRIGGER,TRUNCATE,UPDATE ON TABLE billiards.dim_member TO "local-Python";


--
-- TOC entry 5853 (class 0 OID 0)
-- Dependencies: 227
-- Name: TABLE dim_member_scd; Type: ACL; Schema: billiards; Owner: postgres
--

GRANT SELECT,INSERT,REFERENCES,DELETE,TRIGGER,TRUNCATE,UPDATE ON TABLE billiards.dim_member_scd TO "local-Python";


--
-- TOC entry 5854 (class 0 OID 0)
-- Dependencies: 228
-- Name: TABLE dim_member_current; Type: ACL; Schema: billiards; Owner: postgres
--

GRANT SELECT,INSERT,REFERENCES,DELETE,TRIGGER,TRUNCATE,UPDATE ON TABLE billiards.dim_member_current TO "local-Python";


--
-- TOC entry 5856 (class 0 OID 0)
-- Dependencies: 229
-- Name: SEQUENCE dim_member_scd_member_scd_id_seq; Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON SEQUENCE billiards.dim_member_scd_member_scd_id_seq TO "local-Python";


--
-- TOC entry 5867 (class 0 OID 0)
-- Dependencies: 230
-- Name: TABLE dim_package; Type: ACL; Schema: billiards; Owner: postgres
--

GRANT SELECT,INSERT,REFERENCES,DELETE,TRIGGER,TRUNCATE,UPDATE ON TABLE billiards.dim_package TO "local-Python";


--
-- TOC entry 5887 (class 0 OID 0)
-- Dependencies: 231
-- Name: TABLE dim_product; Type: ACL; Schema: billiards; Owner: postgres
--

GRANT SELECT,INSERT,REFERENCES,DELETE,TRIGGER,TRUNCATE,UPDATE ON TABLE billiards.dim_product TO "local-Python";


--
-- TOC entry 5889 (class 0 OID 0)
-- Dependencies: 232
-- Name: TABLE dim_product_price_scd; Type: ACL; Schema: billiards; Owner: postgres
--

GRANT SELECT,INSERT,REFERENCES,DELETE,TRIGGER,TRUNCATE,UPDATE ON TABLE billiards.dim_product_price_scd TO "local-Python";


--
-- TOC entry 5890 (class 0 OID 0)
-- Dependencies: 233
-- Name: TABLE dim_product_price_current; Type: ACL; Schema: billiards; Owner: postgres
--

GRANT SELECT,INSERT,REFERENCES,DELETE,TRIGGER,TRUNCATE,UPDATE ON TABLE billiards.dim_product_price_current TO "local-Python";


--
-- TOC entry 5892 (class 0 OID 0)
-- Dependencies: 234
-- Name: SEQUENCE dim_product_price_scd_product_scd_id_seq; Type: ACL; Schema: billiards; Owner: postgres
--

GRANT ALL ON SEQUENCE billiards.dim_product_price_scd_product_scd_id_seq TO "local-Python";


--
-- TOC entry 5900 (class 0 OID 0)
-- Dependencies: 235
-- Name: TABLE dim_store; Type: ACL; Schema: billiards; Owner: postgres
--

GRANT SELECT,INSERT,REFERENCES,DELETE,TRIGGER,TRUNCATE,UPDATE ON TABLE billiards.dim_store TO "local-Python";


--
-- TOC entry 5913 (class 0 OID 0)
-- Dependencies: 236
-- Name: TABLE dim_table; Type: ACL; Schema: billiards; Owner: postgres
--

GRANT SELECT,INSERT,REFERENCES,DELETE,TRIGGER,TRUNCATE,UPDATE ON TABLE billiards.dim_table TO "local-Python";


--
-- TOC entry 5915 (class 0 OID 0)
-- Dependencies: 237
-- Name: TABLE fact_assistant_abolish; Type: ACL; Schema: billiards; Owner: postgres
--

GRANT SELECT,INSERT,REFERENCES,DELETE,TRIGGER,TRUNCATE,UPDATE ON TABLE billiards.fact_assistant_abolish TO "local-Python";


--
-- TOC entry 5917 (class 0 OID 0)
-- Dependencies: 238
-- Name: TABLE fact_inventory_change; Type: ACL; Schema: billiards; Owner: postgres
--

GRANT SELECT,INSERT,REFERENCES,DELETE,TRIGGER,TRUNCATE,UPDATE ON TABLE billiards.fact_inventory_change TO "local-Python";


--
-- TOC entry 5919 (class 0 OID 0)
-- Dependencies: 239
-- Name: TABLE fact_ledger_entry; Type: ACL; Schema: billiards; Owner: postgres
--

GRANT SELECT,INSERT,REFERENCES,DELETE,TRIGGER,TRUNCATE,UPDATE ON TABLE billiards.fact_ledger_entry TO "local-Python";


--
-- TOC entry 5938 (class 0 OID 0)
-- Dependencies: 240
-- Name: TABLE fact_order; Type: ACL; Schema: billiards; Owner: postgres
--

GRANT SELECT,INSERT,REFERENCES,DELETE,TRIGGER,TRUNCATE,UPDATE ON TABLE billiards.fact_order TO "local-Python";


--
-- TOC entry 5960 (class 0 OID 0)
-- Dependencies: 241
-- Name: TABLE fact_order_detail; Type: ACL; Schema: billiards; Owner: postgres
--

GRANT SELECT,INSERT,REFERENCES,DELETE,TRIGGER,TRUNCATE,UPDATE ON TABLE billiards.fact_order_detail TO "local-Python";


--
-- TOC entry 5962 (class 0 OID 0)
-- Dependencies: 242
-- Name: TABLE fact_package_usage; Type: ACL; Schema: billiards; Owner: postgres
--

GRANT SELECT,INSERT,REFERENCES,DELETE,TRIGGER,TRUNCATE,UPDATE ON TABLE billiards.fact_package_usage TO "local-Python";


--
-- TOC entry 5964 (class 0 OID 0)
-- Dependencies: 243
-- Name: TABLE fact_payment; Type: ACL; Schema: billiards; Owner: postgres
--

GRANT SELECT,INSERT,REFERENCES,DELETE,TRIGGER,TRUNCATE,UPDATE ON TABLE billiards.fact_payment TO "local-Python";


--
-- TOC entry 5966 (class 0 OID 0)
-- Dependencies: 244
-- Name: TABLE fact_refund; Type: ACL; Schema: billiards; Owner: postgres
--

GRANT SELECT,INSERT,REFERENCES,DELETE,TRIGGER,TRUNCATE,UPDATE ON TABLE billiards.fact_refund TO "local-Python";


--
-- TOC entry 5970 (class 0 OID 0)
-- Dependencies: 245
-- Name: TABLE fact_table_discount; Type: ACL; Schema: billiards; Owner: postgres
--

GRANT SELECT,INSERT,REFERENCES,DELETE,TRIGGER,TRUNCATE,UPDATE ON TABLE billiards.fact_table_discount TO "local-Python";


--
-- TOC entry 5972 (class 0 OID 0)
-- Dependencies: 246
-- Name: TABLE fact_topup; Type: ACL; Schema: billiards; Owner: postgres
--

GRANT SELECT,INSERT,REFERENCES,DELETE,TRIGGER,TRUNCATE,UPDATE ON TABLE billiards.fact_topup TO "local-Python";


--
-- TOC entry 5984 (class 0 OID 0)
-- Dependencies: 247
-- Name: TABLE etl_cursor; Type: ACL; Schema: etl_admin; Owner: postgres
--

GRANT SELECT,INSERT,REFERENCES,DELETE,TRIGGER,TRUNCATE,UPDATE ON TABLE etl_admin.etl_cursor TO "local-Python";


--
-- TOC entry 5986 (class 0 OID 0)
-- Dependencies: 248
-- Name: SEQUENCE etl_cursor_cursor_id_seq; Type: ACL; Schema: etl_admin; Owner: postgres
--

GRANT ALL ON SEQUENCE etl_admin.etl_cursor_cursor_id_seq TO "local-Python";


--
-- TOC entry 6011 (class 0 OID 0)
-- Dependencies: 249
-- Name: TABLE etl_run; Type: ACL; Schema: etl_admin; Owner: postgres
--

GRANT SELECT,INSERT,REFERENCES,DELETE,TRIGGER,TRUNCATE,UPDATE ON TABLE etl_admin.etl_run TO "local-Python";


--
-- TOC entry 6013 (class 0 OID 0)
-- Dependencies: 250
-- Name: SEQUENCE etl_run_run_id_seq; Type: ACL; Schema: etl_admin; Owner: postgres
--

GRANT ALL ON SEQUENCE etl_admin.etl_run_run_id_seq TO "local-Python";


--
-- TOC entry 6028 (class 0 OID 0)
-- Dependencies: 251
-- Name: TABLE etl_task; Type: ACL; Schema: etl_admin; Owner: postgres
--

GRANT SELECT,INSERT,REFERENCES,DELETE,TRIGGER,TRUNCATE,UPDATE ON TABLE etl_admin.etl_task TO "local-Python";


--
-- TOC entry 6030 (class 0 OID 0)
-- Dependencies: 252
-- Name: SEQUENCE etl_task_task_id_seq; Type: ACL; Schema: etl_admin; Owner: postgres
--

GRANT ALL ON SEQUENCE etl_admin.etl_task_task_id_seq TO "local-Python";


-- Completed on 2025-11-19 07:06:32

--
-- PostgreSQL database dump complete
--

\unrestrict p8JD9GasGaebtFp8BKgzK7l8DwZ7APkKsTnZV2aOY6thmYoUHLF5Lz8l8pc1Wad

