summaryrefslogtreecommitdiff
path: root/README.md
blob: 612c76b52721b049ed9faeef283be636a601fdb1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
App/Sqitch version v1.4.1
=========================

| Release           | Coverage          | Database                              ||
|-------------------|-------------------|-------------------|--------------------|
| [![CPAN]][๐Ÿ“š]     | [![OSes]][๐Ÿ’ฟ]     | [![Exasol]][โ˜€๏ธ]    | [![Oracle]][๐Ÿ”ฎ]    |
| [![Docker]][๐Ÿณ]   | [![Perl]][๐Ÿง…]     | [![Firebird]][๐Ÿ”ฅ] | [![Snowflake]][โ„๏ธ]  |
| [![Homebrew]][๐Ÿบ] | [![Coverage]][๐Ÿ“ˆ] | [![MySQL]][๐Ÿฌ]    | [![SQLite]][๐Ÿ’ก]    |
| [![Debian]][๐Ÿฅ]   |                   | [![Postgres]][๐Ÿ˜] | [![Vertica]][๐Ÿ”บ]   |
|                   |                   | [![Yugabyte]][๐Ÿ’ซ] | [![Cockroach]][๐Ÿชณ] |

[Sqitch] is a database change management application. It currently supports:

*   [PostgreSQL] 8.4+
*   [YugabyteDB] 2.6+
*   [CockroachDB] 21+
*   [SQLite][lite] 3.8.6+
*   [MySQL][my] 5.1+
*   [MariaDB] 10.0+
*   [Oracle][orcl] 10g+,
*   [Firebird][bird] 2.0+
*   [Vertica][vert] 7.2+
*   [Exasol][exa] 6.0+
*   [Snowflake][flake]

What makes it different from your typical migration approaches? A few things:

*   No opinions

    Sqitch is not tied to any framework, ORM, or platform. Rather, it is a
    standalone change management system with no opinions about your database
    engine, application framework, or development environment.

*   Native scripting

    Changes are implemented as scripts native to your selected database engine.
    Writing a [PostgreSQL] application? Write SQL scripts for [`psql`]. Writing
    an [Oracle][orcl]-backed app? Write SQL scripts for [SQL\*Plus].

*   Dependency resolution

    Database changes may declare dependencies on other changes -- even on
    changes from other Sqitch projects. This ensures proper order of
    execution, even when you've committed changes to your VCS out-of-order.

*   Deployment integrity

    Sqitch manages changes and dependencies via a plan file, employing a
    [Merkle tree] pattern similar to [Git][gitmerkle] and [Blockchain] to ensure
    deployment integrity. As such, there is no need to number your changes,
    although you can if you want. Sqitch doesn't much care how you name your
    changes.

*   Iterative Development

    Up until you [tag] and [release] your project, you can modify your change
    deployment scripts as often as you like. They're not locked in just because
    they've been committed to your VCS. This allows you to take an iterative or
    test-driven approach to developing your database schema.

Want to learn more? The best place to start is in the tutorials:

*   [Introduction to Sqitch on PostgreSQL, YugabyteDB, and CockroachDB](lib/sqitchtutorial.pod)
*   [Introduction to Sqitch on SQLite](lib/sqitchtutorial-sqlite.pod)
*   [Introduction to Sqitch on Oracle](lib/sqitchtutorial-oracle.pod)
*   [Introduction to Sqitch on MySQL](lib/sqitchtutorial-mysql.pod)
*   [Introduction to Sqitch on Firebird](lib/sqitchtutorial-firebird.pod)
*   [Introduction to Sqitch on Vertica](lib/sqitchtutorial-vertica.pod)
*   [Introduction to Sqitch on Exasol](lib/sqitchtutorial-exasol.pod)
*   [Introduction to Sqitch on Snowflake](lib/sqitchtutorial-snowflake.pod)

There have also been a number of presentations on Sqitch:

* [PDX.pm Presentation]: Slides from "Sane Database Management with Sqitch",
  presented to the Portland Perl Mongers in January, 2013.

* [PDXPUG Presentation]: Movie of "Sane Database Management with Sqitch",
  presented to the Portland PostgreSQL Users Group in September, 2012.

* [Agile Database Development]: Slides from a three-hour tutorial session on
  using [Git], test-driven development with [pgTAP], and change management with
  Sqitch, updated in January, 2014.

Installation
------------

To install Sqitch from a distribution download, type the following:

    perl Build.PL
    ./Build installdeps
    ./Build
    ./Build test
    ./Build install

To install Sqitch and all of its dependencies into a single directory named
`sqitch_bundle`, install the Menlo CPAN client and build the bundle:

    cpanm Menlo::CLI::Compat
    ./Build bundle --install_base sqitch_bundle

After which, Sqitch can be run from `./sqitch_bundle/bin/sqitch`. By default,
no modules that are included in the core Perl distribution are included. To
require that dual-life modules also be bundled, pass `--dual_life 1`:

    ./Build bundle --install_base sqitch_bundle --dual_life 1

To include support for a feature in the bundle, pass the `--with` option
naming the feature:

    ./Build bundle --install_base sqitch_bundle --with postgres --with sqlite

The feature names generally correspond to the supported engines. The currently
supported features are:

*   `--with postgres`:  Support for managing Postgres, Yugabyte, and Cockroach databases
*   `--with sqlite`:    Support for managing SQLite databases
*   `--with mysql`:     Support for managing MySQL databases
*   `--with firebird`:  Support for managing Firebird databases
*   `--with oracle`:    Support for managing Oracle databases
*   `--with vertica`:   Support for managing Vertica databases
*   `--with exasol`:    Support for managing Exasol databases
*   `--with snowflake`: Support for managing Snowflake databases
*   `--with odbc`:      Include the ODBC driver

To build from a Git clone, first install [Dist::Zilla], then use it to install
Sqitch and all dependencies:

    cpanm Dist::Zilla
    dzil authordeps --missing | cpanm
    dzil listdeps --missing | cpanm
    dzil install

To run Sqitch directly from the Git clone, execute `t/sqitch`.

To install Sqitch on a specific platform, including Debian- and RedHat-derived
Linux distributions and Windows, see the [Installation documentation].

License
-------

Copyright (c) 2012-2024 iovation Inc., David E. Wheeler

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

  [CPAN]:      https://img.shields.io/cpan/v/App-Sqitch?label=%F0%9F%93%9A%20CPAN
  [๐Ÿ“š]:        https://metacpan.org/dist/App-Sqitch "Latest version on CPAN"
  [OSes]:      https://github.com/sqitchers/sqitch/actions/workflows/os.yml/badge.svg
  [๐Ÿ’ฟ]:        https://github.com/sqitchers/sqitch/actions/workflows/os.yml "Tested on Linux, macOS, and Windows"
  [Exasol]:    https://github.com/sqitchers/sqitch/actions/workflows/exasol.yml/badge.svg
  [โ˜€๏ธ]:         https://github.com/sqitchers/sqitch/actions/workflows/exasol.yml "Tested with Exasol 7.0โ€“7.1"
  [Oracle]:    https://github.com/sqitchers/sqitch/actions/workflows/oracle.yml/badge.svg
  [๐Ÿ”ฎ]:        https://github.com/sqitchers/sqitch/actions/workflows/oracle.yml "Tested with Oracle 11, 18, and 21"
  [Docker]:    https://img.shields.io/docker/v/sqitch/sqitch?label=%F0%9F%90%B3%20Docker&sort=semver
  [๐Ÿณ]:        https://hub.docker.com/r/sqitch/sqitch "Latest version on Docker Hub"
  [Perl]:      https://github.com/sqitchers/sqitch/actions/workflows/perl.yml/badge.svg
  [๐Ÿง…]:        https://github.com/sqitchers/sqitch/actions/workflows/perl.yml "Tested with Perl 5.12โ€“5.38"
  [Firebird]:  https://github.com/sqitchers/sqitch/actions/workflows/firebird.yml/badge.svg
  [๐Ÿ”ฅ]:        https://github.com/sqitchers/sqitch/actions/workflows/firebird.yml "Tested with Firebird 2.5, 3, and 4"
  [Snowflake]: https://github.com/sqitchers/sqitch/actions/workflows/snowflake.yml/badge.svg
  [โ„๏ธ]:         https://github.com/sqitchers/sqitch/actions/workflows/snowflake.yml "Tested with Snowflake"
  [Homebrew]:  https://img.shields.io/github/v/tag/sqitchers/homebrew-sqitch?label=%F0%9F%8D%BA%20Homebrew&sort=semver
  [๐Ÿบ]:        https://github.com/sqitchers/homebrew-sqitch#readme "Latest Homebrew Tap version"
  [Coverage]:  https://img.shields.io/coveralls/github/sqitchers/sqitch?label=%F0%9F%93%88%20Coverage
  [๐Ÿ“ˆ]:        https://coveralls.io/r/sqitchers/sqitch "Test Coverage"
  [MySQL]:     https://github.com/sqitchers/sqitch/actions/workflows/mysql.yml/badge.svg
  [๐Ÿฌ]:        https://github.com/sqitchers/sqitch/actions/workflows/mysql.yml "Tested with MySQL 5.5โ€“8 and MariaDB 10.0โ€“11.0"
  [SQLite]:    https://github.com/sqitchers/sqitch/actions/workflows/sqlite.yml/badge.svg
  [๐Ÿ’ก]:        https://github.com/sqitchers/sqitch/actions/workflows/sqlite.yml "Tested with SQLite 3.8โ€“3.42"
  [Debian]:    https://img.shields.io/debian/v/sqitch?label=%F0%9F%8D%A5%20Debian
  [๐Ÿฅ]:        https://packages.debian.org/stable/sqitch "Latest version on Debian"
  [Postgres]:  https://github.com/sqitchers/sqitch/actions/workflows/pg.yml/badge.svg
  [๐Ÿ˜]:        https://github.com/sqitchers/sqitch/actions/workflows/pg.yml "Tested with PostgreSQL 8.4โ€“16"
  [Yugabyte]:  https://github.com/sqitchers/sqitch/actions/workflows/yugabyte.yml/badge.svg
  [๐Ÿ’ซ]:        https://github.com/sqitchers/sqitch/actions/workflows/yugabyte.yml "Tested with YugabyteDB 2.6โ€“2.19"
  [Vertica]:   https://github.com/sqitchers/sqitch/actions/workflows/vertica.yml/badge.svg
  [๐Ÿ”บ]:        https://github.com/sqitchers/sqitch/actions/workflows/vertica.yml "Tested with Vertica 7.2โ€“12.0"
[Cockroach]: https://github.com/sqitchers/sqitch/actions/workflows/cockroach.yml/badge.svg
  [๐Ÿชณ]:        https://github.com/sqitchers/sqitch/actions/workflows/cockroach.yml "Tested with CockroachDB v21-23"

  [Sqitch]: https://sqitch.org/
  [PostgreSQL]: https://postgresql.org/
  [YugabyteDB]: https://www.yugabyte.com/yugabytedb/
  [CockroachDB]: https://www.cockroachlabs.com/product/
  [lite]: https://sqlite.org/
  [my]: https://dev.mysql.com/
  [MariaDB]: https://mariadb.org
  [`psql`]: https://www.postgresql.org/docs/current/static/app-psql.html
  [orcl]: https://www.oracle.com/database/
  [bird]: https://www.firebirdsql.org/
  [vert]: https://www.vertica.com/
  [exa]: https://www.exasol.com/
  [flake]: https://www.snowflake.net/
  [SQL\*Plus]: https://www.orafaq.com/wiki/SQL*Plus
  [Merkle tree]: https://en.wikipedia.org/wiki/Merkle_tree "Wikipedia: โ€œMerkle treeโ€"
  [gitmerkle]: https://stackoverflow.com/a/18589734/
    "Stack Overflow: โ€œWhat is the mathematical structure that represents a Git repoโ€"
  [Blockchain]: https://medium.com/byzantine-studio/blockchain-fundamentals-what-is-a-merkle-tree-d44c529391d7
    "Medium: โ€œBlockchain Fundamentals #1: What is a Merkle Tree?โ€"
  [tag]: https://sqitch.org/docs/manual/sqitch-tag/
  [release]: https://sqitch.org/docs/manual/sqitch-tag/
  [PDX.pm Presentation]: https://speakerdeck.com/theory/sane-database-change-management-with-sqitch
  [PDXPUG Presentation]: https://vimeo.com/50104469
  [Agile Database Development]: https://speakerdeck.com/theory/agile-database-development-2ed
  [Git]: https://git-scm.org
  [pgTAP]: https://pgtap.org
  [Dist::Zilla]: https://metacpan.org/module/Dist::Zilla
  [Installation documentation]: https://sqitch.org/download/