fix(gitignore): rm pilot-env and cache

This commit is contained in:
Goon
2023-09-11 10:08:42 +07:00
parent 2c567793c5
commit 367caa1797
117 changed files with 0 additions and 5414 deletions

View File

@@ -1,22 +0,0 @@
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()