chronark
chronark
Explore posts from servers
DTDrizzle Team
Created by chronark on 2/2/2024 in #help
"drizzle-orm/planetscale-serverless/migrator" in cf workers
the problem is that the migrate function tries to read the migration files from the file system, which is just not really a thing in workerd, but I could embed these during docker build time
12 replies
DTDrizzle Team
Created by chronark on 2/2/2024 in #help
"drizzle-orm/planetscale-serverless/migrator" in cf workers
oh I'm not talking about d1, but mysql/pscale but that's not really the point I know I'm hacking here the idea is to offer a docker image of our api (I have it running using workerd and have an api route on it, that would migrate the attached db + seed data basically you'd do
docker run unkey/api:latest
curl http://localhost:8787/v1/seed
docker run unkey/api:latest
curl http://localhost:8787/v1/seed
I know there are other ways to achieve it, but this would be pretty nice
12 replies
DTDrizzle Team
Created by thdxr on 11/10/2023 in #help
Dropping primary keys every time
thank you so much! ❤️
70 replies
DTDrizzle Team
Created by thdxr on 11/10/2023 in #help
Dropping primary keys every time
I can confirm, I can push over it now 🙂
70 replies
DTDrizzle Team
Created by thdxr on 11/10/2023 in #help
Dropping primary keys every time
thank you so much!
70 replies
DTDrizzle Team
Created by thdxr on 11/10/2023 in #help
Dropping primary keys every time
sweet, will do later tonight
70 replies
DTDrizzle Team
Created by thdxr on 11/10/2023 in #help
Dropping primary keys every time
sweet lmk how we can help 🙂
70 replies
DTDrizzle Team
Created by thdxr on 11/10/2023 in #help
Dropping primary keys every time
I did now get the warning btw
This version of drizzle-kit is outdated Please update drizzle-kit package to the latest version 👍
70 replies
DTDrizzle Team
Created by thdxr on 11/10/2023 in #help
Dropping primary keys every time
thanks 🙂 it's not super important, deleting the table is somewhat fine for us planetscale migrations are handling it correctly afterwards, it's just annoying when we edit our schema in a development branch
70 replies
DTDrizzle Team
Created by thdxr on 11/10/2023 in #help
Dropping primary keys every time
yeah
70 replies
DTDrizzle Team
Created by thdxr on 11/10/2023 in #help
Dropping primary keys every time
1. update drizzle-kit and drizzle-orm
2. pnpm install
3. cd internal/db
4. DRIZZLE_DATABASE_URL=XXX pnpm drizzle-kit push:mysql
1. update drizzle-kit and drizzle-orm
2. pnpm install
3. cd internal/db
4. DRIZZLE_DATABASE_URL=XXX pnpm drizzle-kit push:mysql
that should be it
70 replies
DTDrizzle Team
Created by thdxr on 11/10/2023 in #help
Dropping primary keys every time
yeah, let me write down the instructions
70 replies
DTDrizzle Team
Created by thdxr on 11/10/2023 in #help
Dropping primary keys every time
pnpm drizzle-kit push:mysql
drizzle-kit: v0.20.7
drizzle-orm: v0.29.1

No config path provided, using default path
Reading config file '/Users/andreasthomas/github/unkeyed/unkey/internal/db/drizzle.config.ts'
Reading schema files:
/Users/andreasthomas/github/unkeyed/unkey/internal/db/src/schema/index.ts

[✓] Changes applied


___


➜ db git:(drizzle-upgrade) ✗ pnpm drizzle-kit p
ush:mysql
drizzle-kit: v0.20.7
drizzle-orm: v0.29.1

No config path provided, using default path
Reading config file '/Users/andreasthomas/github/unkeyed/unkey/internal/db/drizzle.config.ts'
Reading schema files:
/Users/andreasthomas/github/unkeyed/unkey/internal/db/src/schema/index.ts

Error: target: unkey.-.primary: vttablet: rpc error: code = Unknown desc = Cannot drop index 'audit_logs_workspace_id_workspaces_id_fk': needed in a foreign key constraint (errno 1553) (sqlstate HY000) (CallerID: nkmzozmcad8ld2mez77t): Sql: "alter table audit_logs drop key audit_logs_workspace_id_workspaces_id_fk", BindVars: {REDACTED}
at PromiseConnection.query (/Users/andreasthomas/github/unkeyed/unkey/node_modules/.pnpm/drizzle-kit@0.20.7/node_modules/drizzle-kit/bin.cjs:44278:26)
at Command.<anonymous> (/Users/andreasthomas/github/unkeyed/unkey/node_modules/.pnpm/drizzle-kit@0.20.7/node_modules/drizzle-kit/bin.cjs:63113:33)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
code: 'ER_DROP_INDEX_FK',
errno: 1553,
sql: 'DROP INDEX `audit_logs_workspace_id_workspaces_id_fk` ON `audit_logs`;',
sqlState: 'HY000',
sqlMessage: `target: unkey.-.primary: vttablet: rpc error: code = Unknown desc = Cannot drop index 'audit_logs_workspace_id_workspaces_id_fk': needed in a foreign key constraint (errno 1553) (sqlstate HY000) (CallerID: nkmzozmcad8ld2mez77t): Sql: "alter table audit_logs drop key audit_logs_workspace_id_workspaces_id_fk", BindVars: {REDACTED}`
}
pnpm drizzle-kit push:mysql
drizzle-kit: v0.20.7
drizzle-orm: v0.29.1

No config path provided, using default path
Reading config file '/Users/andreasthomas/github/unkeyed/unkey/internal/db/drizzle.config.ts'
Reading schema files:
/Users/andreasthomas/github/unkeyed/unkey/internal/db/src/schema/index.ts

[✓] Changes applied


___


➜ db git:(drizzle-upgrade) ✗ pnpm drizzle-kit p
ush:mysql
drizzle-kit: v0.20.7
drizzle-orm: v0.29.1

No config path provided, using default path
Reading config file '/Users/andreasthomas/github/unkeyed/unkey/internal/db/drizzle.config.ts'
Reading schema files:
/Users/andreasthomas/github/unkeyed/unkey/internal/db/src/schema/index.ts

Error: target: unkey.-.primary: vttablet: rpc error: code = Unknown desc = Cannot drop index 'audit_logs_workspace_id_workspaces_id_fk': needed in a foreign key constraint (errno 1553) (sqlstate HY000) (CallerID: nkmzozmcad8ld2mez77t): Sql: "alter table audit_logs drop key audit_logs_workspace_id_workspaces_id_fk", BindVars: {REDACTED}
at PromiseConnection.query (/Users/andreasthomas/github/unkeyed/unkey/node_modules/.pnpm/drizzle-kit@0.20.7/node_modules/drizzle-kit/bin.cjs:44278:26)
at Command.<anonymous> (/Users/andreasthomas/github/unkeyed/unkey/node_modules/.pnpm/drizzle-kit@0.20.7/node_modules/drizzle-kit/bin.cjs:63113:33)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
code: 'ER_DROP_INDEX_FK',
errno: 1553,
sql: 'DROP INDEX `audit_logs_workspace_id_workspaces_id_fk` ON `audit_logs`;',
sqlState: 'HY000',
sqlMessage: `target: unkey.-.primary: vttablet: rpc error: code = Unknown desc = Cannot drop index 'audit_logs_workspace_id_workspaces_id_fk': needed in a foreign key constraint (errno 1553) (sqlstate HY000) (CallerID: nkmzozmcad8ld2mez77t): Sql: "alter table audit_logs drop key audit_logs_workspace_id_workspaces_id_fk", BindVars: {REDACTED}`
}
70 replies
DTDrizzle Team
Created by thdxr on 11/10/2023 in #help
Dropping primary keys every time
still fails on the 2nd push
70 replies
DTDrizzle Team
Created by thdxr on 11/10/2023 in #help
Dropping primary keys every time
aah stupid zed has cached the old types
70 replies
DTDrizzle Team
Created by thdxr on 11/10/2023 in #help
Dropping primary keys every time
Invalid input Either "uri" or "host", "database" are required for database connection
ok hold on, this is a completely new error 😄
70 replies
DTDrizzle Team
Created by thdxr on 11/10/2023 in #help
Dropping primary keys every time
same error
70 replies
DTDrizzle Team
Created by thdxr on 11/10/2023 in #help
Dropping primary keys every time
ah yeah we have a few
70 replies
DTDrizzle Team
Created by thdxr on 11/10/2023 in #help
Dropping primary keys every time
give me a few min, I'll do a fresh try
70 replies
DTDrizzle Team
Created by thdxr on 11/10/2023 in #help
Dropping primary keys every time
no it didn't ask might be a monorepo thing?
70 replies