summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--application/migrations/001_add_files.php3
-rw-r--r--application/migrations/002_add_users.php16
-rw-r--r--application/migrations/003_add_referrers.php13
-rw-r--r--application/migrations/004_add_filesize.php14
-rw-r--r--application/migrations/005_drop_file_password.php14
-rw-r--r--application/migrations/006_add_username_index.php14
-rw-r--r--application/migrations/007_repurpose_invitations.php15
-rw-r--r--application/migrations/008_add_profiles.php18
-rw-r--r--application/migrations/009_add_apikeys.php9
-rw-r--r--application/migrations/010_files_innodb.php3
-rw-r--r--application/migrations/011_apikeys_add_access_level.php14
-rw-r--r--application/migrations/012_add_constraints.php9
-rw-r--r--application/migrations/013_add_multipaste.php9
13 files changed, 56 insertions, 95 deletions
diff --git a/application/migrations/001_add_files.php b/application/migrations/001_add_files.php
index c5e4e7dfe..8af202285 100644
--- a/application/migrations/001_add_files.php
+++ b/application/migrations/001_add_files.php
@@ -6,8 +6,7 @@ class Migration_Add_files extends CI_Migration {
public function up()
{
// Set database engine for MySQL drivers
- if (strpos($this->db->dbdriver, 'mysql') !== FALSE)
- {
+ if (strpos($this->db->dbdriver, 'mysql') !== FALSE) {
$this->db->query('SET storage_engine=MYISAM');
}
diff --git a/application/migrations/002_add_users.php b/application/migrations/002_add_users.php
index d74402263..322415d9b 100644
--- a/application/migrations/002_add_users.php
+++ b/application/migrations/002_add_users.php
@@ -5,8 +5,7 @@ class Migration_Add_users extends CI_Migration {
public function up()
{
- if ($this->db->dbdriver == 'postgre')
- {
+ if ($this->db->dbdriver == 'postgre') {
$this->db->query('
CREATE TABLE IF NOT EXISTS "users" (
"id" serial PRIMARY KEY,
@@ -32,9 +31,9 @@ class Migration_Add_users extends CI_Migration {
ALTER TABLE "files" ADD "user" integer NOT NULL DEFAULT 0;
CREATE INDEX "user_idx" ON "files" ("user");
');
- }
- else
- {
+
+ } else {
+
$this->db->query("
CREATE TABLE IF NOT EXISTS `users` (
`id` int(8) UNSIGNED NOT NULL AUTO_INCREMENT,
@@ -69,12 +68,9 @@ class Migration_Add_users extends CI_Migration {
{
$this->dbforge->drop_table('users');
$this->dbforge->drop_table('ci_sessions');
- if ($this->db->dbdriver == 'postgre')
- {
+ if ($this->db->dbdriver == 'postgre') {
$this->db->query('ALTER TABLE "files" DROP "user"');
- }
- else
- {
+ } else {
$this->db->query('ALTER TABLE `files` DROP `user`');
}
}
diff --git a/application/migrations/003_add_referrers.php b/application/migrations/003_add_referrers.php
index 1f6b966e3..9ca167eab 100644
--- a/application/migrations/003_add_referrers.php
+++ b/application/migrations/003_add_referrers.php
@@ -5,8 +5,7 @@ class Migration_Add_referrers extends CI_Migration {
public function up()
{
- if ($this->db->dbdriver == 'postgre')
- {
+ if ($this->db->dbdriver == 'postgre') {
$this->db->query('
CREATE TABLE "invitations" (
"user" integer NOT NULL,
@@ -21,9 +20,9 @@ class Migration_Add_referrers extends CI_Migration {
ALTER TABLE "users"
ADD "referrer" integer NOT NULL DEFAULT 0
');
- }
- else
- {
+
+ } else {
+
$this->db->query("
CREATE TABLE `invitations` (
`user` int(8) unsigned NOT NULL,
@@ -48,9 +47,7 @@ class Migration_Add_referrers extends CI_Migration {
$this->db->query('
ALTER TABLE "users" DROP "referrer"
');
- }
- else
- {
+ } else {
$this->db->query('
ALTER TABLE `users` DROP `referrer`
');
diff --git a/application/migrations/004_add_filesize.php b/application/migrations/004_add_filesize.php
index 7e5355c14..f2367937a 100644
--- a/application/migrations/004_add_filesize.php
+++ b/application/migrations/004_add_filesize.php
@@ -5,15 +5,12 @@ class Migration_Add_filesize extends CI_Migration {
public function up()
{
- if ($this->db->dbdriver == 'postgre')
- {
+ if ($this->db->dbdriver == 'postgre') {
$this->db->query('
ALTER TABLE "files"
ADD "filesize" integer NOT NULL
');
- }
- else
- {
+ } else {
$this->db->query("
ALTER TABLE `files`
ADD `filesize` INT UNSIGNED NOT NULL
@@ -23,14 +20,11 @@ class Migration_Add_filesize extends CI_Migration {
public function down()
{
- if ($this->db->dbdriver == 'postgre')
- {
+ if ($this->db->dbdriver == 'postgre') {
$this->db->query('
ALTER TABLE "files" DROP "filesize"
');
- }
- else
- {
+ } else {
$this->db->query('
ALTER TABLE `files` DROP `filesize`
');
diff --git a/application/migrations/005_drop_file_password.php b/application/migrations/005_drop_file_password.php
index 2be20e550..e8b7f8952 100644
--- a/application/migrations/005_drop_file_password.php
+++ b/application/migrations/005_drop_file_password.php
@@ -5,27 +5,21 @@ class Migration_Drop_file_password extends CI_Migration {
public function up()
{
- if ($this->db->dbdriver == 'postgre')
- {
+ if ($this->db->dbdriver == 'postgre') {
$this->db->query('ALTER TABLE "files" DROP "password"');
- }
- else
- {
+ } else {
$this->db->query("ALTER TABLE `files` DROP `password`;");
}
}
public function down()
{
- if ($this->db->dbdriver == 'postgre')
- {
+ if ($this->db->dbdriver == 'postgre') {
$this->db->query('
ALTER TABLE "files"
ADD "password" character varying(40) DEFAULT NULL
');
- }
- else
- {
+ } else {
$this->db->query("
ALTER TABLE `files`
ADD `password` varchar(40) CHARACTER SET ascii COLLATE ascii_bin DEFAULT NULL;
diff --git a/application/migrations/006_add_username_index.php b/application/migrations/006_add_username_index.php
index a7ad236f3..5b8c3584f 100644
--- a/application/migrations/006_add_username_index.php
+++ b/application/migrations/006_add_username_index.php
@@ -5,14 +5,11 @@ class Migration_Add_username_index extends CI_Migration {
public function up()
{
- if ($this->db->dbdriver == 'postgre')
- {
+ if ($this->db->dbdriver == 'postgre') {
$this->db->query('
CREATE UNIQUE INDEX "users_username_idx" ON "users" ("username")
');
- }
- else
- {
+ } else {
$this->db->query("
ALTER TABLE `users`
ADD UNIQUE `username` (`username`);
@@ -22,12 +19,9 @@ class Migration_Add_username_index extends CI_Migration {
public function down()
{
- if ($this->db->dbdriver == 'postgre')
- {
+ if ($this->db->dbdriver == 'postgre') {
$this->db->query('DROP INDEX "users_username_idx"');
- }
- else
- {
+ } else {
$this->db->query("
ALTER TABLE `users`
DROP INDEX `username`;
diff --git a/application/migrations/007_repurpose_invitations.php b/application/migrations/007_repurpose_invitations.php
index 8f83ff7c9..024b62984 100644
--- a/application/migrations/007_repurpose_invitations.php
+++ b/application/migrations/007_repurpose_invitations.php
@@ -5,8 +5,7 @@ class Migration_Repurpose_invitations extends CI_Migration {
public function up()
{
- if ($this->db->dbdriver == 'postgre')
- {
+ if ($this->db->dbdriver == 'postgre') {
$this->db->query('
ALTER TABLE "invitations"
ADD "action" character varying(255) NOT NULL,
@@ -21,9 +20,9 @@ class Migration_Repurpose_invitations extends CI_Migration {
$this->db->query('
ALTER TABLE "invitations" RENAME TO "actions";
');
- }
- else
- {
+
+ } else {
+
$this->db->query("
ALTER TABLE `invitations`
ADD `action` VARCHAR(255) NOT NULL,
@@ -51,9 +50,9 @@ class Migration_Repurpose_invitations extends CI_Migration {
DROP "action",
DROP "data";
');
- }
- else
- {
+
+ } else {
+
$this->db->query('ALTER TABLE `actions` RENAME `invitations`');
$this->db->query('
ALTER TABLE `invitations`
diff --git a/application/migrations/008_add_profiles.php b/application/migrations/008_add_profiles.php
index 1e55c7d14..9958fb03e 100644
--- a/application/migrations/008_add_profiles.php
+++ b/application/migrations/008_add_profiles.php
@@ -5,8 +5,7 @@ class Migration_Add_profiles extends CI_Migration {
public function up()
{
- if ($this->db->dbdriver == 'postgre')
- {
+ if ($this->db->dbdriver == 'postgre') {
$this->db->query('
CREATE TABLE "profiles" (
"user" integer NOT NULL,
@@ -18,9 +17,9 @@ class Migration_Add_profiles extends CI_Migration {
$this->db->query('
ALTER TABLE "files" ALTER COLUMN "id" TYPE varchar(255);
');
- }
- else
- {
+
+ } else {
+
$this->db->query("
CREATE TABLE `profiles` (
`user` int(8) unsigned NOT NULL,
@@ -37,17 +36,16 @@ class Migration_Add_profiles extends CI_Migration {
public function down()
{
- if ($this->db->dbdriver == 'postgre')
- {
+ if ($this->db->dbdriver == 'postgre') {
$this->db->query('
DROP TABLE "profiles";
');
$this->db->query('
ALTER TABLE "files" ALTER COLUMN "id" TYPE varchar(6);
');
- }
- else
- {
+
+ } else {
+
$this->db->query("
DROP TABLE `profiles`;
");
diff --git a/application/migrations/009_add_apikeys.php b/application/migrations/009_add_apikeys.php
index 7b1b5aa58..bdc4dd07d 100644
--- a/application/migrations/009_add_apikeys.php
+++ b/application/migrations/009_add_apikeys.php
@@ -5,8 +5,7 @@ class Migration_Add_apikeys extends CI_Migration {
public function up()
{
- if ($this->db->dbdriver == 'postgre')
- {
+ if ($this->db->dbdriver == 'postgre') {
$this->db->query('
CREATE TABLE "apikeys" (
"key" varchar(64) NOT NULL,
@@ -17,9 +16,9 @@ class Migration_Add_apikeys extends CI_Migration {
);
CREATE INDEX "apikeys_user_idx" ON "apikeys" ("user");
');
- }
- else
- {
+
+ } else {
+
$this->db->query("
CREATE TABLE `apikeys` (
`key` varchar(64) COLLATE utf8_bin NOT NULL,
diff --git a/application/migrations/010_files_innodb.php b/application/migrations/010_files_innodb.php
index f965344d2..318314bd3 100644
--- a/application/migrations/010_files_innodb.php
+++ b/application/migrations/010_files_innodb.php
@@ -5,8 +5,7 @@ class Migration_files_innodb extends CI_Migration {
public function up()
{
- if ($this->db->dbdriver != 'postgre')
- {
+ if ($this->db->dbdriver != 'postgre') {
$this->db->query("
ALTER TABLE `files` ENGINE = InnoDB;
");
diff --git a/application/migrations/011_apikeys_add_access_level.php b/application/migrations/011_apikeys_add_access_level.php
index 29a2f769b..2fdbc7271 100644
--- a/application/migrations/011_apikeys_add_access_level.php
+++ b/application/migrations/011_apikeys_add_access_level.php
@@ -5,14 +5,11 @@ class Migration_apikeys_add_access_level extends CI_Migration {
public function up()
{
- if ($this->db->dbdriver == 'postgre')
- {
+ if ($this->db->dbdriver == 'postgre') {
$this->db->query('
alter table "apikeys" add "access_level" varchar(255) default \'apikey\'
');
- }
- else
- {
+ } else {
$this->db->query("
alter table `apikeys` add `access_level` varchar(255) default 'apikey';
");
@@ -21,14 +18,11 @@ class Migration_apikeys_add_access_level extends CI_Migration {
public function down()
{
- if ($this->db->dbdriver == 'postgre')
- {
+ if ($this->db->dbdriver == 'postgre') {
$this->db->query('
alter table "apikeys" drop "access_level"
');
- }
- else
- {
+ } else {
$this->db->query('
alter table `apikeys` drop `access_level`
');
diff --git a/application/migrations/012_add_constraints.php b/application/migrations/012_add_constraints.php
index 04c0fb9ca..1ed4abf08 100644
--- a/application/migrations/012_add_constraints.php
+++ b/application/migrations/012_add_constraints.php
@@ -5,8 +5,7 @@ class Migration_add_constraints extends CI_Migration {
public function up()
{
- if ($this->db->dbdriver == 'postgre')
- {
+ if ($this->db->dbdriver == 'postgre') {
$this->db->query('ALTER TABLE "users" ALTER COLUMN "referrer" TYPE integer');
$this->db->query('ALTER TABLE "users" ALTER COLUMN "referrer" DROP NOT NULL');
$this->db->query('CREATE INDEX "users_referrer_idx" ON "users" ("referrer")');
@@ -16,9 +15,9 @@ class Migration_add_constraints extends CI_Migration {
ADD CONSTRAINT "referrer_user_fkey" FOREIGN KEY ("referrer")
REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE RESTRICT
');
- }
- else
- {
+
+ } else {
+
$this->db->query("ALTER TABLE `users` ADD INDEX(`referrer`);");
$this->db->query("ALTER TABLE `users` CHANGE `referrer` `referrer`
INT(8) UNSIGNED NULL;");
diff --git a/application/migrations/013_add_multipaste.php b/application/migrations/013_add_multipaste.php
index 3b97f6986..ef29effa9 100644
--- a/application/migrations/013_add_multipaste.php
+++ b/application/migrations/013_add_multipaste.php
@@ -5,8 +5,7 @@ class Migration_add_multipaste extends CI_Migration {
public function up()
{
- if ($this->db->dbdriver == 'postgre')
- {
+ if ($this->db->dbdriver == 'postgre') {
$this->db->query('
CREATE TABLE "multipaste" (
"url_id" varchar(255) NOT NULL,
@@ -36,9 +35,9 @@ class Migration_add_multipaste extends CI_Migration {
ADD CONSTRAINT "multipaste_file_map_file_id_fkey" FOREIGN KEY ("file_url_id")
REFERENCES "files"("id") ON DELETE CASCADE ON UPDATE CASCADE
');
- }
- else
- {
+
+ } else {
+
$this->db->query('
CREATE TABLE `multipaste` (
`url_id` varchar(255) NOT NULL,