21 lines
760 B
Python
21 lines
760 B
Python
#!/usr/bin/env python3
|
|
"""Drop price check constraints from database"""
|
|
import asyncio
|
|
from database import async_engine
|
|
from sqlalchemy import text
|
|
|
|
async def drop_constraints():
|
|
async with async_engine.begin() as conn:
|
|
# Drop services price constraint
|
|
result1 = await conn.execute(text('ALTER TABLE services DROP CONSTRAINT IF EXISTS chk_services_price_positive'))
|
|
print('Dropped chk_services_price_positive')
|
|
|
|
# Drop products price constraint
|
|
result2 = await conn.execute(text('ALTER TABLE products DROP CONSTRAINT IF EXISTS chk_products_price_positive'))
|
|
print('Dropped chk_products_price_positive')
|
|
|
|
print('Done!')
|
|
|
|
if __name__ == "__main__":
|
|
asyncio.run(drop_constraints())
|