Main migration function
()
| 171 | |
| 172 | |
| 173 | def main(): |
| 174 | """Main migration function""" |
| 175 | logger = setup_logging() |
| 176 | |
| 177 | logger.info("🚀 Starting NDB to PostgreSQL Document Migration") |
| 178 | logger.info("=" * 50) |
| 179 | |
| 180 | # Test connections |
| 181 | if not test_connections(logger): |
| 182 | logger.error("❌ Connection tests failed. Aborting migration.") |
| 183 | sys.exit(1) |
| 184 | |
| 185 | start_time = datetime.now() |
| 186 | |
| 187 | try: |
| 188 | # Migrate documents only (users are now PostgreSQL-only) |
| 189 | doc_count = migrate_documents(logger) |
| 190 | |
| 191 | # Verify migration |
| 192 | verify_migration(logger) |
| 193 | |
| 194 | end_time = datetime.now() |
| 195 | duration = end_time - start_time |
| 196 | |
| 197 | logger.info("🎉 Migration completed successfully!") |
| 198 | logger.info("📊 Summary:") |
| 199 | logger.info(f" Documents migrated: {doc_count}") |
| 200 | logger.info(f" Duration: {duration}") |
| 201 | logger.info(" Log file: migration.log") |
| 202 | |
| 203 | except Exception as e: |
| 204 | logger.error(f"❌ Migration failed: {e}") |
| 205 | import traceback |
| 206 | |
| 207 | logger.error(traceback.format_exc()) |
| 208 | sys.exit(1) |
| 209 | |
| 210 | |
| 211 | if __name__ == "__main__": |
no test coverage detected