This is the database-migrations Reference Manual, version 1.0, generated automatically by Declt version 4.0 beta 2 "William Riker" on Sun Dec 15 05:54:36 2024 GMT+0.
The main system appears first, followed by any subsystem dependency.
database-migrations
System to version the database in roughly the same way rails migrations work. Differences are that only one database is really supported (but hacking around that is trivial) and that migrations are not needed to be stored in separate files.
Aad Versteden <madnificent@gmail.com>
Aad Versteden <madnificent@gmail.com>
MIT
1.0
postmodern
(system).
migrations.lisp
(file).
Files are sorted by type and then listed depth-first from the systems components trees.
database-migrations/database-migrations.asd
database-migrations
(system).
database-migrations/migrations.lisp
database-migrations
(system).
*db-connection-parameters*
(special variable).
def-migration
(function).
def-queries-migration
(macro).
def-query-migration
(macro).
downgrade
(function).
run-unregistered-migrations
(function).
upgrade
(function).
*migrations*
(special variable).
copy-migration
(function).
make-migration
(function).
migration
(structure).
migration-execute
(reader).
(setf migration-execute)
(writer).
migration-number
(reader).
(setf migration-number)
(writer).
migration-p
(function).
migration-revert
(reader).
(setf migration-revert)
(writer).
migration-schema-register
(function).
migration-schema-revert
(function).
migration-subject
(reader).
(setf migration-subject)
(writer).
run-migration
(function).
schema-has-migration-p
(function).
with-db
(macro).
Packages are listed by definition order.
database-migrations
common-lisp
.
postmodern
.
*db-connection-parameters*
(special variable).
def-migration
(function).
def-queries-migration
(macro).
def-query-migration
(macro).
downgrade
(function).
run-unregistered-migrations
(function).
upgrade
(function).
*migrations*
(special variable).
copy-migration
(function).
make-migration
(function).
migration
(structure).
migration-execute
(reader).
(setf migration-execute)
(writer).
migration-number
(reader).
(setf migration-number)
(writer).
migration-p
(function).
migration-revert
(reader).
(setf migration-revert)
(writer).
migration-schema-register
(function).
migration-schema-revert
(function).
migration-subject
(reader).
(setf migration-subject)
(writer).
run-migration
(function).
schema-has-migration-p
(function).
with-db
(macro).
Definitions are sorted by export status, category, package, and then by lexicographic order.
Set the connection settings here, is it will be used to connect to the correct database
Creates a migration for a range of sql queries.
This is similar to def-migration, but instead of allowing one query, it allows you to supply a range of queries.
(def-queries-migration 1239888485 "example queries migration"
:execute ("CREATE TABLE application_user ( user_id SERIAL PRIMARY KEY, name text, email text )"
"CREATE TABLE user_books ( book_id SERIAL PRIMARY KEY, owner_id INTEGER REFERENCES application_user, title text )")
:revert ("DROP TABLE application_user, user_books CASCADE"))
Creates a migration for an sql query.
This only differs with def-migration in the way execute and revert are defined. In definition both execute and revert are wrapped inside (lambda () (with-db (execute <here be supplied content>))) which allows you to only write the query and not the extra stuff surrounding it. with-db sets up a database environment for the variables set in *db-connection-paramters*
Creates the most basic form of a new migration.
A migration is referred to by its number and subject. Each migration should differ in that combination.
Execute must be the function to be called when the migration is applied.
Revert must be the function to be called when the migration is reverted.
Downgrades the database to the given version.
This will revert all migrations that have been run with a migration-number greater than <version>.
The migrations are downgraded from the greatest available migration-number, to the lowest.
When no version is given, 0 is assumed as that will clear the database (migration_schema will continue to exist).
USED ONLY FOR DEBUGGING
Forcibly runs the given migrations without writing the changes in the schema.
This is something you should never really need to run.
Upgrades the database to the given version.
This will run all migrations that haven’t been ran yet and that have a smaller migration-number than <version>.
The migrations are upgraded from the smallest available migration-number to the largest available one (with a cap on <version>).
When no version is given, all available migrations are executed.
Contains all the migrations that can be executed
Register a migration as to pretend it has been executed
Revert a migration as to pretend it was not executed
Runs a single migration with all possible options
Checks whether or not the schema contains the given migration. The migration is stored by its number and its description.
Jump to: | (
C D F M R S U W |
---|
Jump to: | (
C D F M R S U W |
---|
Jump to: | *
E N R S |
---|
Jump to: | *
E N R S |
---|
Jump to: | D F M P S |
---|
Jump to: | D F M P S |
---|