This commit is contained in:
2026-04-09 19:28:41 +03:00
commit 9fa723bb4c
43 changed files with 2804 additions and 0 deletions

30
setup_db.sh Executable file
View File

@@ -0,0 +1,30 @@
#!/bin/bash
# Настройки
DB_NAME="formbuilder"
DB_USER="postgres"
DB_PASSWORD="postgres"
echo "Setting up PostgreSQL database..."
# Проверяем, запущен ли PostgreSQL
if ! pg_isready -U $DB_USER -h localhost -p 5432; then
echo "PostgreSQL is not running. Starting..."
sudo systemctl start postgresql
sleep 3
fi
# Создаем базу данных если не существует
if ! psql -U $DB_USER -h localhost -lqt | cut -d \| -f 1 | grep -qw $DB_NAME; then
echo "Creating database $DB_NAME..."
sudo -u postgres createdb $DB_NAME
echo "Database created successfully!"
else
echo "Database $DB_NAME already exists"
fi
# Запускаем инициализацию Python
echo "Running database initialization..."
python scripts/init_db.py
echo "Setup complete!"