friendica-github/doc/database/db_gcontact.md
Alexandre Alapetite d2901dcb00 Fix for MySQL 5.7+
https://github.com/friendica/friendica/issues/2786

Only tested on Ubuntu 16.10 with MySQL 5.7.17.

https://dev.mysql.com/doc/refman/8.0/en/timestamp-initialization.html

https://dev.mysql.com/doc/refman/8.0/en/sql-mode.html#sqlmode_no_zero_date
As of MySQL 5.7.4, NO_ZERO_DATE is deprecated.

Patch based on the following search & replace (and then reverting some
changes in libraries):

```sh
grep -l '= "0000-00-00"' -r . | xargs sed -i -e "s/= \"0000-00-00\"/=
'0000-00-00'/g"

grep -l "0000-00-00" -r . | xargs sed -i -e "s/0000-00-00/0001-01-01/g"

grep -l "!= '0001-01-01'" -r . | xargs sed -i -e "s/!= '0001-01-01'/>
'0001-01-01'/g"

grep -l " === '0001-01-01'" -r . | xargs sed -i -e "s/ === '0001-01-01'/
<= '0001-01-01'/g"

grep -l " == '0001-01-01'" -r . | xargs sed -i -e "s/ == '0001-01-01'/
<= '0001-01-01'/g"

grep -l "strpos(\$dob, '0000-') === 0" -r . | xargs sed -i -e
"s/strpos(\$dob, '0000-') === 0/strpos(\$dob, '0000-') === 0 ||
strpos(\$dob, '0001-') === 0/g"

grep -l 'array("", "0001-01-01")' -r . | xargs sed -i -e 's/array("",
"0001-01-01")/array("", "0000-00-00", "0001-01-01")/g'

grep -l "\$dob = '0000-'" -r . | xargs sed -i -e "s/\$dob =
'0000-'/\$dob = '0001-'/g"
```
2017-04-11 23:00:45 +02:00

3.4 KiB

Table gcontact

Field Description Type Null Key Default Extra
id sequential ID int(10) unsigned NO PRI NULL auto_increment
name Name that this contact is known by varchar(255) NO
nick Nick- and user name of the contact varchar(255) NO
url Link to the contacts profile page varchar(255) NO
nurl varchar(255) NO MUL
photo Link to the profile photo varchar(255) NO
connect varchar(255) NO
created datetime NO 0001-01-01 00:00:00
updated datetime YES MUL 0001-01-01 00:00:00
last_contact datetime YES 0001-01-01 00:00:00
last_failure datetime YES 0001-01-01 00:00:00
location varchar(255) NO
about text NO NULL
keywords puplic keywords (interests) text NO NULL
gender varchar(32) NO
birthday varchar(32) NO 0001-01-01
community 1 if contact is forum account tinyint(1) NO 0
hide 1 = should be hidden from search tinyint(1) NO 0
nsfw 1 = contact posts nsfw content tinyint(1) NO 0
network social network protocol varchar(255) NO
addr varchar(255) NO
notify text NO
alias varchar(255) NO
generation tinyint(3) NO 0
server_url baseurl of the contacts server varchar(255) NO

Return to database documentation