I’m using payload cms with supabase I connected my app to the database without issues and when i add something it reflect on supabase normally but when i delete something from my admin panel it does not reflect and it deleted entire tables how can i make supabase reflect on whatever i add or delete on my payload admin panel
Payload cms config i added
import path from 'path';
import { fileURLToPath } from 'url';
import { payloadCloudPlugin } from '@payloadcms/payload-cloud';
import { postgresAdapter } from '@payloadcms/db-postgres'; // Updated to Postgres adapter
import { lexicalEditor } from '@payloadcms/richtext-lexical'; // Using Lexical editor
import { buildConfig } from 'payload/config';
import Users from './collections/Users';
import Documents from './collections/Documents'; // Importing Documents collection
const filename = fileURLToPath(import.meta.url);
const dirname = path.dirname(filename);
export default buildConfig({
admin: {
user: Users.slug,
},
collections: [Users, Documents],
editor: lexicalEditor({}),Code feature
plugins: [payloadCloudPlugin()],
secret: process.env.PAYLOAD_SECRET || '',
typescript: {
outputFile: path.resolve(dirname, 'payload-types.ts'),
},
db: postgresAdapter({
pool: {
connectionString: process.env.DATABASE_URI || '',
},
}),
})
Hopefully this helps. My postgresAdapter
has a few other values:
db: postgresAdapter({
pool: {
connectionString: process.env.DATABASE_URI || "",
max: 10,
min: 2,
idleTimeoutMillis: 30000,
connectionTimeoutMillis: 2000,
},
schemaName: "someSchemaName",
}),
You can set the schema up like in the image here; click on the dropdown and the last option lets you create a new one.