#!/bin/bash

# Start SQL Server in the background
/opt/mssql/bin/sqlservr &

# Wait for SQL Server to start
echo "Waiting for SQL Server to start..."
sleep 15

# Run the database initialization script
echo "Running initialization script..."
/opt/mssql-tools18/bin/sqlcmd -C -S localhost -U sa -P StrongPassw0rd! -i /init-scripts/create-database.sql

# Wait indefinitely to keep the container running
wait
