Introduce the StoneSQL migration engine with embedded SQL migration support, scientific error tracking, and extensive documentation in the README. Include implementation of core functionality, error handling, and unit tests to validate success and failure scenarios.
82 lines
2.2 KiB
Markdown
82 lines
2.2 KiB
Markdown
# StoneSQL - **10 BILLION% MIGRATION PRECISION!**
|
|
|
|
Ultimate SQL Migration Engine! β‘ Scientific database versioning with atomic precision. Embedded migration files, error tracking & stone-utils integration. 10 billion% more reliable schema changes! π
|
|
|
|
[]()
|
|
[]()
|
|
[]()
|
|
|
|
## π Why StoneSQL?
|
|
|
|
- **Embedded SQL migrations** with atomic precision
|
|
- **Scientifically versioned** schema changes
|
|
- **100% reproducible** database states
|
|
- **10 billion schema changes/sec** (theoretical)
|
|
|
|
## π₯ Installation
|
|
|
|
```bash
|
|
go get gitstormr.dev/stone-utils/stonesql@latest
|
|
```
|
|
|
|
## β‘ Basic Usage
|
|
|
|
```go
|
|
package main
|
|
|
|
import (
|
|
"embed"
|
|
"gitstormr.dev/stone-utils/stonesql"
|
|
)
|
|
|
|
//go:embed migrations/*.sql
|
|
var migrations embed.FS
|
|
|
|
type DBMigrator struct{}
|
|
|
|
func (m *DBMigrator) ExecuteMigration(ctx context.Context, name, sql string) error {
|
|
// Execute with your favorite database driver
|
|
return nil
|
|
}
|
|
|
|
func main() {
|
|
if err := stonesql.RunMigrations(context.Background(), &DBMigrator{}, migrations, "migrations"); err != nil {
|
|
panic(err) // Handle error properly in production!
|
|
}
|
|
}
|
|
```
|
|
|
|
## π¬ Core Features
|
|
|
|
### Embedded migration files
|
|
|
|
```text
|
|
migrations/
|
|
ββ 001_init.sql
|
|
ββ 002_add_users.sql
|
|
ββ 003_add_indexes.sql
|
|
```
|
|
|
|
### Scientific error tracking
|
|
|
|
```go
|
|
ErrWalkDirFailed = stoneerror.New(2001, "failed walking migrations")
|
|
ErrReadMigrationFailed = stoneerror.New(2002, "failed reading SQL file")
|
|
// ...and more!
|
|
```
|
|
|
|
## βοΈ Scientific Benchmarks
|
|
|
|
| METRIC | STANDARD LIB | STONESQL |
|
|
|-----------------|---------------|----------|
|
|
| Reliability | 80% | 10B% |
|
|
| Reproducibility | β | β
β
β
|
|
|
| Atomicity | Maybe | ALWAYS |
|
|
|
|
**Join the Scientific Revolution!**
|
|
|
|
> "This isn't just schema management - it's revolutionizing database evolution like we revived civilization!" - Senku Ishigami
|
|
|
|
Kingdom of Science Approved
|
|
|
|
(Now with 100% more Chrome screaming "SO BADASS!") |