Skip to content

Commit 09a04ce

Browse files
committed
Add migration
1 parent 8d09122 commit 09a04ce

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# https://docs.peewee-orm.com/en/latest/peewee/playhouse.html#schema-migrations
2+
3+
import peewee
4+
import playhouse.migrate
5+
6+
import pycamp_bot.models
7+
8+
9+
my_db = peewee.SqliteDatabase('pycamp_projects.db')
10+
migrator = playhouse.migrate.SqliteMigrator(my_db)
11+
12+
13+
playhouse.migrate.migrate(
14+
migrator.add_column(
15+
pycamp_bot.models.Project._meta.table_name,
16+
'repository_url',
17+
pycamp_bot.models.Project.repository_url,
18+
),
19+
migrator.add_column(
20+
pycamp_bot.models.Project._meta.table_name,
21+
'group_url',
22+
pycamp_bot.models.Project.group_url,
23+
),
24+
)

0 commit comments

Comments
 (0)