openwisp-ipam icon indicating copy to clipboard operation
openwisp-ipam copied to clipboard

[bug] NetworkField does not work with MySQL/MariaDB

Open pandafy opened this issue 3 years ago • 2 comments

Running migrations on MySQL (Server version: 8.0.31 MySQL Community Server - GPL) raises following error

django.db.utils.ProgrammingError: (1064, "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'cidr NOT NULL, `description` varchar(100) NOT NULL, `master_subnet_id` char(32) ' at line 1")

The CIDR data type is also not supported on MariaDB.

https://github.com/openwisp/openwisp-ipam/blob/956d9d25fc1ac339cb148ec7faf80046cc14be37/openwisp_ipam/base/fields.py#L34-L43

pandafy avatar Dec 12 '22 10:12 pandafy

I also encountered this problem

Manchuker1120 avatar Jul 02 '23 13:07 Manchuker1120

( 'subnet', models.CharField( db_index=True, help_text=( 'Subnet in CIDR notation, eg: "10.0.0.0/24" ' 'for IPv4 and "fdb6:21b:a477::9f7/64" for IPv6' ), max_length=43, )

I can add openwisp_ipam/migrations/0001_initial.py modified to the above content? If I make changes, I can migrate the database without reporting any errors, but what are the issues if I make the changes?

Manchuker1120 avatar Jul 07 '23 09:07 Manchuker1120