Skip to content

Global Set Variables Persist in Both DB and Files Despite Config #428

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
mcrepaldi opened this issue May 21, 2025 · 1 comment
Closed

Global Set Variables Persist in Both DB and Files Despite Config #428

mcrepaldi opened this issue May 21, 2025 · 1 comment
Labels
bug Something isn't working

Comments

@mcrepaldi
Copy link

Bug description

I have configured the Eloquent driver with the following setup:

  • Global Sets are set to use files
  • Global Variables are set to use Eloquent

This configuration works for retrieving values. However, when saving values to the Global Sets, the data is being stored in both locations:

  • In the file: /content/globals/mycoolglobalset.yaml
  • In the database: global_set_variables table

At runtime, the values are only read from the database, which means the file becomes redundant and creates unnecessary changes in version control (dirty Git state).

Expected Behavior:
When Global Variables are configured to use the Eloquent driver, values should be stored only in the database and not persisted to YAML files.

How to reproduce

  1. Configure eloquent-driver.php with the following settings:
'global_sets' => [
    'driver' => 'file',
    'model' => \Statamic\Eloquent\Globals\GlobalSetModel::class,
],

'global_set_variables' => [
    'driver' => 'eloquent',
    'model' => \Statamic\Eloquent\Globals\VariablesModel::class,
],
  1. Create a Global Set named mycoolglobalset. This will result in:
  • A configuration file at /content/globals/mycoolglobalset.yaml
  • A corresponding blueprint for the global set
  • An initial record in the global_set_variables database table
  1. Add a field to the blueprint and save a value.

  2. Observe that:

  • The value is saved to both /content/globals/mycoolglobalset.yaml and the global_set_variables table

Logs

Environment

Environment
Application Name: Laravel
Laravel Version: 12.15.0
PHP Version: 8.4.7
Composer Version: 2.8.9
Environment: local
Debug Mode: ENABLED
URL: localhost
Maintenance Mode: OFF
Timezone: UTC
Locale: en

Cache
Config: NOT CACHED
Events: NOT CACHED
Routes: NOT CACHED
Views: CACHED

Drivers
Broadcasting: log
Cache: database
Database: sqlite
Logs: stack / single
Mail: log
Queue: database
Session: database

Storage
public/storage: NOT LINKED

Statamic
Addons: 1
Sites: 1
Stache Watcher: Enabled (auto)
Static Caching: Disabled
Version: 5.56.0 Solo

Statamic Addons
statamic/eloquent-driver: 4.21.1

Statamic Eloquent Driver
Asset Containers: file
Assets: file
Blueprints: file
Collection Trees: eloquent
Collections: file
Entries: eloquent
Forms: file
Global Sets: file
Global Variables: eloquent
Navigation Trees: eloquent
Navigations: eloquent
Revisions: eloquent
Sites: eloquent
Taxonomies: eloquent
Terms: eloquent
Tokens: eloquent

Additional details

No response

@mcrepaldi mcrepaldi added the bug Something isn't working label May 21, 2025
@ryanmitchell
Copy link
Contributor

Its a known issue and will be fixed by #411 once we can tag a new major version alongside Statamic v6.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants