Clean up unnecessary migration files and outdated documentation

This commit is contained in:
DaX
2025-07-21 12:10:45 +02:00
parent 9f01158241
commit 4020bb4ab8
9 changed files with 19 additions and 664 deletions

View File

@@ -1,56 +0,0 @@
-- Add 1 refill and 1 spulna for each color as PLA Basic filaments
-- Run this with: psql $DATABASE_URL -f scripts/add-basic-refills.sql
-- First show what colors we have
SELECT name, hex FROM colors ORDER BY name;
-- Insert PLA Basic filaments with 1 refill and 1 spulna for each color that doesn't already have one
INSERT INTO filaments (tip, finish, boja, boja_hex, refill, spulna, kolicina, cena)
SELECT
'PLA' as tip,
'Basic' as finish,
c.name as boja,
c.hex as boja_hex,
1 as refill,
1 as spulna,
2 as kolicina, -- 1 refill + 1 spulna
'3999' as cena
FROM colors c
WHERE NOT EXISTS (
SELECT 1 FROM filaments f
WHERE f.tip = 'PLA'
AND f.finish = 'Basic'
AND f.boja = c.name
)
ON CONFLICT DO NOTHING;
-- Update any existing PLA Basic filaments to have 1 refill and 1 spulna
UPDATE filaments
SET refill = 1,
spulna = 1,
kolicina = 2 -- Update quantity to reflect 1 refill + 1 spulna
WHERE tip = 'PLA'
AND finish = 'Basic'
AND (refill = 0 OR spulna = 0);
-- Show summary
SELECT
'Total PLA Basic filaments with refills and spulna' as description,
COUNT(*) as count
FROM filaments
WHERE tip = 'PLA'
AND finish = 'Basic'
AND refill = 1
AND spulna = 1;
-- Show all PLA Basic filaments
SELECT
boja as color,
refill,
spulna,
kolicina as quantity,
cena as price
FROM filaments
WHERE tip = 'PLA'
AND finish = 'Basic'
ORDER BY boja;

View File

@@ -1,17 +0,0 @@
#!/bin/bash
echo "Running sale fields migration..."
# Get RDS endpoint from AWS
RDS_ENDPOINT=$(aws rds describe-db-instances --region eu-central-1 --db-instance-identifier filamenteka --query 'DBInstances[0].Endpoint.Address' --output text)
# Get database credentials from Secrets Manager
DB_CREDS=$(aws secretsmanager get-secret-value --region eu-central-1 --secret-id filamenteka-db-credentials --query 'SecretString' --output text)
DB_USER=$(echo $DB_CREDS | jq -r '.username')
DB_PASS=$(echo $DB_CREDS | jq -r '.password')
DB_NAME=$(echo $DB_CREDS | jq -r '.database')
# Run the migration
PGPASSWORD="$DB_PASS" psql -h $RDS_ENDPOINT -U $DB_USER -d $DB_NAME -f database/migrations/014_add_sale_fields.sql
echo "Migration completed!"