Calling stored procedure in sequalize passing in a parameter
<p>I'm trying to call a stored procedure passing in a parameter as shown below. However, I know my syntax is off and I don't see any examples doing this, either in the docs or unit tests.</p>

<pre><code>model.sequelize.query('CALL truncate_tables(\'appuser\');')
  .then(function (response) {
    done();
  }).error(function (err) {
    done(err);
});
</code></pre>

<p>suggestions?</p>

<p>I started off looking at this link. <a href="https://stackoverflow.com/questions/29280785/calling-stored-procedures-in-sequelize-js">Calling stored procedures in Sequelize.js</a></p>

<p>Additional info:</p>

<p>here is the error I am seeing</p>

<pre><code>Unhandled rejection SequelizeDatabaseError: syntax error at or near "CALL"    
</code></pre>

<p>and here is the sp</p>

<pre><code>CREATE OR REPLACE FUNCTION truncate_tables(username character varying)
RETURNS void AS
$BODY$
DECLARE
    statements CURSOR FOR
    SELECT tablename FROM pg_tables
    WHERE tableowner = username AND schemaname = 'public';
BEGIN
FOR stmt IN statements LOOP
    EXECUTE 'TRUNCATE TABLE ' || quote_ident(stmt.tablename) || ' CASCADE;';
END LOOP;
END;
$BODY$
</code></pre>