So i am trying to login to my site via steam api and this error pops up SQLSTATE[23000]: Integrity constraint violation: 1048 Column ‘ip’ cannot be null. SQL:
insert into `users` (`name`, `steamid`, `avatar`, `token`, `ip`)
i use laravel php7.0 and phpmyadmin on a ubuntu 16.04 server vmware
This is the structure of my database
And this is the users one where i have problems
If you could help me out it would be amazing thanks
code:
CREATE TABLE `users` ( `id` int(11) NOT NULL AUTO_INCREMENT, `ip` text NOT NULL, `steamid` varchar(17) NOT NULL, `wagered` int(11) NOT NULL, `wags` int(11) NOT NULL, `wwags` int(11) NOT NULL, `deps` int(11) NOT NULL, `depamount` int(11) NOT NULL, `withs` int(11) NOT NULL, `withamount` int(11) NOT NULL, `can_withdraw` int(11) NOT NULL DEFAULT '0', `available` int(11) NOT NULL, `aff` varchar(17) NOT NULL, `affs` int(11) NOT NULL DEFAULT '0', `affamount` int(11) NOT NULL, `affcollected` int(11) NOT NULL, `name` varchar(256) NOT NULL, `balance` int(11) NOT NULL, `rank` int(11) NOT NULL, `steam_level` int(11) DEFAULT '-1', `mute` int(11) NOT NULL, `ban` int(11) NOT NULL, `avatar` text NOT NULL, `dailygift` int(11) NOT NULL, `hourlygift` int(11) NOT NULL, `redeemed_code` text NOT NULL, `disabled_send` int(11) NOT NULL, `disabled_withdraw` int(11) NOT NULL, `token` varchar(128) NOT NULL, `last` int(11) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
Advertisement
Answer
The definition for this column is:
`ip` text NOT NULL,
Which is both egregiously huge, as TEXT
is intended to support up to 64K of data, and also strictly “NOT NULL” which means it must be populated.
You probably want to alter it to be:
ip VARCHAR(255) NULL,
Which you can do with a Laravel migration.