Update DBCHANGES.md

Corrections and Improvement for Create table exemple
This commit is contained in:
Silversthorn 2021-08-22 10:00:39 +00:00
parent 73d8be2d57
commit c668b74ed8

View File

@ -39,18 +39,21 @@ import peewee
def migrate(migrator, database, **kwargs): def migrate(migrator, database, **kwargs):
db = database
#Copy Paste here the class of the New Table from models.py
class NewTable(peewee.Model): class NewTable(peewee.Model):
my_id = peewee.IntegerField(unique=True, primary_key=True) my_id = peewee.IntegerField(unique=True, primary_key=True)
class Meta: class Meta:
table_name = 'new_table' table_name = 'new_table'
database = database database = db
create_table(NewTable)
migrator.create_table(NewTable)
def rollback(migrator, database, **kwargs): def rollback(migrator, database, **kwargs):
drop_table('new_table') # Can be model class OR table name migrator.drop_table('new_table') # Can be model class OR table name
``` ```