Home / File/ xata-http.test.ts — drizzle-orm Source File

xata-http.test.ts — drizzle-orm Source File

Architecture documentation for xata-http.test.ts, a typescript file in the drizzle-orm codebase. 15 imports, 0 dependents.

Entity Profile

Dependency Diagram

graph LR
  85a6bb38_0ea0_ecd2_3cef_0f7896a9377a["xata-http.test.ts"]
  32b10e56_2f8e_a70c_6ee5_0beb1b41cd3a["xata.ts"]
  85a6bb38_0ea0_ecd2_3cef_0f7896a9377a --> 32b10e56_2f8e_a70c_6ee5_0beb1b41cd3a
  1893c74d_2a3f_e639_9d4a_52372ddb756d["getXataClient"]
  85a6bb38_0ea0_ecd2_3cef_0f7896a9377a --> 1893c74d_2a3f_e639_9d4a_52372ddb756d
  d133ab06_e39e_bce4_90ee_a55144ce75c2["pg-common.ts"]
  85a6bb38_0ea0_ecd2_3cef_0f7896a9377a --> d133ab06_e39e_bce4_90ee_a55144ce75c2
  d4e96821_5055_cb66_dd7b_f89dd0f8d0a0["tests"]
  85a6bb38_0ea0_ecd2_3cef_0f7896a9377a --> d4e96821_5055_cb66_dd7b_f89dd0f8d0a0
  7b6fdfe3_d9a8_26c3_430d_2261b1d7aadb["pg-common-cache.ts"]
  85a6bb38_0ea0_ecd2_3cef_0f7896a9377a --> 7b6fdfe3_d9a8_26c3_430d_2261b1d7aadb
  76da0078_4d8f_9615_8689_c44d597d58dc["TestCache"]
  85a6bb38_0ea0_ecd2_3cef_0f7896a9377a --> 76da0078_4d8f_9615_8689_c44d597d58dc
  d43d88d6_c6b6_386d_d59b_76b8db53bf29["TestGlobalCache"]
  85a6bb38_0ea0_ecd2_3cef_0f7896a9377a --> d43d88d6_c6b6_386d_d59b_76b8db53bf29
  cad5819d_2851_9c06_9778_62eb6e1b2dab["async-retry"]
  85a6bb38_0ea0_ecd2_3cef_0f7896a9377a --> cad5819d_2851_9c06_9778_62eb6e1b2dab
  690f7dfc_0aea_9ee8_d6e7_26bbb3689031["drizzle-orm"]
  85a6bb38_0ea0_ecd2_3cef_0f7896a9377a --> 690f7dfc_0aea_9ee8_d6e7_26bbb3689031
  53497908_16e7_977d_e97d_7414884a88a6["pg-core"]
  85a6bb38_0ea0_ecd2_3cef_0f7896a9377a --> 53497908_16e7_977d_e97d_7414884a88a6
  2c586f00_3a27_0659_5f6f_2e7797810986["xata-http"]
  85a6bb38_0ea0_ecd2_3cef_0f7896a9377a --> 2c586f00_3a27_0659_5f6f_2e7797810986
  41bcb336_356f_e5b6_cee6_66309367cad2["migrator"]
  85a6bb38_0ea0_ecd2_3cef_0f7896a9377a --> 41bcb336_356f_e5b6_cee6_66309367cad2
  8d35eaf2_a542_cfd4_fa1a_fafca0f02686["vitest"]
  85a6bb38_0ea0_ecd2_3cef_0f7896a9377a --> 8d35eaf2_a542_cfd4_fa1a_fafca0f02686
  5536e6a8_02de_67a7_6eaf_0fd73c9c2d92["common"]
  85a6bb38_0ea0_ecd2_3cef_0f7896a9377a --> 5536e6a8_02de_67a7_6eaf_0fd73c9c2d92
  style 85a6bb38_0ea0_ecd2_3cef_0f7896a9377a fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import retry from 'async-retry';
import { sql } from 'drizzle-orm';
import { pgTable, serial, timestamp } from 'drizzle-orm/pg-core';
import { drizzle } from 'drizzle-orm/xata-http';
import type { XataHttpClient, XataHttpDatabase } from 'drizzle-orm/xata-http';
import { migrate } from 'drizzle-orm/xata-http/migrator';
import { beforeAll, beforeEach, expect, test } from 'vitest';
import { skipTests } from '~/common';
import { randomString } from '~/utils';
import { getXataClient } from '../xata/xata.ts';
import { tests, tests as cacheTests, usersMigratorTable, usersTable } from './pg-common';
import { TestCache, TestGlobalCache } from './pg-common-cache.ts';

const ENABLE_LOGGING = false;

let db: XataHttpDatabase;
let dbGlobalCached: XataHttpDatabase;
let cachedDb: XataHttpDatabase;
let client: XataHttpClient;

beforeAll(async () => {
	const apiKey = process.env['XATA_API_KEY'];
	if (!apiKey) {
		throw new Error('XATA_API_KEY is not defined');
	}

	client = await retry(async () => {
		client = getXataClient();
		return client;
	}, {
		retries: 20,
		factor: 1,
		minTimeout: 250,
		maxTimeout: 250,
		randomize: false,
	});
	db = drizzle(client, { logger: ENABLE_LOGGING });
	cachedDb = drizzle(client, { logger: ENABLE_LOGGING, cache: new TestCache() });
	dbGlobalCached = drizzle(client, { logger: ENABLE_LOGGING, cache: new TestGlobalCache() });
});

beforeEach((ctx) => {
	ctx.pg = {
		db,
	};
	ctx.cachedPg = {
		db: cachedDb,
		dbGlobalCached,
	};
});

test('migrator : default migration strategy', async () => {
	await db.execute(sql`drop table if exists all_columns`);
	await db.execute(sql`drop table if exists users12`);
	await db.execute(sql`drop table if exists "drizzle"."__drizzle_migrations"`);

	await migrate(db, { migrationsFolder: './drizzle2/pg' });

	await db.insert(usersMigratorTable).values({ name: 'John', email: 'email' });

// ... (376 more lines)

Domain

Dependencies

Frequently Asked Questions

What does xata-http.test.ts do?
xata-http.test.ts is a source file in the drizzle-orm codebase, written in typescript. It belongs to the DrizzleORM domain.
What does xata-http.test.ts depend on?
xata-http.test.ts imports 15 module(s): TestCache, TestGlobalCache, async-retry, common, drizzle-orm, getXataClient, migrator, pg-common-cache.ts, and 7 more.
Where is xata-http.test.ts in the architecture?
xata-http.test.ts is located at integration-tests/tests/pg/xata-http.test.ts (domain: DrizzleORM, directory: integration-tests/tests/pg).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free