Database
self:sync
Server
Synchronises all defined table schemas with the database, creating any tables that do not already exist
Syntax
local status = self:sync()Parameters
| Type | Name | Description |
|---|
Returns
| Type | Name | Description |
|---|---|---|
bool | status | true on successful execution, or false on failure |
Examples
local db = database.create("127.0.0.1", "root", "", "vital_sandbox")
--Define the players table schema
db:define("players", {
id = { type = "INT UNSIGNED", primary = true, autoincrement = true, nullable = false },
name = { type = "VARCHAR(64)", nullable = false },
score = { type = "INT", nullable = true }
})
--Sync all defined schemas to the database
db:sync()