Self-hosted personal gallery application with online photo management and albums, supporting Live/Motion Photos, EXIF parsing, geolocation recognition, and an explore map.
TypeScript albumsexif-extractiongeocodinglive-photomotion-photophoto-galleryphoto-sharingwebgl-viewer
ALTER TABLE platform_plans ADD COLUMN currency TEXT NOT NULL DEFAULT 'USD';
ALTER TABLE platform_plans ADD COLUMN monthly_price INTEGER CHECK(monthly_price IS NULL OR monthly_price>=0);
ALTER TABLE platform_plans ADD COLUMN quarterly_price INTEGER CHECK(quarterly_price IS NULL OR quarterly_price>=0);
ALTER TABLE platform_plans ADD COLUMN listed INTEGER NOT NULL DEFAULT 1 CHECK(listed IN(0,1));
ALTER TABLE platform_plans ADD COLUMN description TEXT NOT NULL DEFAULT '';
ALTER TABLE platform_plans ADD COLUMN sort_order INTEGER NOT NULL DEFAULT 0;
UPDATE platform_plans SET monthly_price=0,quarterly_price=0 WHERE id='free';
CREATE TABLE platform_billing_settings(id INTEGER PRIMARY KEY CHECK(id=1),new_plan_id TEXT NOT NULL REFERENCES platform_plans(id),expiry_plan_id TEXT NOT NULL REFERENCES platform_plans(id),revision INTEGER NOT NULL DEFAULT 1);
INSERT INTO platform_billing_settings(id,new_plan_id,expiry_plan_id) VALUES(1,'free','free');
ALTER TABLE platform_workspace_plans ADD COLUMN starts_at INTEGER NOT NULL DEFAULT 0;
ALTER TABLE platform_workspace_plans ADD COLUMN expires_at INTEGER;
ALTER TABLE platform_workspace_plans ADD COLUMN source TEXT NOT NULL DEFAULT 'manual';
ALTER TABLE platform_workspace_plans ADD COLUMN billing_interval INTEGER CHECK(billing_interval IS NULL OR billing_interval IN(1,3));
UPDATE platform_workspace_plans SET starts_at=COALESCE((SELECT created_at FROM platform_workspaces WHERE id=workspace_id),0);
INSERT OR IGNORE INTO platform_workspace_plans(workspace_id,plan_id,starts_at,source) SELECT id,'free',created_at,'default' FROM platform_workspaces;
CREATE INDEX platform_subscription_expiry ON platform_workspace_plans(expires_at) WHERE expires_at IS NOT NULL;
CREATE TABLE platform_subscription_events(id TEXT PRIMARY KEY,workspace_id INTEGER NOT NULL REFERENCES platform_workspaces(id),actor_id INTEGER REFERENCES platform_users(id),kind TEXT NOT NULL,before_json TEXT NOT NULL,after_json TEXT NOT NULL,created_at INTEGER NOT NULL);
CREATE INDEX platform_subscription_events_workspace ON platform_subscription_events(workspace_id,created_at);
CREATE TABLE platform_activation_codes(id TEXT PRIMARY KEY,code_hash TEXT NOT NULL UNIQUE,display TEXT NOT NULL,batch_id TEXT NOT NULL,plan_id TEXT NOT NULL REFERENCES platform_plans(id),duration_unit TEXT NOT NULL CHECK(duration_unit IN('permanent','days','months')),duration_value INTEGER,redeem_until INTEGER,max_uses INTEGER CHECK(max_uses IS NULL OR max_uses>0),uses INTEGER NOT NULL DEFAULT 0,enabled INTEGER NOT NULL DEFAULT 1 CHECK(enabled IN(0,1)),revision INTEGER NOT NULL DEFAULT 1,created_at INTEGER NOT NULL,created_by INTEGER NOT NULL REFERENCES platform_users(id));
CREATE INDEX platform_activation_batch ON platform_activation_codes(batch_id);
CREATE TABLE platform_activation_redemptions(claim_id TEXT NOT NULL UNIQUE,code_id TEXT NOT NULL REFERENCES platform_activation_codes(id),user_id INTEGER NOT NULL REFERENCES platform_users(id),workspace_id INTEGER NOT NULL REFERENCES platform_workspaces(id),request_id TEXT NOT NULL,receipt_json TEXT NOT NULL,created_at INTEGER NOT NULL,PRIMARY KEY(code_id,user_id),UNIQUE(user_id,request_id));
CREATE TABLE platform_activation_attempts(user_id INTEGER NOT NULL,window_start INTEGER NOT NULL,attempts INTEGER NOT NULL DEFAULT 0,PRIMARY KEY(user_id,window_start));