Releases: harshdoesdev/rayql
Releases · harshdoesdev/rayql
First Release
This is the first release of rayql
. In this release, we have implemented the parser and SQL generator for schema.
Entities
Currently, the following entities are supported:
- Enums
- Models
Functions
The following functions are supported:
- min: the minimum value that can be passed to a column
- max: the maximum value that can be passed to a column
- foreign_key: declares an FK relationship between two models. Example:
foreign_key(user.id)
- default: the default value of a column
- now: the current timestamp
Commands
Only the rayql print
command is available, which looks for the schema.rayql
file in the current directory, parses it, and outputs the SQL statements for generating tables using that schema.
Example Schema
# Enum for user types
enum user_type {
admin
developer
normal
}
# Model declaration for 'user'
model user {
id: int primary_key auto_increment,
username: str unique,
email: str unique, # this is an inline comment
phone_number: str?, # nullable field
user_type: user_type default(user_type.normal)
}
# Model declaration for 'post'
model post {
id: int primary_key auto_increment,
title: str default('New Post'),
content: str,
author_id: int foreign_key(user.id),
created_at: timestamp default(now()),
}
Changelog
Full Changelog: https://github.com/harshdoesdev/rayql/commits/0.1.0