-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3214118
commit d94c646
Showing
6 changed files
with
33 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
import blocks from "./blocks.sql"; | ||
import module_hashes from "./module_hashes.sql"; | ||
|
||
export const tables = [ | ||
export const sqlTables = [ | ||
["blocks", await Bun.file(blocks).text()], | ||
["module_hashes", await Bun.file(module_hashes).text()] | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,13 @@ | ||
import { logger } from "../logger.js"; | ||
import { client } from "./createClient.js"; | ||
import { databases } from "./stores.js"; | ||
|
||
export async function createDatabase(database: string) { | ||
if (!database) { | ||
throw new Error("[database] is required") | ||
} | ||
logger.info('[clickhouse::createDatabase]\t', `CREATE DATABASE [${database}]`); | ||
if ( databases?.has(database) ) return {}; | ||
const query = `CREATE DATABASE IF NOT EXISTS "${database}"`; | ||
logger.info('[clickhouse::createDatabase]\t', `CREATE DATABASE [${database}]`); | ||
return {query, ...await client.exec({ query })}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters