- New models: WarrantyModel, WalletModel, SystemConfigModel - New schemas: WarrantySchema, RefundSchema, SystemConfig, CrmTaskCalendar, NotificationTemplate, NotificationGateway, RepairErp, ReviewModeration, InventoryPos, MultiDashboard, BillingFinance - New services: WarrantyService, RefundService, CrmService, CrmTaskCalendarService, DeliveryService, EmailTemplateService, InventoryPosService, MultiDashboardService, NotificationGatewayService, RepairErpService, ReviewModerationService, SystemConfigService, TemplateService, CreditService - Updated routers: AdminOrder, BillingFinance, Cart, Catalog, Checkout, Crm, InventoryPos, NotificationGateway, RolePermission, ServiceJob, Settings, Storefront, UserCreation - Updated models: Inventory, Notification, Order, Product, Service, Setting, SystemConfig, User - Updated core: database init, invoice generator, main app - Added WarrantyRouter with full CRUD and claim flow
51 lines
1.6 KiB
Python
51 lines
1.6 KiB
Python
import pymysql
|
|
import datetime
|
|
import ulid
|
|
|
|
conn = pymysql.connect(
|
|
host='127.0.0.1',
|
|
user='root',
|
|
password='NewStrongPassword123!',
|
|
database='ifixkart_crm'
|
|
)
|
|
|
|
try:
|
|
with conn.cursor() as cursor:
|
|
# Create table if not exists
|
|
cursor.execute("""
|
|
CREATE TABLE IF NOT EXISTS crm_locations (
|
|
location_id VARCHAR(36) PRIMARY KEY,
|
|
tenant_id VARCHAR(36) NOT NULL DEFAULT 'tenant_default',
|
|
code VARCHAR(50) NOT NULL,
|
|
name VARCHAR(255) NOT NULL,
|
|
address TEXT,
|
|
city VARCHAR(100),
|
|
state VARCHAR(100),
|
|
pincode VARCHAR(20),
|
|
phone VARCHAR(20),
|
|
is_active BOOLEAN DEFAULT 1,
|
|
is_primary BOOLEAN DEFAULT 0,
|
|
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
|
|
updated_at DATETIME ON UPDATE CURRENT_TIMESTAMP
|
|
)
|
|
""")
|
|
|
|
# Check if locations exist
|
|
cursor.execute("SELECT COUNT(*) FROM crm_locations")
|
|
count = cursor.fetchone()[0]
|
|
|
|
if count == 0:
|
|
location_id = str(ulid.ULID())
|
|
cursor.execute("""
|
|
INSERT INTO crm_locations (location_id, tenant_id, code, name, city, is_active, is_primary)
|
|
VALUES (%s, %s, %s, %s, %s, %s, %s)
|
|
""", (location_id, 'tenant_default', 'HQ01', 'Headquarters', 'Bangalore', 1, 1))
|
|
conn.commit()
|
|
print("Successfully inserted default location.")
|
|
else:
|
|
print(f"Locations already exist. Found {count} location(s).")
|
|
|
|
except Exception as e:
|
|
print(f"Error: {e}")
|
|
finally:
|
|
conn.close()
|