The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

Name

sqitch-init - Create a new Sqitch project

Synopsis

  sqitch [options] init

Description

This command creates an new Sqitch project -- basically a sqitch.conf file and a sql directory with deploy, revert, and test subdirectories.

Running sqitch init in an existing repository is safe. It will not overwrite things that are already there.

Configuration

The most important thing sqitch init does is create the project plan file, sqitch.conf. While the init command has no options of its own, it relies on several of the options to sqitch to determine what to write to this file:

--plan-file

Sets the core.plan_file configuration variable.

--plan-file

Sets the core.plan_file configuration variable.

--sql-dir

Determines the top-level directory to use when writing the core.deploy_dir, core.revert_dir, and core.test_dir variable -- unless they are overridden by their more-specific options, detailed below.

--deploy-dir

Sets the core.deploy_dir configuration variable.

--revert-dir

Sets the core.revert_dir configuration variable.

--test-dir

Sets the core.test_dir configuration variable.

--extension

Sets the core.extension configuration variable.

--engine

Sets the core.engine configuration variable.

These variables will only be written if their corresponding options are specified. Variables will not be copied from user or system configuration. As a general rule, you like won't need any of them except for --engine, since your project can have only one engine at a time, and specifying it on the command-line forever after would be annoying.

Relatedly, the engine-specific sqitch options will also be used to write variables, as follows:

--client

Used to set core.pg.client, core.sqlite.client, or core.mysql.client.

--db_name

Used to set core.pg.db_name, core.sqlite.db_name, or core.mysql.db_name.

--username

Used to set core.pg.username, or core.mysql.username.

--host

Used to set core.pg.host, or core.mysql.host.

--port

Used to set core.pg.port, or core.mysql.port.

Examples

Start a new Sqitch project using the SQLite engine, setting the default database file to /var/db/widgets.db

  sqitch --engine --db-name /var/db/widgets.db sqlite init

Start a new Sqitch project using the PostgreSQL engine, with the default database name "widgets", the default user name "postgres", and a version-specific client:

  sqitch --engine pg \
  --db-name widgets \
  --username postgres \
  --client /opt/pgsql-9.1/bin/psql init

Sqitch

Part of the sqitch suite.