Conversation
KnorpelSenf
left a comment
There was a problem hiding this comment.
Interesting stuff. @Satont?
There was a problem hiding this comment.
The "why" is because pnpm lock version was 6 at storages@2.4.2. Now that lockfile is version 9, will update
There was a problem hiding this comment.
Why example not using sessions?
Those packages suposed to be used mostly in sessions. Yea, not only sessions, but certainly not for such use in bare code.
Also for deno i'd like to see env usage for bot token, tursor url and token.
| static async create<T>(opts: { client: Client, table: string }) { | ||
| const createTableStatement = ` | ||
| CREATE TABLE IF NOT EXISTS "${opts.table}" ( | ||
| key TEXT NOT NULL, | ||
| value TEXT | ||
| );`; | ||
| await opts.client.execute(createTableStatement); | ||
|
|
||
| const createIndexStatement = `CREATE UNIQUE INDEX IF NOT EXISTS "IDX_${opts.table}" ON "${opts.table}" (key);`; | ||
| await opts.client.execute(createIndexStatement); | ||
|
|
||
| return new LibSQLAdapter<T>(opts); | ||
| } |
There was a problem hiding this comment.
Some users have correctly pointed out that await create() to be called on every application start is bad, because sometimes bots can be used in serverless environments where this call takes a decent amount of time. Instead, I'd like to instruct them in the readme that they should create a table in their database. Then we will accept the table name, client, as an option. And we wouldn't need a static create method
Thats also about psql adapter, which i didnt refactored yet.
Please help verify (not familiar with lerna and pnpm) this works for deno and node.