Skip to content
Trevor DeVore edited this page Nov 28, 2018 · 2 revisions

The Database Schema

A Database object stores the schema of the database in an internal Schema object. The information about the database tables and fields stored in the Schema object is what enables many of SQL Yoga's features.

Database schema diagram

If SQL Yoga does not have a schema object stored in the database object when it connects to a database then the schema object will be created by asking the database for information about the tables and columns contained in it. This will occur every time you load SQL Yoga and connect to a database unless you specifically set the schema object before connecting to the database.

When using SQL Yoga with Levure you can import the database schame into the schema.yml file as described here. This schema.yml file will be loaded at startup and will set the schema object. This will be faster than reading in the database properties each time you load SQL Yoga.

If your schema changes then you will need to update the schema.yml file. SQL Yoga includes helper functions for doing this automatically.