-- Supabase AI is experimental and may produce incorrect answers
-- Always verify the output before executing
-- Creating the 'users' table
create table
users (
id bigint primary key not null,
user_uuid uuid not null unique,
email text unique not null,
name text not null,
profile_picture_url varchar(255)
);
-- Creating the 'trips' table
create table
trips (
id bigint primary key not null,
trip_uuid uuid not null unique,
user_id bigint references users (id),
title text not null,
date_from DATE,
date_to DATE,
cost numeric,
description text,
image_storage_object_id uuid -- FK to storage_objects, omitted as per your request
);
-- Creating the 'schedules' table
create table
schedules (
id BIGSERIAL primary key not null,
schedule_uuid uuid not null unique,
trip_id bigint references trips (id),
title text not null,
time_from TIMESTAMPTZ,
time_to TIMESTAMPTZ,
address varchar(255),
url varchar(255),
memo text,
cost numeric,
image_storage_object_id uuid -- FK to storage_objects, omitted as per your request
);
-- Creating the 'tags' table
create table
tags (
id BIGSERIAL primary key not null,
tag_uuid uuid not null unique,
name varchar(255) not null unique
);
-- Creating the 'trip_tags' table
create table
trip_tags (
trip_id bigint references trips (id),
tag_id bigint references tags (id),
primary key (trip_id, tag_id)
);
-- Creating the 'invitations' table
create table
invitations (
id BIGSERIAL primary key not null,
invitation_uuid uuid not null unique,
trip_id bigint references trips (id),
invited_by_user_id bigint references users (id),
invitee_user_id bigint references users (id),
email varchar(255) not null,
invitation_url varchar(255) not null,
permission_level int not null
);
Research Supabase
Create Database
GraphQL Playground
How to use from Frontend?
It's like this 👇
Samples
Query
Mutation
Storage (WIP)