|
1 | 1 | import type { CompiledQuery, Dialect, Driver, QueryResult } from 'kysely' |
2 | 2 | import type { connections } from '~/drizzle' |
3 | 3 | import { type } from 'arktype' |
4 | | -import { MysqlQueryCompiler } from 'kysely' |
| 4 | +import { DummyDriver, MysqlQueryCompiler } from 'kysely' |
5 | 5 | import { logSql } from '../../sql' |
6 | 6 |
|
7 | 7 | function escapeSqlString(v: string) { |
@@ -86,19 +86,34 @@ function createDriver(connection: typeof connections.$inferSelect) { |
86 | 86 | } satisfies Driver |
87 | 87 | } |
88 | 88 |
|
| 89 | +function clickhouseAdapter() { |
| 90 | + return { |
| 91 | + supportsCreateIfNotExists: false, |
| 92 | + supportsTransactionalDdl: false, |
| 93 | + supportsReturning: false, |
| 94 | + acquireMigrationLock: async () => {}, |
| 95 | + releaseMigrationLock: async () => {}, |
| 96 | + } |
| 97 | +} |
| 98 | + |
89 | 99 | export function clickhouseDialect(connection: typeof connections.$inferSelect) { |
90 | 100 | return { |
91 | | - createAdapter: () => ({ |
92 | | - supportsCreateIfNotExists: false, |
93 | | - supportsTransactionalDdl: false, |
94 | | - supportsReturning: false, |
95 | | - acquireMigrationLock: async () => {}, |
96 | | - releaseMigrationLock: async () => {}, |
97 | | - }), |
| 101 | + createAdapter: clickhouseAdapter, |
98 | 102 | createDriver: () => createDriver(connection), |
99 | 103 | createQueryCompiler: () => new MysqlQueryCompiler(), |
100 | 104 | createIntrospector: () => { |
101 | 105 | throw new Error('Not implemented') |
102 | 106 | }, |
103 | 107 | } satisfies Dialect |
104 | 108 | } |
| 109 | + |
| 110 | +export function clickhouseColdDialect() { |
| 111 | + return { |
| 112 | + createAdapter: clickhouseAdapter, |
| 113 | + createDriver: () => new DummyDriver(), |
| 114 | + createQueryCompiler: () => new MysqlQueryCompiler(), |
| 115 | + createIntrospector: () => { |
| 116 | + throw new Error('Not implemented') |
| 117 | + }, |
| 118 | + } satisfies Dialect |
| 119 | +} |
0 commit comments