Durable Object example weird import

Here in thd docs https://orm.drizzle.team/docs/connect-cloudflare-do There is the following import import migrations from '../drizzle/migrations'; which i dont get? Inside my drizzle folder i have the migration files .sql and a meta folder. Where does the migrations file come from? I did see the We need rules so we can import migrations in the next steps ```toml [[rules]] type = "Text" globs = ["**/.sql"] fallthrough = true ``` But do i need to run some command first?
Drizzle ORM - Cloudflare Durable Objects
Drizzle ORM is a lightweight and performant TypeScript ORM with developer experience in mind.
9 Replies
Silvan
SilvanOP7d ago
On github i do see people with a file that looks like
import journal from "./meta/_journal.json";
import m0000 from "./0000_blue_catseye.sql";

export default {
journal,
migrations: {
m0000,
},
};
import journal from "./meta/_journal.json";
import m0000 from "./0000_blue_catseye.sql";

export default {
journal,
migrations: {
m0000,
},
};
but is this supposed to be generated somehow?
Maston
Maston7d ago
yes - you need a drizzle.config.ts that looks like this:
import { defineConfig } from 'drizzle-kit';

export default defineConfig({
dialect: 'sqlite',
driver: 'durable-sqlite',
// change with where your schema is
schema: './src/db/schema.ts',
});
import { defineConfig } from 'drizzle-kit';

export default defineConfig({
dialect: 'sqlite',
driver: 'durable-sqlite',
// change with where your schema is
schema: './src/db/schema.ts',
});
then run drizzle-kit generate this will create that file
Silvan
SilvanOP7d ago
oh i see makes sense thanks!
Silvan
SilvanOP7d ago
even tho i think i will still need to adjust it because of this weird vite setup i got :P
No description
Silvan
SilvanOP7d ago
i wonder if theres any downside of adding ?raw by default but i will see
Maston
Maston7d ago
im sure theres a more elegant way of doing this by specifying something for it to count .sql files as text in the vite config
Maston
Maston7d ago
vitejs
Shared Options
Next Generation Frontend Tooling
Silvan
SilvanOP7d ago
fair enough thanks! gotta get the other stuff working first tho
Maston
Maston7d ago
nevermind its not that option don't use it

Did you find this page helpful?