phpipam icon indicating copy to clipboard operation
phpipam copied to clipboard

Error upgrade 1.4.7 to 1.5.0 : SQLSTATE[42S21]: Column already exists: 1060 Duplicate column name 'isPool'

Open Matthiman opened this issue 3 years ago • 1 comments

Describe the bug Hi, I follow this guide to upgrade from 1.4.7 to 1.5.0 : https://phpipam.net/documents/upgrade/

After git installation I went to WebUI for DB upgrade : Database needs to be upgraded to version 1.5.r39, it seems you are using phpipam version 1.47.r25!

But database upgrade failed with error, exactly as for this topic : https://github.com/phpipam/phpipam/issues/3563 Upgrade failed ! SQLSTATE[42S21]: Column already exists: 1060 Duplicate column name 'isPool' Failed query: ALTER TABLE subnets ADD isPool BOOL NOT NULL DEFAULT '0'; Failed to upgrade database!

Your Environment (please supply the following information):

  • phpIPAM version: 1.4.7 to 1.5.0
  • OS RH 7.9
  • php 7.2
  • MariaDB 10.1

Here are the results of the different commands :

  • show columns from subnets from phpipam;
  • show tables from phpipam;
  • DESCRIBE usersAuthMethod;
  • SELECT id, type, description FROM usersAuthMethod;

` MariaDB [(none)]> show columns from subnets from phpipam; +-----------------------+------------------+------+-----+---------+-----------------------------+ | Field | Type | Null | Key | Default | Extra | +-----------------------+------------------+------+-----+---------+-----------------------------+ | id | int(11) | NO | PRI | NULL | auto_increment | | subnet | varchar(255) | YES | | NULL | | | mask | varchar(3) | YES | | NULL | | | sectionId | int(11) unsigned | YES | MUL | NULL | | | description | text | YES | | NULL | | | linked_subnet | int(11) unsigned | YES | | NULL | | | firewallAddressObject | varchar(100) | YES | | NULL | | | vrfId | int(11) unsigned | YES | MUL | NULL | | | masterSubnetId | int(11) unsigned | NO | MUL | 0 | | | allowRequests | tinyint(1) | NO | | 0 | | | vlanId | int(11) unsigned | YES | | NULL | | | showName | tinyint(1) | NO | | 0 | | | device | int(10) unsigned | YES | | 0 | | | permissions | varchar(1024) | YES | | NULL | | | pingSubnet | tinyint(1) | NO | | 0 | | | discoverSubnet | tinyint(1) | NO | | 0 | | | resolveDNS | tinyint(1) | NO | | 0 | | | DNSrecursive | tinyint(1) | NO | | 0 | | | DNSrecords | tinyint(1) | NO | | 0 | | | nameserverId | int(11) | YES | | 0 | | | scanAgent | int(11) | YES | | NULL | | | customer_id | int(11) unsigned | YES | MUL | NULL | | | isFolder | tinyint(1) | NO | | 0 | | | isFull | tinyint(1) | NO | | 0 | | | isPool | tinyint(1) | NO | | 0 | | | state | int(3) | YES | | 2 | | | threshold | int(3) | YES | | 0 | | | location | int(11) unsigned | YES | MUL | NULL | | | editDate | timestamp | YES | | NULL | on update CURRENT_TIMESTAMP | | lastScan | timestamp | YES | | NULL | | | lastDiscovery | timestamp | YES | | NULL | | +-----------------------+------------------+------+-----+---------+-----------------------------+ 31 rows in set (0.00 sec)

MariaDB [(none)]> show tables from phpipam; +------------------------+ | Tables_in_phpipam | +------------------------+ | api | | changelog | | circuitProviders | | circuitTypes | | circuits | | circuitsLogical | | circuitsLogicalMapping | | customers | | deviceTypes | | devices | | firewallZoneMapping | | firewallZoneSubnet | | firewallZones | | instructions | | ipTags | | ipaddresses | | lang | | locations | | loginAttempts | | logs | | nameservers | | nat | | php_sessions | | pstnNumbers | | pstnPrefixes | | rackContents | | racks | | requests | | routing_bgp | | routing_subnets | | scanAgents | | sections | | settings | | settingsMail | | subnets | | userGroups | | users | | usersAuthMethod | | vlanDomains | | vlans | | vrf | | widgets | +------------------------+ 42 rows in set (0.00 sec)

MariaDB [phpipam]> DESCRIBE usersAuthMethod; +-------------+-----------------------------------------------------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +-------------+-----------------------------------------------------------+------+-----+---------+----------------+ | id | int(11) unsigned | NO | PRI | NULL | auto_increment | | type | enum('local','http','AD','LDAP','NetIQ','Radius','SAML2') | NO | | local | | | params | text | YES | | NULL | | | protected | enum('Yes','No') | NO | | Yes | | | description | text | YES | | NULL | | +-------------+-----------------------------------------------------------+------+-----+---------+----------------+ 5 rows in set (0.00 sec)

MariaDB [phpipam]> SELECT id, type, description FROM usersAuthMethod; +----+-------+-----------------------+ | id | type | description | +----+-------+-----------------------+ | 1 | local | Local database | | 2 | http | Apache authentication | +----+-------+-----------------------+ 2 rows in set (0.00 sec)

`

Any help would be appreciate, thanks ! Matthieu

Matthiman avatar Aug 02 '22 14:08 Matthiman

Hi. I can see a lot of time has gone by since you opened this issue, were you able to solve it? There can sometimes be issues in the upgrade process that are solved in later releases. Just as an example, you might hit an issue with going from 1.4.7 to 1.5.0, but it could be fixed in code for version 1.6.0, so then upgrading from 1.4.7 to 1.6.0 works. Only an example.

What source are you using to upgrade to 1.5? A release package, or a git branch? Are you running the upgrade a second time because something failed the first time?

riversdev0 avatar Sep 24 '24 13:09 riversdev0