fix: create database 'leadsdb' before running migrations

This commit is contained in:
Lord_Devi 2024-09-16 21:40:59 -04:00
parent 1ad1211b9f
commit c70aa6c499

23
create_db.py Normal file
View file

@ -0,0 +1,23 @@
import psycopg2
from psycopg2.extensions import ISOLATION_LEVEL_AUTOCOMMIT
# Connect to the default database
conn = psycopg2.connect(
dbname='postgres',
user='melkor',
password='Th3leetnis!leadsdb',
host='barad-dur.lan.mgk.one',
port='5433'
)
conn.set_isolation_level(ISOLATION_LEVEL_AUTOCOMMIT)
cur = conn.cursor()
# Create the database
cur.execute('CREATE DATABASE leadsdb')
cur.close()
conn.close()
print("Database 'leadsdb' created successfully.")