blob: 474b0d16f21cec375dcb9e9be5915747c42301c9 (
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
|
:mod:`migrate` - SQLAlchemy Migrate (schema change management)
==============================================================
.. module:: migrate
.. moduleauthor:: Evan Rosson
:Author: Evan Rosson
:Maintainer: Domen Kožar <domenNO@SPAMdev.si>
:Source code: http://code.google.com/p/sqlalchemy-migrate/issues/list
:Issues: http://code.google.com/p/sqlalchemy-migrate/
:Continuous Integration: http://jenkins.gnuviech-server.de/job/sqlalchemy-migrate-all/
:Generated: |today|
:License: MIT
:Version: |release|
.. topic:: Overview
Inspired by Ruby on Rails' migrations, SQLAlchemy Migrate provides a
way to deal with database schema changes in SQLAlchemy_ projects.
Migrate was started as part of `Google's Summer of Code`_ by Evan
Rosson, mentored by Jonathan LaCour.
The project was taken over by a small group of volunteers when Evan
had no free time for the project. It is now hosted as a `Google Code
project`_. During the hosting change the project was renamed to
SQLAlchemy Migrate.
Currently, sqlalchemy-migrate supports Python versions from 2.4 to 2.7.
SQLAlchemy Migrate 0.7.0 supports SQLAlchemy 0.5.x, 0.6.x and 0.7.x
branches.
.. warning::
Version **0.6** breaks backward compatibility, please read
:ref:`changelog <backwards-06>` for more info.
Download and Development
------------------------
.. toctree::
download
.. _dialect-support:
Dialect support
---------------
.. list-table::
:header-rows: 1
:widths: 25 10 10 10 10 10 11
* - Operation / Dialect
- :ref:`sqlite <sqlite-d>`
- :ref:`postgres <postgres-d>`
- :ref:`mysql <mysql-d>`
- :ref:`oracle <oracle-d>`
- :ref:`firebird <firebird-d>`
- mssql
* - :ref:`ALTER TABLE RENAME TABLE <table-rename>`
- yes
- yes
- yes
- yes
- no
- not supported
* - :ref:`ALTER TABLE RENAME COLUMN <column-alter>`
- yes (workaround) [#1]_
- yes
- yes
- yes
- yes
- not supported
* - :ref:`ALTER TABLE ADD COLUMN <column-create>`
- yes (workaround) [#2]_
- yes
- yes
- yes
- yes
- not supported
* - :ref:`ALTER TABLE DROP COLUMN <column-drop>`
- yes (workaround) [#1]_
- yes
- yes
- yes
- yes
- not supported
* - :ref:`ALTER TABLE ALTER COLUMN <column-alter>`
- yes (workaround) [#1]_
- yes
- yes
- yes (with limitations) [#3]_
- yes [#4]_
- not supported
* - :ref:`ALTER TABLE ADD CONSTRAINT <constraint-tutorial>`
- partial (workaround) [#1]_
- yes
- yes
- yes
- yes
- not supported
* - :ref:`ALTER TABLE DROP CONSTRAINT <constraint-tutorial>`
- partial (workaround) [#1]_
- yes
- yes
- yes
- yes
- not supported
* - :ref:`RENAME INDEX <index-rename>`
- no
- yes
- no
- yes
- yes
- not supported
.. [#1] Table is renamed to temporary table, new table is created followed by INSERT statements.
.. [#2] See http://www.sqlite.org/lang_altertable.html for more information.
In cases not supported my sqlite, table is renamed to temporary table, new table is created followed by INSERT statements.
.. [#3] You can not change datatype or rename column if table has NOT NULL data, see http://blogs.x2line.com/al/archive/2005/08/30/1231.aspx for more information.
.. [#4] Changing nullable is not supported
Tutorials
--------------
List of useful tutorials:
* `Using migrate with Elixir <http://www.karoltomala.com/blog/?p=633>`_
* `Developing with migrations <http://caneypuggies.alwaysreformed.com/wiki/DevelopingWithMigrations>`_
User guide
-------------
SQLAlchemy Migrate is split into two parts, database schema versioning (:mod:`migrate.versioning`) and
database migration management (:mod:`migrate.changeset`).
The versioning API is available as the :ref:`migrate <command-line-usage>` command.
.. toctree::
versioning
changeset
tools
faq
.. _`google's summer of code`: http://code.google.com/soc
.. _`Google Code project`: http://code.google.com/p/sqlalchemy-migrate
.. _sqlalchemy: http://www.sqlalchemy.org
API Documentation
------------------
.. toctree::
api
Changelog
---------
.. toctree::
changelog
Indices and tables
==================
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
|