Loading...
Loading...
Use this skill when you need to alter the PocketBase database schema - creating, updating, or deleting collections. Never write migration SQL by hand.
npx skill4agent add levino/shipyard-pocketbase-app-template create-collectiondocker network inspect shipyard-pocketbase-template_default --format '{{range .Containers}}{{.IPv4Address}}{{end}}'temp-collection.jsimport PocketBase from 'pocketbase'
const pb = new PocketBase('http://<CONTAINER_IP>:8090')
await pb.collection('_superusers').authWithPassword('admin@test.local', 'testtest123')
// CREATE a collection
await pb.collections.create({
name: 'my_collection',
type: 'base', // or 'auth' for user collections
fields: [
{ name: 'title', type: 'text', required: true },
{ name: 'completed', type: 'bool' },
{ name: 'user_id', type: 'text', required: true },
],
listRule: '@request.auth.id != ""',
viewRule: '@request.auth.id != ""',
createRule: '@request.auth.id != ""',
updateRule: 'user_id = @request.auth.id',
deleteRule: 'user_id = @request.auth.id',
})
// UPDATE a collection
// const collection = await pb.collections.getOne('my_collection')
// await pb.collections.update(collection.id, { name: 'new_name' })
// DELETE a collection
// await pb.collections.delete('my_collection')
console.log('Done!')node temp-collection.jsls -la pocketbase/pb_migrations/.jsrm temp-collection.jspb.collections.create()textboolnumberemailurldateselectvalues: ['a', 'b']relationcollectionId: 'xxx'filejsonnull'''@request.auth.id != ""''user_id = @request.auth.id'