Stormkit's Database feature provides each environment with an isolated PostgreSQL schema, complete with automatic schema migrations and secure credential management. This allows you to develop and deploy database-backed applications with confidence.
When you attach a database to an environment, Stormkit:
a123e456) for your environmentNavigate to your environment's Database section and click Attach Database.
Enable schema migrations to automatically apply SQL migration files during deployment.
Stormkit's migration system is designed for simplicity and power:
/migrations, /db/migrations)
Place your SQL migration files in the configured path and deploy your application:
/migrations
├── 001_create_users.sql
├── 002_add_posts.sql
└── 003_add_comments.sql
Important:
-- migrations/001_create_users.sql
CREATE TABLE IF NOT EXISTS users (
id SERIAL PRIMARY KEY,
email TEXT NOT NULL UNIQUE,
name TEXT NOT NULL,
created_at TIMESTAMPTZ DEFAULT NOW()
);
CREATE INDEX idx_users_email ON users(email);
The following environment variables are automatically injected into your application:
DATABASE_URL=postgresql://user_name:secure_password@db_host:5432/db?options=-csearch_path=my_schema
POSTGRES_USER=user_name
POSTGRES_PASSWORD=secure_password
POSTGRES_HOST=db_host
POSTGRES_PORT=5432
POSTGRES_DB=db
POSTGRES_SCHEMA=my_schema
You can use these in your application:
// Next.js, Remix, etc.
const db = new Client({
connectionString: process.env.DATABASE_URL,
});
Used only during deployments with resource limits:
| Configuration Option | Value |
|---|---|
statement_timeout |
30s |
lock_timeout |
10s |
temp_file_limit |
100MB |
work_mem |
4MB |
idle_in_transaction_session_timeout |
60s |
connection limit |
1 |
Can do: CREATE/ALTER/DROP tables, indexes, and sequences within the schema
Cannot do: Access other schemas, create databases, modify roles, or access the file system
Used by your running application with runtime limits:
| Configuration Option | Value |
|---|---|
statement_timeout |
15s |
lock_timeout |
5s |
temp_file_limit |
100MB |
work_mem |
8MB |
idle_in_transaction_session_timeout |
60s |
connection limit |
10 |
Can do: SELECT, INSERT, UPDATE, DELETE on tables and sequences
Cannot do: ALTER/DROP tables, CREATE tables, or access other schemas
To delete a schema:
Warning: This action:
001_, 002_, 003_IF NOT EXISTS, IF EXISTS