Initial commit of CK-QR Platform

This commit is contained in:
Mohan Ki
2026-07-27 13:42:18 +05:30
commit 60dcb029dc
19 changed files with 2582 additions and 0 deletions
+20
View File
@@ -0,0 +1,20 @@
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
CREATE TABLE IF NOT EXISTS users (
id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
email VARCHAR(255) UNIQUE NOT NULL,
password_hash VARCHAR(255) NOT NULL,
role VARCHAR(50) DEFAULT 'free',
created_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP
);
CREATE TABLE IF NOT EXISTS qr_codes (
id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
user_id UUID REFERENCES users(id) ON DELETE CASCADE,
type VARCHAR(20) NOT NULL, -- 'static' or 'dynamic'
data_type VARCHAR(50) NOT NULL, -- 'URL', 'Wi-Fi', etc.
destination_url TEXT,
short_url_id VARCHAR(50) UNIQUE, -- Only for dynamic routing e.g. 'xyz123'
design_data JSONB, -- Custom styling
created_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP
);
@@ -0,0 +1,9 @@
CREATE TABLE IF NOT EXISTS qr_scans (
id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
qr_code_id UUID REFERENCES qr_codes(id) ON DELETE CASCADE,
ip_address VARCHAR(45),
user_agent TEXT,
os VARCHAR(100),
device_type VARCHAR(50),
scanned_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP
);
+15
View File
@@ -0,0 +1,15 @@
CREATE TABLE IF NOT EXISTS app_settings (
key VARCHAR(100) PRIMARY KEY,
value TEXT,
category VARCHAR(50),
updated_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP
);
-- Insert some default keys so they show up in the UI
INSERT INTO app_settings (key, value, category) VALUES
('icici_merchant_id', '', 'payments'),
('icici_api_key', '', 'payments'),
('google_safe_browsing_key', '', 'security'),
('google_client_id', '', 'auth'),
('apple_service_id', '', 'auth')
ON CONFLICT (key) DO NOTHING;
+3
View File
@@ -0,0 +1,3 @@
INSERT INTO users (email, password_hash, role)
VALUES ('admin@ckqr.com', '$2b$10$ezY4oBvmZUc667XCKbl98.hKicJbOG9yaV9lFbZXwbeXWgMuN7L/6', 'enterprise')
ON CONFLICT (email) DO NOTHING;