File tree Expand file tree Collapse file tree 2 files changed +22
-2
lines changed
Expand file tree Collapse file tree 2 files changed +22
-2
lines changed Original file line number Diff line number Diff line change @@ -198,8 +198,24 @@ jobs:
198198 exit 1
199199 fi
200200
201- # Run migrations
202- docker exec $BACKEND_CONTAINER php artisan migrate:fresh --seed --force
201+ docker exec $BACKEND_CONTAINER php artisan migrate --force
202+
203+ # Check if seeding is needed (if ALL tables are empty)
204+ SEED_NEEDED=$(docker exec $BACKEND_CONTAINER php artisan tinker --execute '
205+ echo (
206+ DB::table("users")->count() === 0 &&
207+ DB::table("elections")->count() === 0 &&
208+ DB::table("counted_votes")->count() === 0
209+ DB::table("malicious_votes")->count() === 0
210+ ) ? "true" : "false";
211+ ')
212+
213+ if [ "$SEED_NEEDED" = "true" ]; then
214+ echo "Seeding fresh data..."
215+ docker exec $BACKEND_CONTAINER php artisan db:seed --force
216+ else
217+ echo "Database already has data. Skipping seeding."
218+ fi
203219
204220 # If fails, show error logs
205221 if [ $? -ne 0 ]; then
Original file line number Diff line number Diff line change @@ -4,6 +4,10 @@ const token = localStorage.getItem('access_token');
44
55const axiosInstance = axios . create ( {
66 baseURL : import . meta. env . VITE_API_URL ,
7+ headers : {
8+ 'Content-Type' : 'application/json' ,
9+ 'Accept' : 'application/json'
10+ }
711} ) ;
812
913export default axiosInstance ;
You can’t perform that action at this time.
0 commit comments