Пример #1
0
 public static function createSchema() : Schema
 {
     $schema = new Schema('CalledBy', [new Column('id', Column::TYPE_INT, true, true), new Column('fqsen_string', Column::TYPE_STRING), new Column('file_path', Column::TYPE_STRING), new Column('line_number', Column::TYPE_INT)]);
     // Enforce that we only save one reference per line. Its OK
     // if we overwrite on things like `[C::f(1), C::f(2)]`.
     $schema->addCreateQuery("CREATE UNIQUE INDEX IF NOT EXISTS CalledBy_fqsen_file_line" . " ON `CalledBy` " . " (fqsen_string, file_path, line_number)");
     // Find all callers by FQSEN
     $schema->addCreateQuery("CREATE INDEX IF NOT EXISTS CalledBy_fqsen" . " ON `CalledBy` " . " (fqsen_string)");
     // Find all references by File (so we can delete 'em
     // when the file changes).
     $schema->addCreateQuery("CREATE INDEX IF NOT EXISTS CalledBy_file" . " ON `CalledBy` " . " (file_path)");
     return $schema;
 }
Пример #2
0
 public static function createSchema() : Schema
 {
     $schema = new Schema('Parameter', [new Column('id', Column::TYPE_INT, true, true), new Column('method_fqsen', Column::TYPE_STRING), new Column('name', Column::TYPE_STRING), new Column('type', Column::TYPE_STRING), new Column('flags', Column::TYPE_INT), new Column('context', Column::TYPE_STRING), new Column('is_deprecated', Column::TYPE_BOOL)]);
     // Enforce that we only save one reference per line. Its OK
     // if we overwrite on things like `[C::f(1), C::f(2)]`.
     $schema->addCreateQuery("CREATE INDEX IF NOT EXISTS Parameter_Method_FQSEN" . " ON `Parameter` " . " (method_fqsen)");
     return $schema;
 }
Пример #3
0
 /**
  * @param string $table_name
  * The table we'll be interacting with
  *
  * @param string $item_sql_type
  * The type of items being stored
  *
  * @param \Closure $read_closure
  * A closure that accepts a map from keys to models
  * that are to be handled by the source model
  *
  * @param \Closure $write_closure
  * A closure that returns an array mapping string keys
  * to model objects that will be written.
  */
 public function __construct(string $table_name, string $item_sql_type, \Closure $read_closure, \Closure $write_closure)
 {
     $schema = new Schema($table_name, [new Column('id', Column::TYPE_INT, true, true), new Column('source_pk', 'STRING'), new Column('value', $item_sql_type)]);
     $schema->addCreateQuery("CREATE UNIQUE INDEX IF NOT EXISTS {$table_name}_source_pk_value ON `{$table_name}` " . " (source_pk, value)");
     parent::__construct($schema, $read_closure, $write_closure);
 }