 );
 
 
-ALTER TABLE debiki_prod_daily_2013_05_17.dw1_tenant_hosts OWNER TO debiki_prod_daily_2013_05_17;
-
---
--- Name: dw1_tenants; Type: TABLE; Schema: debiki_prod_daily_2013_05_17; Owner: debiki_prod_daily_2013_05_17; Tablespace: 
---
 
 CREATE TABLE dw1_tenants (
     id character varying(32) NOT NULL,

);


ALTER TABLE debiki_prod_daily_2013_05_17.dw1_ids_simple_email OWNER TO debiki_prod_daily_2013_05_17;

--
-- Name: dw1_ids_sno; Type: SEQUENCE; Schema: debiki_prod_daily_2013_05_17; Owner: debiki_prod_daily_2013_05_17
--

CREATE SEQUENCE dw1_ids_sno
    START WITH 10


# --- !Ups

CREATE FUNCTION inc_next_per_page_reply_id(site_id character varying, page_id character varying, step integer) RETURNS integer
    LANGUAGE plpgsql
    AS $$
declare
  next_id int;;
begin
  update DW1_PAGES
    set NEXT_REPLY_ID = NEXT_REPLY_ID + step
    where TENANT = site_id and GUID = page_id
    returning NEXT_REPLY_ID into next_id;;
  return next_id;;
end;;
$$;


CREATE TABLE dw0_version (
    version character varying(100) NOT NULL
);


CREATE TABLE dw1_emails_out (
    tenant character varying(32) NOT NULL,
