-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmigration_gallery.sql
More file actions
38 lines (33 loc) · 1.91 KB
/
Copy pathmigration_gallery.sql
File metadata and controls
38 lines (33 loc) · 1.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
-- migration_gallery.sql
-- 1. Create the projects table
create table projects (
id bigint generated by default as identity primary key,
created_at timestamp with time zone default timezone('utc'::text, now()) not null,
title text not null,
category text not null, -- 'ecommerce', 'vitrine', 'mobile'
description text,
image_url text, -- Store the path or public URL
link text, -- External URL
status text default 'published',
is_featured boolean default false
);
-- 2. Setup Row Level Security (RLS)
alter table projects enable row level security;
-- Policy: Allow everyone to read published projects
create policy "Public projects are viewable by everyone"
on projects for select
using ( status = 'published' );
-- Policy: Admins can do anything
create policy "Admins have full access to projects"
on projects for all
using ( auth.role() = 'authenticated' )
with check ( auth.role() = 'authenticated' );
-- 3. Insert Initial Data (based on generated mockups)
-- Note: Replace these URLs with the actual ones if they change, but for now we use the ones already in assets
insert into projects (title, category, description, image_url, link, status, is_featured)
values
('Touch of Glow', 'ecommerce', 'E-commerce cosmétique haut de gamme avec une expérience immersive.', '/src/assets/gallery/glow.png', '#', 'published', true),
('French Green', 'ecommerce', 'Boutique CBD premium alliant élégance et nature.', '/src/assets/gallery/green.png', '#', 'published', true),
('Roshibarber', 'vitrine', 'Site vitrine moderne avec système de réservation intégré.', '/src/assets/gallery/roshi.png', '#', 'published', false),
('New Japan', 'vitrine', 'Expérience culinaire digitale pour un restaurant japonais raffiné.', '/src/assets/gallery/japan.png', '#', 'published', false),
('KROM App', 'mobile', 'Application mobile au design Néo-Brutaliste impactant.', '/src/assets/gallery/krom.png', '#', 'published', true);