| @@ 191-209 (lines=19) @@ | ||
| 188 | return "names"; |
|
| 189 | } |
|
| 190 | ||
| 191 | public function init_name_table(S\Schema $schema) { |
|
| 192 | $name_table = $schema->createTable($this->name_table()); |
|
| 193 | $name_table->addColumn |
|
| 194 | ("id", "integer" |
|
| 195 | , array("notnull" => true, "unsigned" => true, "autoincrement" => true) |
|
| 196 | ); |
|
| 197 | $name_table->addColumn |
|
| 198 | ( "name", "string" |
|
| 199 | , array("notnull" => true) |
|
| 200 | ); |
|
| 201 | // TODO: insert namespace column here |
|
| 202 | $name_table->addColumn |
|
| 203 | ( "type", "integer" |
|
| 204 | , array("notnull" => true, "unsigned" => true) |
|
| 205 | ); |
|
| 206 | $name_table->setPrimaryKey(array("id")); |
|
| 207 | $name_table->addUniqueIndex(array("name")); |
|
| 208 | return $name_table; |
|
| 209 | } |
|
| 210 | ||
| 211 | public function file_table() { |
|
| 212 | return "files"; |
|
| @@ 233-254 (lines=22) @@ | ||
| 230 | return "source"; |
|
| 231 | } |
|
| 232 | ||
| 233 | public function init_source_table(S\Schema $schema, S\Table $file_table) { |
|
| 234 | $source_table = $schema->createTable($this->source_table()); |
|
| 235 | $source_table->addColumn |
|
| 236 | ( "file", "integer" |
|
| 237 | , array("notnull" => true) |
|
| 238 | ); |
|
| 239 | $source_table->addColumn |
|
| 240 | ( "line", "integer" |
|
| 241 | , array("notnull" => true, "unsigned" => true) |
|
| 242 | ); |
|
| 243 | $source_table->addColumn |
|
| 244 | ( "source", "string" |
|
| 245 | , array("notnull" => true) |
|
| 246 | ); |
|
| 247 | $source_table->setPrimaryKey(array("file", "line")); |
|
| 248 | $source_table->addForeignKeyConstraint |
|
| 249 | ( $file_table |
|
| 250 | , array("file") |
|
| 251 | , array("id") |
|
| 252 | ); |
|
| 253 | return $source_table; |
|
| 254 | } |
|
| 255 | ||
| 256 | public function definition_table() { |
|
| 257 | return "definitions"; |
|