Skip to content
πŸ—ƒ The ORM of AdonisJs Framework with support for PostgreSQL, MSSQL, MySQL, MariaDB, SQLite3, Oracle and Amazon Redshift
JavaScript HTML
Branch: develop
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github chore(package): update dependencies Oct 1, 2018
commands chore(package): update dependencies Oct 1, 2018
config feat(config): add sample config file inside config dir Jan 21, 2018
lib chore(knex): update knex & fix warnings Feb 23, 2018
providers feat(validation): add unique validation rule for validator Aug 22, 2017
src add parameter index in the JSDoc (#502) Dec 6, 2019
templates feat(instructions): add instructions file Aug 1, 2017
test test(mysql): fix failing tests Mar 11, 2019
.editorconfig chore(meta): add meta files via mrm Jul 14, 2018
.gitignore chore: remove package-lock Sep 23, 2018
.npmignore feat(config): add sample config file inside config dir Jan 21, 2018
.travis.yml ci(travis): make travis run tests on mysql also Oct 1, 2018
CHANGELOG.md chore(release): 6.1.3 Oct 1, 2018
CONTRIBUTING.md docs(contributing): fix broken link Jul 16, 2017
LICENSE.md chore(package): update dependencies Oct 1, 2018
README.md doc(readme): fix typo Nov 27, 2018
appveyor.yml ci(appveyor): update test script Oct 1, 2018
config.json chore(meta): add meta files via mrm Jul 14, 2018
docker-compose.yml chore(docker): add docker file for local testing Mar 11, 2019
index.js test(providers): add test for providers Jul 16, 2017
instructions.js refactor(instructions): log config file has been created Aug 1, 2017
instructions.md doc(instructions.md): fix typo Nov 22, 2018
japaFile.js chore(package): update dependencies Oct 1, 2018
package.json chore(package): update dependencies (#500) Dec 6, 2019

README.md

Adonis Lucid πŸ’‘

Adonis lucid is a SQL ORM built on top of knexjs. It is built on standards of Active Record pattern which become mainly popular with Ruby on Rails.

NPM Version Build Status Appveyor Coveralls

Features?

Apart from being just a query builder, Lucid has following features.

  1. ES6 classes based data Models.
  2. Model Hooks
  3. Associations
  4. Serializers ( Vanilla and JSON API )
  5. Migrations
  6. Factories and Seeds

Setup

The provider must be installed from npm using adonis command.

adonis install @adonisjs/lucid

Post that make sure to read instructions.md file on how to setup the provider.

Node/OS Target

This repo/branch is supposed to run fine on all major OS platforms and targets Node.js >=7.0

Development

Great! If you are planning to contribute to the framework, make sure to adhere to following conventions, since a consistent code-base is always joy to work with.

Run the following command to see list of available npm scripts.

npm run

Tests & Linting

  1. Lint your code using standardJs. Run npm run lint command to check if there are any linting errors.
  2. Make sure you write tests for all the changes/bug fixes.
  3. Also you can write regression tests, which shows that something is failing but doesn't break the build. Which is actually a nice way to show that something fails. Regression tests are written using test.failing() method.
  4. Make sure all the tests are passing on travis and appveyor.

General Practices

Since Es6 is in, you should strive to use latest features. For example:

  1. Use Spread over arguments keyword.
  2. Never use bind or call. After calling these methods, we cannot guarantee the scope of any methods and in AdonisJs codebase we do not override the methods scope.
  3. Make sure to write proper docblock.

Issues & PR

It is always helpful if we try to follow certain practices when creating issues or PR's, since it will save everyone's time.

  1. Always try creating regression tests when you find a bug (if possible).
  2. Share some context on what you are trying to do, with enough code to reproduce the issue.
  3. For general questions, please create a forum thread.
  4. When creating a PR for a feature, make sure to create a parallel PR for docs too.

Regression Tests

Regression tests are tests, which shows how a piece of code fails under certain circumstance, but the beauty is even after the failure, the test suite will never fail. Actually is a nice way to notify about bugs, but making sure everything is green.

The regression tests are created using

test.failing('2 + 2 is always 4, but add method returns 6', (assert) => {
 assert.true(add(2, 2), 4)
})

Now since the add method has a bug, it will return 6 instead of 4. But the build will pass.

You can’t perform that action at this time.