drizzle-team / drizzle-team/drizzle-orm

[BUG]: question: Running raw sql inside of the schema.ts just for the migrations

Open
#450 2 comments 11 reactions 0 assignees View on GitHub
drizzle/kit enhancement
Dominant language
TypeScript
Stars
35.8k
Forks
1.6k
Avg merge
2d 7h
Merged PRs (30d)
4

Description

### What version of `drizzle-orm` are you using?

0.23.10

### Describe the Bug

Hello this is another question/suggesting/bug, I miss a possibility to ran just a plain raw sql inside of the `schema.ts` so that the migration will somehow take that into an account, I have tried to include things like:

```ts
sql`ALTER TABLE ${someTable} ENABLE ROW LEVEL SECURITY`
```
inside of the `schema.ts` but with no effect.

If you could somehow make the raw sql inside of the schema/migrations, I think it would solve a lot of problems for us since the users would now have a way how to hack around the current and future issues like:
- having two sources of true for the db (schema.ts and some patch.sql) and not having to patch the drizzle-kit npm generation script
- cross schema thingies
- practically anything migrations related that would come up in the future could be solved by this ability

I would definitely like to have it in one place.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.