managarten/uload/scripts/fix-links-collection.sh
Till-JS c712a2504a feat: integrate uload and picture, unify package naming
- Add uload project with apps/web structure
  - Reorganize from flat to monorepo structure
  - Remove PocketBase binary and local data
  - Update to pnpm and @uload/web namespace

- Add picture project to monorepo
  - Remove embedded git repository

- Unify all package names to @{project}/{app} schema:
  - @maerchenzauber/* (was @storyteller/*)
  - @manacore/* (was manacore-*, manacore)
  - @manadeck/* (was web, backend, manadeck)
  - @memoro/* (was memoro-web, landing, memoro)
  - @picture/* (already unified)
  - @uload/web

- Add convenient dev scripts for all apps:
  - pnpm dev:{project}:web
  - pnpm dev:{project}:landing
  - pnpm dev:{project}:mobile
  - pnpm dev:{project}:backend

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-25 04:00:36 +01:00

86 lines
No EOL
2.1 KiB
Bash
Executable file

#!/bin/bash
# Script to update the links collection in PocketBase
# This adds missing fields to improve the structure
echo "Updating links collection structure..."
# PocketBase URL
PB_URL="https://pb.ulo.ad"
# Note: This script outlines the manual steps needed
# Since we can't modify the collection directly through the API due to references,
# these changes need to be made in the PocketBase Admin UI
cat << EOF
===========================================
MANUAL STEPS FOR POCKETBASE ADMIN UI
===========================================
Please log into PocketBase Admin at: ${PB_URL}/_/
1. Navigate to Collections > links
2. Add the following NEW fields:
a) use_username (Bool)
- Required: No
- Default: false
b) click_count (Number)
- Required: No
- Default: 0
- Note: Will be calculated from clicks collection
c) last_clicked_at (Date)
- Required: No
d) utm_source (Text)
- Required: No
- Max length: 255
e) utm_medium (Text)
- Required: No
- Max length: 255
f) utm_campaign (Text)
- Required: No
- Max length: 255
3. Rename field (if possible):
- "password" → "password_hash"
- Note: If renaming breaks references, keep as "password"
4. Update field settings:
- max_clicks: Set "Only integers" to true, Min value: 0
- click_count: Set "Only integers" to true, Min value: 0
5. Add Indexes (under "Indexes" tab):
- short_code (unique)
- user_id
- is_active
- created_by
6. Save the collection
===========================================
CODE CHANGES NEEDED AFTER DB UPDATE:
===========================================
After updating the database, update these files:
1. /src/lib/pocketbase/types.ts
- Add new fields to Link interface
2. /src/routes/(app)/my/links/+page.server.ts
- Handle use_username field in create action
- Remove references to folder_id
3. /src/routes/[code]/+page.server.ts
- Update click tracking to increment click_count
- Set last_clicked_at on each click
EOF
echo "Instructions printed. Please follow the manual steps above."