|
| 1 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 2 | +# you may not use this file except in compliance with the License. |
| 3 | +# You may obtain a copy of the License at |
| 4 | +# |
| 5 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 6 | +# |
| 7 | +# Unless required by applicable law or agreed to in writing, software |
| 8 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 9 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 10 | +# See the License for the specific language governing permissions and |
| 11 | +# limitations under the License. |
| 12 | +""" |
| 13 | +Drop JournalEntry.submitted_from |
| 14 | +
|
| 15 | +Revision ID: 60e6b0dd0f47 |
| 16 | +Revises: d738a238d781 |
| 17 | +Create Date: 2023-05-25 18:30:46.332534 |
| 18 | +""" |
| 19 | + |
| 20 | +import sqlalchemy as sa |
| 21 | + |
| 22 | +from alembic import op |
| 23 | + |
| 24 | +revision = "60e6b0dd0f47" |
| 25 | +down_revision = "d738a238d781" |
| 26 | + |
| 27 | +# Note: It is VERY important to ensure that a migration does not lock for a |
| 28 | +# long period of time and to ensure that each individual migration does |
| 29 | +# not break compatibility with the *previous* version of the code base. |
| 30 | +# This is because the migrations will be ran automatically as part of the |
| 31 | +# deployment process, but while the previous version of the code is still |
| 32 | +# up and running. Thus backwards incompatible changes must be broken up |
| 33 | +# over multiple migrations inside of multiple pull requests in order to |
| 34 | +# phase them in over multiple deploys. |
| 35 | +# |
| 36 | +# By default, migrations cannot wait more than 4s on acquiring a lock |
| 37 | +# and each individual statement cannot take more than 5s. This helps |
| 38 | +# prevent situations where a slow migration takes the entire site down. |
| 39 | +# |
| 40 | +# If you need to increase this timeout for a migration, you can do so |
| 41 | +# by adding: |
| 42 | +# |
| 43 | +# op.execute("SET statement_timeout = 5000") |
| 44 | +# op.execute("SET lock_timeout = 4000") |
| 45 | +# |
| 46 | +# To whatever values are reasonable for this migration as part of your |
| 47 | +# migration. |
| 48 | + |
| 49 | + |
| 50 | +def upgrade(): |
| 51 | + # ### commands auto generated by Alembic - please adjust! ### |
| 52 | + op.drop_column("journals", "submitted_from") |
| 53 | + # ### end Alembic commands ### |
| 54 | + |
| 55 | + |
| 56 | +def downgrade(): |
| 57 | + # ### commands auto generated by Alembic - please adjust! ### |
| 58 | + op.add_column( |
| 59 | + "journals", |
| 60 | + sa.Column("submitted_from", sa.TEXT(), autoincrement=False, nullable=True), |
| 61 | + ) |
| 62 | + # ### end Alembic commands ### |
0 commit comments