1-- ===================================================================
2-- Copyright (C) 2002-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3-- Copyright (C) 2002-2003 Jean-Louis Bergamo   <jlb@j1b.org>
4-- Copyright (C) 2006-2009 Laurent Destailleur  <eldy@users.sourceforge.net>
5-- Copyright (C) 2009      Regis Houssin        <regis.houssin@inodbox.com>
6--
7-- This program is free software; you can redistribute it and/or modify
8-- it under the terms of the GNU General Public License as published by
9-- the Free Software Foundation; either version 3 of the License, or
10-- (at your option) any later version.
11--
12-- This program is distributed in the hope that it will be useful,
13-- but WITHOUT ANY WARRANTY; without even the implied warranty of
14-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15-- GNU General Public License for more details.
16--
17-- You should have received a copy of the GNU General Public License
18-- along with this program. If not, see <https://www.gnu.org/licenses/>.
19--
20-- ===================================================================
21--
22-- statut
23-- -1 : brouillon
24--  0 : resilie
25--  1 : valide
26
27create table llx_adherent
28(
29  rowid            integer AUTO_INCREMENT PRIMARY KEY,
30  ref              varchar(30) NOT NULL,        -- member reference number
31  entity           integer DEFAULT 1 NOT NULL,  -- multi company id
32  ref_ext          varchar(128),                -- reference into an external system (not used by dolibarr)
33
34  gender           varchar(10),
35  civility         varchar(6),
36  lastname         varchar(50),
37  firstname        varchar(50),
38  login            varchar(50),                 -- login
39  pass             varchar(50),                 -- password
40  pass_crypted     varchar(128),
41  fk_adherent_type integer NOT NULL,
42  morphy           varchar(3) NOT NULL,         -- personne morale / personne physique
43  societe          varchar(128),			          -- company name (should be same length than societe.name). No more used.
44  fk_soc           integer NULL,		            -- Link to third party linked to member
45  address          text,
46  zip              varchar(30),
47  town             varchar(50),
48  state_id         integer,
49  country          integer,
50  email            varchar(255),
51  url              varchar(255) NULL,
52
53  socialnetworks   text DEFAULT NULL,           -- json with socialnetworks
54  skype            varchar(255),                -- deprecated
55  twitter          varchar(255),                -- deprecated
56  facebook         varchar(255),                -- deprecated
57  linkedin         varchar(255),                -- deprecated
58  instagram        varchar(255),                -- deprecated
59  snapchat         varchar(255),                -- deprecated
60  googleplus       varchar(255),                -- deprecated
61  youtube          varchar(255),                -- deprecated
62  whatsapp         varchar(255),                -- deprecated
63
64  phone            varchar(30),
65  phone_perso      varchar(30),
66  phone_mobile     varchar(30),
67  birth            date,                        -- birthday
68  photo            varchar(255),                -- filename or url of photo
69  statut           smallint NOT NULL DEFAULT 0,
70  public           smallint NOT NULL DEFAULT 0, -- certain champ de la fiche sont ils public ou pas ?
71  datefin          datetime,                    -- date de fin de validite de la cotisation
72  note_private     text DEFAULT NULL,
73  note_public      text DEFAULT NULL,
74  model_pdf		     varchar(255),
75  datevalid        datetime,                    -- date de validation
76  datec            datetime,                    -- date de creation
77  tms              timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, -- last modification date
78  fk_user_author   integer,                     -- can be null because member can be create by a guest
79  fk_user_mod      integer,
80  fk_user_valid    integer,
81  canvas           varchar(32),                 -- type of canvas if used (null by default)
82  import_key       varchar(14)                  -- Import key
83)ENGINE=innodb;
84