Skip to content

Commit

Permalink
Fixes related to SingleDB destroy command
Browse files Browse the repository at this point in the history
  • Loading branch information
littleK0i committed Mar 21, 2024
1 parent 6518523 commit a5c7f28
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 5 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## [0.25.1] - 2024-03-21

- Prevent SingleDB mode from asking for `--destroy-without-prefix` CLI option which is not possible to set on "destroy" action.
- Make sure schemas are correctly "destroyed" even when `DatabaseResolver` is not present in resolver sequence. Most schema objects are still being ignored.

## [0.25.0] - 2024-03-20

- Added browser-based SSO authentication (thanks to Joseph Niblo).
Expand Down
31 changes: 31 additions & 0 deletions snowddl/app/singledb.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,37 @@ def init_settings(self):

return settings

def execute(self):
error_count = 0

with self.engine:
self.output_engine_context()

if self.args.get("action") == "destroy":
for resolver_cls in self.resolver_sequence:
resolver = resolver_cls(self.engine)
resolver.destroy()

error_count += len(resolver.errors)

else:
for resolver_cls in self.resolver_sequence:
resolver = resolver_cls(self.engine)
resolver.resolve()

error_count += len(resolver.errors)

self.engine.connection.close()
self.output_engine_stats()

if self.args.get("show_sql"):
self.output_executed_ddl()

self.output_suggested_ddl()

if error_count > 0:
exit(8)


def entry_point():
app = SingleDbApp()
Expand Down
4 changes: 0 additions & 4 deletions snowddl/resolver/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,6 @@ def drop_object(self, row: dict):

return ResolveResult.DROP

def destroy(self):
# Do nothing, all schemas are dropped automatically on DROP DATABASE
pass

def _post_process(self):
for result in self.resolved_objects.values():
if result != ResolveResult.NOCHANGE:
Expand Down
2 changes: 1 addition & 1 deletion snowddl/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.25.0"
__version__ = "0.25.1"

0 comments on commit a5c7f28

Please sign in to comment.