diff --git a/CHANGELOG.md b/CHANGELOG.md index dd0045a..215ac1a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,5 @@ # Change Log - ## [0.0.1] 2022-11-02 ### Minimal Version diff --git a/README.md b/README.md index ffa365b..0985f96 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,9 @@ -# DB Migration Tool +# Database Introspection Tool -`Open-Source` project that provides simple helpers for database migrations. +`Open-Source` **[developers tool](https://appseed.us/developer-tools/)** that provides simple helpers for legacy databases introspection. Crafted on top of `Python` and [Peewee](http://docs.peewee-orm.com/en/latest/). + +- 👉 Free [support](https://appseed.us/support/) via Email and [Discord](https://discord.gg/fZC6hup) +- 👉 More [Developer Tools](https://appseed.us/developer-tools/) - provided by AppSeed
@@ -104,4 +107,4 @@ $ SQLITE_django_migrations.sql
--- -DB Migration Tool - Provided by **AppSeed** [App Generator](https://appseed.us/app-generator). +Database Introspection Tool - Provided by **AppSeed** [App Generator](https://appseed.us/app-generator). diff --git a/util/__init__.py b/util/__init__.py index 2b1817e..81feeab 100644 --- a/util/__init__.py +++ b/util/__init__.py @@ -213,6 +213,42 @@ def dump_tables(self, aFileName=None): file_write('output/' + aFileName, sqlContent) return True + def dump_models(self, aFileName=None): + + sqlContent = '' + + if not self._models: + print( ' > Error: No DB models' ) + return False + + if not aFileName: + aFileName = get_date() + '_' + self.driver + '_models' + + if not aFileName.endswith('.sql'): + aFileName += '.sql' + + for table_name in self._models.keys(): + + # SQLite Engine Metadata + if 'sqlite_sequence' == table_name: + continue + + # Unused + aModel = self._models[ table_name ] + + # Hack the print + with Capturing() as output: + + self.print_db_model( table_name ) + + sqlContent += '\n' + sqlContent += '-- Table: ' + table_name + '\n' + sqlContent += h_list_to_s( output, '\n' ) + sqlContent += ';\n' + + file_write('output/' + aFileName, sqlContent) + return True + def dump_tables_data(self, aFileName=None): sqlContent = '' @@ -232,7 +268,7 @@ def dump_tables_data(self, aFileName=None): # SQLite Engine Metadata if 'sqlite_sequence' == table_name: continue - + print( ' > Dump data for [' + table_name + ']' ) self.dump_model_data( table_name ) pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy