21 lines
801 B
SQL
Executable file
21 lines
801 B
SQL
Executable file
-- Platform Admin Schema for E2E Tests
|
|
-- Creates devices table for device authorization testing
|
|
|
|
-- Enable UUID extension if not already enabled
|
|
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
|
|
|
|
-- Devices table for macOS desktop client authorization
|
|
CREATE TABLE IF NOT EXISTS devices (
|
|
id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
|
|
"userId" UUID NOT NULL,
|
|
"deviceId" VARCHAR(255) NOT NULL UNIQUE,
|
|
"deviceName" VARCHAR(255) NOT NULL,
|
|
"isAuthorized" BOOLEAN NOT NULL DEFAULT false,
|
|
"authCode" VARCHAR(6),
|
|
"lastSyncAt" TIMESTAMP,
|
|
"createdAt" TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
|
|
);
|
|
|
|
-- Indexes for common queries
|
|
CREATE INDEX IF NOT EXISTS "IDX_devices_userId" ON devices("userId");
|
|
CREATE UNIQUE INDEX IF NOT EXISTS "IDX_devices_deviceId" ON devices("deviceId");
|