Skip to content

Commit a4bb4aa

Browse files
committed
add export for 3.4/pg
1 parent 3247f27 commit a4bb4aa

File tree

7 files changed

+33
-20
lines changed

7 files changed

+33
-20
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# Changelog
22

3+
4+
## [0.4] - 2025-03-15
5+
6+
### Added
7+
8+
- Export method for Papermerge DMS 3.4 for postgres and sqlite3
9+
10+
311
## [0.3] - 2025-03-10
412

513
### Added

commands/exp/exp.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,17 @@ func PerformExport(settings config.Config, targetFile, exportYaml string) {
2727
switch settings.AppVersion {
2828
case string(types.V2_0):
2929
filePaths = exporter_app_v2_0.PerformExport(settings, targetFile, exportYaml)
30-
case string(types.V3_3):
31-
filePaths = exporter_app_v3_3.PerformExport(settings, targetFile, exportYaml)
3230
case string(types.V2_1):
3331
filePaths = exporter_app_v2_1.PerformExport(settings, targetFile, exportYaml)
3432
case string(types.V3_2):
3533
filePaths = exporter_app_v3_2.PerformExport(settings, targetFile, exportYaml)
34+
case string(types.V3_3), string(types.V3_4):
35+
filePaths = exporter_app_v3_3.PerformExport(settings, targetFile, exportYaml)
36+
3637
default:
3738
supported_versions := []types.AppVersion{
3839
types.V2_0, types.V2_1,
40+
types.V3_2, types.V3_3, types.V3_4,
3941
}
4042
fmt.Fprintf(os.Stderr, "Export for version %q not supported\n", settings.AppVersion)
4143
fmt.Fprintf(os.Stderr, "Supported versions are %v\n", supported_versions)

database/api.go

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ func GetUsers(db *types.DBConn) (any, error) {
3131
switch db.AppVersion {
3232
case types.V2_0:
3333
return database_app_v2_0.GetUsers(db)
34-
case types.V3_3:
34+
case types.V3_4, types.V3_3:
3535
return database_app_v3_3.GetUsers(db.DB)
3636
case types.V3_2:
3737
return database_app_v3_2.GetUsers(db.DB)
@@ -44,7 +44,7 @@ func GetUsers(db *types.DBConn) (any, error) {
4444

4545
func GetGroups(db *types.DBConn) (any, error) {
4646
switch db.AppVersion {
47-
case types.V3_3:
47+
case types.V3_4, types.V3_3:
4848
return database_app_v3_3.GetGroups(db)
4949
}
5050

@@ -53,7 +53,7 @@ func GetGroups(db *types.DBConn) (any, error) {
5353

5454
func GetPermissions(db *types.DBConn) (any, error) {
5555
switch db.AppVersion {
56-
case types.V3_3:
56+
case types.V3_3, types.V3_4:
5757
return database_app_v3_3.GetPermissions(db)
5858
}
5959

@@ -62,7 +62,7 @@ func GetPermissions(db *types.DBConn) (any, error) {
6262

6363
func GetGroupsPermissions(db *types.DBConn) (any, error) {
6464
switch db.AppVersion {
65-
case types.V3_3:
65+
case types.V3_3, types.V3_4:
6666
return database_app_v3_3.GetGroupsPermissions(db)
6767
}
6868

@@ -71,7 +71,7 @@ func GetGroupsPermissions(db *types.DBConn) (any, error) {
7171

7272
func GetDocumentTypes(db *types.DBConn) (any, error) {
7373
switch db.AppVersion {
74-
case types.V3_3:
74+
case types.V3_3, types.V3_4:
7575
return database_app_v3_3.GetDocumentTypes(db)
7676
}
7777

@@ -80,7 +80,7 @@ func GetDocumentTypes(db *types.DBConn) (any, error) {
8080

8181
func GetTags(db *types.DBConn) (any, error) {
8282
switch db.AppVersion {
83-
case types.V3_3:
83+
case types.V3_3, types.V3_4:
8484
return database_app_v3_3.GetTags(db)
8585
}
8686

@@ -89,7 +89,7 @@ func GetTags(db *types.DBConn) (any, error) {
8989

9090
func GetNodesTags(db *types.DBConn) (any, error) {
9191
switch db.AppVersion {
92-
case types.V3_3:
92+
case types.V3_3, types.V3_4:
9393
return database_app_v3_3.GetNodesTags(db)
9494
}
9595

@@ -98,7 +98,7 @@ func GetNodesTags(db *types.DBConn) (any, error) {
9898

9999
func GetUsersGroups(db *types.DBConn) (any, error) {
100100
switch db.AppVersion {
101-
case types.V3_3:
101+
case types.V3_3, types.V3_4:
102102
return database_app_v3_3.GetUsersGroups(db)
103103
}
104104

@@ -107,7 +107,7 @@ func GetUsersGroups(db *types.DBConn) (any, error) {
107107

108108
func GetUsersPermissions(db *types.DBConn) (any, error) {
109109
switch db.AppVersion {
110-
case types.V3_3:
110+
case types.V3_3, types.V3_4:
111111
return database_app_v3_3.GetUsersPermissions(db)
112112
}
113113

@@ -116,7 +116,7 @@ func GetUsersPermissions(db *types.DBConn) (any, error) {
116116

117117
func GetCustomFields(db *types.DBConn) (any, error) {
118118
switch db.AppVersion {
119-
case types.V3_3:
119+
case types.V3_3, types.V3_4:
120120
return database_app_v3_3.GetCustomFields(db)
121121
}
122122

@@ -125,7 +125,7 @@ func GetCustomFields(db *types.DBConn) (any, error) {
125125

126126
func GetDocumentTypesCustomFields(db *types.DBConn) (any, error) {
127127
switch db.AppVersion {
128-
case types.V3_3:
128+
case types.V3_3, types.V3_4:
129129
return database_app_v3_3.GetDocumentTypesCustomFields(db)
130130
}
131131

@@ -134,7 +134,7 @@ func GetDocumentTypesCustomFields(db *types.DBConn) (any, error) {
134134

135135
func GetCustomFieldValues(db *types.DBConn) (any, error) {
136136
switch db.AppVersion {
137-
case types.V3_3:
137+
case types.V3_3, types.V3_4:
138138
return database_app_v3_3.GetCustomFieldValues(db)
139139
}
140140

@@ -145,7 +145,7 @@ func GetHomeFlatNodes(db *types.DBConn, user_id interface{}) (interface{}, error
145145
switch db.AppVersion {
146146
case types.V2_0:
147147
return database_app_v2_0.GetHomeFlatNodes(db, user_id)
148-
case types.V3_3:
148+
case types.V3_3, types.V3_4:
149149
return database_app_v3_3.GetHomeFlatNodes(db, user_id)
150150
case types.V3_2:
151151
return database_app_v3_2.GetHomeFlatNodes(db, user_id)
@@ -160,7 +160,7 @@ func GetInboxFlatNodes(db *types.DBConn, user_id interface{}) (interface{}, erro
160160
switch db.AppVersion {
161161
case types.V2_0:
162162
return database_app_v2_0.GetInboxFlatNodes(db, user_id)
163-
case types.V3_3:
163+
case types.V3_3, types.V3_4:
164164
return database_app_v3_3.GetInboxFlatNodes(db, user_id)
165165
case types.V3_2:
166166
return database_app_v3_2.GetInboxFlatNodes(db, user_id)
@@ -175,7 +175,7 @@ func GetUserNodes(db *types.DBConn, user interface{}) error {
175175
switch db.AppVersion {
176176
case types.V2_0:
177177
return database_app_v2_0.GetUserNodes(db, &user)
178-
case types.V3_3:
178+
case types.V3_3, types.V3_4:
179179
return database_app_v3_3.GetUserNodes(db, &user)
180180
case types.V3_2:
181181
return database_app_v3_2.GetUserNodes(db, &user)
@@ -204,7 +204,7 @@ func InsertUsersData(db *types.DBConn, sourceUsers any, targetUsers any) ([]type
204204

205205
func InsertDocVersionsAndPages(db *types.DBConn, node any) error {
206206
switch db.AppVersion {
207-
case types.V3_3:
207+
case types.V3_3, types.V3_4:
208208
database_app_v3_3.InsertDocVersionsAndPages(db, node)
209209
case types.V3_2:
210210
database_app_v3_2.InsertDocVersionsAndPages(db, node)

examples/source_3_4_pg.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
media_root: /home/eugen/var/data-media-root
2+
database_url: postgresql://coco:jumbo@127.0.0.1:5432/pmgdb?sslmode=disable
3+
app_version: 3.4

exporter/exp.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ func CreateYAML(
1717
switch appVersion {
1818
case types.V2_0:
1919
return exporter_app_v2_0.CreateYAML(fileName, data)
20-
2120
case types.V3_3:
2221
return exporter_app_v3_3.CreateYAML(fileName, data)
2322
case types.V3_2:

pmdump.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99
"github.com/papermerge/pmdump/config"
1010
)
1111

12-
const PMDUMP_VERSION = "0.2"
12+
const PMDUMP_VERSION = "0.4"
1313

1414
var configFile = flag.String("c", "", "path to config file")
1515
var targetFile = flag.String("f", "", "Target file - zipped tar archive file name were to dump")

types/constants.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ var AppVersionsForExport = []AppVersion{
1717
V3_1,
1818
V3_2,
1919
V3_3,
20+
V3_4,
2021
}
2122

2223
const (

0 commit comments

Comments
 (0)