From 839444cc8a2548a68135db76ed7a9c56992a1d3c Mon Sep 17 00:00:00 2001 From: Thomas Keller Date: Tue, 15 May 2012 22:43:15 +0200 Subject: [PATCH] Use Pluf's new migration capabilities to prevent problems with the circular dependency between project and project activity during new db installations (issue 800). ATTENTION: IDF now needs Pluf a45dc195 or newer! --- NEWS.mdtext | 6 ++++++ src/IDF/Migrations/Backup.php | 4 ++++ src/IDF/Migrations/Install.php | 8 ++++++++ 3 files changed, 18 insertions(+) diff --git a/NEWS.mdtext b/NEWS.mdtext index 9f62604..b5f3900 100644 --- a/NEWS.mdtext +++ b/NEWS.mdtext @@ -1,5 +1,8 @@ # InDefero 1.3.3 - xxx xxx xx xx:xx 2012 UTC +**ATTENTION**: InDefero needs Pluf [a45dc195](http://projects.ceondo.com/p/pluf/source/commit/a45dc195) +or newer to run properly! + ## Bugfixes - If an anonymous or authenticated user had no access to any project in a @@ -10,6 +13,9 @@ authorized_keys file when the public key data contained slashes (thanks to Simon Gareste for the fix!) +- Under PostgreSQL indefero could not be set up because of a circular + foreign key dependency. This has been fixed (issue 800). + - Under PostgreSQL new projects could not be created due to a failing foreign key relation. Adding project tags was not possible for a similar reason. This has been fixed (issue 800, continued). diff --git a/src/IDF/Migrations/Backup.php b/src/IDF/Migrations/Backup.php index 7d4083a..7145560 100644 --- a/src/IDF/Migrations/Backup.php +++ b/src/IDF/Migrations/Backup.php @@ -119,5 +119,9 @@ function IDF_Migrations_Backup_restore($folder, $name) foreach ($full_data as $model => $data) { Pluf_Test_Fixture::load($data, false); } + foreach ($models as $model) { + $schema->model = new $model(); + $schema->createConstraints(); + } return true; } diff --git a/src/IDF/Migrations/Install.php b/src/IDF/Migrations/Install.php index 74709b3..89b5880 100644 --- a/src/IDF/Migrations/Install.php +++ b/src/IDF/Migrations/Install.php @@ -62,6 +62,10 @@ function IDF_Migrations_Install_setup($params=null) $schema->model = new $model(); $schema->createTables(); } + foreach ($models as $model) { + $schema->model = new $model(); + $schema->createConstraints(); + } // Install the permissions $perm = new Pluf_Permission(); $perm->name = 'Project membership'; @@ -120,6 +124,10 @@ function IDF_Migrations_Install_teardown($params=null) ); $db = Pluf::db(); $schema = new Pluf_DB_Schema($db); + foreach ($models as $model) { + $schema->model = new $model(); + $schema->dropConstraints(); + } foreach ($models as $model) { $schema->model = new $model(); $schema->dropTables();