Skip to content

Projects, environments and production

Group the copies of one application’s database into a project, and mark each copy with its environment. The environment decides how careful Alcuin is with it: production opens read-only.

In the connection’s form, choose under This database is:

Environment Use it for
Local Postgres on your own machine
Development A shared development database
Staging A copy that should behave like production
Production The database your users’ data lives in

Choosing Production also turns on Open read-only and sets Stop queries after to 30 seconds, in the form, so you see it before you save.

A URL pasted into the launcher opens as a one-off Local connection, read-only unless it points at this computer (localhost or a name ending .localhost, a 127.x.x.x address, or ::1). A URL says nothing about what it reaches, so Alcuin doesn’t assume it is safe to change. Save it from the form to choose its environment. Imported connections open read-only too. One whose group, folder, connection type or name says prod or production is marked Production; the rest are marked Local, still read-only, until you edit them. See Bring your connections from another tool.

Choose a project with Project in the form, or New project… to make one. A connection outside any project is Standalone.

In the launcher, each project lists its environments in order, Local first and Production last. To add one, right-click the project and choose Add environment…, or run Add environment… from the command palette. Alcuin offers the kinds the project does not have yet, plus Another… for a second of one kind.

The form opens copied from the nearest environment the project has: the port, database, user and settings. Only the server is left for you: Host, and the certificate files. If the new environment’s server and user turn out to be the same as the one it was copied from, the form offers to use that one’s saved password.

While a connection in a project with other environments is open, click the environment in the top bar to switch the window to another one.

When a production connection opens, a banner across the window reads Production and Read-only. Nothing you do here can change data. The server enforces it too: every session runs with default_transaction_read_only on. Work on production without breaking it covers unlocking, locking again, running one write, and the time limits.

The red Production banner across the top of the window, reading Read-only. Nothing you do here can change data., with an Unlock editing… button.

Locked: the banner while the connection is read-only.

Open read-only works the same way on any connection: turn it on in the form for a staging database you only want to read.

Each environment has its own rules. Open Settings with ⌘, on macOS or Ctrl+, on Windows and Linux, go to Safety, and choose the environment in Rules for.

Rule Local Development Staging Production
Open read-only Off Off Off On
Stop statements after Never Never Never 30 s
Give up waiting for a lock after Never Never Never 3 s
Ask before: destructive statements On On On On
Ask before: structure changes Off Off Off On
Ask before: every write Off Off Off Off
Ask before: code that cannot be read Off Off On On
Ask before: scripts that cannot be parsed On On On On
Ask before large results Never Never Never 100,000 rows
Warn about a transaction open for 1 min 1 min 1 min 1 min
Lock again after an unlock Never Never Never 15 min

These are the defaults. Never means no limit: a statement may run as long as it takes, and an unlock lasts until you lock or close the connection. Warn about a transaction open for only tells you, in the status bar and a toast; nothing ends the transaction on its own.

Production’s rules can only be made stricter: you can add questions or shorten limits, never turn read-only off or lengthen a limit. A connection’s own Stop queries after applies when it is shorter than its environment’s.

Settings lists each rule with the app’s own explanation. How Alcuin protects your data explains why the rules are shaped this way.