-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
43 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
7. Alembic migrations for Aspects | ||
################################# | ||
|
||
Status | ||
****** | ||
|
||
Accepted | ||
|
||
Context | ||
******* | ||
|
||
Alembic is a migration tool for SQLAlchemy. It is used to manage the clickhouse database | ||
schema for the Aspects project. | ||
|
||
For more information about Alembic, see https://alembic.sqlalchemy.org/en/latest/ | ||
|
||
Decisions | ||
********* | ||
|
||
#. There should be a single initial SQL executed at initialization time. This will | ||
create the databases, users and permissions, and any other necessary setup before | ||
running migrations. | ||
#. Migrations are executed with RAW SQL using the ``op.execute`` method. This allows | ||
us to use ClickHouse-specific SQL syntax. | ||
#. Migrations should always define a downgrade step, even if it is a no-op. | ||
#. Migrations are generated using a Sequential ID. This allows us to easily identify | ||
the order in which migrations were created and executed. | ||
#. Migrations cannot be modified once they are released to production. If a migration | ||
needs to be modified, a new migration should be created with a new sequential ID. | ||
|
||
Consequences | ||
************ | ||
|
||
* Users should not run migrations manually. They should be run automatically by Tutor | ||
when the LMS is started. | ||
|
||
Rejected Alternatives | ||
********************* | ||
|
||
**Clickhouse SQL Alchemy Models** | ||
|
||
Model allows us to automagically create tables and columns in Clickhouse. However, it is | ||
not well supported and we didn't find any benefits over raw SQL migrations. |