Update schema.sql for my-recipes
This commit is contained in:
parent
f036e6e2ce
commit
3b15565a9d
@ -81,3 +81,52 @@ data:
|
|||||||
ALTER TABLE users ALTER COLUMN display_name SET NOT NULL;
|
ALTER TABLE users ALTER COLUMN display_name SET NOT NULL;
|
||||||
END IF;
|
END IF;
|
||||||
END $$;
|
END $$;
|
||||||
|
|
||||||
|
DO $$
|
||||||
|
BEGIN
|
||||||
|
IF NOT EXISTS (
|
||||||
|
SELECT 1 FROM information_schema.columns
|
||||||
|
WHERE table_name = 'users' AND column_name = 'is_admin'
|
||||||
|
) THEN
|
||||||
|
ALTER TABLE users ADD COLUMN is_admin BOOLEAN DEFAULT FALSE;
|
||||||
|
END IF;
|
||||||
|
END $$;
|
||||||
|
|
||||||
|
-- Create grocery lists table
|
||||||
|
CREATE TABLE IF NOT EXISTS grocery_lists (
|
||||||
|
id SERIAL PRIMARY KEY,
|
||||||
|
name TEXT NOT NULL,
|
||||||
|
items TEXT[] NOT NULL DEFAULT '{}',
|
||||||
|
owner_id INTEGER NOT NULL REFERENCES users(id) ON DELETE CASCADE,
|
||||||
|
is_pinned BOOLEAN DEFAULT FALSE,
|
||||||
|
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
||||||
|
);
|
||||||
|
|
||||||
|
-- Create grocery list shares table
|
||||||
|
CREATE TABLE IF NOT EXISTS grocery_list_shares (
|
||||||
|
id SERIAL PRIMARY KEY,
|
||||||
|
list_id INTEGER NOT NULL REFERENCES grocery_lists(id) ON DELETE CASCADE,
|
||||||
|
shared_with_user_id INTEGER NOT NULL REFERENCES users(id) ON DELETE CASCADE,
|
||||||
|
can_edit BOOLEAN DEFAULT FALSE,
|
||||||
|
shared_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
UNIQUE(list_id, shared_with_user_id)
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE INDEX IF NOT EXISTS idx_grocery_lists_owner_id ON grocery_lists (owner_id);
|
||||||
|
CREATE INDEX IF NOT EXISTS idx_grocery_list_shares_list_id ON grocery_list_shares (list_id);
|
||||||
|
CREATE INDEX IF NOT EXISTS idx_grocery_list_shares_user_id ON grocery_list_shares (shared_with_user_id);
|
||||||
|
|
||||||
|
-- Create notifications table
|
||||||
|
CREATE TABLE IF NOT EXISTS notifications (
|
||||||
|
id SERIAL PRIMARY KEY,
|
||||||
|
user_id INTEGER NOT NULL REFERENCES users(id) ON DELETE CASCADE,
|
||||||
|
type TEXT NOT NULL,
|
||||||
|
message TEXT NOT NULL,
|
||||||
|
related_id INTEGER,
|
||||||
|
is_read BOOLEAN DEFAULT FALSE,
|
||||||
|
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE INDEX IF NOT EXISTS idx_notifications_user_id ON notifications (user_id);
|
||||||
|
CREATE INDEX IF NOT EXISTS idx_notifications_is_read ON notifications (is_read);
|
||||||
|
|||||||
@ -8,7 +8,7 @@ backend:
|
|||||||
image:
|
image:
|
||||||
repository: harbor.dvirlabs.com/my-apps/my-recipes-backend
|
repository: harbor.dvirlabs.com/my-apps/my-recipes-backend
|
||||||
pullPolicy: Always
|
pullPolicy: Always
|
||||||
tag: develop-ba7d0c9
|
tag: latest
|
||||||
service:
|
service:
|
||||||
type: ClusterIP
|
type: ClusterIP
|
||||||
port: 8000
|
port: 8000
|
||||||
@ -45,7 +45,7 @@ frontend:
|
|||||||
image:
|
image:
|
||||||
repository: harbor.dvirlabs.com/my-apps/my-recipes-frontend
|
repository: harbor.dvirlabs.com/my-apps/my-recipes-frontend
|
||||||
pullPolicy: Always
|
pullPolicy: Always
|
||||||
tag: develop-ba7d0c9
|
tag: latest
|
||||||
service:
|
service:
|
||||||
type: ClusterIP
|
type: ClusterIP
|
||||||
port: 80
|
port: 80
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user