1:mod:`migrate` - SQLAlchemy Migrate (schema change management)
2==============================================================
3
4.. module:: migrate
5.. moduleauthor:: Evan Rosson
6
7:Author: Evan Rosson
8:Maintainer: Domen Kožar <domenNO@SPAMdev.si>
9:Maintainer: Jan Dittberner <jan.dittbernerNO@SPAMgooglemail.com>
10:Source Code: https://github.com/stackforge/sqlalchemy-migrate
11:Documentation: https://sqlalchemy-migrate.readthedocs.org/
12:Issues: https://bugs.launchpad.net/sqlalchemy-migrate
13:Generated: |today|
14:License: MIT
15:Version: |release|
16
17
18.. topic:: Overview
19
20    Inspired by Ruby on Rails' migrations, SQLAlchemy Migrate provides a way to
21    deal with database schema changes in SQLAlchemy_ projects.
22
23    Migrate was started as part of `Google's Summer of Code`_ by Evan Rosson,
24    mentored by Jonathan LaCour.
25
26    The project was taken over by a small group of volunteers when Evan had no
27    free time for the project. It is now hosted as a `Github project`_.
28    During the hosting change the project was renamed to SQLAlchemy Migrate.
29
30    Currently, sqlalchemy-migrate supports Python versions from 2.6 to 2.7.
31    SQLAlchemy Migrate 0.7.2 supports SQLAlchemy 0.6.x and 0.7.x branches.
32
33    Support for Python 2.4 and 2.5 as well as SQLAlchemy 0.5.x has been dropped
34    after sqlalchemy-migrate 0.7.1.
35
36.. warning::
37
38    Version **0.6** broke backward compatibility, please read :ref:`changelog
39    <backwards-06>` for more info.
40
41
42Download and Development
43------------------------
44
45.. toctree::
46
47   download
48   credits
49
50
51.. _dialect-support:
52
53Dialect support
54---------------
55
56.. list-table::
57    :header-rows: 1
58    :widths: 25 10 10 10 10 10 11 10
59
60    * - Operation / Dialect
61      - :ref:`sqlite <sqlite-d>`
62      - :ref:`postgres <postgres-d>`
63      - :ref:`mysql <mysql-d>`
64      - :ref:`oracle  <oracle-d>`
65      - :ref:`firebird <firebird-d>`
66      - mssql
67      - DB2
68    * - :ref:`ALTER TABLE RENAME TABLE <table-rename>`
69      - yes
70      - yes
71      - yes
72      - yes
73      - no
74      - not supported
75      - unknown
76    * - :ref:`ALTER TABLE RENAME COLUMN <column-alter>`
77      - yes (workaround) [#1]_
78      - yes
79      - yes
80      - yes
81      - yes
82      - not supported
83      - unknown
84    * - :ref:`ALTER TABLE ADD COLUMN <column-create>`
85      - yes (workaround) [#2]_
86      - yes
87      - yes
88      - yes
89      - yes
90      - not supported
91      - unknown
92    * - :ref:`ALTER TABLE DROP COLUMN <column-drop>`
93      - yes (workaround) [#1]_
94      - yes
95      - yes
96      - yes
97      - yes
98      - not supported
99      - unknown
100    * - :ref:`ALTER TABLE ALTER COLUMN <column-alter>`
101      - yes (workaround) [#1]_
102      - yes
103      - yes
104      - yes (with limitations) [#3]_
105      - yes [#4]_
106      - not supported
107      - unknown
108    * - :ref:`ALTER TABLE ADD CONSTRAINT <constraint-tutorial>`
109      - partial (workaround) [#1]_
110      - yes
111      - yes
112      - yes
113      - yes
114      - not supported
115      - unknown
116    * - :ref:`ALTER TABLE DROP CONSTRAINT <constraint-tutorial>`
117      - partial (workaround) [#1]_
118      - yes
119      - yes
120      - yes
121      - yes
122      - not supported
123      - unknown
124    * - :ref:`RENAME INDEX <index-rename>`
125      - no
126      - yes
127      - no
128      - yes
129      - yes
130      - not supported
131      - unknown
132
133
134.. [#1] Table is renamed to temporary table, new table is created followed by
135        INSERT statements.
136.. [#2] See http://www.sqlite.org/lang_altertable.html for more information.
137        In cases not supported by sqlite, table is renamed to temporary table,
138        new table is created followed by INSERT statements.
139.. [#3] You can not change datatype or rename column if table has NOT NULL
140        data, see http://blogs.x2line.com/al/archive/2005/08/30/1231.aspx for
141        more information.
142.. [#4] Changing nullable is not supported
143
144
145Tutorials
146--------------
147
148List of useful tutorials:
149
150* `Using migrate with Elixir <http://www.karoltomala.com/blog/?p=633>`_
151* `Developing with migrations
152  <http://caneypuggies.alwaysreformed.com/wiki/DevelopingWithMigrations>`_
153
154
155User guide
156-------------
157
158SQLAlchemy Migrate is split into two parts, database schema versioning
159(:mod:`migrate.versioning`) and database migration management
160(:mod:`migrate.changeset`).  The versioning API is available as the
161:ref:`migrate <command-line-usage>` command.
162
163.. toctree::
164
165   versioning
166   changeset
167   tools
168   faq
169   glossary
170
171.. _`google's summer of code`: http://code.google.com/soc
172.. _`Github project`: https://github.com/stackforge/sqlalchemy-migrate
173.. _sqlalchemy: http://www.sqlalchemy.org
174
175
176API Documentation
177------------------
178
179.. toctree::
180
181   api
182
183
184Changelog
185---------
186
187.. toctree::
188
189   changelog
190
191
192Indices and tables
193==================
194
195* :ref:`genindex`
196* :ref:`modindex`
197* :ref:`search`
198