JT
Explore posts from servershow to have `nuxt build` include extra data files
When I do
nuxt build
my app works fine except that I have some extra .json files that are loaded at run time for some of my server routes. However, Nuxt reports that those files are not found when when I run nuxt preview
and try to access a server route.
Everything works fine in nuxt dev
, so I'm thinking there must be some way to either statically load the JSON files, or, better yet, to include them somehow so that the compiler includes them into the build.1 replies
Having a problem with imports: Dev works, Prod does not
First, in case it matters, my source code is all here: https://github.com/plainblack/ving
I have this in package.json
This
ving
folder is in my nuxt root, but it is not inside of /app
or /server
.
My app has a Vue interface (inside the /app
folder), a REST interface, inside the /server
folder, and a CLI interface inside the /ving
folder. The libraries for the whole app are in the /ving
folder and the REST inteface accesses those just fine in dev mode.
However, now when I run npm run build
and then npm run preview
I get this error:
How do I build the production mode so that it imports these files correctly like dev mode does?1 replies
DTDrizzle Team
•Created by JT on 4/4/2024 in #help
How to do a foreign key with cascades
Right now I'm doing something like this:
I would like to name the key that is generated here. I understand that I can use the
foreignKey()
to name the key. However, I don't know how to handle the cascades if I do the foreign key using that function rather than using references()
.
Can anybody give me a pointer?3 replies
DTDrizzle Team
•Created by JT on 3/13/2024 in #help
Can I pay for a new feature to be added?
I'd really like drizzle kit to support rollback migrations, to downgrade a database. Can I speak to someone about adding that?
3 replies
DTDrizzle Team
•Created by JT on 2/18/2024 in #help
query to text
Is there a way to get a query output as text for debugging/logging purposes?
5 replies
DTDrizzle Team
•Created by JT on 2/11/2024 in #help
where has iterator gone?
Way back in 0.24.0 I sponsored an iterator for large data sets, but it is no longer in the documentation. Can someone point me to it?
5 replies
DTDrizzle Team
•Created by JT on 2/1/2024 in #help
How to get the name of the table
In 0.22 I used to import
Name
from drizzle-orm/table.js and then I could get the name of the table by calling table[Name]
. I'm now upgrading to the latest, and a lot of things have changed. Obviously this is one of them, and I can no longer get the name of the table that way. What is the appropriate way to inspect the object and get the name of the table?2 replies
DTDrizzle Team
•Created by JT on 4/9/2023 in #help
Iterator for result set
I've got some big ass database tables that I'd rather not read into memory. In other languages there is an iterator attached to result set, but I haven't seen that in the JS/TS world anywhere. Is that something I'm going to have to write for myself, or have I missed it?
What I'm imagining is either something that uses a DB cursor, or something that basically works like a paginator, where it will select 100 rows at a time, iterate over those rows, and keep doing that each time you call .next() until it has reached the end of the result set.
10 replies
DTDrizzle Team
•Created by JT on 4/5/2023 in #help
cascades
I know you can add
.references()
to set up foreign keys in a table definition, but how do you set up cascades?2 replies
DTDrizzle Team
•Created by JT on 3/18/2023 in #help
What is the type for an .orderBy() parameter
Inside of a function, i have a query more complicated than this, but something like:
I'd like to be able to pass in the
part of that from the outside., but to do that I need to know what type i should be putting on the function parameter.
15 replies
DTDrizzle Team
•Created by JT on 3/18/2023 in #help
MySqlInsertValue<> vs typeof Table type mismatch
I've got this line of code:
Where
props
is showing a TS problem:
The variables in there are typed like:
The ModelMap
is an index of all the different types generated by various drizzle schemas I have, so that they are available for quick reference by just passing T
.
ModelMap[T]['model']
is equivalent to typeof SomeTable
and ModelMap[T]['select']
is equivalent to InferModel<typeof SomeTable>
What might be causing this problem?25 replies
DTDrizzle Team
•Created by JT on 3/16/2023 in #help
documented types for the return of `drizzle()` and the return of `mysqlTable()`
my most pressing need is documented types: https://github.com/drizzle-team/drizzle-orm/issues/273
Specifically the 2 that are holding me up right now are how to pass a the mysql2 version of drizzle() (aka a db reference) and a model reference (the result of mysqlTable()) around through my app
41 replies
DTDrizzle Team
•Created by JT on 3/16/2023 in #help
.andWhere()
I know that
.andWhere()
isn't a function, but I'm wondering if there's a way to start a query in one function, and return it. And then have the receiver be able to continue to add to the where clause?
Something like:
28 replies
DTDrizzle Team
•Created by JT on 3/16/2023 in #help
how do you pass a query in a typesafe way?
Let's say i want to paginate a query, so I'm going to pass a query such as this to a pagination function
And then that pagination function will add
.limit()
and .offset()
to the query. What type would I put on the function argument?11 replies
DTDrizzle Team
•Created by JT on 3/15/2023 in #help
help with column builder types
As I play around with learning drizzle, I wondered if I could generate a drizzle schema from a master schema. I'm very close to being able to do that. As you can see in this repo I created: https://github.com/rizen/drizzle-icing/blob/main/user.ts
The code works perfectly, but problem is that when I try to use
InferModel
to get the column types from my schema, I'm getting
Where the I would get the following on a hand-built table:
My guess is that the problem lies in the use of the AnyMySqlColumnBuilder
type in this function:
Any help on what I should do to get the appropriate types out for InferModel
?76 replies
DTDrizzle Team
•Created by JT on 3/14/2023 in #help
migration on mysql errors
I've written this migrator:
and tried to run this migration, which was generated by drizzle-kit:
And I get this error:
Now each of the commands individually inside that migration work. So I think it's croaking on the fact that all 3 lines are being sent at once.
Any thoughts on how to get around this?
8 replies
DTDrizzle Team
•Created by JT on 3/14/2023 in #help
drizzle-kit generates mysql 8 syntax, but AWS Aurora uses 5.7 syntax, any way to switch?
I think the title says it all
2 replies
DTDrizzle Team
•Created by JT on 3/14/2023 in #help
error: there is no transaction in progress
I created a drizzle table:
Which then generated this migration:
That creates this error when I try to use the migrator to run it.
It looks like transactions were generated to wrap around the enums, but not the create table or create indexes. Did I do something wrong here? Or is this error pointing to something else?
8 replies
DTDrizzle Team
•Created by JT on 3/13/2023 in #help
Having a problem just connecting with drizzle
Howdy, I just found out about drizzle and thought I might give it a try, but unfortunately I'm having trouble just getting the example working from the documentation.
I've created this sample file:
Then compiled it into JS like this:
Then ran it like this:
The execution order is wrong, and the program just hangs at the end rather than exiting cleanly.
Here's the output:
Any ideas what I'm doing wrong?
8 replies