Home / File/ pg-role.test.ts — drizzle-orm Source File

pg-role.test.ts — drizzle-orm Source File

Architecture documentation for pg-role.test.ts, a typescript file in the drizzle-orm codebase. 3 imports, 0 dependents.

File typescript 3 imports

Entity Profile

Dependency Diagram

graph LR
  2202781a_1420_2a00_a947_9b34d9dbecb9["pg-role.test.ts"]
  53497908_16e7_977d_e97d_7414884a88a6["pg-core"]
  2202781a_1420_2a00_a947_9b34d9dbecb9 --> 53497908_16e7_977d_e97d_7414884a88a6
  2080849e_169d_739e_1ba9_1396fc229951["schemaDiffer"]
  2202781a_1420_2a00_a947_9b34d9dbecb9 --> 2080849e_169d_739e_1ba9_1396fc229951
  8d35eaf2_a542_cfd4_fa1a_fafca0f02686["vitest"]
  2202781a_1420_2a00_a947_9b34d9dbecb9 --> 8d35eaf2_a542_cfd4_fa1a_fafca0f02686
  style 2202781a_1420_2a00_a947_9b34d9dbecb9 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import { pgRole } from 'drizzle-orm/pg-core';
import { diffTestSchemas } from 'tests/schemaDiffer';
import { expect, test } from 'vitest';

test('create role', async (t) => {
	const schema1 = {};

	const schema2 = {
		manager: pgRole('manager'),
	};

	const { statements, sqlStatements } = await diffTestSchemas(schema1, schema2, []);

	expect(sqlStatements).toStrictEqual(['CREATE ROLE "manager";']);
	expect(statements).toStrictEqual([
		{
			name: 'manager',
			type: 'create_role',
			values: {
				createDb: false,
				createRole: false,
				inherit: true,
			},
		},
	]);
});

test('create role with properties', async (t) => {
	const schema1 = {};

	const schema2 = {
		manager: pgRole('manager', { createDb: true, inherit: false, createRole: true }),
	};

	const { statements, sqlStatements } = await diffTestSchemas(schema1, schema2, []);

	expect(sqlStatements).toStrictEqual(['CREATE ROLE "manager" WITH CREATEDB CREATEROLE NOINHERIT;']);
	expect(statements).toStrictEqual([
		{
			name: 'manager',
			type: 'create_role',
			values: {
				createDb: true,
				createRole: true,
				inherit: false,
			},
		},
	]);
});

test('create role with some properties', async (t) => {
	const schema1 = {};

	const schema2 = {
		manager: pgRole('manager', { createDb: true, inherit: false }),
	};

	const { statements, sqlStatements } = await diffTestSchemas(schema1, schema2, []);

	expect(sqlStatements).toStrictEqual(['CREATE ROLE "manager" WITH CREATEDB NOINHERIT;']);
// ... (175 more lines)

Dependencies

  • pg-core
  • schemaDiffer
  • vitest

Frequently Asked Questions

What does pg-role.test.ts do?
pg-role.test.ts is a source file in the drizzle-orm codebase, written in typescript.
What does pg-role.test.ts depend on?
pg-role.test.ts imports 3 module(s): pg-core, schemaDiffer, vitest.
Where is pg-role.test.ts in the architecture?
pg-role.test.ts is located at drizzle-kit/tests/rls/pg-role.test.ts (directory: drizzle-kit/tests/rls).

Analyze Your Own Codebase

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

Try Supermodel Free