Database

Lucid

9 Series
134 Lessons
36h 23m

Lucid is AdonisJS' Object Relational Mapping (ORM). It's a first-party package that follows the active record pattern. With it you can easily perform CRUD operations, add database hooks, normalize data, and so much more.

Lessons.

Video preview
Data Pools
Let's Learn AdonisJS 6 #5.12
・
Apr 05, 24

How To Create Factory Relationships from a Pool of Data

In this lesson, we'll learn how we can refactor our fake data seeder to allow us to assign cast members and crew members to our movies via our many-to-many relationships from a single pool of cineast records.

Video preview
Relationship CRUD
Let's Learn AdonisJS 6 #5.11
・
Apr 02, 24

A Deep Dive Into Relationship CRUD with Models

In this lesson, we'll take a deep look at how we can perform CRUD operations with one-to-one, one-to-many, many-to-one, and many-to-many relationships using our Lucid Models.

Video preview
Many to Many Relationship Model Factories
Let's Learn AdonisJS 6 #5.10
・
Apr 02, 24

Many-To-Many Model Factory Relationships

In this lesson, we'll learn how we can define and use many-to-many relationships with Model Factories, including how we can define pivot table data when creating our fake records.

Video preview
Defining Many to Many Relationships
Let's Learn AdonisJS 6 #5.9
・
Apr 02, 24

Defining Many-To-Many Relationships and Pivot Columns

In this lesson, we'll learn how you can define many-to-many relationships within your Lucid ORM Models. We'll also discuss the relationship options, and how you can automatically include pivot table data with all queries.

Video preview
Using Eager and Lazy Loading to Load A Movie's Writer and Director
Let's Learn AdonisJS 6 #5.8
・
Mar 26, 24

Using Eager and Lazy Loading to Load A Movie's Writer and Director

In this lesson, we'll learn how we can use eager loading to preload our writer and director onto our movie's details. We'll then, learn how we can load our writer and director onto our movie's details using lazy loading.

Video preview
Listing and Counting a Writer's Movies
Let's Learn AdonisJS 6 #5.7
・
Mar 26, 24

Listing and Counting a Writer's Movies

In this lesson, we'll learn how we can perform multiple different relationship counts with the same relationship using the Model Query Builder. We'll count our writer's total number of released and not-released movies.

Video preview
Listing A Director's Movies with Relationship Existance Queries
Let's Learn AdonisJS 6 #5.6
・
Mar 26, 24

Listing A Director's Movies with Relationship Existence Queries

In this lesson, we'll learn how we can perform a relationship existence check to grab a list of our cineasts who have directed one or more movies. We'll then create a show page for that director, listing the movies that they directed.

Video preview
One to Many Factory Relationships
Let's Learn AdonisJS 6 #5.5
・
Mar 22, 24

Seeding Movies with One to Many Model Factory Relationships

In this lesson, we'll learn how we can use Model Factory Relationships to create a pool of cineasts to bind to our movies. This will create cineasts bound to many movies as a writer, director, or both.

Video preview
Defining One to Many Relationships with Lucid Models
Let's Learn AdonisJS 6 #5.4
・
Mar 22, 24

Defining One to Many Relationships with Lucid Models

In this lesson, we'll learn how to define one-to-many and many-to-one relationships using Lucid Models. We'll also learn how we can specify the columns that should be used for a relationship, allowing us to use one model for multiple relationships.

Video preview
Cascading and Deleting Model Relationships
Let's Learn AdonisJS 6 #5.3
・
Mar 22, 24

Cascading and Deleting Model Relationships

In this lesson, we'll learn how to account for foreign key constraints when deleting relationships using our Lucid Models. We'll then learn how we can automatically cascade deletions through to relationships.

Video preview
Querying Relationships and Eager Vs Lazy Loading
Let's Learn AdonisJS 6 #5.2
・
Mar 18, 24

Querying Relationships and Eager Vs Lazy Loading

In this lesson, we'll learn how we can query our relationships using our Lucid Models. We'll then learn what the difference is between eagerly loading a relationship (load) and lazily loading a relationship (preload).

Video preview
Factory Relationships
Let's Learn AdonisJS 6 #5.1
・
Mar 18, 24

Model Factory Relationships

In this lesson, we'll learn how to use relationships with our Model Factories; easing our capabilities to quickly generate fake data with relationships.

Video preview
Defining One to One Relationships
Let's Learn AdonisJS 6 #5.0
・
Mar 18, 24

Defining One to One Relationships Within Lucid Models

In this lesson, we'll learn how to define one-to-one relationships within our Lucid Models. We'll learn about the belongs to and has one decorators, their options, and types that make this possible.

Video preview
Generating A Movie Slug Using Model Hooks
Let's Learn AdonisJS 6 #4.17
・
Mar 15, 24

Generating A Unique Movie Slug With Model Hooks

In this lesson, we'll learn how we can use Model Hooks to generate a unique URL-safe slug based on the movie's title.

Video preview
Querying Recently Released and Releasing Soon Movies
Let's Learn AdonisJS 6 #4.16
・
Mar 15, 24

Querying Recently Released and Coming Soon Movies

In this lesson, we'll learn how to use the Model Query Builder to query our movies that have been recently released. We'll then do a separate query to get movies that are coming soon.

Video preview
Altering Factory States
Let's Learn AdonisJS 6 #4.15
・
Mar 15, 24

Tapping into Model Factory States

In this lesson, we'll dive a little bit deeper into Model Factories by introducing factory states. We'll also learn how we can use the tap method to alter a factory result prior to it persisting into the database

Video preview
Reusable Query Statements with Model Query Scopes
Let's Learn AdonisJS 6 #4.14
・
Mar 11, 24

Reusable Query Statements with Model Query Scopes

In this lesson, we'll learn about Model Query Scopes and how we can use them to create easily reusable query statements that we can apply using the Model Query Builder.

Video preview
SQL Parameters and Injection Protection
Let's Learn AdonisJS 6 #4.13
・
Mar 11, 24

SQL Parameters and Injection Protection

In this lesson, we'll learn about SQL Parameters, also called query bindings, and how using them helps safeguard our database from malicious attacks attempting to perform SQL Injection.

Video preview
Adding A User Profile Model, Migration, Factory, and Controller
Let's Learn AdonisJS 6 #4.12
・
Mar 11, 24

Adding A Profile Model, Migration, Factory, and Controller

Uh oh, a new requirement has come in and now we also need to account for user profiles! In this lesson, we'll learn how we can easily create a new model, migration, factory, and controller for an entity in one fell swoop!

Video preview
Altering Tables with Migrations
Let's Learn AdonisJS 6 #4.11
・
Mar 05, 24

Altering Tables with Migrations

In this lesson, we'll learn how to alter our database tables using migrations both while in development, where we can delete our data, and once our data has already hit production where we need to persist all data.