Dock
Dock is your database command center for production. Run SQL queries, compare schemas, apply migrations, and browse data—all without external tools or SSH access.
What is Dock?
Dock provides a web-based interface for managing your PostgreSQL or MySQL database:
- SQL Console - Run queries directly against your database
- Table Browser - View and navigate your data
- Schema Viewer - Inspect table structures and columns
- Schema Diff - Compare Waterline models with database schema
- One-Click Migrations - Generate and apply schema changes
No more switching to pgAdmin or DBeaver. Manage your production database from Slipway.
Requirements
Dock is automatically available when your environment has a PostgreSQL or MySQL service attached:
slipway db:create main-db --type=postgresqlOnce the service is running, the Dock icon appears in your environment's toolbar.
Accessing Dock
Via Dashboard
- Go to your project in Slipway
- Select an environment and click the app name from the Apps list
- In the Services section, click the Dock icon next to a database service
- Start managing your database
Via Direct URL
https://your-slipway-instance.com/projects/myapp/dockOr with a specific environment:
https://your-slipway-instance.com/projects/myapp/environments/staging/dockSQL Console
The SQL Console lets you run queries directly against your production database.
Running Queries
- Enter your SQL in the query editor
- Press Cmd/Ctrl + Enter or click Run Query
- View results in the table below
SELECT * FROM users WHERE "createdAt" > '2024-01-01' LIMIT 50;Query Results
Results display in a formatted table with:
- Column headers
- Row count
- Query execution time
- Scrollable data view
Safety Features
Dock blocks dangerous queries that could harm your database:
DROP DATABASEstatementsDROP SCHEMAstatements- System table modifications
For destructive operations, use a dedicated migration or backup first.
Table Browser
Browse your database tables without writing SQL.
Viewing Tables
- Click the Tables tab
- Select a table from the list
- View data with automatic pagination
Each table shows:
- Table name
- Row count
- Columns and their types
Pagination
Large tables are paginated automatically:
- Default limit: 50 rows
- Navigate through pages
- Sort by any column
Schema Viewer
Inspect your database schema at a glance.
Table Structure
For each table, Dock shows:
| Column | Info |
|---|---|
| Name | Column identifier |
| Type | PostgreSQL/MySQL data type |
| Nullable | Whether NULL is allowed |
| Default | Default value, if set |
| PK | Primary key indicator |
Example
┌─────────────────────────────────────────────────────────────────┐
│ users │
├─────────────────────────────────────────────────────────────────┤
│ Column Type Nullable Default PK │
│ id integer NO auto ✓ │
│ email character varying NO - │
│ fullName character varying YES - │
│ createdAt timestamp NO now() │
│ updatedAt timestamp NO now() │
└─────────────────────────────────────────────────────────────────┘Schema Diff & Migrations
The most powerful Dock feature: compare your Waterline models with the actual database schema.
How It Works
- Dock reads your Waterline model definitions from the running app
- Queries the database's
information_schema - Compares them and generates SQL to sync
Viewing the Diff
- Click the Migrate tab
- Dock analyzes models vs database
- See what changes are needed
Status Indicators
| Status | Meaning |
|---|---|
| Schema is up to date | Database matches models |
| X change(s) needed | Migration required |
Generated SQL
For each difference, Dock generates the appropriate SQL:
-- New table
CREATE TABLE "posts" (
"id" SERIAL PRIMARY KEY,
"title" character varying(255) NOT NULL,
"body" text,
"createdAt" timestamp NOT NULL DEFAULT now()
);
-- New column
ALTER TABLE "users" ADD COLUMN "avatarUrl" character varying(255);Applying Migrations
- Review the generated SQL
- Click Apply Migration
- Confirm the action
- SQL executes against your database
WARNING
Migrations modify your production database. Always backup first and review the generated SQL carefully.
First-Time Schema Setup
When deploying a new Sails app, your database starts empty. Use Dock to initialize it:
- Deploy your app (it will fail to connect to empty database)
- Open Dock → Migrate tab
- See all tables that need to be created
- Click Apply Migration
- Redeploy or restart your app
This is much easier than manually running sails lift with migrate: alter in production.
Waterline Type Mapping
Dock uses the same type mappings as the actual Sails database adapters:
PostgreSQL
| Waterline | PostgreSQL | Notes |
|---|---|---|
string | TEXT | Not VARCHAR - PostgreSQL prefers TEXT |
text | TEXT | Long text content |
number | REAL / INTEGER | REAL for floats, INTEGER for PKs |
boolean | BOOLEAN | Native PostgreSQL boolean |
json | JSON | Native JSON type |
ref | TEXT | Arbitrary references |
Auto-increment columns use SERIAL type.
MySQL
| Waterline | MySQL | Notes |
|---|---|---|
string | VARCHAR(255) | Length-limited strings |
text | TEXT | Long text content |
number | REAL / INTEGER | REAL for floats, INTEGER for PKs |
boolean | TINYINT(1) | MySQL boolean representation |
json | LONGTEXT | For compatibility with older MySQL |
ref | LONGTEXT | Arbitrary references |
Auto-increment columns use AUTO_INCREMENT flag.
Custom Column Types
If you specify columnType in your model, Dock uses it directly:
attributes: {
uuid: {
type: 'string',
columnType: 'UUID DEFAULT uuid_generate_v4()'
},
metadata: {
type: 'json',
columnType: 'JSONB' // Use JSONB instead of JSON
}
}API Endpoints
Dock provides REST API endpoints for automation:
Execute SQL
POST /api/v1/projects/:projectSlug/dock/sql
{
"query": "SELECT * FROM users LIMIT 10"
}Get Schema
GET /api/v1/projects/:projectSlug/dock/schemaGet Schema Diff
GET /api/v1/projects/:projectSlug/dock/diffApply Migration
POST /api/v1/projects/:projectSlug/dock/migrate
{
"statements": [
{"sql": "ALTER TABLE users ADD COLUMN bio TEXT;"}
]
}List Tables
GET /api/v1/projects/:projectSlug/dock/tablesBrowse Table Data
GET /api/v1/projects/:projectSlug/dock/tables/:table/data?limit=50&offset=0Best Practices
1. Backup Before Migrations
Always create a backup before applying schema changes:
slipway backup:create myapp postgresql2. Test in Staging First
Use a staging environment to test migrations. Apply via the Dock UI in your staging environment first, verify it works, then apply to production.
3. Review Generated SQL
Always review the SQL that Dock generates. While it handles most cases correctly, complex migrations may need manual adjustment.
4. Use Transactions for Multiple Changes
When applying multiple related changes, consider wrapping them in a transaction via the SQL Console:
BEGIN;
ALTER TABLE orders ADD COLUMN discount DECIMAL(10,2);
ALTER TABLE orders ADD COLUMN discountCode VARCHAR(50);
COMMIT;5. Keep Models and Database in Sync
Run schema diff regularly to catch drift between your models and database. Ideally, your CI/CD pipeline should verify this.
Troubleshooting
Dock Not Appearing
If the Dock icon doesn't show:
- Verify you have a PostgreSQL or MySQL service attached
- Check the service is running (
status: running) - The icon only appears when service is active
Query Timeout
For long-running queries:
- Default timeout is 30 seconds
- Optimize your query (add indexes, limit results)
- For complex reports, consider using a read replica
Migration Fails
If migration fails:
- Check the error message in the result
- The database may have constraints preventing the change
- Try running individual statements via SQL Console
- Check for dependent objects (foreign keys, views)
Schema Diff Shows Incorrect Results
If diff seems wrong:
- Ensure your app is running (models are read from running container)
- Check that model file syntax is correct
- Custom
columnTypemay not match expected patterns
What's Next?
- Use Helm for debugging app issues
- Configure Auto-Deploy for continuous deployment