Replies: 1 comment
-
I tried with just this code too : const gameboard = Gameboard.query().where('uuid', gameboardUuid).preload('freetexts').preload('positions', (posQuery) => {
posQuery.preload('stacks', (stackQuery) => {
stackQuery.preload('ranges', (rangeQuery) => {
rangeQuery.preload('rangeCellData')
})
})
}).firstOrFail(); And even this don't give me my rangeCellData, here is my migration files : import BaseSchema from '@ioc:Adonis/Lucid/Schema'
export default class RangeCellData extends BaseSchema {
protected tableName = 'range_cell_data'
public async up () {
this.schema.createTable(this.tableName, (table) => {
table.string('uuid').primary()
table.string('range_uuid').references('ranges.uuid').notNullable().onDelete('CASCADE')
table.integer('cell_id').unsigned().notNullable()
table.string('legend_color_uuid').references('legend_colors.uuid').notNullable().onDelete('CASCADE')
table.boolean('is_border').notNullable().defaultTo(false)
table.integer('weight').notNullable()
table.timestamps(true, true)
table.unique(['range_uuid', 'cell_id', 'legend_color_uuid'])
})
}
public async down () {
this.schema.dropTable(this.tableName)
}
} import BaseSchema from '@ioc:Adonis/Lucid/Schema'
export default class Ranges extends BaseSchema {
protected tableName = 'ranges'
public async up () {
this.schema.createTable(this.tableName, (table) => {
table.string('uuid').primary()
table.string('legend_uuid').references('legends.uuid').onDelete('CASCADE').nullable()
// table.string('origin_legend_uuid').references('legends.uuid').onDelete('CASCADE').notNullable()
table.string('stack_uuid').references('stacks.uuid').onDelete('CASCADE').notNullable()
table.string('label').notNullable()
table.integer('x').notNullable()
table.integer('y').notNullable()
table.integer('width').defaultTo(1).notNullable()
table.integer('height').defaultTo(1).notNullable()
table.double('scale_x').defaultTo(1).notNullable()
table.double('scale_y').defaultTo(1).notNullable()
table.boolean('locked').notNullable().defaultTo(false)
table.timestamps(true, true)
})
}
public async down () {
this.schema.dropTable(this.tableName)
}
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi everyone,
Im coding an export function for my web app, so i need to preload much entities and relations, I did this code :
And there is the return for one of my gameboard : https://pastebin.mozilla.org/vqZJDJdr
But it's strange, Im supposed to have relations of my range, so I tried with this code :
And i got this result for the same gameboard : https://pastebin.mozilla.org/nu72huEk
This time i have relations of my range entity, but this code have pretty bad performance. I think my first code have to work but just something can be wrong in my code or entities.
For example, there is the model of range :
And the code for RangeCellData entity :
Im currently running this app with
NodeJS v16.17.0
and here is my dependencies :Tell me if you need more information and thank you for helping me <3
Have a nice day !
Beta Was this translation helpful? Give feedback.
All reactions