mirror of
https://gitlab.com/crafty-controller/crafty-4.git
synced 2024-08-30 18:23:09 +00:00
Update DBCHANGES.md
Corrections and Improvement for Create table exemple
This commit is contained in:
parent
73d8be2d57
commit
c668b74ed8
@ -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
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user