File size: 1,301 Bytes
a38e4b0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
49
50
51
52
53
54
55
# import sqlite3

# conn = sqlite3.connect("restaurant_reservation.db")
# cursor = conn.cursor()

# # Drop the existing empty tables
# cursor.execute("DROP TABLE IF EXISTS reservations;")
# cursor.execute("DROP TABLE IF EXISTS reservation_tables;")

# # Recreate the tables with AUTOINCREMENT for `id`
# cursor.execute("""
# CREATE TABLE reservations (
#     id INTEGER PRIMARY KEY AUTOINCREMENT,
#     restaurant_id TEXT,
#     user_name TEXT,
#     contact TEXT,
#     date TEXT,          -- Hard coded to 2025-05-12
#     time TEXT,
#     party_size INTEGER
# );
# """)

# cursor.execute("""
# CREATE TABLE reservation_tables (
#     id INTEGER PRIMARY KEY AUTOINCREMENT,
#     reservation_id TEXT,
#     table_id TEXT
# );
# """)

# conn.commit()
# conn.close()

# print("Tables recreated successfully with AUTOINCREMENT ids.")

import sqlite3

conn = sqlite3.connect("restaurant_reservation.db")
cursor = conn.cursor()

try:
    cursor.execute("""

        UPDATE restaurants

        SET name = 'Street Tacos Co'

        WHERE name = 'Street Tacos Co.';

    """)
    conn.commit()
    print("βœ… Restaurant name updated successfully.")
except Exception as e:
    conn.rollback()
    print(f"❌ Update failed: {e}")
finally:
    conn.close()