#7365·sails

sails-disk does not support .transaction() method

Author: DominusKelvinCreated Sep 16, 2025Updated Sep 16, 2025

Problem

The sails-disk adapter does not support the .transaction() method, which creates issues when developing applications that need transaction support.

Current Behavior

When attempting to use .transaction() with sails-disk:

javascript
await sails.getDatastore().transaction(async (db) => {
  // Transaction logic here
});

This fails because sails-disk lacks the .transaction() method implementation.

Expected Behavior

sails-disk should support the .transaction() method with pseudo transaction behavior, allowing the same transaction API to work consistently across development (sails-disk) and production (sails-postgresql, sails-mysql) environments.

Impact

  • Cannot test transaction-dependent code during development with sails-disk
  • Forces developers to use production adapters even for local development
  • Creates development/production parity issues

Proposed Solution

Implement a pseudo transaction method in sails-disk that:

  • Provides the same .transaction() API interface
  • Uses in-memory state management for rollback capability
  • Maintains transaction isolation within the adapter context

This would enable consistent development workflow while preserving sails-disk's lightweight nature.