Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
2da5693
feat: fetch server databases
Rudra-Sankha-Sinhamahapatra Dec 19, 2025
7becb57
refactor: using useQuery & map
Rudra-Sankha-Sinhamahapatra Dec 20, 2025
c43c0cc
fix: database-list height issue
Rudra-Sankha-Sinhamahapatra Dec 20, 2025
56bea03
fix: merge with main
Rudra-Sankha-Sinhamahapatra Dec 21, 2025
e48c03a
Merge branch 'main' of https://github.com/wannabespace/conar into fea…
letstri Dec 22, 2025
b573321
Merge branch 'main' of https://github.com/wannabespace/conar into fea…
Rudra-Sankha-Sinhamahapatra Dec 22, 2025
a6f058b
fix: skip default databases
Rudra-Sankha-Sinhamahapatra Dec 22, 2025
fee20de
fix: show expand button only if database more than 0
Rudra-Sankha-Sinhamahapatra Dec 22, 2025
3031370
fix: merge conflicts
Rudra-Sankha-Sinhamahapatra Dec 25, 2025
4588070
fix: merge conflicts
Rudra-Sankha-Sinhamahapatra Jan 7, 2026
cbbc680
Merge branch 'main' of https://github.com/wannabespace/conar into fea…
Rudra-Sankha-Sinhamahapatra Jan 8, 2026
e11a6f5
Merge branch 'main' of https://github.com/wannabespace/conar into fea…
Rudra-Sankha-Sinhamahapatra Jan 8, 2026
11dbe23
Merge branch 'main' of https://github.com/wannabespace/conar into fea…
Rudra-Sankha-Sinhamahapatra Jan 8, 2026
34dc24f
refactor: merge with main
Rudra-Sankha-Sinhamahapatra Jan 10, 2026
5f0bc53
fix: merge conflicts
Rudra-Sankha-Sinhamahapatra Jan 23, 2026
5a3ebe0
fix: connection string false copy on toggle
Rudra-Sankha-Sinhamahapatra Jan 23, 2026
1e5fed0
refactor: made separate components for database-lists
Rudra-Sankha-Sinhamahapatra Jan 23, 2026
d4c2e37
fix: merge conflicts
Rudra-Sankha-Sinhamahapatra Jan 27, 2026
1808216
refactor: fixes merge conflict and refactor comp names
Rudra-Sankha-Sinhamahapatra Jan 28, 2026
ead5d2d
refactor: adds error handling and removed empty onKeyDown
Rudra-Sankha-Sinhamahapatra Jan 28, 2026
2862824
Merge branch 'main' of https://github.com/wannabespace/conar into fea…
Rudra-Sankha-Sinhamahapatra Jan 29, 2026
91bbee5
refactor: remove retry:5
Rudra-Sankha-Sinhamahapatra Jan 29, 2026
38de4de
fix: merge conflicts
Rudra-Sankha-Sinhamahapatra Jan 31, 2026
d60befc
Merge branch 'main' of https://github.com/wannabespace/conar into fea…
Rudra-Sankha-Sinhamahapatra Jan 31, 2026
01d23a3
refactor: remove clone connection
letstri Feb 2, 2026
f0cc3dd
Merge branch 'main' of https://github.com/wannabespace/conar into fea…
Rudra-Sankha-Sinhamahapatra Feb 4, 2026
80d4811
Merge branch 'feat/server-databases' of https://github.com/wannabespa…
Rudra-Sankha-Sinhamahapatra Feb 4, 2026
02bddef
Merge branch 'main' of https://github.com/wannabespace/conar into fea…
Rudra-Sankha-Sinhamahapatra Feb 8, 2026
a64d450
Merge branch 'main' of https://github.com/wannabespace/conar into fea…
Rudra-Sankha-Sinhamahapatra Feb 9, 2026
6b9f395
feat(connections): open server connections
Rudra-Sankha-Sinhamahapatra Feb 9, 2026
c23340d
fix: merge conflicts
Rudra-Sankha-Sinhamahapatra Feb 13, 2026
fb76135
Merge branch 'main' of https://github.com/wannabespace/conar into fea…
Rudra-Sankha-Sinhamahapatra Feb 16, 2026
54d662c
Merge branch 'main' of https://github.com/wannabespace/conar into fea…
Rudra-Sankha-Sinhamahapatra Feb 17, 2026
c9817b8
Merge branch 'main' of https://github.com/wannabespace/conar into fea…
letstri Feb 17, 2026
64fb19b
Merge branch 'main' of https://github.com/wannabespace/conar into fea…
Rudra-Sankha-Sinhamahapatra Feb 18, 2026
a0c625a
Merge branch 'main' of https://github.com/wannabespace/conar into fea…
Rudra-Sankha-Sinhamahapatra Feb 19, 2026
11d7b07
feat: implement resources
letstri Feb 23, 2026
a153d1f
Merge branch 'main' of https://github.com/wannabespace/conar into fea…
letstri Feb 23, 2026
74ed036
refactor: rename SQL references to query
letstri Feb 25, 2026
1cd2773
fix: clickhouse connections
letstri Feb 25, 2026
2fd673c
Merge branch 'main' of https://github.com/wannabespace/conar into fea…
letstri Feb 26, 2026
94d52e2
feat: new dashboard page
letstri Feb 26, 2026
30d6bc2
refactor: improve list
letstri Feb 27, 2026
0677cf8
Merge branch 'main' of https://github.com/wannabespace/conar into fea…
letstri Feb 27, 2026
82483fe
chore: update tanstack store
letstri Feb 27, 2026
b51e821
fix: lint error
Rudra-Sankha-Sinhamahapatra Mar 1, 2026
c5d4811
fix: rendering logic
Rudra-Sankha-Sinhamahapatra Mar 1, 2026
1deb49c
feat: add shadows on scroll
letstri Mar 6, 2026
5d66842
Merge branch 'feat/server-databases' of https://github.com/wannabespa…
letstri Mar 6, 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
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import type { WithSchema } from '../../../utils/types'
import type { InformationSchema } from './information'

import type { System } from './system'

export type Database = WithSchema<InformationSchema, 'information_schema'>
& WithSchema<System, 'system'>
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/**
* @name system
* @type schema
*/
export interface System {
databases: Databases
}

/**
* @name databases
* @type table
*/
interface Databases {
name: string
engine: string
data_path: string
metadata_path: string
uuid: string
comment: string
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import type { WithSchema } from '../../../utils/types'
import type { InformationSchema } from './information'

import type { Sys } from './sys'

export type Database = WithSchema<InformationSchema, 'information_schema'>
& WithSchema<Sys, 'sys'>
88 changes: 88 additions & 0 deletions apps/desktop/src/entities/database/dialects/mssql/schema/sys.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
/**
* @name sys
* @type schema
*/
export interface Sys {
databases: Databases
}

/**
* @name databases
* @type table
*/
interface Databases {
name: string
database_id: number
source_database_id: number | null
owner_sid: string
create_date: Date
compatibility_level: number
collation_name: string | null
user_access: number
user_access_desc: string | null
is_read_only: boolean
is_auto_shrink_on: boolean
state: number
state_desc: string | null
is_in_standby: boolean
is_cleanly_shutdown: boolean
is_supplemental_logging_enabled: boolean
snapshot_isolation_state: number
snapshot_isolation_state_desc: string | null
recovery_model: number
recovery_model_desc: string | null
page_verify_option: number
page_verify_option_desc: string | null
is_auto_create_stats_on: boolean
is_auto_update_stats_on: boolean
is_auto_update_stats_async_on: boolean
is_ansi_null_default_on: boolean
is_ansi_nulls_on: boolean
is_ansi_padding_on: boolean
is_ansi_warnings_on: boolean
is_arithabort_on: boolean
is_concat_null_yields_null_on: boolean
is_numeric_roundabort_on: boolean
is_quoted_identifier_on: boolean
is_recursive_triggers_on: boolean
is_cursor_close_on_commit_on: boolean
is_local_cursor_default: boolean
is_fulltext_enabled: boolean
is_trustworthy_on: boolean
is_db_chaining_on: boolean
is_parameterization_forced: boolean
is_master_key_encrypted_by_server: boolean
is_query_store_on: boolean
is_published: boolean
is_subscribed: boolean
is_merge_published: boolean
is_distributor: boolean
is_sync_with_backup: boolean
service_broker_guid: string
is_broker_enabled: boolean
log_reuse_wait: number
log_reuse_wait_desc: string | null
is_date_correlation_on: boolean
is_cdc_enabled: boolean
is_encrypted: boolean
is_honor_broker_priority_on: boolean
replica_id: string | null
group_database_id: string | null
resource_pool_id: number | null
default_language_lcid: number | null
default_language_name: string | null
default_fulltext_language_lcid: number | null
default_fulltext_language_name: string | null
is_nested_triggers_on: boolean | null
is_transform_noise_words_on: boolean | null
two_digit_year_cutoff: number | null
containment: number | null
containment_desc: string | null
target_recovery_time_in_seconds: number | null
delayed_durability: number | null
delayed_durability_desc: string | null
is_memory_optimized_elevate_to_snapshot_on: boolean | null
is_federation_member: boolean | null
is_remote_data_archive_enabled: boolean | null
is_mixed_page_allocation_on: boolean | null
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,19 @@ export interface InformationSchema {
VIEWS: Views
TABLE_CONSTRAINTS: TableConstraints
KEY_COLUMN_USAGE: KeyColumnUsage
SCHEMATA: Schemata
}

/**
* @name SCHEMATA
* @type table
*/
interface Schemata {
CATALOG_NAME: string
SCHEMA_NAME: string
DEFAULT_CHARACTER_SET_NAME: string
DEFAULT_COLLATION_NAME: string
SQL_PATH: string | null
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@
*/
export interface PgCatalog {
pg_namespace: PgNamespace
pg_database: PgDatabase
}

/**
* @name pg_database
* @type table
*/
interface PgDatabase {
datname: string
datistemplate: boolean
}

/**
Expand Down
66 changes: 66 additions & 0 deletions apps/desktop/src/entities/database/hooks/use-server-databases.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
import type { databases } from '~/drizzle'
import { DatabaseType } from '@conar/shared/enums/database-type'
import { SafeURL } from '@conar/shared/utils/safe-url'
import { useState } from 'react'
import { listDatabasesQuery } from '../sql/list-databases'

export function useServerDatabases(database: typeof databases.$inferSelect) {
const [isExpanded, setIsExpanded] = useState(false)
const [databasesList, setDatabasesList] = useState<string[]>([])
const [isLoading, setIsLoading] = useState(false)

const toggleExpand = async () => {
if (isExpanded) {
setIsExpanded(false)
return
}

setIsExpanded(true)

if (databasesList.length === 0) {
setIsLoading(true)
const url = new SafeURL(database.connectionString)

switch (database.type) {
case DatabaseType.Postgres:
Comment thread
Rudra-Sankha-Sinhamahapatra marked this conversation as resolved.
Outdated
url.pathname = 'postgres'
break
case DatabaseType.MySQL:
url.pathname = 'mysql'
break
case DatabaseType.MSSQL:
url.pathname = 'master'
break
case DatabaseType.ClickHouse:
url.pathname = 'default'
break
}

const systemDatabase = {
...database,
connectionString: url.toString(),
}

try {
const dbNames = await listDatabasesQuery.run(systemDatabase)
Comment thread
Rudra-Sankha-Sinhamahapatra marked this conversation as resolved.
Outdated
const currentDbName = new SafeURL(database.connectionString).pathname.replace(/^\//, '')
const otherDbs = dbNames.filter(name => name !== currentDbName)
setDatabasesList(otherDbs)
}
catch (err) {
console.error('Failed to list databases', err)
}
finally {
setIsLoading(false)
}
}
}

return {
isExpanded,
isLoading,
databasesList,
toggleExpand,
setIsExpanded,
}
}
2 changes: 2 additions & 0 deletions apps/desktop/src/entities/database/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
export * from './components/database-icon'
export * from './components/react-flow-node'
export * from './hooks/use-database-link-params'
export * from './hooks/use-server-databases'
export * from './lib/fetching'
export * from './lib/last-opened-databases'
export * from './queries/columns'
Expand All @@ -22,6 +23,7 @@ export * from './sql/set'
export * from './sql/tables-and-schemas'
export * from './sql/total'
export * from './store'
export * from './utils/clone-connection'
export * from './utils/helpers'
export * from './utils/sync'
export * from './utils/table'
38 changes: 38 additions & 0 deletions apps/desktop/src/entities/database/sql/list-databases.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import { type } from 'arktype'
import { createQuery } from '../query'

export const listDatabasesType = type('string[]')

export const listDatabasesQuery = createQuery({
type: listDatabasesType,
query: () => ({
postgres: db => db
.selectFrom('pg_catalog.pg_database')
.select('datname')
.where('datistemplate', '=', false)
.orderBy('datname')
.execute()
.then(rows => rows.map(r => r.datname)),

mysql: db => db
.selectFrom('information_schema.SCHEMATA')
.select('SCHEMA_NAME')
.orderBy('SCHEMA_NAME')
.execute()
.then(rows => rows.map(r => r.SCHEMA_NAME)),

mssql: db => db
.selectFrom('sys.databases')
.select('name')
.orderBy('name')
.execute()
.then(rows => rows.map(r => r.name)),

clickhouse: db => db
.selectFrom('system.databases')
.select('name')
.orderBy('name')
.execute()
.then(rows => rows.map(r => r.name)),
}),
})
20 changes: 20 additions & 0 deletions apps/desktop/src/entities/database/utils/clone-connection.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import type { databases } from '~/drizzle'
import { SafeURL } from '@conar/shared/utils/safe-url'
import { v7 } from 'uuid'

export function cloneConnectionForDatabase(
Comment thread
Rudra-Sankha-Sinhamahapatra marked this conversation as resolved.
Outdated
originalDatabase: typeof databases.$inferSelect,
newDatabaseName: string,
) {
const url = new SafeURL(originalDatabase.connectionString)
url.pathname = newDatabaseName

return {
...originalDatabase,
id: v7(),
name: newDatabaseName,
connectionString: url.toString(),
createdAt: new Date(),
updatedAt: new Date(),
} satisfies typeof databases.$inferSelect
}
Loading