MCPcopy Create free account
hub / github.com/TanStack/db / createTestTables

Function createTestTables

packages/db-collection-e2e/src/fixtures/test-schema.ts:38–57  ·  view source on GitHub ↗
(
  dbClient: { query: (sql: string) => Promise<void> },
  tableNames: {
    users: string
    posts: string
    comments: string
  },
)

Source from the content-addressed store, hash-verified

36 * Helper to create all test tables
37 */
38export async function createTestTables(
39 dbClient: { query: (sql: string) => Promise<void> },
40 tableNames: {
41 users: string
42 posts: string
43 comments: string
44 },
45): Promise<void> {
46 await dbClient.query(`
47 CREATE TABLE IF NOT EXISTS ${tableNames.users} (${USERS_TABLE_SCHEMA});
48 `)
49
50 await dbClient.query(`
51 CREATE TABLE IF NOT EXISTS ${tableNames.posts} (${POSTS_TABLE_SCHEMA});
52 `)
53
54 await dbClient.query(`
55 CREATE TABLE IF NOT EXISTS ${tableNames.comments} (${COMMENTS_TABLE_SCHEMA});
56 `)
57}
58
59/**
60 * Helper to drop all test tables

Callers

nothing calls this directly

Calls 1

queryMethod · 0.45

Tested by

no test coverage detected