 DO $$
   BEGIN
     BEGIN
-      CREATE SCHEMA integration;
-
+      CREATE SCHEMA IF NOT EXISTS integration;
     END;
   END;
 $$;

  BEGIN
    BEGIN
      CREATE SEQUENCE "integration"."integration_id_seq" INCREMENT 1 START 1 MAXVALUE 9223372036854775807 MINVALUE 1 CACHE 1;
    END;
      CREATE SEQUENCE "integration"."channel_integration_id_seq" INCREMENT 1 START 1 MAXVALUE 9223372036854775807 MINVALUE 1 CACHE 1;
  END;
$$;



GRANT SELECT, INSERT, UPDATE ON "integration"."channel_integration" TO "social";

DO $$
  BEGIN
    BEGIN
      CREATE INDEX  "channel_integration_token_idx" ON integration.channel_integration USING btree(token DESC NULLS LAST);
    EXCEPTION WHEN duplicate_table THEN
      RAISE NOTICE 'channel_integration_token_idx index already exists';
    END;
  END;
$$;



--
