cleanups
This commit is contained in:
53
README.md
53
README.md
@@ -33,3 +33,56 @@ UPDATE calendar_objects SET path = regexp_replace(path, '/old/', '/new/')' WHERE
|
||||
```sql
|
||||
select id, path, linecut from calendar_objects, LATERAL regexp_split_to_table(data, E'\r\n') AS linecut where linecut ~ 'CLASS';
|
||||
```
|
||||
|
||||
|
||||
---
|
||||
|
||||
# Helpers
|
||||
|
||||
## Prerequisites
|
||||
The scripts require psycopg2 (or psycopg2-binary) and PyYAML.
|
||||
|
||||
```shell
|
||||
pip install psycopg2-binary pyyaml
|
||||
```
|
||||
|
||||
## Exporting Events
|
||||
The `export_events.py` script extracts events from the database and saves them as `.ics` files in a structured directory format: `username/calendarID/filename.ics`.
|
||||
|
||||
### Examples:
|
||||
- Export everything:
|
||||
```shell
|
||||
python export_events.py --output ./my_backup
|
||||
```
|
||||
|
||||
- Export only one user:
|
||||
```shell
|
||||
python export_events.py --user alice --output ./alice_backup
|
||||
```
|
||||
|
||||
- Export a specific calendar:
|
||||
```shell
|
||||
python export_events.py --user alice --calendar preservation --output ./preservation_backup
|
||||
```
|
||||
|
||||
|
||||
## Importing Events
|
||||
The `import_events.py` script uploads events back into the database. It can either walk a structured directory (like the one created by the export script) or upload a flat directory of files to a specific target calendar.
|
||||
|
||||
### Examples:
|
||||
- Restore everything from a backup:
|
||||
```shell
|
||||
python import_events.py --input ./my_backup
|
||||
```
|
||||
|
||||
- Upload a directory of .ics files to a specific calendar:
|
||||
```shell
|
||||
python import_events.py --input ./some_events/ --user alice --calendar work
|
||||
```
|
||||
|
||||
- Upload a single file to a specific calendar:
|
||||
```shell
|
||||
python import_events.py --input ./event.ics --user bob --calendar bob
|
||||
```
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user