Replace individual Rust migration modules with a define_sql_migrations macro that reads up/down SQL files via include_str!. Consolidate all legacy single-file SQL into per-table directories and add full schema migration coverage for 90+ tables.
33 lines
1.0 KiB
SQL
33 lines
1.0 KiB
SQL
create table if not exists project
|
|
(
|
|
id uuid not null
|
|
primary key,
|
|
name varchar(255) not null,
|
|
display_name varchar(255) not null,
|
|
avatar_url varchar(255),
|
|
description text,
|
|
is_public boolean default false not null,
|
|
created_by uuid not null,
|
|
created_at timestamp with time zone not null,
|
|
updated_at timestamp with time zone not null,
|
|
workspace_id uuid
|
|
references workspace
|
|
on delete set null
|
|
);
|
|
|
|
create index if not exists idx_project_name
|
|
on project (name);
|
|
|
|
create index if not exists idx_project_created_by
|
|
on project (created_by);
|
|
|
|
create index if not exists idx_project_workspace_id
|
|
on project (workspace_id)
|
|
where (workspace_id IS NOT NULL);
|
|
|
|
create unique index if not exists idx_workspace_slug
|
|
on workspace (slug);
|
|
|
|
create index if not exists idx_workspace_deleted_at
|
|
on workspace (deleted_at);
|