From 2e627d7a88aed82363a7ad48dab21b2b55797452 Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Sun, 20 Sep 2015 15:46:09 +0200 Subject: postgres: Add missing prefix to index creation Signed-off-by: Florian Pritz --- application/migrations/001_add_files.php | 4 ++-- application/migrations/002_add_users.php | 4 ++-- application/migrations/003_add_referrers.php | 4 ++-- application/migrations/006_add_username_index.php | 4 ++-- application/migrations/007_repurpose_invitations.php | 2 +- application/migrations/009_add_apikeys.php | 2 +- application/migrations/012_add_constraints.php | 2 +- 7 files changed, 11 insertions(+), 11 deletions(-) diff --git a/application/migrations/001_add_files.php b/application/migrations/001_add_files.php index dd37d08c3..7b1398e1c 100644 --- a/application/migrations/001_add_files.php +++ b/application/migrations/001_add_files.php @@ -18,8 +18,8 @@ class Migration_Add_files extends CI_Migration { "mimetype" varchar(255) NOT NULL, PRIMARY KEY ("id") ); - CREATE INDEX "files_date_idx" ON '.$prefix.'files ("date"); - CREATE INDEX "files_hash_id_idx" ON '.$prefix.'files ("hash", "id"); + CREATE INDEX "'.$prefix.'files_date_idx" ON '.$prefix.'files ("date"); + CREATE INDEX "'.$prefix.'files_hash_id_idx" ON '.$prefix.'files ("hash", "id"); '); } else { $this->db->query(' diff --git a/application/migrations/002_add_users.php b/application/migrations/002_add_users.php index 5ccef6669..454618e48 100644 --- a/application/migrations/002_add_users.php +++ b/application/migrations/002_add_users.php @@ -26,12 +26,12 @@ class Migration_Add_users extends CI_Migration { "user_data" text NOT NULL, PRIMARY KEY ("session_id") ); - CREATE INDEX "ci_sessions_last_activity_idx" ON "'.$prefix.'ci_sessions" ("last_activity"); + CREATE INDEX "'.$prefix.'ci_sessions_last_activity_idx" ON "'.$prefix.'ci_sessions" ("last_activity"); '); $this->db->query(' ALTER TABLE "'.$prefix.'files" ADD "user" integer NOT NULL DEFAULT 0; - CREATE INDEX "user_idx" ON "'.$prefix.'files" ("user"); + CREATE INDEX "'.$prefix.'user_idx" ON "'.$prefix.'files" ("user"); '); } else { diff --git a/application/migrations/003_add_referrers.php b/application/migrations/003_add_referrers.php index c504b5539..e6da1c0dd 100644 --- a/application/migrations/003_add_referrers.php +++ b/application/migrations/003_add_referrers.php @@ -15,8 +15,8 @@ class Migration_Add_referrers extends CI_Migration { "date" integer NOT NULL, PRIMARY KEY ("key") ); - CREATE INDEX "invitations_user_idx" ON "'.$prefix.'invitations" ("user"); - CREATE INDEX "invitations_date_idx" ON "'.$prefix.'invitations" ("date"); + CREATE INDEX "'.$prefix.'invitations_user_idx" ON "'.$prefix.'invitations" ("user"); + CREATE INDEX "'.$prefix.'invitations_date_idx" ON "'.$prefix.'invitations" ("date"); '); $this->db->query(' ALTER TABLE "'.$prefix.'users" diff --git a/application/migrations/006_add_username_index.php b/application/migrations/006_add_username_index.php index 0e6dc7650..1633a95a9 100644 --- a/application/migrations/006_add_username_index.php +++ b/application/migrations/006_add_username_index.php @@ -9,7 +9,7 @@ class Migration_Add_username_index extends CI_Migration { if ($this->db->dbdriver == 'postgre') { $this->db->query(' - CREATE UNIQUE INDEX "users_username_idx" ON "'.$prefix.'users" ("username") + CREATE UNIQUE INDEX "'.$prefix.'users_username_idx" ON "'.$prefix.'users" ("username") '); } else { $this->db->query(' @@ -24,7 +24,7 @@ class Migration_Add_username_index extends CI_Migration { $prefix = $this->db->dbprefix; if ($this->db->dbdriver == 'postgre') { - $this->db->query('DROP INDEX "users_username_idx"'); + $this->db->query('DROP INDEX "'.$prefix.'users_username_idx"'); } else { $this->db->query(" ALTER TABLE `'.$prefix.'users` diff --git a/application/migrations/007_repurpose_invitations.php b/application/migrations/007_repurpose_invitations.php index ecdef305d..0bc39c64b 100644 --- a/application/migrations/007_repurpose_invitations.php +++ b/application/migrations/007_repurpose_invitations.php @@ -12,7 +12,7 @@ class Migration_Repurpose_invitations extends CI_Migration { ALTER TABLE "'.$prefix.'invitations" ADD "action" character varying(255) NOT NULL, ADD "data" TEXT NULL; - CREATE INDEX "invitations_action_idx" ON '.$prefix.'invitations ("action"); + CREATE INDEX "'.$prefix.'invitations_action_idx" ON '.$prefix.'invitations ("action"); '); $this->db->query(' diff --git a/application/migrations/009_add_apikeys.php b/application/migrations/009_add_apikeys.php index a5af809fc..e9dba4e41 100644 --- a/application/migrations/009_add_apikeys.php +++ b/application/migrations/009_add_apikeys.php @@ -16,7 +16,7 @@ class Migration_Add_apikeys extends CI_Migration { "comment" varchar(255) NOT NULL, PRIMARY KEY ("key") ); - CREATE INDEX "apikeys_user_idx" ON "'.$prefix.'apikeys" ("user"); + CREATE INDEX "'.$prefix.'apikeys_user_idx" ON "'.$prefix.'apikeys" ("user"); '); } else { diff --git a/application/migrations/012_add_constraints.php b/application/migrations/012_add_constraints.php index 40a4540f6..a2569d54d 100644 --- a/application/migrations/012_add_constraints.php +++ b/application/migrations/012_add_constraints.php @@ -10,7 +10,7 @@ class Migration_add_constraints extends CI_Migration { if ($this->db->dbdriver == 'postgre') { $this->db->query('ALTER TABLE "'.$prefix.'users" ALTER COLUMN "referrer" TYPE integer'); $this->db->query('ALTER TABLE "'.$prefix.'users" ALTER COLUMN "referrer" DROP NOT NULL'); - $this->db->query('CREATE INDEX "users_referrer_idx" ON "'.$prefix.'users" ("referrer")'); + $this->db->query('CREATE INDEX "'.$prefix.'users_referrer_idx" ON "'.$prefix.'users" ("referrer")'); $this->db->query('UPDATE "'.$prefix.'users" SET "referrer" = NULL where "referrer" = 0'); $this->db->query(' ALTER TABLE "'.$prefix.'users" -- cgit v1.2.3-24-g4f1b