webupdate1
This commit is contained in:
41
backend/fix-permissions.sh
Executable file
41
backend/fix-permissions.sh
Executable 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"
|
||||
@@ -1,8 +1,8 @@
|
||||
-- Add structured fields to pages table for contact information
|
||||
-- This allows each section to be edited independently without breaking layout
|
||||
|
||||
ALTER TABLE pages
|
||||
ADD COLUMN IF NOT EXISTS pagedata JSONB DEFAULT '{}'::jsonb;
|
||||
-- This is valid PostgreSQL syntax (JSONB type and IF NOT EXISTS are PostgreSQL features)
|
||||
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)';
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
-- Add foreign key constraint for product_images -> products
|
||||
-- This ensures referential integrity and enables CASCADE deletes
|
||||
DO $$
|
||||
DO $$
|
||||
BEGIN
|
||||
IF NOT EXISTS (
|
||||
SELECT 1 FROM information_schema.table_constraints
|
||||
|
||||
Reference in New Issue
Block a user