[PATCH v2 4/N] sql: Remove old migration scripts
Stephen Finucane
stephen at that.guru
Mon Dec 4 20:49:43 AEDT 2017
These have not been used since v1.0 and we don't expect users to jump
straight from pre-v1.0 to post-v2.0. Remove them.
Signed-off-by: Stephen Finucane <stephen at that.guru>
---
lib/sql/migration/001-hex-hash-types.sql | 8 -----
...02-extend-userpersonconfirmation-key-length.sql | 4 ---
lib/sql/migration/003-add-comment-parent.sql | 7 ----
lib/sql/migration/004-msgid-uniqueness.sql | 7 ----
lib/sql/migration/005-bundle-patch-ordering.sql | 40 ----------------------
lib/sql/migration/007-patch-pull-requests.sql | 6 ----
lib/sql/migration/008-confirmations.sql | 11 ------
lib/sql/migration/009-drop-registrationprofile.sql | 27 ---------------
lib/sql/migration/010-optout-tables.sql | 5 ---
.../migration/011-patch-change-notifications.sql | 12 -------
lib/sql/migration/012-project-add-columns.sql | 5 ---
lib/sql/migration/013-bundle-names.sql | 6 ----
lib/sql/migration/014-cleanup-people.sql | 7 ----
lib/sql/migration/015-add-patch-tags.sql | 19 ----------
14 files changed, 164 deletions(-)
delete mode 100644 lib/sql/migration/001-hex-hash-types.sql
delete mode 100644 lib/sql/migration/002-extend-userpersonconfirmation-key-length.sql
delete mode 100644 lib/sql/migration/003-add-comment-parent.sql
delete mode 100644 lib/sql/migration/004-msgid-uniqueness.sql
delete mode 100644 lib/sql/migration/005-bundle-patch-ordering.sql
delete mode 100644 lib/sql/migration/007-patch-pull-requests.sql
delete mode 100644 lib/sql/migration/008-confirmations.sql
delete mode 100644 lib/sql/migration/009-drop-registrationprofile.sql
delete mode 100644 lib/sql/migration/010-optout-tables.sql
delete mode 100644 lib/sql/migration/011-patch-change-notifications.sql
delete mode 100644 lib/sql/migration/012-project-add-columns.sql
delete mode 100644 lib/sql/migration/013-bundle-names.sql
delete mode 100644 lib/sql/migration/014-cleanup-people.sql
delete mode 100644 lib/sql/migration/015-add-patch-tags.sql
diff --git a/lib/sql/migration/001-hex-hash-types.sql b/lib/sql/migration/001-hex-hash-types.sql
deleted file mode 100644
index cef6b0b7..00000000
--- a/lib/sql/migration/001-hex-hash-types.sql
+++ /dev/null
@@ -1,8 +0,0 @@
-BEGIN;
-ALTER TABLE patchwork_patch ALTER COLUMN hash DROP NOT NULL;
-UPDATE patchwork_patch SET hash = NULL;
-COMMIT;
-BEGIN;
-ALTER TABLE patchwork_patch ALTER COLUMN hash TYPE CHAR(40);
-CREATE INDEX "patchwork_patch_hash" ON "patchwork_patch" ("hash");
-COMMIT;
diff --git a/lib/sql/migration/002-extend-userpersonconfirmation-key-length.sql b/lib/sql/migration/002-extend-userpersonconfirmation-key-length.sql
deleted file mode 100644
index fa10fba0..00000000
--- a/lib/sql/migration/002-extend-userpersonconfirmation-key-length.sql
+++ /dev/null
@@ -1,4 +0,0 @@
-BEGIN;
-ALTER TABLE patchwork_userpersonconfirmation
- ALTER COLUMN key TYPE char(40);
-COMMIT;
diff --git a/lib/sql/migration/003-add-comment-parent.sql b/lib/sql/migration/003-add-comment-parent.sql
deleted file mode 100644
index e6f9f64b..00000000
--- a/lib/sql/migration/003-add-comment-parent.sql
+++ /dev/null
@@ -1,7 +0,0 @@
-BEGIN;
-ALTER TABLE "patchwork_comment" ADD COLUMN "parent_id" integer NULL;
-ALTER TABLE "patchwork_comment" ADD CONSTRAINT parent_id_refs_id_7b721867
- FOREIGN KEY ("parent_id")
- REFERENCES "patchwork_comment" ("id")
- DEFERRABLE INITIALLY DEFERRED;
-COMMIT;
diff --git a/lib/sql/migration/004-msgid-uniqueness.sql b/lib/sql/migration/004-msgid-uniqueness.sql
deleted file mode 100644
index 1e8ac0b6..00000000
--- a/lib/sql/migration/004-msgid-uniqueness.sql
+++ /dev/null
@@ -1,7 +0,0 @@
-BEGIN;
-ALTER TABLE patchwork_patch DROP CONSTRAINT "patchwork_patch_msgid_key";
-ALTER TABLE patchwork_comment DROP CONSTRAINT "patchwork_comment_msgid_key";
-
-ALTER TABLE patchwork_patch ADD UNIQUE ("msgid", "project_id");
-ALTER TABLE patchwork_comment ADD UNIQUE ("msgid", "patch_id");
-COMMIT;
diff --git a/lib/sql/migration/005-bundle-patch-ordering.sql b/lib/sql/migration/005-bundle-patch-ordering.sql
deleted file mode 100644
index cd2183a8..00000000
--- a/lib/sql/migration/005-bundle-patch-ordering.sql
+++ /dev/null
@@ -1,40 +0,0 @@
-BEGIN;
-CREATE TABLE "patchwork_bundlepatch" (
- "id" SERIAL NOT NULL PRIMARY KEY,
- "patch_id" INTEGER NOT NULL
- REFERENCES "patchwork_patch" ("id") DEFERRABLE INITIALLY DEFERRED,
- "bundle_id" INTEGER NOT NULL
- REFERENCES "patchwork_bundle" ("id") DEFERRABLE INITIALLY DEFERRED,
- "order" SERIAL NOT NULL,
- UNIQUE ("bundle_id", "patch_id")
-);
-
--- we 'INSERT INTO ... SELECT' (rather than renaming and adding the order
--- column) here so that we can order by date
-INSERT INTO patchwork_bundlepatch (id, patch_id, bundle_id)
- SELECT patchwork_bundle_patches.id, patch_id, bundle_id
- FROM patchwork_bundle_patches
- INNER JOIN patchwork_patch
- ON patchwork_patch.id = patchwork_bundle_patches.patch_id
- ORDER BY bundle_id, patchwork_patch.date;
-COMMIT;
-
-BEGIN;
-ALTER TABLE patchwork_bundlepatch
- ALTER COLUMN "order" TYPE INTEGER;
-
--- initialise the starting number for this sequence
-SELECT setval('patchwork_bundlepatch_id_seq',
- (SELECT max(id) + 1 FROM patchwork_bundlepatch));
-
-DROP TABLE patchwork_bundle_patches;
-
--- normalise ordering: order should start with 1 in each bundle
-UPDATE patchwork_bundlepatch SET "order" = 1 + "order" -
- (SELECT min("order") FROM patchwork_bundlepatch AS p2
- WHERE p2.bundle_id = patchwork_bundlepatch.bundle_id);
-
-GRANT SELECT, INSERT, UPDATE, DELETE ON patchwork_bundlepatch TO "www-data";
-GRANT SELECT, UPDATE ON patchwork_bundlepatch_id_seq TO "www-data";
-
-COMMIT;
diff --git a/lib/sql/migration/007-patch-pull-requests.sql b/lib/sql/migration/007-patch-pull-requests.sql
deleted file mode 100644
index 9155133c..00000000
--- a/lib/sql/migration/007-patch-pull-requests.sql
+++ /dev/null
@@ -1,6 +0,0 @@
-BEGIN;
-ALTER TABLE patchwork_patch ADD column pull_url varchar(255);
-ALTER TABLE patchwork_patch ALTER COLUMN content DROP NOT NULL;
-ALTER TABLE patchwork_patch ADD CONSTRAINT has_content_or_url
- CHECK (pull_url IS NOT NULL OR content IS NOT NULL);
-COMMIT;
diff --git a/lib/sql/migration/008-confirmations.sql b/lib/sql/migration/008-confirmations.sql
deleted file mode 100644
index 89437a24..00000000
--- a/lib/sql/migration/008-confirmations.sql
+++ /dev/null
@@ -1,11 +0,0 @@
-BEGIN;
-ALTER TABLE "patchwork_userpersonconfirmation"
- RENAME TO "patchwork_emailconfirmation";
-ALTER SEQUENCE "patchwork_userpersonconfirmation_id_seq"
- RENAME TO "patchwork_emailconfirmation_id_seq";
-ALTER TABLE "patchwork_emailconfirmation"
- ALTER COLUMN "user_id" DROP NOT NULL,
- ADD COLUMN "type" varchar(20) NOT NULL DEFAULT 'userperson';
-ALTER TABLE "patchwork_emailconfirmation"
- ALTER COLUMN "type" DROP DEFAULT;
-COMMIT;
diff --git a/lib/sql/migration/009-drop-registrationprofile.sql b/lib/sql/migration/009-drop-registrationprofile.sql
deleted file mode 100644
index f1c2b438..00000000
--- a/lib/sql/migration/009-drop-registrationprofile.sql
+++ /dev/null
@@ -1,27 +0,0 @@
-BEGIN;
-
-DELETE FROM registration_registrationprofile;
-
--- unlink users who have contributed
-
-UPDATE patchwork_person SET user_id = NULL
- WHERE user_id IN (SELECT id FROM auth_user WHERE is_active = False)
- AND id IN (SELECT DISTINCT submitter_id FROM patchwork_comment);
-
--- remove persons who only have a user linkage
-
-DELETE FROM patchwork_person WHERE user_id IN
- (SELECT id FROM auth_user WHERE is_active = False);
-
--- delete profiles
-
-DELETE FROM patchwork_userprofile WHERE user_id IN
- (SELECT id FROM auth_user WHERE is_active = False);
-
--- delete inactive users
-
-DELETE FROM auth_user WHERE is_active = False;
-
-DROP TABLE registration_registrationprofile;
-
-COMMIT;
diff --git a/lib/sql/migration/010-optout-tables.sql b/lib/sql/migration/010-optout-tables.sql
deleted file mode 100644
index 0a5d8353..00000000
--- a/lib/sql/migration/010-optout-tables.sql
+++ /dev/null
@@ -1,5 +0,0 @@
-BEGIN;
-CREATE TABLE "patchwork_emailoptout" (
- "email" varchar(200) NOT NULL PRIMARY KEY
-);
-COMMIT;
diff --git a/lib/sql/migration/011-patch-change-notifications.sql b/lib/sql/migration/011-patch-change-notifications.sql
deleted file mode 100644
index 0a9b9b73..00000000
--- a/lib/sql/migration/011-patch-change-notifications.sql
+++ /dev/null
@@ -1,12 +0,0 @@
-BEGIN;
-CREATE TABLE "patchwork_patchchangenotification" (
- "patch_id" integer NOT NULL PRIMARY KEY REFERENCES "patchwork_patch" ("id") DEFERRABLE INITIALLY DEFERRED,
- "last_modified" timestamp with time zone NOT NULL,
- "orig_state_id" integer NOT NULL REFERENCES "patchwork_state" ("id") DEFERRABLE INITIALLY DEFERRED
-)
-;
-ALTER TABLE "patchwork_project" ADD COLUMN
- "send_notifications" boolean NOT NULL DEFAULT False;
-ALTER TABLE "patchwork_project" ALTER COLUMN
- "send_notifications" DROP DEFAULT;
-COMMIT;
diff --git a/lib/sql/migration/012-project-add-columns.sql b/lib/sql/migration/012-project-add-columns.sql
deleted file mode 100644
index ecade280..00000000
--- a/lib/sql/migration/012-project-add-columns.sql
+++ /dev/null
@@ -1,5 +0,0 @@
-BEGIN;
-ALTER TABLE patchwork_project ADD COLUMN web_url varchar(2000);
-ALTER TABLE patchwork_project ADD COLUMN scm_url varchar(2000);
-ALTER TABLE patchwork_project ADD COLUMN webscm_url varchar(2000);
-COMMIT;
diff --git a/lib/sql/migration/013-bundle-names.sql b/lib/sql/migration/013-bundle-names.sql
deleted file mode 100644
index 3dbbfb13..00000000
--- a/lib/sql/migration/013-bundle-names.sql
+++ /dev/null
@@ -1,6 +0,0 @@
-BEGIN;
-UPDATE patchwork_bundle
- SET name = replace(name, '/', '-')
- WHERE name like '%/%';
-COMMIT;
-
diff --git a/lib/sql/migration/014-cleanup-people.sql b/lib/sql/migration/014-cleanup-people.sql
deleted file mode 100644
index 7c102784..00000000
--- a/lib/sql/migration/014-cleanup-people.sql
+++ /dev/null
@@ -1,7 +0,0 @@
-BEGIN;
-DELETE FROM patchwork_person WHERE id NOT IN (
- SELECT submitter_id FROM patchwork_patch
- UNION
- SELECT submitter_id FROM patchwork_comment)
- AND user_id IS NULL;
-COMMIT;
diff --git a/lib/sql/migration/015-add-patch-tags.sql b/lib/sql/migration/015-add-patch-tags.sql
deleted file mode 100644
index bdf73305..00000000
--- a/lib/sql/migration/015-add-patch-tags.sql
+++ /dev/null
@@ -1,19 +0,0 @@
-BEGIN;
-ALTER TABLE patchwork_project ADD COLUMN use_tags boolean default true;
-
-CREATE TABLE "patchwork_tag" (
- "id" serial NOT NULL PRIMARY KEY,
- "name" varchar(20) NOT NULL,
- "pattern" varchar(50) NOT NULL,
- "abbrev" varchar(2) NOT NULL UNIQUE
-);
-
-CREATE TABLE "patchwork_patchtag" (
- "id" serial NOT NULL PRIMARY KEY,
- "patch_id" integer NOT NULL,
- "tag_id" integer NOT NULL REFERENCES "patchwork_tag" ("id"),
- "count" integer NOT NULL,
- UNIQUE ("patch_id", "tag_id")
-);
-
-COMMIT;
--
2.14.3
More information about the Patchwork
mailing list