Skip to content

Commit 66c2793

Browse files
committed
test migration
1 parent 16be62f commit 66c2793

1 file changed

Lines changed: 57 additions & 0 deletions

File tree

migrations/0001-test.py

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# Copyright 2016 Eugene Frolov <eugene@frolov.net.ru>
2+
# Copyright 2025 Genesis Corporation
3+
#
4+
# All Rights Reserved.
5+
#
6+
# Licensed under the Apache License, Version 2.0 (the "License"); you may
7+
# not use this file except in compliance with the License. You may obtain
8+
# a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing, software
13+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
14+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
15+
# License for the specific language governing permissions and limitations
16+
# under the License.
17+
18+
from restalchemy.storage.sql import migrations
19+
20+
21+
class MigrationStep(migrations.AbstarctMigrationStep):
22+
def __init__(self):
23+
self._depends = [
24+
"0000-squashed-new-3b0440ab.py",
25+
]
26+
27+
@property
28+
def migration_id(self):
29+
return "01992e6e-53d5-449c-ab61-60f3bbc52651"
30+
31+
@property
32+
def is_manual(self):
33+
return False
34+
35+
36+
def upgrade(self, session):
37+
session.execute("""
38+
ALTER TABLE "iam_users"
39+
ADD COLUMN bla VARCHAR(128) NOT NULL DEFAULT ''
40+
""")
41+
session.execute("""
42+
ALTER TABLE "iam_users"
43+
ADD COLUMN bla2 VARCHAR(15)
44+
""")
45+
46+
def downgrade(self, session):
47+
session.execute("""
48+
ALTER TABLE "iam_users"
49+
DROP COLUMN bla
50+
""")
51+
session.execute("""
52+
ALTER TABLE "iam_users"
53+
DROP COLUMN bla2
54+
""")
55+
56+
57+
migration_step = MigrationStep()

0 commit comments

Comments
 (0)