Vital.sandbox
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

TypeNameDescription

Returns

TypeNameDescription
boolstatustrue on successful execution, or false on failure

Examples

Define and sync the 'players' table
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()

On this page