added ENUM for scan status in scan_history table

This commit is contained in:
heyethereum
2024-07-14 23:38:03 +08:00
parent ab65e5306e
commit 3db9733710
2 changed files with 8 additions and 2 deletions

View File

@@ -4,6 +4,10 @@ CREATE SCHEMA IF NOT EXISTS safeqr;
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
-- Create Enum for scan_history status
CREATE TYPE scan_status AS ENUM ('active', 'inactive');
-- user table, need "" because user is a reserved word is postgres
CREATE TABLE safeqr."user" (
@@ -41,7 +45,8 @@ CREATE TABLE safeqr.qr_code (
CREATE TABLE safeqr.scan_history (
id SERIAL PRIMARY KEY,
qr_code_id UUID REFERENCES safeqr.qr_code(id),
user_id VARCHAR(255) REFERENCES safeqr."user"(id)
user_id VARCHAR(255) REFERENCES safeqr."user"(id),
status scan_status DEFAULT 'active'
);
-- Create Scan_Bookmark table

View File

@@ -37,7 +37,8 @@ INSERT INTO safeqr.qr_code_types (type, description, prefix, table_name) VALUES
('GEOLOCATION', 'Geographic Location', 'geo:', 'geolocation'),
('WIFI', 'Wireless Network Configuration', 'WIFI:', 'wifi'),
('BITCOIN', 'Cryptocurrency Address', 'bitcoin:', 'bitcoin'),
('VCARD', 'Virtual Contact File', 'BEGIN:VCARD', 'vcard');
('VCARD', 'Virtual Contact File', 'BEGIN:VCARD', 'vcard'),
('TEXT', 'Text', '', 'text');
-- Insert into QR_Code table