pumb_keycrm/models.py

27 lines
928 B
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

from peewee import *
# Соединение с базой данных SQLite (или любой другой поддерживаемой базой данных)
db = SqliteDatabase('my_database.db')
# Определение модели для таблицы
class Transaction(Model):
id = AutoField()
uuid = CharField()
amount = FloatField()
description = CharField()
created_at = CharField()
gateway_id = CharField()
class Meta:
database = db # Указание базы данных
# Создание таблицы
db.connect()
db.create_tables([Transaction])
# Пример добавления данных в таблицу
# new_transaction = Transaction.create(amount=100.50, description='Payment for services')
# print(new_transaction.id, new_transaction.amount, new_transaction.description)
# Закрытие соединения с базой данных
# db.close()