Skip to content

Releases: harshdoesdev/rayql

First Release

28 Apr 08:08
Compare
Choose a tag to compare

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:

  1. Enums
  2. Models

Functions

The following functions are supported:

  1. min: the minimum value that can be passed to a column
  2. max: the maximum value that can be passed to a column
  3. foreign_key: declares an FK relationship between two models. Example: foreign_key(user.id)
  4. default: the default value of a column
  5. 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