Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Contains a migration to remove the resourcegroups and have the resource have a reference direct to it's package, this removes a lot of joins.
- Loading branch information
Showing
20 changed files
with
117 additions
and
264 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import ckan.model | ||
|
||
|
||
def upgrade(migrate_engine): | ||
migrate_engine.execute( | ||
''' | ||
ALTER TABLE "resource" ADD COLUMN "package_id" text NOT NULL DEFAULT ''; | ||
UPDATE "resource" AS R | ||
SET package_id = G.package_id | ||
FROM "resource_group" AS G | ||
WHERE R.resource_group_id = G.id; | ||
ALTER TABLE "resource_revision" ADD COLUMN "package_id" text NOT NULL DEFAULT ''; | ||
UPDATE "resource_revision" AS R | ||
SET package_id = G.package_id | ||
FROM "resource_group_revision" AS G | ||
WHERE R.resource_group_id = G.id; | ||
ALTER TABLE resource DROP CONSTRAINT resource_resource_group_id_fkey; | ||
ALTER TABLE resource_revision DROP CONSTRAINT resource_revision_resource_group_id_fkey; | ||
DROP TABLE "resource_group"; | ||
DROP TABLE "resource_group_revision"; | ||
''' | ||
) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.