-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy.sh
More file actions
48 lines (40 loc) · 1.37 KB
/
deploy.sh
File metadata and controls
48 lines (40 loc) · 1.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/bin/bash
set -e
echo "=== RESTAURANT DEPLOYMENT ==="
# 1. Install
pip install -r requirements.txt
# 2. Migrations
python manage.py migrate
# 3. Emergency table creation if migrations failed
python manage.py shell -c "
from django.db import connection
tables = connection.introspection.table_names()
if 'app_menuitem' not in tables:
print('⚠️ MenuItem table missing, creating manually...')
with connection.cursor() as c:
c.execute('''
CREATE TABLE IF NOT EXISTS app_menuitem (
id INTEGER PRIMARY KEY AUTOINCREMENT,
name VARCHAR(200) NOT NULL,
description TEXT NOT NULL,
price DECIMAL(8,2) NOT NULL,
category VARCHAR(20) NOT NULL,
type VARCHAR(20) NOT NULL,
image VARCHAR(300),
static_image_path VARCHAR(300),
is_available BOOLEAN NOT NULL DEFAULT 1,
display_order INTEGER NOT NULL DEFAULT 0,
is_alcoholic BOOLEAN NOT NULL DEFAULT 0,
created_at DATETIME NOT NULL,
updated_at DATETIME NOT NULL
)
''')
print('✅ Table created')
else:
print('✅ MenuItem table exists')
"
# 4. Import data (safe - won't duplicate)
python manage.py import_menu
# 5. Static files
python manage.py collectstatic --noinput
echo "=== READY ==="