Schema.php 3.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. <?php
  2. namespace Illuminate\Support\Facades;
  3. /**
  4. * @method static void defaultStringLength(int $length)
  5. * @method static void defaultTimePrecision(int|null $precision)
  6. * @method static void defaultMorphKeyType(string $type)
  7. * @method static void morphUsingUuids()
  8. * @method static void morphUsingUlids()
  9. * @method static bool createDatabase(string $name)
  10. * @method static bool dropDatabaseIfExists(string $name)
  11. * @method static array getSchemas()
  12. * @method static bool hasTable(string $table)
  13. * @method static bool hasView(string $view)
  14. * @method static array getTables(string|string[]|null $schema = null)
  15. * @method static array getTableListing(string|string[]|null $schema = null, bool $schemaQualified = true)
  16. * @method static array getViews(string|string[]|null $schema = null)
  17. * @method static array getTypes(string|string[]|null $schema = null)
  18. * @method static bool hasColumn(string $table, string $column)
  19. * @method static bool hasColumns(string $table, array $columns)
  20. * @method static void whenTableHasColumn(string $table, string $column, \Closure $callback)
  21. * @method static void whenTableDoesntHaveColumn(string $table, string $column, \Closure $callback)
  22. * @method static void whenTableHasIndex(string $table, string|array $index, \Closure $callback, string|null $type = null)
  23. * @method static void whenTableDoesntHaveIndex(string $table, string|array $index, \Closure $callback, string|null $type = null)
  24. * @method static string getColumnType(string $table, string $column, bool $fullDefinition = false)
  25. * @method static array getColumnListing(string $table)
  26. * @method static array getColumns(string $table)
  27. * @method static array getIndexes(string $table)
  28. * @method static array getIndexListing(string $table)
  29. * @method static bool hasIndex(string $table, string|array $index, string|null $type = null)
  30. * @method static array getForeignKeys(string $table)
  31. * @method static void table(string $table, \Closure $callback)
  32. * @method static void create(string $table, \Closure $callback)
  33. * @method static void drop(string $table)
  34. * @method static void dropIfExists(string $table)
  35. * @method static void dropColumns(string $table, string|array $columns)
  36. * @method static void dropAllTables()
  37. * @method static void dropAllViews()
  38. * @method static void dropAllTypes()
  39. * @method static void rename(string $from, string $to)
  40. * @method static bool enableForeignKeyConstraints()
  41. * @method static bool disableForeignKeyConstraints()
  42. * @method static mixed withoutForeignKeyConstraints(\Closure $callback)
  43. * @method static void ensureVectorExtensionExists(string|null $schema = null)
  44. * @method static void ensureExtensionExists(string $name, string|null $schema = null)
  45. * @method static string[]|null getCurrentSchemaListing()
  46. * @method static string|null getCurrentSchemaName()
  47. * @method static array parseSchemaAndTable(string $reference, string|bool|null $withDefaultSchema = null)
  48. * @method static \Illuminate\Database\Connection getConnection()
  49. * @method static void blueprintResolver(\Closure $resolver)
  50. * @method static void macro(string $name, object|callable $macro)
  51. * @method static void mixin(object $mixin, bool $replace = true)
  52. * @method static bool hasMacro(string $name)
  53. * @method static void flushMacros()
  54. *
  55. * @see \Illuminate\Database\Schema\Builder
  56. */
  57. class Schema extends Facade
  58. {
  59. /**
  60. * Indicates if the resolved facade should be cached.
  61. *
  62. * @var bool
  63. */
  64. protected static $cached = false;
  65. /**
  66. * Get a schema builder instance for a connection.
  67. *
  68. * @param string|null $name
  69. * @return \Illuminate\Database\Schema\Builder
  70. */
  71. public static function connection($name)
  72. {
  73. return static::$app['db']->connection($name)->getSchemaBuilder();
  74. }
  75. /**
  76. * Get the registered name of the component.
  77. *
  78. * @return string
  79. */
  80. protected static function getFacadeAccessor()
  81. {
  82. return 'db.schema';
  83. }
  84. }