webupdate1

This commit is contained in:
Local Server
2026-01-04 18:09:47 -06:00
parent c1da8eff42
commit dc58a8ae5f
28 changed files with 44 additions and 3 deletions

41
backend/fix-permissions.sh Executable file
View File

@@ -0,0 +1,41 @@
#!/bin/bash
# Fix database permissions for skyartapp user
echo "🔐 Fixing database permissions..."
sudo -u postgres psql -d skyartshop <<EOF
-- Grant all privileges on schema
GRANT ALL ON SCHEMA public TO skyartapp;
-- Grant all privileges on all tables
GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO skyartapp;
-- Grant all privileges on all sequences
GRANT ALL PRIVILEGES ON ALL SEQUENCES IN SCHEMA public TO skyartapp;
-- Change ownership of all tables to skyartapp
DO \$\$
DECLARE
r RECORD;
BEGIN
FOR r IN SELECT tablename FROM pg_tables WHERE schemaname = 'public'
LOOP
EXECUTE 'ALTER TABLE ' || quote_ident(r.tablename) || ' OWNER TO skyartapp';
END LOOP;
END \$\$;
-- Change ownership of all sequences
DO \$\$
DECLARE
r RECORD;
BEGIN
FOR r IN SELECT sequence_name FROM information_schema.sequences WHERE sequence_schema = 'public'
LOOP
EXECUTE 'ALTER SEQUENCE ' || quote_ident(r.sequence_name) || ' OWNER TO skyartapp';
END LOOP;
END \$\$;
\echo '✅ Permissions fixed!'
EOF
echo "✅ Done! Now you can run: node apply-db-fixes.js"

View File

@@ -1,8 +1,8 @@
-- Add structured fields to pages table for contact information -- Add structured fields to pages table for contact information
-- This allows each section to be edited independently without breaking layout -- This allows each section to be edited independently without breaking layout
ALTER TABLE pages -- This is valid PostgreSQL syntax (JSONB type and IF NOT EXISTS are PostgreSQL features)
ADD COLUMN IF NOT EXISTS pagedata JSONB DEFAULT '{}'::jsonb; ALTER TABLE pages ADD COLUMN IF NOT EXISTS pagedata JSONB DEFAULT '{}'::jsonb;
COMMENT ON COLUMN pages.pagedata IS 'Structured data for pages that need separate editable fields (e.g., contact info)'; COMMENT ON COLUMN pages.pagedata IS 'Structured data for pages that need separate editable fields (e.g., contact info)';

View File

@@ -10,7 +10,7 @@
-- Add foreign key constraint for product_images -> products -- Add foreign key constraint for product_images -> products
-- This ensures referential integrity and enables CASCADE deletes -- This ensures referential integrity and enables CASCADE deletes
DO $$ DO $$
BEGIN BEGIN
IF NOT EXISTS ( IF NOT EXISTS (
SELECT 1 FROM information_schema.table_constraints SELECT 1 FROM information_schema.table_constraints