Skip to content

Commit 5846e30

Browse files
committed
Add migrations
1 parent 831095a commit 5846e30

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
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+
add published in Release
14+
15+
Revision ID: 3e7bf3217166
16+
Revises: f7720656a33c
17+
Create Date: 2024-12-06 11:04:21.907167
18+
"""
19+
20+
import sqlalchemy as sa
21+
22+
from alembic import op
23+
24+
revision = "3e7bf3217166"
25+
down_revision = "f7720656a33c"
26+
27+
28+
def upgrade():
29+
op.add_column(
30+
"releases",
31+
sa.Column(
32+
"published", sa.DateTime(), server_default=sa.text("now()"), nullable=True
33+
),
34+
)
35+
36+
op.execute(
37+
"""
38+
UPDATE releases
39+
SET published = created
40+
"""
41+
)
42+
43+
44+
def downgrade():
45+
op.drop_column("releases", "published")

0 commit comments

Comments
 (0)