AbstractSchemaManager
public abstract class AbstractSchemaManager
Field Summary | |
---|---|
protected \Doctrine\DBAL\Connection | Holds instance of the Doctrine connection for this schema manager |
protected \Doctrine\DBAL\Platforms\AbstractPlatform | Holds instance of the database platform used for this schema manager |
Constructor Summary | |
---|---|
AbstractSchemaManager(\Doctrine\DBAL\Connection conn) Constructor. |
Method Summary | |
---|---|
void | alterTable(TableDiff tableDiff) Alter an existing tables schema |
void | createConstraint(Constraint constraint, string|Table table) Create a constraint on a table |
void | createDatabase(string database) Creates a new database. |
void | createForeignKey(ForeignKeyConstraint foreignKey, string|Table table) Create a new foreign key |
void | createIndex(Index index, string table) Create a new index on a table |
Schema | Create a schema instance for the current database. |
SchemaConfig | Create the configuration for this schema. |
void | createSequence(Sequence sequence) Create a new sequence |
void | createTable(Table table, int createFlags) Create a new table. |
void | createView(View view) Create a new view |
void | dropAndCreateConstraint(Constraint constraint, string table) Drop and create a constraint |
void | dropAndCreateDatabase(string database) Drop and creates a new database. |
void | dropAndCreateForeignKey(ForeignKeyConstraint foreignKey, string|Table table) Drop and create a new foreign key |
void | dropAndCreateIndex(Index index, string|Table table) Drop and create a new index on a table |
void | dropAndCreateSequence(Sequence sequence) Drop and create a new sequence |
void | dropAndCreateTable(Table table) Drop and create a new table. |
void | dropAndCreateView(View view) Drop and create a new view |
void | dropConstraint(Constraint constraint, string table) Drop the constraint from the given table |
void | dropDatabase(string database) Drops a database. |
boolean | dropForeignKey(mixed foreignKey, ForeignKeyConstraint|string table, Table|string name) Drops a foreign key from a table. |
void | dropIndex(Index|string index, string|Table table) Drop the index from the given table |
void | dropSequence(string name) Drops a sequence with a given name. |
void | dropTable(string table) Drop the given table |
boolean | dropView(string name) Drop a view |
\Doctrine\DBAL\Platform\AbstractPlatform | Return associated platform. |
array | List the available databases for this connection |
Sequence[] | listSequences(mixed database) List the available sequences for this connection |
Column[] | listTableColumns(string table) List the columns for a given table. |
Table | listTableDetails(string tableName) |
ForeignKeyConstraint[] | listTableForeignKeys(string table, mixed database) List the foreign keys for the given table |
Index[] | listTableIndexes(string table) List the indexes for a given table returning an array of Index instances. |
array | Return a list of all tables in the current database |
Table[] | List the tables for this connection |
View[] | List the views this connection has |
void | renameTable(string name, string newName) Rename a given table to another name |
mixed | Try any method on the schema manager. |
protected \Doctrine\DBAL\Connection $_conn
Holds instance of the Doctrine connection for this schema manager
protected \Doctrine\DBAL\Platforms\AbstractPlatform $_platform
Holds instance of the database platform used for this schema manager
public AbstractSchemaManager(\Doctrine\DBAL\Connection conn)
Constructor. Accepts the Connection instance to manage the schema for
public void alterTable(TableDiff tableDiff)
Alter an existing tables schema
public void createConstraint(Constraint constraint, string|Table table)
Create a constraint on a table
public void createDatabase(string database)
Creates a new database.
public void createForeignKey(ForeignKeyConstraint foreignKey, string|Table table)
Create a new foreign key
public void createIndex(Index index, string table)
Create a new index on a table
public Schema createSchema()
Create a schema instance for the current database.
public SchemaConfig createSchemaConfig()
Create the configuration for this schema.
public void createSequence(Sequence sequence)
Create a new sequence
public void createTable(Table table, int createFlags)
Create a new table.
public void createView(View view)
Create a new view
public void dropAndCreateConstraint(Constraint constraint, string table)
Drop and create a constraint
public void dropAndCreateDatabase(string database)
Drop and creates a new database.
public void dropAndCreateForeignKey(ForeignKeyConstraint foreignKey, string|Table table)
Drop and create a new foreign key
public void dropAndCreateIndex(Index index, string|Table table)
Drop and create a new index on a table
public void dropAndCreateSequence(Sequence sequence)
Drop and create a new sequence
public void dropAndCreateTable(Table table)
Drop and create a new table.
public void dropAndCreateView(View view)
Drop and create a new view
public void dropConstraint(Constraint constraint, string table)
Drop the constraint from the given table
public void dropDatabase(string database)
Drops a database.
NOTE: You can not drop the database this SchemaManager is currently connected to.
public boolean dropForeignKey(mixed foreignKey, ForeignKeyConstraint|string table, Table|string name)
Drops a foreign key from a table.
public void dropIndex(Index|string index, string|Table table)
Drop the index from the given table
public void dropSequence(string name)
Drops a sequence with a given name.
public void dropTable(string table)
Drop the given table
public boolean dropView(string name)
Drop a view
public \Doctrine\DBAL\Platform\AbstractPlatform getDatabasePlatform()
Return associated platform.
public array listDatabases()
List the available databases for this connection
public Sequence[] listSequences(mixed database)
List the available sequences for this connection
public Column[] listTableColumns(string table)
List the columns for a given table.
In contrast to other libraries and to the old version of Doctrine, this column definition does try to contain the 'primary' field for the reason that it is not portable accross different RDBMS. Use listTableIndexes($tableName) to retrieve the primary key of a table. We're a RDBMS specifies more details these are held in the platformDetails array.
public Table listTableDetails(string tableName)
public ForeignKeyConstraint[] listTableForeignKeys(string table, mixed database)
List the foreign keys for the given table
public Index[] listTableIndexes(string table)
List the indexes for a given table returning an array of Index instances.
Keys of the portable indexes list are all lower-cased.
public array listTableNames()
Return a list of all tables in the current database
public Table[] listTables()
List the tables for this connection
public View[] listViews()
List the views this connection has
public void renameTable(string name, string newName)
Rename a given table to another name
public mixed tryMethod()
Try any method on the schema manager. Normally a method throws an exception when your DBMS doesn't support it or if an error occurs. This method allows you to try and method on your SchemaManager instance and will return false if it does not work or is not supported.
$result = $sm->tryMethod('dropView', 'view_name');
Base class for schema managers. Schema managers are used to inspect and/or modify the database schema/structure.