Skip to main content

Databases

PayLink has one platform database and one database per tenant. Each can be SQLite, MySQL 8.0+ or PostgreSQL 13+, independently.

SQLiteMySQLPostgreSQL
Platform databaseDefault; a file in the data folderA database you run, or one created by auto-provisioningA database you run
Tenant databaseDefault; one file per tenant in tenants/The tenant's own, or auto-provisionedThe tenant's own
Good forGetting started, small and medium installationsShared hosting, panels (Plesk, cPanel), CrudApiTeams already running PostgreSQL

Admin → Platform settings → Database engines in this version lists what this build supports.

Schema and migrations​

The SQL scripts ship next to the app (db/{sqlite,mysql,postgresql}/{platform,tenant}/) and are applied automatically at startup, in order, each once. PayLink records which have run. A tenant whose database can't be migrated at startup is listed on the admin dashboard and keeps its last schema until it's fixed.

For a DBA who prefers to create the MySQL database and user by hand, db/mysql/provisioning/create-paylink-database.sql has the statements.

Connection details​

Wherever a database is asked for, you can give fields (host, port, database, user, password, SSL mode) or a full connection string. The password is stored encrypted and shown masked afterwards. Every connection is tested before it's saved: a tenant's own database must be empty.

Tenant database options at signup​

Admin → Platform settings → Tenant database options chooses what businesses see at /signup:

Option
SQLite, managed by PayLinkA file in the data folder. Easiest to start with.
Their own MySQL or PostgreSQLThe tenant enters a connection to an empty database they run.
Auto-provisioned MySQLCreated on the platform's hosting, for organizations the auto-provisioning rules allow.

Platform admins can always use any option from Tenants → New tenant.

Moving later​

A tenant's data, or the platform database, can move between engines at any time. See backup and moving.