pg-views.test.ts — drizzle-orm Source File
Architecture documentation for pg-views.test.ts, a typescript file in the drizzle-orm codebase. 5 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR fa42e115_d4b9_8a0a_eb46_94fcf2505f1a["pg-views.test.ts"] fb6b4a65_030b_ce6b_df0d_2be21adcd2b3["schemaDiffer.ts"] fa42e115_d4b9_8a0a_eb46_94fcf2505f1a --> fb6b4a65_030b_ce6b_df0d_2be21adcd2b3 c00494ea_6230_22b6_9b91_d37781a8ac08["diffTestSchemas"] fa42e115_d4b9_8a0a_eb46_94fcf2505f1a --> c00494ea_6230_22b6_9b91_d37781a8ac08 690f7dfc_0aea_9ee8_d6e7_26bbb3689031["drizzle-orm"] fa42e115_d4b9_8a0a_eb46_94fcf2505f1a --> 690f7dfc_0aea_9ee8_d6e7_26bbb3689031 53497908_16e7_977d_e97d_7414884a88a6["pg-core"] fa42e115_d4b9_8a0a_eb46_94fcf2505f1a --> 53497908_16e7_977d_e97d_7414884a88a6 8d35eaf2_a542_cfd4_fa1a_fafca0f02686["vitest"] fa42e115_d4b9_8a0a_eb46_94fcf2505f1a --> 8d35eaf2_a542_cfd4_fa1a_fafca0f02686 style fa42e115_d4b9_8a0a_eb46_94fcf2505f1a fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import { sql } from 'drizzle-orm';
import { integer, pgMaterializedView, pgSchema, pgTable, pgView } from 'drizzle-orm/pg-core';
import { expect, test } from 'vitest';
import { diffTestSchemas } from './schemaDiffer';
test('create table and view #1', async () => {
const users = pgTable('users', {
id: integer('id').primaryKey().notNull(),
});
const to = {
users: users,
view: pgView('some_view').as((qb) => qb.select().from(users)),
};
const { statements, sqlStatements } = await diffTestSchemas({}, to, []);
expect(statements.length).toBe(2);
expect(statements[0]).toStrictEqual({
type: 'create_table',
tableName: 'users',
schema: '',
columns: [{
name: 'id',
notNull: true,
primaryKey: true,
type: 'integer',
}],
compositePKs: [],
uniqueConstraints: [],
isRLSEnabled: false,
compositePkName: '',
checkConstraints: [],
policies: [],
});
expect(statements[1]).toStrictEqual({
type: 'create_view',
name: 'some_view',
definition: `select "id" from "users"`,
schema: 'public',
with: undefined,
materialized: false,
tablespace: undefined,
using: undefined,
withNoData: false,
});
expect(sqlStatements.length).toBe(2);
expect(sqlStatements[0]).toBe(`CREATE TABLE "users" (
\t"id" integer PRIMARY KEY NOT NULL
);\n`);
expect(sqlStatements[1]).toBe(`CREATE VIEW "public"."some_view" AS (select "id" from "users");`);
});
test('create table and view #2', async () => {
const users = pgTable('users', {
id: integer('id').primaryKey().notNull(),
});
const to = {
users: users,
view: pgView('some_view', { id: integer('id') }).as(sql`SELECT * FROM ${users}`),
// ... (1870 more lines)
Domain
Dependencies
- diffTestSchemas
- drizzle-orm
- pg-core
- schemaDiffer.ts
- vitest
Source
Frequently Asked Questions
What does pg-views.test.ts do?
pg-views.test.ts is a source file in the drizzle-orm codebase, written in typescript. It belongs to the DrizzleORM domain.
What does pg-views.test.ts depend on?
pg-views.test.ts imports 5 module(s): diffTestSchemas, drizzle-orm, pg-core, schemaDiffer.ts, vitest.
Where is pg-views.test.ts in the architecture?
pg-views.test.ts is located at drizzle-kit/tests/pg-views.test.ts (domain: DrizzleORM, directory: drizzle-kit/tests).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free