Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rudolfochrist/migrator
Simple declarative schema migration for SQLite
https://github.com/rudolfochrist/migrator
Last synced: 21 days ago
JSON representation
Simple declarative schema migration for SQLite
- Host: GitHub
- URL: https://github.com/rudolfochrist/migrator
- Owner: rudolfochrist
- License: mpl-2.0
- Created: 2022-12-23T09:50:30.000Z (almost 2 years ago)
- Default Branch: master
- Last Pushed: 2024-01-01T10:26:41.000Z (10 months ago)
- Last Synced: 2024-01-01T11:27:28.264Z (10 months ago)
- Language: Common Lisp
- Size: 20.5 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.txt
- License: LICENSE.txt
Awesome Lists containing this project
README
1 NAME
======migratory --- Simple declarative schema migration for SQLite.
2 VERSION
=========,----
| 0.1
`----3 SYNOPSIS
==========,----
| (sqlite:with-open-database (db "db.sqlite3")
| (migrator:migrate db #p"migrations/" :allow-deletions t))
`----4 DESCRIPTION
=============Migrates a database to the new schema given by the SQL text `schema`
preserving the data. We create any table that exists in schema,
delete any old table that is no longer used and add/remove columns and
indices as necessary.Under this scheme there are a set of changes that we can make to the
schema and this script will handle it fine:1. Adding a new table
2. Adding, deleting or modifying an index
3. Adding a column to an existing table as long as the new column can
be NULL or has a DEFAULT value specified.
4. Changing a column to remove NULL or DEFAULT as long as all values
in the database are not NULL
5. Changing the type of a column
6. Changing the user_versionIn addition this function is capable of:
1. Deleting tables
2. Deleting columns from tablesBut only if allow-deletions is non-nil. If the new schema requires
a column/table to be deleted and allow-deletions is T this function
will raise an error.Note: When this function is called a transaction must not be held
open on db. A transaction will be used internally. If you wish to
perform additional migration steps as part of a migration use
DBMigrator directly.Any internally generated rowid columns by SQLite may change values
by this migration.But only if `allow-deletions' is non-nil. If the new schema
requires a column/table to be deleted and `allow-deletions' is nil
this function will signal an error.`directory' must contain a `schema.sql' file that gets
loaded. Optionally `directory' can contain a `pre.sql' and `post.sql'
hooks to do some pre or post works, like data migrations etc.5 AUTHOR
========Sebastian Christ ()
6 LICENSE
=========Released under the MPL-2.0 license.
7 SEE ALSO
==========- [Simple declarative schema migration for SQLite]
[Simple declarative schema migration for SQLite]