self:drop
Server
Drops the table from the database and removes it from the schema
Syntax
local promise = self:drop()This function returns a promise and starts processing the query. Use thread:await inside a thread to retrieve the result.
- Inside a thread —
self:await(db_query:drop())yields until the operation completes, then returns the resolved values. - Outside a thread — the promise can still be created, but must be awaited from within a thread to retrieve the result.
Parameters
| No parameters are accepted by this function |
|---|
Returns
| Type | Name | Description |
|---|---|---|
promise | promise | Refer Settlements section |
Settlements
| Type | Name | Description |
|---|---|---|
bool | status | true on success, false otherwise |
bool | resolved | true |
string | rejected | Error message describing the failure |
Examples
local db = core.database.create("127.0.0.1", "root", "", "vital_sandbox")
util.thread.create(function(self)
local ok, err = self:await(db:table("players")
:drop())
if not ok then
core.engine.print("error", err)
end
end):resume()