Changeset e498070 for src/webservice/htdocs/SiWeather/Webservice/Setup.php
- Timestamp:
- Sep 9, 2015, 10:03:34 PM (11 years ago)
- Branches:
- master
- Children:
- 915dc18
- Parents:
- d83a844
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/webservice/htdocs/SiWeather/Webservice/Setup.php
rd83a844 re498070 251 251 } 252 252 253 // prepare status table 254 $table = "status"; 255 if(!$this->databaseTableExists($table)){ 256 $sql = "CREATE TABLE ". $table ." ("; 257 $sql .= " id INTEGER NOT NULL PRIMARY KEY,"; 258 $sql .= " name TEXT NOT NULL"; 259 $sql .= ")"; 260 if(!$this->databaseTableCreate($table, $sql, $errorMessage)){ 261 return false; 262 } 263 $status = array("confirming", "active", "deletionrequested"); 264 $sql = "INSERT INTO ". $table ." (name) VALUES(:name)"; 265 $sqlStatement = $this->_databaseHandler->prepare($sql); 266 foreach ($status as $name){ 267 $sqlStatement->clear(); 268 $sqlStatement->bindValue(":name", $name); 269 if(!$sqlStatement->execute()){ 270 $errorMessage = Translation::swGettext("Could not add status %s to the database", $name); 271 error_log($errorMessage); 272 return false; 273 } 274 $sqlStatement->reset(); 275 } 276 } 277 253 278 // prepare stations table 254 279 $table = "stations"; … … 257 282 $sql .= " id INTEGER NOT NULL PRIMARY KEY,"; 258 283 $sql .= " name TEXT NOT NULL,"; 259 $sql .= " city INTEGER ,";284 $sql .= " city INTEGER NOT NULL,"; 260 285 $sql .= " uuid TEXT NOT NULL,"; 261 286 $sql .= " ownerMail TEXT NOT NULL,"; 287 $sql .= " type TEXT NOT NULL,"; 288 $sql .= " typeUrl TEXT,"; 289 $sql .= " status INTEGER NOT NULL,"; 262 290 $sql .= " FOREIGN KEY(city) REFERENCES cities(id)"; 291 $sql .= " FOREIGN KEY(status) REFERENCES status(id)"; 263 292 $sql .= ")"; 264 293 if(!$this->databaseTableCreate($table, $sql, $errorMessage)){
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/siweather/chrome/site/your_project_logo.png)