jbarrett/Dancer-Plugin-Database — comment on commit 9dcb8de250d024c201260e8370447fdefe6d9e57
File:  line 0
By jbarrett:

So given something like:

database->quick_create(
'posts',
{
id => {
type => 'int',
increment => 1,
key => 1
},
luser => {},
title => {},
text => {}
}
);

this will run something like:

CREATE FUNCTION create_table () RETURNS void
AS $_$
BEGIN

IF NOT EXISTS ( SELECT 1
FROM pg_catalog.pg_tables
WHERE tablename = ?
) THEN

CREATE TABLE posts (luser TEXT ,text TEXT ,title TEXT ,id SERIAL PRIMARY KEY );

END IF;

END;
$_$
LANGUAGE plpgsql;

SELECT create_table();