summaryrefslogtreecommitdiff
path: root/doc/en_US/plugin-schema-migrations.markdown
diff options
context:
space:
mode:
authorFrédéric Guillot <fred@kanboard.net>2018-04-06 10:54:58 -0700
committerFrédéric Guillot <fred@kanboard.net>2018-04-06 10:54:58 -0700
commit0b306fa60ad84ea077111e0ff7b59208ba7bc8a3 (patch)
tree5d8941b5950ede2db8ca3fba0213792db0f07a50 /doc/en_US/plugin-schema-migrations.markdown
parentac11220a1aa7ae30b8827d9bbf221888d3edd0a7 (diff)
Move documentation to https://docs.kanboard.org/
Diffstat (limited to 'doc/en_US/plugin-schema-migrations.markdown')
-rw-r--r--doc/en_US/plugin-schema-migrations.markdown39
1 files changed, 0 insertions, 39 deletions
diff --git a/doc/en_US/plugin-schema-migrations.markdown b/doc/en_US/plugin-schema-migrations.markdown
deleted file mode 100644
index 36a57f37..00000000
--- a/doc/en_US/plugin-schema-migrations.markdown
+++ /dev/null
@@ -1,39 +0,0 @@
-Plugin Schema Migrations
-========================
-
-Kanboard executes database migrations automatically for you.
-Migrations must be stored in a folder **Schema** and the filename must be the same as the database driver:
-
-```bash
-Schema
-├── Mysql.php
-├── Postgres.php
-└── Sqlite.php
-```
-
-Each file contains all migrations, here an example for Sqlite:
-
-```php
-<?php
-
-namespace Kanboard\Plugin\Something\Schema;
-
-const VERSION = 1;
-
-function version_1($pdo)
-{
- $pdo->exec('CREATE TABLE IF NOT EXISTS something (
- "id" INTEGER PRIMARY KEY,
- "project_id" INTEGER NOT NULL,
- "something" TEXT,
- FOREIGN KEY(project_id) REFERENCES projects(id) ON DELETE CASCADE
- )');
-}
-```
-
-- The constant `VERSION` is the last version of your schema
-- Each function is a migration `version_1()`, `version_2()`, etc.
-- A `PDO` instance is passed as first argument
-- Everything is executed inside a transaction, if something doesn't work a rollback is performed and the error is displayed to the user
-
-Kanboard will compare the version defined in your schema and the version stored in the database. If the versions are different, Kanboard will execute one by one each migration until to reach the last version.