mirror of
https://github.com/OMGeeky/gpt-pilot.git
synced 2026-01-06 19:29:33 +01:00
refactor DB
This commit is contained in:
24
euclid/database/models/components/base_models.py
Normal file
24
euclid/database/models/components/base_models.py
Normal file
@@ -0,0 +1,24 @@
|
||||
from peewee import *
|
||||
from datetime import datetime
|
||||
from uuid import uuid4
|
||||
|
||||
from const import db
|
||||
|
||||
|
||||
# Establish connection to the database
|
||||
database = PostgresqlDatabase(
|
||||
db.DB_NAME,
|
||||
user=db.DB_USER,
|
||||
password=db.DB_PASSWORD,
|
||||
host=db.DB_HOST,
|
||||
port=db.DB_PORT
|
||||
)
|
||||
|
||||
|
||||
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