瀏覽代碼

rev.2 for DB update

and fix mysql db driver
Visman 4 年之前
父節點
當前提交
5bfceba89e
共有 5 個文件被更改,包括 24 次插入7 次删除
  1. 2 2
      app/Core/DB/mysql.php
  2. 5 3
      app/Models/Pages/Admin/Install.php
  3. 15 0
      app/Models/Pages/Admin/Update.php
  4. 1 1
      app/bootstrap.php
  5. 1 1
      readme.md

+ 2 - 2
app/Core/DB/mysql.php

@@ -387,7 +387,7 @@ class Mysql
         $this->testStr($table);
         $this->testStr($table);
         $this->testStr($field);
         $this->testStr($field);
         $query = "ALTER TABLE `{$table}` ADD `{$field}` " . $this->replType($type);
         $query = "ALTER TABLE `{$table}` ADD `{$field}` " . $this->replType($type);
-        if ($allowNull) {
+        if (! $allowNull) {
             $query .= ' NOT NULL';
             $query .= ' NOT NULL';
         }
         }
         if (null !== $default) {
         if (null !== $default) {
@@ -420,7 +420,7 @@ class Mysql
         $this->testStr($table);
         $this->testStr($table);
         $this->testStr($field);
         $this->testStr($field);
         $query = "ALTER TABLE `{$table}` MODIFY `{$field}` " . $this->replType($type);
         $query = "ALTER TABLE `{$table}` MODIFY `{$field}` " . $this->replType($type);
-        if ($allowNull) {
+        if (! $allowNull) {
             $query .= ' NOT NULL';
             $query .= ' NOT NULL';
         }
         }
         if (null !== $default) {
         if (null !== $default) {

+ 5 - 3
app/Models/Pages/Admin/Install.php

@@ -900,8 +900,8 @@ class Install extends Admin
                 'yahoo'            => ['VARCHAR(30)', false, ''],
                 'yahoo'            => ['VARCHAR(30)', false, ''],
                 'location'         => ['VARCHAR(30)', false, ''],
                 'location'         => ['VARCHAR(30)', false, ''],
                 'signature'        => ['TEXT', false],
                 'signature'        => ['TEXT', false],
-                'disp_topics'      => ['TINYINT(3) UNSIGNED', false, 0],
-                'disp_posts'       => ['TINYINT(3) UNSIGNED', false, 0],
+                'disp_topics'      => ['TINYINT UNSIGNED', false, 0],
+                'disp_posts'       => ['TINYINT UNSIGNED', false, 0],
                 'email_setting'    => ['TINYINT(1)', false, 1],
                 'email_setting'    => ['TINYINT(1)', false, 1],
                 'notify_with_post' => ['TINYINT(1)', false, 0],
                 'notify_with_post' => ['TINYINT(1)', false, 0],
                 'auto_notify'      => ['TINYINT(1)', false, 0],
                 'auto_notify'      => ['TINYINT(1)', false, 0],
@@ -935,9 +935,11 @@ class Install extends Admin
                 'pmsn_last_post'   => ['INT(10) UNSIGNED', false, 0],
                 'pmsn_last_post'   => ['INT(10) UNSIGNED', false, 0],
                 'warning_flag'     => ['TINYINT(1)', false, 0],
                 'warning_flag'     => ['TINYINT(1)', false, 0],
                 'warning_all'      => ['INT(10) UNSIGNED', false, 0],
                 'warning_all'      => ['INT(10) UNSIGNED', false, 0],
-                'gender'           => ['TINYINT(4) UNSIGNED', false, 0],
+                'gender'           => ['TINYINT UNSIGNED', false, 0],
                 'u_mark_all_read'  => ['INT(10) UNSIGNED', false, 0],
                 'u_mark_all_read'  => ['INT(10) UNSIGNED', false, 0],
                 'last_report_id'   => ['INT(10) UNSIGNED', false, 0],
                 'last_report_id'   => ['INT(10) UNSIGNED', false, 0],
+                'ip_check_type'    => ['TINYINT UNSIGNED', false, 0],
+                'login_ip_cache'   => ['VARCHAR(255)', false, ''],
             ],
             ],
             'PRIMARY KEY' => ['id'],
             'PRIMARY KEY' => ['id'],
             'UNIQUE KEYS' => [
             'UNIQUE KEYS' => [

+ 15 - 0
app/Models/Pages/Admin/Update.php

@@ -426,4 +426,19 @@ class Update extends Admin
 #
 #
 #        return null;
 #        return null;
 #    }
 #    }
+
+    /**
+     * rev.1 to rev.2
+     */
+    protected function stageNumber1(array $args): ?int
+    {
+        $this->c->DB->alterField('users', 'gender', 'TINYINT UNSIGNED', false, 0);
+        $this->c->DB->alterField('users', 'disp_topics', 'TINYINT UNSIGNED', false, 0);
+        $this->c->DB->alterField('users', 'disp_posts', 'TINYINT UNSIGNED', false, 0);
+
+        $this->c->DB->addField('users', 'ip_check_type', 'TINYINT UNSIGNED', false, 0);
+        $this->c->DB->addField('users', 'login_ip_cache', 'VARCHAR(255)', false, '');
+
+        return null;
+    }
 }
 }

+ 1 - 1
app/bootstrap.php

@@ -41,7 +41,7 @@ if (
 }
 }
 $c->PUBLIC_URL = $c->BASE_URL . $forkPublicPrefix;
 $c->PUBLIC_URL = $c->BASE_URL . $forkPublicPrefix;
 
 
-$c->FORK_REVISION = 1;
+$c->FORK_REVISION = 2;
 $c->START         = $forkStart;
 $c->START         = $forkStart;
 $c->DIR_APP       = __DIR__;
 $c->DIR_APP       = __DIR__;
 $c->DIR_PUBLIC    = $forkPublic;
 $c->DIR_PUBLIC    = $forkPublic;

+ 1 - 1
readme.md

@@ -1,4 +1,4 @@
-# ForkBB rev 1 Pre-Alpha Readme
+# ForkBB rev 2 Pre-Alpha Readme
 
 
 ## About
 ## About