Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
f90324c
feat: added ability to copy table schema & query (filters or without …
Rudra-Sankha-Sinhamahapatra Dec 31, 2025
e9e365e
fix: using cn
Rudra-Sankha-Sinhamahapatra Dec 31, 2025
877bc49
feat: adds enum support & added parsing for special char or hypens ta…
Rudra-Sankha-Sinhamahapatra Jan 2, 2026
ffd302b
feat: add label property to columns and update related components for…
letstri Jan 2, 2026
8f57b15
feat: refactor copy dialog to use tabs for format selection and updat…
letstri Jan 2, 2026
f56bb17
feat: adds data types support and added size calculation on columns
Rudra-Sankha-Sinhamahapatra Jan 2, 2026
2423a7d
feat: adds foreign key support
Rudra-Sankha-Sinhamahapatra Jan 2, 2026
4e9eb62
fix: merge conflicts
Rudra-Sankha-Sinhamahapatra Jan 6, 2026
09dd7ef
Merge branch 'main' of https://github.com/wannabespace/conar into fea…
letstri Jan 6, 2026
4fed82d
fix: query formatting, prisma where, syntaxes, added mappings
Rudra-Sankha-Sinhamahapatra Jan 7, 2026
255c557
refactor: removed eslint expect error
Rudra-Sankha-Sinhamahapatra Jan 7, 2026
1863f6c
chore: merge with main
Rudra-Sankha-Sinhamahapatra Jan 7, 2026
207542f
Merge branch 'main' of https://github.com/wannabespace/conar into fea…
Rudra-Sankha-Sinhamahapatra Jan 8, 2026
fa1aebf
Merge branch 'main' of https://github.com/wannabespace/conar into fea…
Rudra-Sankha-Sinhamahapatra Jan 8, 2026
75b365b
refactor: merge with main
Rudra-Sankha-Sinhamahapatra Jan 10, 2026
3803285
fix: merge conflicts
Rudra-Sankha-Sinhamahapatra Jan 23, 2026
2583117
Merge branch 'main' of https://github.com/wannabespace/conar into fea…
Rudra-Sankha-Sinhamahapatra Jan 23, 2026
1ee614e
Merge branch 'main' of https://github.com/wannabespace/conar into fea…
Rudra-Sankha-Sinhamahapatra Jan 26, 2026
06c2a9c
Merge branch 'main' of https://github.com/wannabespace/conar into fea…
letstri Jan 26, 2026
8944ab6
fix: prisma 1 to many relationship
Rudra-Sankha-Sinhamahapatra Jan 26, 2026
4dc0687
feat: adds foreign key relationship on drizzle
Rudra-Sankha-Sinhamahapatra Jan 26, 2026
7b144d7
feat: added lengths for columns in zod and prisma
Rudra-Sankha-Sinhamahapatra Jan 26, 2026
ff850e9
feat: adds indexes support
Rudra-Sankha-Sinhamahapatra Jan 26, 2026
39e0041
refactor: moved generators to separate folders
Rudra-Sankha-Sinhamahapatra Jan 26, 2026
74194d4
feat: add change-case package and update sidebar link component
letstri Jan 26, 2026
3882b9c
refactor: streamline schema generation functions
letstri Jan 26, 2026
82e1097
fix: alignments of table structure and added null for ts
Rudra-Sankha-Sinhamahapatra Jan 27, 2026
7834dbe
fix: changing drizzle case to camelCase
Rudra-Sankha-Sinhamahapatra Jan 27, 2026
1760716
feat: adds camelCase to zod & ts schema
Rudra-Sankha-Sinhamahapatra Jan 27, 2026
c6cf086
refactor: replaced toPascalCase with pascalCase
Rudra-Sankha-Sinhamahapatra Jan 27, 2026
9d60380
Merge branch 'main' of https://github.com/wannabespace/conar into fea…
Rudra-Sankha-Sinhamahapatra Jan 28, 2026
ba825d2
fix: prisma model name & key conventions
Rudra-Sankha-Sinhamahapatra Jan 28, 2026
bbfc467
fix: handles drizzle for special cases
Rudra-Sankha-Sinhamahapatra Jan 28, 2026
be6af9b
fix: handles special case for ts,zod,kysely
Rudra-Sankha-Sinhamahapatra Jan 28, 2026
a218d0e
fix: using unknown for json type on fields of zod & ts
Rudra-Sankha-Sinhamahapatra Jan 28, 2026
a72f401
fix: moving definitions to bottom
Rudra-Sankha-Sinhamahapatra Jan 28, 2026
6f192b2
fix: zod import
Rudra-Sankha-Sinhamahapatra Jan 28, 2026
c6925d2
fix: prisma file structure spacing
Rudra-Sankha-Sinhamahapatra Jan 28, 2026
c1392c3
fix: revert back to correct sql enums position
Rudra-Sankha-Sinhamahapatra Jan 28, 2026
2c2a556
fix: prisma schema structue formattin
Rudra-Sankha-Sinhamahapatra Jan 28, 2026
b0ea8a6
Merge branch 'main' of https://github.com/wannabespace/conar into fea…
letstri Jan 28, 2026
a85ff49
refactor: improved copy functionality and refactor format handling
letstri Jan 28, 2026
e09e94f
refactor: enhance dialog structure and copy button integration
letstri Jan 28, 2026
1c3026f
Merge branch 'main' of https://github.com/wannabespace/conar into fea…
letstri Jan 29, 2026
fb2d7bd
refactor: reorganize Prisma filter value type and update max length n…
letstri Jan 29, 2026
9ffaa1a
refactor: update query generation functions to use destructured param…
letstri Jan 30, 2026
b21db98
Merge branch 'main' of https://github.com/wannabespace/conar into fea…
letstri Jan 30, 2026
ff35936
refactor(dialects): introduce cold dialects
letstri Jan 30, 2026
cb5d26d
refactor(generators): update query and schema functions
letstri Jan 30, 2026
88688d7
feat: adds db onUpdate CasCade,onDelete CasCade & 1 to 1 relationship
Rudra-Sankha-Sinhamahapatra Jan 30, 2026
f84a58e
fix: merge conflict
Rudra-Sankha-Sinhamahapatra Jan 30, 2026
8918c39
feat(schema): adds default and SERIAL for postgres
Rudra-Sankha-Sinhamahapatra Jan 30, 2026
8be8930
refactor(dialects): rename getColdKysely to getColdDialect for clarity
letstri Jan 31, 2026
033f1f6
Merge branch 'feat/copy-table-queryAndSchema' of https://github.com/w…
letstri Jan 31, 2026
3619ce6
refactor(generators): streamline enum handling in schema generation
letstri Jan 31, 2026
ada1a45
refactor(generators): update getColumnType to return 'any' as default…
letstri Jan 31, 2026
70f29aa
refactor(generators): enhance schema generation and type handling acr…
letstri Jan 31, 2026
de11555
refactor(generators): simplify type handling in schema generation by …
letstri Jan 31, 2026
3fbaa9d
refactor(generators): optimize schema generation by consolidating col…
letstri Jan 31, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions apps/desktop/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
"arktype": "catalog:",
"babel-plugin-react-compiler": "catalog:",
"better-auth": "catalog:",
"change-case": "catalog:",
"date-fns": "catalog:",
"drizzle-kit": "catalog:",
"drizzle-orm": "catalog:",
Expand Down
22 changes: 17 additions & 5 deletions apps/desktop/src/components/sidebar-link.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,29 @@ import type { ComponentProps } from 'react'
import { cn } from '@conar/ui/lib/utils'
import { Link } from '@tanstack/react-router'

const baseClasses = 'flex w-full items-center gap-2 rounded-md border px-2 py-1 text-sm'
const activeClasses = 'border-primary/20 bg-primary/10 text-primary hover:bg-primary/20'
const inactiveClasses = 'border-transparent text-foreground hover:bg-accent/30'

export function SidebarButton({ className, active, ...props }: ComponentProps<'button'> & { active?: boolean }) {
return (
<button
type="button"
className={cn(baseClasses, className, active ? activeClasses : inactiveClasses)}
{...props}
/>
)
}

export function SidebarLink({
className,
...props
}: LinkProps & Omit<ComponentProps<'a'>, 'children'>) {
return (
<Link
activeProps={{ className: 'border-primary/20 bg-primary/10 text-primary hover:bg-primary/20' }}
inactiveProps={{ className: 'border-transparent text-foreground hover:bg-accent/30' }}
className={cn(`
flex w-full items-center gap-2 rounded-md border px-2 py-1 text-sm
`, className)}
activeProps={{ className: activeClasses }}
inactiveProps={{ className: inactiveClasses }}
className={cn(baseClasses, className)}
{...props}
/>
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ export function TableCellTable({ schema, table, column, value }: { schema: strin
header: props => (
<TableHeaderCell
column={column}
resize={false}
{...props}
/>
),
Expand Down
10 changes: 9 additions & 1 deletion apps/desktop/src/entities/connection/components/table/utils.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,31 @@
export interface Column {
id: string
type?: string
type: string
label?: string
enum?: string
isArray?: boolean
isEditable?: boolean
isNullable?: boolean
maxLength?: number | null
precision?: number | null
scale?: number | null
unique?: string
primaryKey?: string
defaultValue?: string | null
foreign?: {
name: string
schema: string
table: string
column: string
onDelete?: string
onUpdate?: string
}
references?: {
name: string
schema: string
table: string
column: string
isUnique?: boolean
}[]
}

Expand Down
31 changes: 23 additions & 8 deletions apps/desktop/src/entities/connection/dialects/clickhouse/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { CompiledQuery, Dialect, Driver, QueryResult } from 'kysely'
import type { connections } from '~/drizzle'
import { type } from 'arktype'
import { MysqlQueryCompiler } from 'kysely'
import { DummyDriver, MysqlQueryCompiler } from 'kysely'
import { logSql } from '../../sql'

function escapeSqlString(v: string) {
Expand Down Expand Up @@ -86,19 +86,34 @@ function createDriver(connection: typeof connections.$inferSelect) {
} satisfies Driver
}

function clickhouseAdapter() {
return {
supportsCreateIfNotExists: false,
supportsTransactionalDdl: false,
supportsReturning: false,
acquireMigrationLock: async () => {},
releaseMigrationLock: async () => {},
}
}

export function clickhouseDialect(connection: typeof connections.$inferSelect) {
return {
createAdapter: () => ({
supportsCreateIfNotExists: false,
supportsTransactionalDdl: false,
supportsReturning: false,
acquireMigrationLock: async () => {},
releaseMigrationLock: async () => {},
}),
createAdapter: clickhouseAdapter,
createDriver: () => createDriver(connection),
createQueryCompiler: () => new MysqlQueryCompiler(),
createIntrospector: () => {
throw new Error('Not implemented')
},
} satisfies Dialect
}

export function clickhouseColdDialect() {
return {
createAdapter: clickhouseAdapter,
createDriver: () => new DummyDriver(),
createQueryCompiler: () => new MysqlQueryCompiler(),
createIntrospector: () => {
throw new Error('Not implemented')
},
} satisfies Dialect
}
19 changes: 15 additions & 4 deletions apps/desktop/src/entities/connection/dialects/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,25 @@ import type { Database as PostgresDatabase } from './postgres/schema'
import type { connections } from '~/drizzle'
import { memoize } from '@conar/shared/utils/helpers'
import { Kysely } from 'kysely'
import { clickhouseDialect } from './clickhouse'
import { mssqlDialect } from './mssql'
import { mysqlDialect } from './mysql'
import { postgresDialect } from './postgres'
import { clickhouseColdDialect, clickhouseDialect } from './clickhouse'
import { mssqlColdDialect, mssqlDialect } from './mssql'
import { mysqlColdDialect, mysqlDialect } from './mysql'
import { postgresColdDialect, postgresDialect } from './postgres'

const coldDialects = {
postgres: postgresColdDialect,
mysql: mysqlColdDialect,
clickhouse: clickhouseColdDialect,
mssql: mssqlColdDialect,
} satisfies Record<ConnectionType, () => unknown>

export const dialects = {
postgres: memoize((connection: typeof connections.$inferSelect) => new Kysely<PostgresDatabase>({ dialect: postgresDialect(connection) })),
mysql: memoize((connection: typeof connections.$inferSelect) => new Kysely<MysqlDatabase>({ dialect: mysqlDialect(connection) })),
clickhouse: memoize((connection: typeof connections.$inferSelect) => new Kysely<ClickhouseDatabase>({ dialect: clickhouseDialect(connection) })),
mssql: memoize((connection: typeof connections.$inferSelect) => new Kysely<MssqlDatabase>({ dialect: mssqlDialect(connection) })),
} satisfies Record<ConnectionType, (connection: typeof connections.$inferSelect) => unknown>

export function getColdDialect(dialect: ConnectionType) {
return new Kysely<Record<string, Record<string, unknown>>>({ dialect: coldDialects[dialect]() })
}
13 changes: 12 additions & 1 deletion apps/desktop/src/entities/connection/dialects/mssql/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import type {
SelectQueryNode,
} from 'kysely'
import type { connections } from '~/drizzle'
import { MssqlQueryCompiler as DefaultMssqlQueryCompiler, MssqlAdapter } from 'kysely'
import { MssqlQueryCompiler as DefaultMssqlQueryCompiler, DummyDriver, MssqlAdapter } from 'kysely'
import { logSql } from '../../sql'

function isSelectQueryNode(node: OperationNode): node is SelectQueryNode {
Expand Down Expand Up @@ -98,3 +98,14 @@ export function mssqlDialect(connection: typeof connections.$inferSelect) {
},
} satisfies Dialect
}

export function mssqlColdDialect() {
return {
createDriver: () => new DummyDriver(),
createQueryCompiler: () => new MssqlQueryCompiler(),
createAdapter: () => new MssqlAdapter(),
createIntrospector: () => {
throw new Error('Not implemented')
},
} satisfies Dialect
}
13 changes: 12 additions & 1 deletion apps/desktop/src/entities/connection/dialects/mysql/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { CompiledQuery, Dialect, Driver, QueryResult } from 'kysely'
import type { connections } from '~/drizzle'
import { MysqlAdapter, MysqlQueryCompiler } from 'kysely'
import { DummyDriver, MysqlAdapter, MysqlQueryCompiler } from 'kysely'
import { logSql } from '../../sql'

function execute(connection: typeof connections.$inferSelect, compiledQuery: CompiledQuery) {
Expand Down Expand Up @@ -57,3 +57,14 @@ export function mysqlDialect(connection: typeof connections.$inferSelect) {
},
} satisfies Dialect
}

export function mysqlColdDialect() {
return {
createDriver: () => new DummyDriver(),
createQueryCompiler: () => new MysqlQueryCompiler(),
createAdapter: () => new MysqlAdapter(),
createIntrospector: () => {
throw new Error('Not implemented')
},
} satisfies Dialect
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export interface InformationSchema {
TABLE_CONSTRAINTS: TableConstraints
KEY_COLUMN_USAGE: KeyColumnUsage
STATISTICS: Statistics
REFERENTIAL_CONSTRAINTS: ReferentialConstraints
}

/**
Expand Down Expand Up @@ -129,3 +130,21 @@ interface Statistics {
COLUMN_NAME: string
NON_UNIQUE: number
}

/**
* @name REFERENTIAL_CONSTRAINTS
* @type table
*/
interface ReferentialConstraints {
CONSTRAINT_CATALOG: string
CONSTRAINT_SCHEMA: string
CONSTRAINT_NAME: string
UNIQUE_CONSTRAINT_CATALOG: string
UNIQUE_CONSTRAINT_SCHEMA: string
UNIQUE_CONSTRAINT_NAME: string
MATCH_OPTION: string
UPDATE_RULE: string
DELETE_RULE: string
TABLE_NAME: string
REFERENCED_TABLE_NAME: string
}
13 changes: 12 additions & 1 deletion apps/desktop/src/entities/connection/dialects/postgres/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { CompiledQuery, Dialect, Driver, QueryResult } from 'kysely'
import type { connections } from '~/drizzle'
import { PostgresAdapter, PostgresQueryCompiler } from 'kysely'
import { DummyDriver, PostgresAdapter, PostgresQueryCompiler } from 'kysely'
import { logSql } from '../../sql'

function execute(connection: typeof connections.$inferSelect, compiledQuery: CompiledQuery) {
Expand Down Expand Up @@ -57,3 +57,14 @@ export function postgresDialect(connection: typeof connections.$inferSelect) {
},
} satisfies Dialect
}

export function postgresColdDialect() {
return {
createDriver: () => new DummyDriver(),
createQueryCompiler: () => new PostgresQueryCompiler(),
createAdapter: () => new PostgresAdapter(),
createIntrospector: () => {
throw new Error('Not implemented')
},
} satisfies Dialect
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export interface InformationSchema {
table_constraints: TableConstraints
constraint_column_usage: ConstraintColumnUsage
key_column_usage: KeyColumnUsage
referential_constraints: ReferentialConstraints
}

/**
Expand Down Expand Up @@ -126,3 +127,19 @@ interface KeyColumnUsage {
ordinal_position: number
position_in_unique_constraint: number | null
}

/**
* @name referential_constraints
* @type table
*/
interface ReferentialConstraints {
constraint_catalog: string
constraint_schema: string
constraint_name: string
unique_constraint_catalog: string
unique_constraint_schema: string
unique_constraint_name: string
match_option: 'NONE' | 'PARTIAL' | 'FULL'
update_rule: 'CASCADE' | 'SET NULL' | 'SET DEFAULT' | 'RESTRICT' | 'NO ACTION'
delete_rule: 'CASCADE' | 'SET NULL' | 'SET DEFAULT' | 'RESTRICT' | 'NO ACTION'
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import type { GeneratorFormat } from './utils'
import { ConnectionType } from '@conar/shared/enums/connection-type'

export const GENERATOR_COMPATIBILITY: Partial<Record<GeneratorFormat, ConnectionType[]>> = {
prisma: [ConnectionType.Postgres, ConnectionType.MySQL, ConnectionType.MSSQL],
drizzle: [ConnectionType.Postgres, ConnectionType.MySQL, ConnectionType.MSSQL, ConnectionType.ClickHouse],
kysely: [ConnectionType.Postgres, ConnectionType.MySQL, ConnectionType.MSSQL, ConnectionType.ClickHouse],
}
Loading