dsql 0.0.9+2
dsql: ^0.0.9+2 copied to clipboard
Dart SQL library for generating .dart files from .sql files
DSQL ORM #
An Experimental Dart ORM or Something Similar
Installation
dart pub global activate dsql
and add dsql to your pubspec.yaml
dependencies:
dsql: ^0.0.9+2
Create a file .env in the root of your project with database connection information.
DATABASE_URL=postgresql://postgres:postgres@localhost:5432/postgres
In the root, create a folder called migrations with your .sql file, like spring boot for example.
-- ./migrations/V1__create_users_table.sql
CREATE TABLE users (
id SERIAL PRIMARY KEY DEFAULT nextval('users_id_seq'),
name VARCHAR(255) NOT NULL,
email VARCHAR(255) NOT NULL UNIQUE,
password VARCHAR(255) NOT NULL,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
Then you can run the migrations command with the following command
dsql --generate or -g // Generate a dsql.dart file inside the lib/generated folder
dsql -g -o /path/to/output // Generates in a custom path