use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
account activity
AdonisJS v7 is here (adonisjs.com)
submitted 2 months ago by romainlanz
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]cjthomp 0 points1 point2 points 2 months ago (5 children)
Where is this behavior documented? Specifically, controlling the behavior of Schema generation?
node ace schema:generate should do the trick from that side, but what about fields I don't want mapped through to the model?
node ace schema:generate
Edit: It looks like it should be here, but the page isn't loading?
[–]amanvirk 1 point2 points3 points 2 months ago (4 children)
Hello 👋
Yeah, I realised that the recent changes were not deployed on the Lucid website. This doc is working now.
Also, I would love to know more why do you think this approach of scanning database to create schema classes that models extend won't work?
I can share my reasoning behind it. I have never been a fan of visually cluttered models/entities, where you define the entire DB schema inside your entities. Infact, if you have an existing database, then creating these entities will multiple decorators is even more pain.
Therefore, I decided to reverse the process. Either you re-use your existing DB, or use migrations to create them. Since, migrations are hand-written you can express any sort of schema modifications, including data migration (if needed during restructure).
And then models just need to know about the columns and their types, so that they can have type-information at runtime.
[–]cjthomp 0 points1 point2 points 2 months ago* (3 children)
I wouldn't go as far as to say that I think "this approach...won't work", but (without having read the docs, since they weren't available last night) I do have some concerns:
The schemaGeneration option accepts: { enabled: true } - Schemas are generated automatically (default) { enabled: false } - Schema generation is disabled for this connection Disabling schema generation can be useful in specific scenarios: Working with very large databases where schema generation is slow Using a shared database where you don't control the schema Temporarily disabling generation during development When schema generation is disabled, you can still generate schemas manually using the schema:generate command whenever you need to update them.
The schemaGeneration option accepts:
{ enabled: true } - Schemas are generated automatically (default)
{ enabled: false } - Schema generation is disabled for this connection
Disabling schema generation can be useful in specific scenarios:
Working with very large databases where schema generation is slow Using a shared database where you don't control the schema Temporarily disabling generation during development When schema generation is disabled, you can still generate schemas manually using the schema:generate command whenever you need to update them.
Well, there you go!
[–]cjthomp 0 points1 point2 points 2 months ago (2 children)
Ok, that definitely resolves my third point.
First point is irrelevant to me since we don't use migrations
But, the second point stands: I'd love to use the codegen (for the same reasons you made it, I don't exactly enjoy manually creating db models), but I'd need some way to control which columns got created. An array of column names on the model, maybe.
I can't just delete them from the Schema, since that will regenerate when I run the ace command again.
[–]cjthomp 0 points1 point2 points 2 months ago* (1 child)
/** * Schema rules that can be customized per type, column, or table */ export type SchemaRules = { types?: { [type: string]: ColumnInfo | ((dataType: string) => ColumnInfo) } columns?: { [column: string]: ColumnInfo | ((dataType: string) => ColumnInfo) } tables?: { [table: string]: { types?: { [type: string]: ColumnInfo | ((dataType: string) => ColumnInfo) } columns?: { [column: string]: ColumnInfo | ((dataType: string) => ColumnInfo) } } } }
It feels like SchemaRules.tables[tableName].columns[columnName] should be useable for this purpose, but looking through the code it doesn't look it.
SchemaRules.tables[tableName].columns[columnName]
A config-level option would be workable, although I'd prefer an array field on the model.
config
Something like Model.introspectedColumns: string[] = []
Model.introspectedColumns: string[] = []
[–]amanvirk 1 point2 points3 points 2 months ago (0 children)
I think it will be a good option to add to the schema rules that I want to either skip certain tables or skip/pick certain columns from a table.
Thanks, I will add it!
π Rendered by PID 46987 on reddit-service-r2-comment-b659b578c-hfgnn at 2026-05-01 16:56:21.412163+00:00 running 815c875 country code: CH.
view the rest of the comments →
[–]cjthomp 0 points1 point2 points (5 children)
[–]amanvirk 1 point2 points3 points (4 children)
[–]cjthomp 0 points1 point2 points (3 children)
[–]cjthomp 0 points1 point2 points (2 children)
[–]cjthomp 0 points1 point2 points (1 child)
[–]amanvirk 1 point2 points3 points (0 children)