| @@ 209-227 (lines=19) @@ | ||
| 206 | return "names"; |
|
| 207 | } |
|
| 208 | ||
| 209 | public function init_name_table(S\Schema $schema) { |
|
| 210 | $name_table = $schema->createTable($this->name_table()); |
|
| 211 | $name_table->addColumn |
|
| 212 | ("id", "integer" |
|
| 213 | , array("notnull" => true, "unsigned" => true, "autoincrement" => true) |
|
| 214 | ); |
|
| 215 | $name_table->addColumn |
|
| 216 | ( "name", "string" |
|
| 217 | , array("notnull" => true) |
|
| 218 | ); |
|
| 219 | // TODO: insert namespace column here |
|
| 220 | $name_table->addColumn |
|
| 221 | ( "type", "integer" |
|
| 222 | , array("notnull" => true, "unsigned" => true) |
|
| 223 | ); |
|
| 224 | $name_table->setPrimaryKey(array("id")); |
|
| 225 | $name_table->addUniqueIndex(array("name")); |
|
| 226 | return $name_table; |
|
| 227 | } |
|
| 228 | ||
| 229 | public function file_table() { |
|
| 230 | return "files"; |
|
| @@ 251-272 (lines=22) @@ | ||
| 248 | return "source"; |
|
| 249 | } |
|
| 250 | ||
| 251 | public function init_source_table(S\Schema $schema, S\Table $file_table) { |
|
| 252 | $source_table = $schema->createTable($this->source_table()); |
|
| 253 | $source_table->addColumn |
|
| 254 | ( "file", "integer" |
|
| 255 | , array("notnull" => true) |
|
| 256 | ); |
|
| 257 | $source_table->addColumn |
|
| 258 | ( "line", "integer" |
|
| 259 | , array("notnull" => true, "unsigned" => true) |
|
| 260 | ); |
|
| 261 | $source_table->addColumn |
|
| 262 | ( "source", "string" |
|
| 263 | , array("notnull" => true) |
|
| 264 | ); |
|
| 265 | $source_table->setPrimaryKey(array("file", "line")); |
|
| 266 | $source_table->addForeignKeyConstraint |
|
| 267 | ( $file_table |
|
| 268 | , array("file") |
|
| 269 | , array("id") |
|
| 270 | ); |
|
| 271 | return $source_table; |
|
| 272 | } |
|
| 273 | ||
| 274 | public function definition_table() { |
|
| 275 | return "definitions"; |
|