Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ Constants are in `constants/mod.rs`. Errors are `AppError` (`error.rs`), which r
The PostgreSQL dialog always lists versions 18 to 12 (`PG_TOOL_VERSIONS`). The app never installs a tool:
a missing version shows an install guide for the platform (`PgInstallGuide`). `open_link` opens only the guide links (`GUIDE_LINKS`).
- PostgreSQL only (`PgToolDialog.vue`): the user picks plain SQL or custom format (`--format=custom`, a
`.dump` file) and the pg_dump version. `DumpRepository::pg_tools` lists the installed versions
`.dump` file, the default each time the dialog opens) and the pg_dump version. `DumpRepository::pg_tools` lists the installed versions
(`--version`). The default is the server version (`SHOW server_version_num`), else the newest.
- `restore_dump` loads a `.dump` file with `pg_restore --no-owner --no-privileges` into the current
database, optionally with `--clean --if-exists`. It uses the same progress, cancel map and `DumpLog`.
Expand Down
10 changes: 9 additions & 1 deletion src/components/PgToolDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { confirm, save } from '@tauri-apps/plugin-dialog'
import { PG_INSTALL_GUIDE, injectRequired } from '../services/keys'
import type { GuideLink, GuideStep } from '../services/PgInstallGuide'
import { PgToolLoader, type PgToolChoice } from '../services/PgToolChoice'
import { PG_BACKUP_CUSTOM_DEFAULT } from '../constants/pgTools'
import type { Session } from '../services/Session'

// The PostgreSQL backup and restore dialog: the format of a backup, the pg_dump or
Expand All @@ -12,7 +13,13 @@ import type { Session } from '../services/Session'
const props = defineProps<{ session: Session }>()
const guide = injectRequired(PG_INSTALL_GUIDE)
const dialog = useTemplateRef<HTMLDialogElement>('dialog')
const form = reactive({ restoring: false, path: '', custom: false, clean: false, problem: '' })
const form = reactive({
restoring: false,
path: '',
custom: PG_BACKUP_CUSTOM_DEFAULT,
clean: false,
problem: '',
})
const choice = ref<PgToolChoice | null>(null)
const loader = new PgToolLoader()
const checking = ref(false)
Expand All @@ -29,6 +36,7 @@ function openRestore(path: string): Promise<void> {
async function show(restoring: boolean, path: string): Promise<void> {
form.restoring = restoring
form.path = path
form.custom = PG_BACKUP_CUSTOM_DEFAULT
form.clean = false
choice.value = null
dialog.value?.showModal()
Expand Down
3 changes: 3 additions & 0 deletions src/constants/pgTools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,6 @@ export const PG_WINDOWS_DOWNLOAD_URL = 'https://www.postgresql.org/download/wind

/** `navigator.platform` of Windows matches this. */
export const WINDOWS_PLATFORM_PATTERN = /win/i

/** The backup dialog starts on the custom format (.dump). It is smaller and pg_restore loads it faster. */
export const PG_BACKUP_CUSTOM_DEFAULT = true
Loading