![]() ![]() Usage: See Creating and Dropping Databases. $dbName ( string) – Name of the database to dropĭrops a database. $column_names ( mixed) – Comma-delimited string or an array of column namesĭrops single or multiple columns from a table. dropColumn ( $table, $column_name ) Parameters Query object on success, false on failure Return typeĬreates a new table. $attributes ( string) – An associative array of table attributes $if_not_exists ( string) – Set to true to add an IF NOT EXISTS clause $table ( string) – Name of the table to create The table method on the Schema facade may be used to. For example, for TableC, you might use the following definition: CREATE TABLE TableC ( id INTEGER PRIMARY KEY AUTOINCREMENT, column1 TEXT, tbbid INTEGER NOT NULL, CONSTRAINT fkb FOREIGN KEY (tbbid) REFERENCES TableB (id) ON DELETE CASCADE ) The purpose of the constraint in the above table. Usage: See Creating and Dropping Databases. Otherwise, the foreign key constraint name will refer to the old table name. $ifNotExists ( string) – Set to true to add an IF NOT EXISTS clause or check if database existsĬreates a new database. For example,If there is one entry in the TRANSACTIONS table with TRANSACTIONID as ‘A2234’ (primary key). $db_name ( string) – Name of the database to create The CASCADE rule of the foreign key states that when any entry is deleted from the parent table then all the dependent rows in the child table should also get deleted. This does not work with SQLite3Īdds a foreign key to the set that will be used to create a table. Therefore, I think the issue is multiple foreign keys with ON DELETE CASCADE, at least as far as Sequelize seeis it. If I remove one of the associations, the other works just fine. $onDelete ( string) – Desired action for the “on delete” Despite the associations being configured the same, the foreign keys for Tasks and TaskLists have different DELETE behavior. $onUpdate ( string) – Desired action for the “on update” A single DELETE statement on multiple related tables which the child table have an ON DELETE CASCADE referential action for the foreign key. $tableField ( string|string) – Name of a parent table field or an array of fields $tableName ( string) – Name of a parent table $fieldName ( string|string) – Name of a key field or an array of fields addForeignKey ( $fieldName, $tableName, $tableField ) Parameters \CodeIgniter\Database\Forge instance (method chaining) Return typeĪdds a field to the set that will be used to create a table. ![]() $field ( array) – Field definition to add True on success, false on failure Return typeĪdds a column to an existing table. $table ( string) – Table name to add the column to RenameTable ( 'old_table_name', 'new_table_name' ) // gives ALTER TABLE `old_table_name` RENAME TO `new_table_name` Class Reference class CodeIgniter\Database\ Forge addColumn ( $table ] ) Parameters
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |