pgloader/test/sqlite-env.load
Dimitri Fontaine f719d2976d Implement a template system for pgloader commands.
This feature has been asked several times, and I can't see any way to fix
the GETENV parsing mess that we have. In this patch the GETENV support is
retired and replaced with a templating system, using the Mustache syntax.

To get back the GETENV feature, our implementation of the Mustache template
system adds support for fetching the template variable values from the OS
environment.

Fixes #555, Fixes #609.
See #500, #477, #278.
2017-08-16 01:33:11 +02:00

27 lines
742 B
Fish

/*
* Run with either one of those commands:
*
* DBPATH=sqlite/sqlite.db ./build/bin/pgloader ./test/sqlite-env.load
* ./build/bin/pgloader --context ./test/sqlite.ini ./test/sqlite-ini.load
*
*/
load database
from '{{DBPATH}}'
into postgresql:///pgloader
-- with include drop, create tables, create indexes, reset sequences
before load do
$$ drop schema if exists sqlite cascade; $$,
$$ create schema if not exists sqlite; $$
cast column character.f1 to text drop typemod,
column appointments.time to timestamptz drop default,
type intege to integer,
type character to varchar keep typemod
set work_mem to '16MB',
maintenance_work_mem to '512 MB',
search_path to 'sqlite';