]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 1402894 followup - revert schema change portion
authorDylan William Hardison <dylan@hardison.net>
Wed, 20 Feb 2019 04:10:50 +0000 (23:10 -0500)
committerKohei Yoshino <kohei.yoshino@gmail.com>
Wed, 20 Feb 2019 04:10:50 +0000 (23:10 -0500)
Bugzilla/DB/Schema.pm
Bugzilla/Install/DB.pm

index 9356a1391b2ef48a007177d24c1bbc15f89a1378..ee96220cf661b10ded3958a97e40d7b1c4454fdb 100644 (file)
@@ -1138,6 +1138,7 @@ use constant ABSTRACT_SCHEMA => {
       ipaddr          => {TYPE => 'varchar(40)'},
       lastused        => {TYPE => 'DATETIME', NOTNULL => 1},
       id              => {TYPE => 'INTSERIAL', NOTNULL => 1, PRIMARYKEY => 1},
+      restrict_ipaddr => {TYPE => 'BOOLEAN', NOTNULL => 1, DEFAULT => 0},
     ],
     INDEXES => [
       logincookies_lastused_idx => ['lastused'],
index 72a1cab6fc9365c8d4fe4a852b0f89ca0d48e9c7..f9142fa4a124c1bac5a55b79b80cd327de3b6eb4 100644 (file)
@@ -744,6 +744,8 @@ sub update_table_definitions {
 
   $dbh->bz_add_column('user_api_keys', 'last_used_ip', {TYPE => 'varchar(40)'});
 
+  _add_restrict_ipaddr();
+
   $dbh->bz_add_column('profiles', 'password_change_required',
     {TYPE => 'BOOLEAN', NOTNULL => 1, DEFAULT => 'FALSE'});
   $dbh->bz_add_column('profiles', 'password_change_reason',
@@ -780,9 +782,6 @@ sub update_table_definitions {
 
   _add_oauth2_jwt_support();
 
-  # Bug 1402894 - kohei.yoshino@gmail.com
-  $dbh->bz_drop_column('logincookies', 'restrict_ipaddr');
-
   ################################################################
   # New --TABLE-- changes should go *** A B O V E *** this point #
   ################################################################
@@ -4177,6 +4176,16 @@ sub _fix_disable_mail {
   Bugzilla->dbh->do("UPDATE profiles SET disable_mail = 1 WHERE is_enabled = 0");
 }
 
+sub _add_restrict_ipaddr {
+  my $dbh = Bugzilla->dbh;
+  return if $dbh->bz_column_info('logincookies', 'restrict_ipaddr');
+
+  $dbh->bz_add_column('logincookies', 'restrict_ipaddr',
+    {TYPE => 'BOOLEAN', NOTNULL => 1, DEFAULT => 0});
+  $dbh->do(
+    "UPDATE logincookies SET restrict_ipaddr = 1 WHERE ipaddr IS NOT NULL");
+}
+
 sub _migrate_group_owners {
   my $dbh = Bugzilla->dbh;
   return if $dbh->bz_column_info('groups', 'owner_user_id');