Skip to content

Commit

Permalink
fix: allow setting null poolUrl
Browse files Browse the repository at this point in the history
  • Loading branch information
fenos committed Oct 13, 2023
1 parent ad63a37 commit 091ac6e
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/http/routes/tenant/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const patchSchema = {
properties: {
anonKey: { type: 'string' },
databaseUrl: { type: 'string' },
databasePoolUrl: { type: 'string' },
databasePoolUrl: { type: 'string', nullable: true },
maxConnections: { type: 'number' },
fileSizeLimit: { type: 'number' },
jwtSecret: { type: 'string' },
Expand Down Expand Up @@ -193,11 +193,16 @@ export default async function routes(fastify: FastifyInstance) {
if (databaseUrl) {
await runMigrations(tenantId, databaseUrl)
}
console.log(databasePoolUrl, databasePoolUrl === null)
await knex('tenants')
.update({
anon_key: anonKey !== undefined ? encrypt(anonKey) : undefined,
database_url: databaseUrl !== undefined ? encrypt(databaseUrl) : undefined,
database_pool_url: databasePoolUrl !== undefined ? encrypt(databasePoolUrl) : undefined,
database_pool_url: databasePoolUrl
? encrypt(databasePoolUrl)
: databasePoolUrl === null
? null
: undefined,
max_connections: maxConnections ? Number(maxConnections) : undefined,
file_size_limit: fileSizeLimit,
jwt_secret: jwtSecret !== undefined ? encrypt(jwtSecret) : undefined,
Expand Down

0 comments on commit 091ac6e

Please sign in to comment.