summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorOlly Cope <olly@ollycope.com>2020-01-16 16:40:47 +0000
committerOlly Cope <olly@ollycope.com>2020-01-16 16:40:47 +0000
commita89c8a85e67f8fc8d9dcd706fd29cf11aead304b (patch)
tree4d016a5a6d08ad2d2ce15211aa25aeeaea836233 /doc
parent12cf74470aee1e14cc63ee2a7578188d92e7fd32 (diff)
downloadyoyo-a89c8a85e67f8fc8d9dcd706fd29cf11aead304b.tar.gz
docs: add docs for sql file migrations
Diffstat (limited to 'doc')
-rw-r--r--doc/index.rst27
1 files changed, 27 insertions, 0 deletions
diff --git a/doc/index.rst b/doc/index.rst
index 3c3515a..15a3fc3 100644
--- a/doc/index.rst
+++ b/doc/index.rst
@@ -161,6 +161,33 @@ their only argument:
step(do_step)
+
+SQL migration files
+-------------------
+
+Migrations can also be specified as SQL files, eg:
+
+.. code:: sql
+
+ --
+ -- file: migrations/0001.create-foo.sql
+ --
+ CREATE TABLE foo (
+ id INT,
+ bar TEXT,
+ PRIMARY KEY (id)
+ );
+
+Rollback code can be added in a file with the same base name as your migration, but with the extension ``.rollback.sql``::
+
+.. code:: sql
+
+ --
+ -- file: migrations/0001.create-foo.rollback.sql
+ --
+ DROP TABLE foo;
+
+
Post-apply hook
---------------