mirror of
https://github.com/OMGeeky/gpt-pilot.git
synced 2026-01-24 10:50:24 +01:00
fix(gitignore): rm cache
This commit is contained in:
23
pilot/database/models/components/base_models.py
Normal file
23
pilot/database/models/components/base_models.py
Normal file
@@ -0,0 +1,23 @@
|
||||
from peewee import *
|
||||
from datetime import datetime
|
||||
from uuid import uuid4
|
||||
|
||||
from database.config import DATABASE_TYPE
|
||||
from database.connection.postgres import get_postgres_database
|
||||
from database.connection.sqlite import get_sqlite_database
|
||||
|
||||
|
||||
# Establish connection to the database
|
||||
if DATABASE_TYPE == "postgres":
|
||||
database = get_postgres_database()
|
||||
else:
|
||||
database = get_sqlite_database()
|
||||
|
||||
|
||||
class BaseModel(Model):
|
||||
id = UUIDField(primary_key=True, default=uuid4)
|
||||
created_at = DateTimeField(default=datetime.now)
|
||||
updated_at = DateTimeField(default=datetime.now)
|
||||
|
||||
class Meta:
|
||||
database = database
|
||||
Reference in New Issue
Block a user