Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

adonis-schema-builder

Package Overview
Dependencies
Maintainers
2
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

adonis-schema-builder

Quickly create adonis migrations, seeds, models and tests for AdonisJS from a schema json file

  • 0.1.6
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2
decreased by-84.62%
Maintainers
2
Weekly downloads
 
Created
Source

Adonis Schema Builder

NPM Package License Build Status Coverage Status Maintainability Dependencies Greenkeeper badge

Build adonis migrations, factories and models with pre-configured relationships from Database Schema.

Based on a schema-builder for laravel and using the same schema format as schema-builder.

Installation

This package works with AdonisJS v4. In your project directory you'll need ace, fold and cli installed:

npm install --save @adonisjs/ace @adonisjs/cli @adonisjs/fold

These are all peer dependencies so you will get a warning from NPM if they're not installed first. Then install adonis-schema-builder:

npm install --save adonis-schema-builder

Add the following to your aceProviders array in start/app.js:

'adonis-schema-builder/providers/BuilderProvider'

You should now see the schema:build option when running adonis or ace.

How to use

Creating a Schema

Use the schema-builder GUI to design your schema, and export as JSON. All of the table and column options in the schema builder are supported, although some column types might be substituted to supported Knex types.

Importing the Schema

Run adonis schema:build <path to schema file> in your project root to import the schema file and generate source files. You will be asked to confirm before overwriting any existing files.

Generated files

  • A create table migration for each table.
  • A model for each table (except link tables) including validator and sanitisation rules and relationships.
  • A factory js file, with a blueprint for each model.

Caveats

  • Link tables - link tables (tables that exist only to join other models) must be denoted with an underscore (i.e. posts_categories).
  • Soft Deletes - Currently not supported in V4, but should be added soon.

Upcoming features

  • Validator message - Messages corresponding to validator rules
  • Seeds - use the factories to create a seed file that creates entities that follow the relationship rules.
  • Tests - generate integration tests to check that models and factories are set up correctly and are compatible with adonis-lucid.

Keywords

FAQs

Package last updated on 12 Apr 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc