File size: 631 Bytes
ef9fa15 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | import psycopg2
conn = psycopg2.connect(
dbname="postgres",
user="postgres",
password="j.3C+Y!AqRJYrXi",
host="db.ktxkcyqxftjhbggucaqd.supabase.co",
port="5432"
)
conn.autocommit = True
cur = conn.cursor()
try:
cur.execute("ALTER TABLE reservations DROP CONSTRAINT IF EXISTS reservations_status_check;")
cur.execute("ALTER TABLE reservations ADD CONSTRAINT reservations_status_check CHECK (status IN ('pending', 'confirmed', 'cancelled', 'completed', 'arrived', 'no_show'));")
print("Check constraint updated successfully!")
except Exception as e:
print(f"Error: {e}")
cur.close()
conn.close()
|