This commit is contained in:
Timothy J. Baek committed 2024-07-03 21:28:14 -07:00
1 parent 15f6f7bd15
commit bfc53b49fd
9 files changed
+345 -105

No files matched your search

@@ -1,4 +1,4 @@
"""Peewee migrations -- 009_add_models.py.
"""Peewee migrations -- 002_add_local_sharing.py.
Some examples (model - class or model name)::
@@ -37,25 +37,10 @@ with suppress(ImportError):
def migrate(migrator: Migrator, database: pw.Database, *, fake=False):
"""Write your migrations here."""
@migrator.create_model
class Model(pw.Model):
id = pw.TextField(unique=True)
user_id = pw.TextField()
base_model_id = pw.TextField(null=True)
name = pw.TextField()
meta = pw.TextField()
params = pw.TextField()
created_at = pw.BigIntegerField(null=False)
updated_at = pw.BigIntegerField(null=False)
class Meta:
table_name = "model"
migrator.add_fields("chat", archived=pw.BooleanField(default=False))
def rollback(migrator: Migrator, database: pw.Database, *, fake=False):
"""Write your rollback migrations here."""
migrator.remove_model("model")
migrator.remove_fields("chat", "archived")