schema added drop aliased

Added dropDatetimes() and dropSoftDeletesDatetime().

 - updated docs
This commit is contained in:
silverqx
2023-02-21 13:38:28 +01:00
parent 66f278d180
commit 564328f6f7
2 changed files with 24 additions and 7 deletions
+9 -7
View File
@@ -1103,13 +1103,15 @@ The SQLite prior to `v3.35.0` doesn't support dropping columns using the `ALTER
TinyORM provides several convenient methods related to dropping common types of columns. Each of these methods is described in the table below:
| Command | Description |
| -------------------------------- | ----------- |
| `table.dropRememberToken();` | Drop the `remember_token` column. |
| `table.dropSoftDeletes();` | Drop the `deleted_at` column. |
| `table.dropSoftDeletesTz();` | Alias of `dropSoftDeletes()` method. |
| `table.dropTimestamps();` | Drop the `created_at` and `updated_at` columns. |
| `table.dropTimestampsTz();` | Alias of `dropTimestamps()` method. |
| Command | Description |
| -------------------------------- | ----------- |
| `table.dropRememberToken();` | Drop the `remember_token` column. |
| `table.dropSoftDeletes();` | Drop the `deleted_at` column. |
| `table.dropSoftDeletesDatetime();` | Alias of `dropSoftDeletes()` method. |
| `table.dropSoftDeletesTz();` | Alias of `dropSoftDeletes()` method. |
| `table.dropTimestamps();` | Drop the `created_at` and `updated_at` columns. |
| `table.dropTimestampsTz();` | Alias of `dropTimestamps()` method. |
| `table.dropDatetimes();` | Alias of `dropTimestamps()` method. |
## Indexes
+15
View File
@@ -78,11 +78,16 @@ namespace Grammars
void dropTimestamps();
/*! Indicate that the timestamp columns should be dropped. */
inline void dropTimestampsTz();
/*! Indicate that the datetime columns should be dropped. */
inline void dropDatetimes();
/*! Indicate that the soft delete column should be dropped. */
inline void dropSoftDeletes(const QString &column = Orm::Constants::DELETED_AT);
/*! Indicate that the soft delete column should be dropped. */
inline void dropSoftDeletesTz(const QString &column = Orm::Constants::DELETED_AT);
/*! Indicate that the soft delete column should be dropped. */
inline void
dropSoftDeletesDatetime(const QString &column = Orm::Constants::DELETED_AT);
/*! Indicate that the remember token column should be dropped. */
inline void dropRememberToken();
@@ -520,6 +525,11 @@ namespace Grammars
dropTimestamps();
}
void Blueprint::dropDatetimes()
{
dropTimestamps();
}
void Blueprint::dropSoftDeletes(const QString &column)
{
dropColumns(QVector<QString> {column});
@@ -530,6 +540,11 @@ namespace Grammars
dropSoftDeletes(column);
}
void Blueprint::dropSoftDeletesDatetime(const QString &column)
{
dropSoftDeletes(column);
}
void Blueprint::dropRememberToken()
{
dropColumns({QStringLiteral("remember_token")});