retreat-dev / retreat-dev-general

The retreat general
0 stars 0 forks source link

To investigate the next available familyID #10

Open retreat-dev opened 2 years ago

retreat-dev commented 2 years ago

To provide a PHP DB function to share with retreat/management for:

  1. a DB PHP function: getNextAvailableFamilyID()
  2. the msqyl call must have the table lock to ensure the next available familyID to be returned.
  3. familyID can't be re-used.
retreat-dev commented 2 years ago

CREATE TABLE family_ids ( FamilyID int(11) NOT NULL, default tinyint(1) DEFAULT '0' ) ENGINE=InnoDB DEFAULT CHARSET=latin1;

ALTER TABLE family_ids ADD PRIMARY KEY (FamilyID);

ALTER TABLE family_ids MODIFY FamilyID int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=xxxx;

xxxx will be the next current id of the familyIDs .