database

package
v2.0.0+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 18, 2019 License: AGPL-3.0 Imports: 17 Imported by: 0

README

PENDING REMOVALS

NONE

MYSQL ENCODING

https://stackoverflow.com/questions/37307146/difference-between-utf8mb4-unicode-ci-and-utf8mb4-unicode-520-ci-collations-in-m

https://mathiasbynens.be/notes/mysql-utf8mb4

https://medium.com/@adamhooper/in-mysql-never-use-utf8-use-utf8mb4-11761243e434

MIGRATE ENCODING

ALTER DATABASE documize CHARACTER SET utf8mb4 COLLATE utf8mb4_bin; ALTER TABLE account CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin; ALTER TABLE attachment CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin; ALTER TABLE block CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin; ALTER TABLE config CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin; ALTER TABLE document CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin; ALTER TABLE feedback CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin; ALTER TABLE label CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin; ALTER TABLE labelrole CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin; ALTER TABLE link CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin; ALTER TABLE organization CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin; ALTER TABLE page CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin; ALTER TABLE pagemeta CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin; ALTER TABLE participant CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin; ALTER TABLE pin CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin; ALTER TABLE revision CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin; ALTER TABLE search CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin; ALTER TABLE share CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin; ALTER TABLE user CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin; ALTER TABLE useraction CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin; ALTER TABLE useractivity CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin; ALTER TABLE userconfig CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin; ALTER TABLE userevent CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Check

func Check(runtime *env.Runtime) bool

Check that the database is configured correctly and that all the required tables exist. It must be the first function called in this package.

func CurrentVersion added in v1.71.0

func CurrentVersion(runtime *env.Runtime) (version int, err error)

CurrentVersion returns number that represents the current database version number. For example 23 represents the 23rd iteration of the database.

func InstallUpgrade added in v1.71.0

func InstallUpgrade(runtime *env.Runtime, existingDB bool) (err error)

InstallUpgrade creates new database or upgrades existing database.

func RebindParams added in v1.71.0

func RebindParams(sql string, s env.StoreType) string

RebindParams changes MySQL query parameter placeholder from "?" to correct value for given database provider.

MySQL uses ?, ?, ? (default for all Documize queries) PostgreSQL uses $1, $2, $3 MS SQL Server uses @p1, @p2, @p3

func RebindPostgreSQL added in v1.71.0

func RebindPostgreSQL(sql string) string

RebindPostgreSQL is a helper method on top of RebindParams.

Types

type Handler added in v1.51.0

type Handler struct {
	Runtime *env.Runtime
	Store   *store.Store
}

Handler contains the runtime information such as logging and database.

func (*Handler) Setup added in v1.53.2

func (h *Handler) Setup(w http.ResponseWriter, r *http.Request)

Setup the tables in a blank database

type Script added in v1.71.0

type Script struct {
	Version int
	Script  []byte
}

Script holds SQL script and it's associated version number.

func SpecificScripts added in v1.71.0

func SpecificScripts(runtime *env.Runtime, all Scripts) (s []Script)

SpecificScripts returns SQL scripts for current databasse provider.

type Scripts added in v1.71.0

type Scripts struct {
	MySQL      []Script
	PostgreSQL []Script
	SQLServer  []Script
}

Scripts holds all .SQL files for all supported database providers.

func LoadScripts added in v1.71.0

func LoadScripts() (s Scripts, err error)

LoadScripts returns .SQL scripts for supported database providers.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL