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
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,17 @@ func (uc *CreatePostgresqlBackupUsecase) buildPgDumpArgs(pg *pgtypes.PostgresqlD
"--verbose",
}

// Add schema filters if specified
if pg.Schemas != nil && *pg.Schemas != "" {
schemas := strings.Split(*pg.Schemas, ",")
for _, schema := range schemas {
schema = strings.TrimSpace(schema)
if schema != "" {
args = append(args, "--schema", schema)
}
}
}

compressionArgs := uc.getCompressionArgs(pg.Version)
return append(args, compressionArgs...)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ type PostgresqlDatabase struct {
Password string `json:"password" gorm:"type:text;not null"`
Database *string `json:"database" gorm:"type:text"`
IsHttps bool `json:"isHttps" gorm:"type:boolean;default:false"`
Schemas *string `json:"schemas" gorm:"type:text"`
}

func (p *PostgresqlDatabase) TableName() string {
Expand Down Expand Up @@ -85,6 +86,7 @@ func (p *PostgresqlDatabase) Update(incoming *PostgresqlDatabase) {
p.Username = incoming.Username
p.Database = incoming.Database
p.IsHttps = incoming.IsHttps
p.Schemas = incoming.Schemas

if incoming.Password != "" {
p.Password = incoming.Password
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,17 @@ func (uc *RestorePostgresqlBackupUsecase) Execute(
"--no-acl", // Skip restoring access privileges (GRANT/REVOKE commands)
}

// Add schema filters if specified
if pg.Schemas != nil && *pg.Schemas != "" {
schemas := strings.Split(*pg.Schemas, ",")
for _, schema := range schemas {
schema = strings.TrimSpace(schema)
if schema != "" {
args = append(args, "--schema", schema)
}
}
}

return uc.restoreFromStorage(
originalDB,
tools.GetPostgresqlExecutable(
Expand Down
15 changes: 15 additions & 0 deletions backend/migrations/20251210053223_add_schemas_column.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
-- +goose Up
-- +goose StatementBegin

ALTER TABLE postgresql_databases
ADD COLUMN schemas TEXT;

-- +goose StatementEnd

-- +goose Down
-- +goose StatementBegin

ALTER TABLE postgresql_databases
DROP COLUMN IF EXISTS schemas;

-- +goose StatementEnd
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ export interface PostgresqlDatabase {
password: string;
database?: string;
isHttps: boolean;
schemas?: string;
}
2 changes: 1 addition & 1 deletion frontend/src/features/backups/ui/BackupsComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -649,7 +649,7 @@ export const BackupsComponent = ({ database, isCanManageDBs, scrollContainerRef

{showingRestoresBackupId && (
<Modal
width={400}
width={420}
open={!!showingRestoresBackupId}
onCancel={() => setShowingRestoresBackupId(undefined)}
title="Restore from backup"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,32 @@ export const EditDatabaseSpecificDataComponent = ({
</div>
)}

<div className="mb-1 flex w-full items-center">
<div className="min-w-[150px]">Schemas</div>
<Input
value={editingDatabase.postgresql?.schemas}
onChange={(e) => {
if (!editingDatabase.postgresql) return;

setEditingDatabase({
...editingDatabase,
postgresql: { ...editingDatabase.postgresql, schemas: e.target.value.trim() },
});
setIsConnectionTested(false);
}}
size="small"
className="max-w-[200px] grow"
placeholder="public,myschema (optional)"
/>

<Tooltip
className="cursor-pointer"
title="Comma-separated list of schemas to include. Leave empty for all schemas."
>
<InfoCircleOutlined className="ml-2" style={{ color: 'gray' }} />
</Tooltip>
</div>

<div className="mb-3 flex w-full items-center">
<div className="min-w-[150px]">Use HTTPS</div>
<Switch
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ export const ShowDatabaseSpecificDataComponent = ({ database }: Props) => {
<div>{database.postgresql?.database || ''}</div>
</div>

<div className="mb-1 flex w-full items-center">
<div className="min-w-[150px]">Schemas</div>
<div>{database.postgresql?.schemas || 'All (full backup)'}</div>
</div>

<div className="mb-1 flex w-full items-center">
<div className="min-w-[150px]">Use HTTPS</div>
<div>{database.postgresql?.isHttps ? 'Yes' : 'No'}</div>
Expand Down
Loading