All blocks
Content
Drive files
The part of the drive module that needs attachments, versions, trash and share-links: file uploads and revisions, storage policies, the bin, starred and recent items, folder share links and the purge event. Installed with drive.
npx better-supabase sql add drive-filesimport { defineConfig } from "better-supabase/config";
export default defineConfig({
sql: {
modules: {
// Required by drive-files; sql add installs them too.
"updated-at": {},
tenant: {},
access: {},
attachments: {},
// Modes: "managed", "custom". The default is "managed".
"drive-files": { mode: "managed" },
},
},
});npx better-supabase sql add drive-files writes these files into your declarative schema with the default layout. See SQL modules for the migration step and the layout options.
supabase/schemas/900_better_supabase_01_updated_at.sqlschemaupdated-at100 linessupabase/better-supabase-data/900_better_supabase_01_updated_at.sqldataupdated-at12 linessupabase/schemas/900_better_supabase_04_tenant.sqlschematenant156 linessupabase/better-supabase-data/900_better_supabase_04_tenant.sqldatatenant12 linessupabase/schemas/900_better_supabase_19_access.sqlschemaaccess376 linessupabase/better-supabase-data/900_better_supabase_19_access.sqldataaccess12 linessupabase/schemas/900_better_supabase_34_attachments.sqlschemaattachments446 linessupabase/better-supabase-data/900_better_supabase_34_attachments.sqldataattachments16 linessupabase/schemas/900_better_supabase_83_drive_files.sqlschema20 linessupabase/better-supabase-data/900_better_supabase_83_drive_files.sqldata12 lines
supabase/schemas/900_better_supabase_83_drive_files.sql
-- better-supabase module: drive-files -- @bs-module drive-files@1 managed -- The part of the drive module that needs attachments, versions, trash and share-links: file uploads and revisions, storage policies, the bin, starred and recent items, folder share links and the purge event. Installed with drive. -- Managed by `better-supabase sql add`; re-running it overwrites this file. -- Change it through `sql.modules` in better-supabase.config.ts and the module's SQL hooks. create schema if not exists better_supabase; create table if not exists better_supabase.modules ( name text primary key, version integer not null, mode text not null, installed_at timestamptz not null default now(), updated_at timestamptz not null default now() ); alter table better_supabase.modules enable row level security; revoke all on better_supabase.modules from anon, authenticated; grant select on better_supabase.modules to service_role;
supabase/better-supabase-data/900_better_supabase_83_drive_files.sql
-- better-supabase module: drive-files
-- @bs-module-data drive-files
-- Rows and settings a schema diff doesn't capture. Run `better-supabase sql data`
-- after the schema migration to put them in a migration.
-- Managed by `better-supabase sql add`; re-running it overwrites this file.
-- Change it through `sql.modules` in better-supabase.config.ts and the module's SQL hooks.
insert into better_supabase.modules (name, version, mode)
values ('drive-files', 1, 'managed')
on conflict (name) do update
set version = excluded.version, mode = excluded.mode, updated_at = now();
This block is SQL only: call its functions from your policies, RPCs and the other modules.
This module writes no outbox events.