Skip to main content
State-based workflow (SDL) currently has these limitations:

Database Support

Supported:
  • PostgreSQL
  • MySQL (5.7 and 8.0)
Not yet supported:
  • SQL Server
  • Oracle
  • MongoDB
  • Other databases

Supported SQL Statements

Only these PostgreSQL statements are supported:
  • CREATE TABLE
  • CREATE INDEX / CREATE UNIQUE INDEX
  • CREATE VIEW
  • CREATE SEQUENCE
  • CREATE FUNCTION
  • ALTER SEQUENCE (for OWNED BY)
Not supported:
  • Complex stored procedures
  • Triggers
  • Row-level security policies
  • DML operations (INSERT, UPDATE, DELETE)
  • Transaction control
  • Database-level settings

Strict Syntax Requirements

PostgreSQL SDL requires strict adherence to conventions:
  1. All objects must use fully qualified names (with schema prefix)
  2. PRIMARY KEY, UNIQUE, FOREIGN KEY, CHECK must be table-level with explicit names
  3. Only NOT NULL, DEFAULT, GENERATED allowed at column level
  4. Foreign key references must be fully qualified
  5. All indexes must have explicit names

MySQL Considerations

  • CHECK constraints require MySQL 8.0.16+: MySQL 5.7 parses and ignores CHECK constraints, so they are not compared on 5.7.
  • DEFINER is not managed: DEFINER clauses are omitted from the export and ignored in comparison.
  • Session context is preserved for routines, triggers, and events only: functions, procedures, triggers, and events keep their original sql_mode and character-set context when recreated; events also keep their time_zone. Views do not carry session context.
  • Column renames are drop + add: renaming a column in an SDL file generates DROP COLUMN + ADD COLUMN, which loses the column’s data. Use migration-based workflow for renames.
  • Partition changes regenerate the whole clause: any change to a table’s partitioning emits a full ALTER TABLE ... PARTITION BY ... (or REMOVE PARTITIONING), not incremental ADD/DROP PARTITION statements.
  • Trigger ordering is not tracked: FOLLOWS / PRECEDES clauses are not part of the comparison.
  • Event start times are normalized: MySQL stores an implicit STARTS timestamp on every recurring event, so a change that only modifies an explicit STARTS value is not detected as a diff.
Because DEFINER is not managed, views, routines, triggers, and events are recreated with the deploying account as their definer. For SQL SECURITY DEFINER views and routines - and for triggers and events, which always execute as their definer - this changes the execution security context: a more privileged deploy account can broaden runtime privileges, and a less privileged one can break existing callers. Use a dedicated deploy account, or the migration-based workflow, when definer identity matters.

No Direct Data Operations

SDL only manages schema structure. For data operations, use migration-based workflow. Not supported in SDL:
  • INSERT statements
  • UPDATE statements
  • DELETE statements
  • Data transformation logic
SDL rejects top-level DML only. MySQL function, procedure, trigger, and event bodies can still contain DML that runs when the object executes - for example, a scheduled event that purges rows. Review these bodies with the same care as data changes.
Solution: Combine both workflows:

Destructive Operations

SDL-generated DROP statements execute automatically when objects are removed from files:
Always backup data before deploying SDL changes that remove objects from schema files. Bytebase will automatically drop those objects.

Limited Rollback

SDL only moves forward to new desired states:
  • No automatic rollback generation
  • To rollback: revert SDL files to previous state and redeploy
  • Data in dropped objects is lost (backup required)

Schema Rollback Strategies

Approaches for reversing schema changes

Performance Considerations

For large schemas:
  • Initial SDL adoption requires exporting complete schema
  • State comparison time increases with schema complexity
  • DDL generation uses topological sort (handles dependencies)
Mitigation:
  • Organize schema into multiple files
  • Use database groups for fleet management
  • Test SDL workflow on staging first

Next Steps

Migration-Based Workflow

Learn about the imperative alternative

Best Practices

Production-ready workflow patterns

Troubleshooting

Solutions for common issues

GitOps Overview

Return to GitOps overview