many fixes and improvements - rework for modules/ and common/
feat(emailer): add Postmark and Resend providers
This commit is contained in:
17
backend/scripts/add-migration.sh
Executable file
17
backend/scripts/add-migration.sh
Executable file
@@ -0,0 +1,17 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Usage: ./add-migration.sh Messaging Initial
|
||||
|
||||
MODULE_NAME=$1
|
||||
MIGRATION_NAME=$2
|
||||
|
||||
if [ -z "$MODULE_NAME" ] || [ -z "$MIGRATION_NAME" ]; then
|
||||
echo "Usage: $0 <ModuleName> <MigrationName>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
dotnet ef migrations add \
|
||||
--context "Hutopy.Modules.${MODULE_NAME}.Data.${MODULE_NAME}DbContext" \
|
||||
--configuration Debug \
|
||||
--output-dir "Modules/${MODULE_NAME}/Migrations" \
|
||||
"$MIGRATION_NAME"
|
||||
25
backend/scripts/start-infrastructure.sh
Executable file
25
backend/scripts/start-infrastructure.sh
Executable file
@@ -0,0 +1,25 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Start the container (if not already running)
|
||||
docker start postgres 2>/dev/null || docker run \
|
||||
--cap-add SYS_PTRACE \
|
||||
-e POSTGRES_USER=sa \
|
||||
-e POSTGRES_PASSWORD='P@ssword123!' \
|
||||
-p 5432:5432 \
|
||||
--name postgres \
|
||||
-d postgres:latest
|
||||
|
||||
# Wait until Postgres is ready
|
||||
echo "Waiting for Postgres to be ready..."
|
||||
until docker exec postgres pg_isready -U sa > /dev/null 2>&1; do
|
||||
sleep 1
|
||||
done
|
||||
|
||||
# Create 'hutopy' database if it doesn't exist
|
||||
echo "Ensuring 'hutopy' database exists..."
|
||||
docker exec -e PGPASSWORD='P@ssword123!' postgres \
|
||||
psql -U sa -d postgres -tAc "SELECT 1 FROM pg_database WHERE datname='hutopy'" | grep -q 1 || \
|
||||
docker exec -e PGPASSWORD='P@ssword123!' postgres \
|
||||
createdb -U sa hutopy
|
||||
|
||||
echo "✅ Done."
|
||||
25
backend/scripts/update-databases.sh
Executable file
25
backend/scripts/update-databases.sh
Executable file
@@ -0,0 +1,25 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Usage:
|
||||
# ./update-db.sh Messaging => applies latest migration
|
||||
# ./update-db.sh Messaging Initial => updates to a specific migration
|
||||
|
||||
MODULE_NAME=$1
|
||||
TARGET_MIGRATION=$2 # Optional
|
||||
|
||||
if [ -z "$MODULE_NAME" ]; then
|
||||
echo "Usage: $0 <ModuleName> [MigrationName]"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
UPDATE_COMMAND=(
|
||||
dotnet ef database update
|
||||
--context "Hutopy.Modules.${MODULE_NAME}.Data.${MODULE_NAME}DbContext"
|
||||
--configuration Debug
|
||||
)
|
||||
|
||||
if [ -n "$TARGET_MIGRATION" ]; then
|
||||
UPDATE_COMMAND+=("$TARGET_MIGRATION")
|
||||
fi
|
||||
|
||||
"${UPDATE_COMMAND[@]}"
|
||||
Reference in New Issue
Block a user