pum 1.2.2__tar.gz → 1.2.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. {pum-1.2.2 → pum-1.2.3}/PKG-INFO +1 -1
  2. {pum-1.2.2 → pum-1.2.3}/pum/cli.py +21 -2
  3. {pum-1.2.2 → pum-1.2.3}/pum/config_model.py +1 -1
  4. {pum-1.2.2 → pum-1.2.3}/pum.egg-info/PKG-INFO +1 -1
  5. {pum-1.2.2 → pum-1.2.3}/LICENSE +0 -0
  6. {pum-1.2.2 → pum-1.2.3}/README.md +0 -0
  7. {pum-1.2.2 → pum-1.2.3}/pum/__init__.py +0 -0
  8. {pum-1.2.2 → pum-1.2.3}/pum/changelog.py +0 -0
  9. {pum-1.2.2 → pum-1.2.3}/pum/checker.py +0 -0
  10. {pum-1.2.2 → pum-1.2.3}/pum/dependency_handler.py +0 -0
  11. {pum-1.2.2 → pum-1.2.3}/pum/dumper.py +0 -0
  12. {pum-1.2.2 → pum-1.2.3}/pum/exceptions.py +0 -0
  13. {pum-1.2.2 → pum-1.2.3}/pum/hook.py +0 -0
  14. {pum-1.2.2 → pum-1.2.3}/pum/info.py +0 -0
  15. {pum-1.2.2 → pum-1.2.3}/pum/parameter.py +0 -0
  16. {pum-1.2.2 → pum-1.2.3}/pum/pum_config.py +0 -0
  17. {pum-1.2.2 → pum-1.2.3}/pum/role_manager.py +0 -0
  18. {pum-1.2.2 → pum-1.2.3}/pum/schema_migrations.py +0 -0
  19. {pum-1.2.2 → pum-1.2.3}/pum/sql_content.py +0 -0
  20. {pum-1.2.2 → pum-1.2.3}/pum/upgrader.py +0 -0
  21. {pum-1.2.2 → pum-1.2.3}/pum.egg-info/SOURCES.txt +0 -0
  22. {pum-1.2.2 → pum-1.2.3}/pum.egg-info/dependency_links.txt +0 -0
  23. {pum-1.2.2 → pum-1.2.3}/pum.egg-info/entry_points.txt +0 -0
  24. {pum-1.2.2 → pum-1.2.3}/pum.egg-info/requires.txt +0 -0
  25. {pum-1.2.2 → pum-1.2.3}/pum.egg-info/top_level.txt +0 -0
  26. {pum-1.2.2 → pum-1.2.3}/pyproject.toml +0 -0
  27. {pum-1.2.2 → pum-1.2.3}/requirements/base.txt +0 -0
  28. {pum-1.2.2 → pum-1.2.3}/requirements/development.txt +0 -0
  29. {pum-1.2.2 → pum-1.2.3}/setup.cfg +0 -0
  30. {pum-1.2.2 → pum-1.2.3}/test/test_changelog.py +0 -0
  31. {pum-1.2.2 → pum-1.2.3}/test/test_config.py +0 -0
  32. {pum-1.2.2 → pum-1.2.3}/test/test_dumper.py +0 -0
  33. {pum-1.2.2 → pum-1.2.3}/test/test_roles.py +0 -0
  34. {pum-1.2.2 → pum-1.2.3}/test/test_schema_migrations.py +0 -0
  35. {pum-1.2.2 → pum-1.2.3}/test/test_upgrader.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pum
3
- Version: 1.2.2
3
+ Version: 1.2.3
4
4
  Summary: Pum stands for "Postgres Upgrades Manager". It is a Database migration management tool very similar to flyway-db or Liquibase, based on metadata tables.
5
5
  Author-email: Denis Rouzaud <denis@opengis.ch>
6
6
  License-Expression: GPL-2.0-or-later
@@ -279,6 +279,11 @@ def create_parser() -> argparse.ArgumentParser:
279
279
  parser_baseline.add_argument(
280
280
  "-b", "--baseline", help="Set baseline in the format x.x.x", required=True
281
281
  )
282
+ parser_baseline.add_argument(
283
+ "--create-table",
284
+ help="Create the pum_migrations table if it does not exist",
285
+ action="store_true",
286
+ )
282
287
 
283
288
  # Parser for the "upgrade" command
284
289
  parser_upgrade = subparsers.add_parser("upgrade", help="upgrade db")
@@ -307,10 +312,13 @@ def cli() -> int: # noqa: PLR0912
307
312
  parser.print_help()
308
313
  parser.exit()
309
314
 
315
+ validate = args.command not in ("info", "baseline")
310
316
  if args.config_file:
311
- config = PumConfig.from_yaml(args.config_file, install_dependencies=True)
317
+ config = PumConfig.from_yaml(args.config_file, validate=validate, install_dependencies=True)
312
318
  else:
313
- config = PumConfig.from_yaml(Path(args.dir) / ".pum.yaml", install_dependencies=True)
319
+ config = PumConfig.from_yaml(
320
+ Path(args.dir) / ".pum.yaml", validate=validate, install_dependencies=True
321
+ )
314
322
 
315
323
  with psycopg.connect(f"service={args.pg_service}") as conn:
316
324
  # Check if the connection is successful
@@ -391,6 +399,17 @@ def cli() -> int: # noqa: PLR0912
391
399
  elif args.command == "restore":
392
400
  pum.run_restore(args.pg_service, args.file, args.x, args.exclude_schema)
393
401
  elif args.command == "baseline":
402
+ sm = SchemaMigrations(config=config)
403
+ if not sm.exists(connection=conn):
404
+ if args.create_table:
405
+ sm.create(connection=conn)
406
+ logger.info("Created pum_migrations table.")
407
+ else:
408
+ logger.error(
409
+ "pum_migrations table does not exist. Use --create-table to create it."
410
+ )
411
+ exit_code = 1
412
+ return exit_code
394
413
  SchemaMigrations(config=config).set_baseline(connection=conn, version=args.baseline)
395
414
 
396
415
  elif args.command == "upgrade":
@@ -72,7 +72,7 @@ class PumModel(PumCustomBaseModel):
72
72
  PumModel holds some PUM specifics.
73
73
 
74
74
  Attributes:
75
- migration_table_schema: Name of schema for the migration table.
75
+ migration_table_schema: Name of schema for the migration table. The table will always be named `pum_migrations`.
76
76
  minimum_version: Minimum required version of PUM.
77
77
  """
78
78
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pum
3
- Version: 1.2.2
3
+ Version: 1.2.3
4
4
  Summary: Pum stands for "Postgres Upgrades Manager". It is a Database migration management tool very similar to flyway-db or Liquibase, based on metadata tables.
5
5
  Author-email: Denis Rouzaud <denis@opengis.ch>
6
6
  License-Expression: GPL-2.0-or-later
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes