fastpluggy-sql-migration

No description available

v0.1.1
1 downloads this week
Latest version
Requires Python >=3.8
by FastPluggy Team

Quick Install

pip install fastpluggy-sql-migration
Or with specific version:
pip install fastpluggy-sql-migration==0.1.1

FastPluggy Plugin SQL Migration System

This module provides a simple SQL-based migration system for plugins in the FastPluggy framework.
Each plugin can manage its own set of .sql migration files independently, with version tracking and isolated execution.


✨ Features

  • Per-plugin migrations — Each plugin has its own migrations/ folder
  • Ordered .sql files — Files are sorted and executed in version order
  • Central version tracking — Applied migrations are stored in a core table
  • Transactional execution — Each .sql migration runs in its own transaction
  • Minimal dependencies — Pure SQL, no external tools required
  • FastPluggy integrated — Easily register and run migrations from plugin metadata

📁 Plugin Folder Structure

plugins/
├── <plugin_name>/
│   └── migrations/
│       ├── 0001_create_posts_table.sql
│       ├── 0002_add_index_to_title.sql
│       └── ...

Files should be named with a numeric prefix for ordering.


🧪 Usage

TODO: install the plugin

Step 1: Ensure migration tracking table exists

Run this once in your main database:

CREATE TABLE IF NOT EXISTS plugin_migrations (
    plugin_name TEXT NOT NULL,
    version TEXT NOT NULL,
    applied_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
    PRIMARY KEY (plugin_name, version)
);

Step 2: Call migration runner in Python

from fastpluggy_migrations import run_sql_migrations
from sqlalchemy import create_engine
from pathlib import Path

engine = create_engine("sqlite:///main.db")

run_sql_migrations(
    plugin_name="blog",
    engine=engine,
    migration_path=Path("plugins/blog/migrations")
)

Step 3 (Optional): Add CLI

python manage.py migrate --plugin blog

🛣 Roadmap

✅ MVP (Current)

  • [ ] Support .sql files with numeric order
  • [ ] Track migration version per plugin
  • [ ] Auto-skip already-applied migrations
  • [ ] Transactional .sql execution
  • [ ] FastPluggy plugin integration

🛠️ Planned

  • [ ] Logging / dry-run mode
  • [ ] Web admin interface to view migration state
  • [ ] Plugin migration validation (naming, hash, etc.)
  • [ ] Optional hook before/after migration (for metrics, logs, etc.)

Future idea

  • [ ] Optional .down.sql support for development
  • [ ] CLI with migrate all or migrate plugin-name

UI INFO:

Dashboard

System Overview: Stats cards showing total plugins, pending/applied/failed migrations
Recent Activity Feed: Real-time view of latest migration executions
Quick Actions: One-click button to run all pending migrations

Plugin Management

Plugin Status Table: Shows each plugin's version, status, and migration progress
Visual Progress Bars: Clear indication of applied vs pending migrations
Action Menus: Manage, view details, run migrations, or disable plugins
Status Badges: Color-coded indicators (Active, Failed, Pending)

Migration Management

Per-Plugin Cards: Organized view of migrations by plugin
File-Level Status: Individual migration files with timestamps
Execution Controls: Retry failed migrations, run pending ones
Visual Status Indicators: Green (applied), red (failed), yellow (pending)

Migration Logs

Execution History: Detailed table of all migration runs
Log Details Modal: Full execution logs with SQL commands and timing
Search & Filter: Find specific migrations or filter by status
Export Functionality: Download logs for analysis

🎨 Design Highlights:

Modern Interface: Clean, professional Tabler.io styling
Responsive Layout: Works on desktop, tablet, and mobile
Intuitive Navigation: Clear sidebar with section-based organization
Status-Driven UI: Color coding and icons for quick status recognition
Action-Oriented: Context-appropriate buttons and controls


📜 License

MIT License.
Copyright (c) 2025.


🤝 Contributions

Feel free to open issues or PRs to improve functionality.
Let’s build a solid, plugin-friendly migration ecosystem together!

No Changelog Available

This plugin does not have a Changelog file or it could not be extracted from the package.

fastpluggy-sql-migration API

API documentation for this plugin is not available.

Package Analysis

Last analysis performed: 2025-07-24 13:46:30

✓ Valid Entry Point

This plugin has a valid entry point:
sql_migration = fastpluggy_plugin.sql_migration.plugin:SqlMigrationPlugin

Issues Found

Issues were found during analysis, but details are not available.

v0.1.6

v0.1.5

v0.1.4

v0.1.3

v0.1.2

v0.1.1

Latest

Plugin Information

Name
fastpluggy-sql-migration
Version
0.1.1
Entry Point
fastpluggy_plugin.sql_migration.plugin:SqlMigrationPlugin
Python
>=3.8
Status
Community
Keywords
database migration sql schema

Dependencies

loguru
Simple yet powerful logging library for Python applications
Logging

Download Statistics

1
Weekly
2
Monthly
1
Total

Download Frequency: ~2 downloads per month
Average Per Day: 0.1 downloads
Last Download: 12 days ago
Yearly Estimate: 30 downloads
1% estimated growth rate based on 12 days of data