| 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() | |