diff options
author | Olly Cope <olly@ollycope.com> | 2020-01-16 16:40:47 +0000 |
---|---|---|
committer | Olly Cope <olly@ollycope.com> | 2020-01-16 16:40:47 +0000 |
commit | a89c8a85e67f8fc8d9dcd706fd29cf11aead304b (patch) | |
tree | 4d016a5a6d08ad2d2ce15211aa25aeeaea836233 /doc | |
parent | 12cf74470aee1e14cc63ee2a7578188d92e7fd32 (diff) | |
download | yoyo-a89c8a85e67f8fc8d9dcd706fd29cf11aead304b.tar.gz |
docs: add docs for sql file migrations
Diffstat (limited to 'doc')
-rw-r--r-- | doc/index.rst | 27 |
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 --------------- |