fix(gitignore): rm cache

This commit is contained in:
Goon
2023-09-11 10:08:57 +07:00
parent 367caa1797
commit c39346868a
102 changed files with 4724 additions and 0 deletions

View File

@@ -0,0 +1,22 @@
import psycopg2
from peewee import PostgresqlDatabase
from psycopg2.extensions import quote_ident
from database.config import DB_NAME, DB_HOST, DB_PORT, DB_USER, DB_PASSWORD
def get_postgres_database():
return PostgresqlDatabase(DB_NAME, user=DB_USER, password=DB_PASSWORD, host=DB_HOST, port=DB_PORT)
def create_postgres_database():
conn = psycopg2.connect(
dbname='postgres',
user=DB_USER,
password=DB_PASSWORD,
host=DB_HOST,
port=DB_PORT
)
conn.autocommit = True
cursor = conn.cursor()
safe_db_name = quote_ident(DB_NAME, conn)
cursor.execute(f"CREATE DATABASE {safe_db_name}")
cursor.close()
conn.close()