-
Notifications
You must be signed in to change notification settings - Fork 4
Levure Configuring a Levure application
The SQL Yoga repo includes the necessary files to work as a Helper in the Levure framework. Using SQL Yoga with Levure simplifies configuration and development work.
The simplest way is to download the SQL Yoga repository, rename the folder to "sql yoga" and place it in your applications "helpers" folder. The next time you open your application in the IDE SQL Yoga will be loaded.
In the app.yml file you tell SQL Yoga where to find your database configuration files and the name of the database object that will be created. Add the following to the app.yml file.
app.yml
sql yoga:
configuration:
- filename: ./database
database key: default
Since you told SQL Yoga that configuration files are stored in a database folder you now need to create the folder. Create the database folder in the app folder (alongside the ui, behaviors, etc. folders).
When your app is opened up in the IDE the SQL Yoga helper will look for any YAML files in the configuration folder, load them into memory, convert them into a LiveCode array, and then pass that array to dbobject_initialize.
You can configure the following objects in the YAML files:
- connections
- tables
- relationships
- scopes
- sql query templates
You can split up different objects into different YAML files for the sake of readability. One approach is to create a connections.yml, table objects.yml, and query templates.yml. The table objects.yml file can define tables, relationships, and scopes.
In the ./app/database folder create a file named connections.yml. Configure a connection that points to the database file. Here is a SQLite example that points to a .sqlite file in the ./app/database folder:
default connection: local
connections:
local:
adaptor: sqlite
file: ./database/to-do.sqlite
In the ./app/database folder create a file named table objects.yml. You will add YAML for configuring any table, relationship, and scope objects to this file.
SQL Yoga USER GUIDE
- Home
- SQL Yoga Objects
- Database Objects
- Connection Objects
- SQL Query Objects
- SQL Record Objects
- Table Objects
- Table Object Behaviors
- Relationships
- Scopes
- Schema
- Working with User Search Strings
- SQL Query Template Objects
- Error Handling
- Migrating from SQL Yoga 1.x
- Integrating with the Levure Application Framework