Skip to content

Commit

Permalink
feat: Revised implementation
Browse files Browse the repository at this point in the history
* Checked table object initialization order
* Added support end-to-end FK/PK references
  • Loading branch information
wwoytenko committed Nov 1, 2024
1 parent 40274fe commit 29f466f
Show file tree
Hide file tree
Showing 10 changed files with 323 additions and 103 deletions.
5 changes: 4 additions & 1 deletion internal/db/postgres/cmd/dump.go
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,9 @@ func (d *Dump) taskProducer(ctx context.Context, tasks chan<- dumpers.DumpTask)
var task dumpers.DumpTask
switch v := dumpObj.(type) {
case *entries.Table:
if v.RelKind == 'p' {
continue
}
task = dumpers.NewTableDumper(v, d.validate, d.validateRowsLimit, d.pgDumpOptions.Pgzip)
case *entries.Sequence:
task = dumpers.NewSequenceDumper(v)
Expand Down Expand Up @@ -355,7 +358,7 @@ func (d *Dump) setDumpDependenciesGraph(tables []*entries.Table) {
d.dumpDependenciesGraph = make(map[int32][]int32)
for _, oid := range sortedOids {
idx := slices.IndexFunc(tables, func(entry *entries.Table) bool {
return entry.Oid == oid
return entry.Oid == oid || entry.RootPtOid == oid
})
if idx == -1 {
panic(fmt.Sprintf("table not found: oid=%d", oid))
Expand Down
Loading

0 comments on commit 29f466f

Please sign in to comment.