mirror of
https://github.com/writefreely/writefreely
synced 2024-11-28 11:30:18 +00:00
9cb0f80921
Now admins can choose a title for their About and Privacy pages; now editable through the instance page editor. This adds `title` and `content_type` fields to the `appcontent` table, requiring a migration by running `writefreely --migrate` The content_type field specifies that items we're currently storing in this table are all "page"s; queries for fetching these have been updated to filter for this type. In the future, this field will be used to indicate when an item is a stylesheet (ref T563) or other supported type. Ref T566
80 lines
1.5 KiB
Go
80 lines
1.5 KiB
Go
/*
|
|
* Copyright © 2019 A Bunch Tell LLC.
|
|
*
|
|
* This file is part of WriteFreely.
|
|
*
|
|
* WriteFreely is free software: you can redistribute it and/or modify
|
|
* it under the terms of the GNU Affero General Public License, included
|
|
* in the LICENSE file in this source code package.
|
|
*/
|
|
|
|
package migrations
|
|
|
|
import (
|
|
"fmt"
|
|
)
|
|
|
|
// TODO: use now() from writefreely pkg
|
|
func (db *datastore) now() string {
|
|
if db.driverName == driverSQLite {
|
|
return "strftime('%Y-%m-%d %H:%M:%S','now')"
|
|
}
|
|
return "NOW()"
|
|
}
|
|
|
|
func (db *datastore) typeInt() string {
|
|
if db.driverName == driverSQLite {
|
|
return "INTEGER"
|
|
}
|
|
return "INT"
|
|
}
|
|
|
|
func (db *datastore) typeSmallInt() string {
|
|
if db.driverName == driverSQLite {
|
|
return "INTEGER"
|
|
}
|
|
return "SMALLINT"
|
|
}
|
|
|
|
func (db *datastore) typeText() string {
|
|
return "TEXT"
|
|
}
|
|
|
|
func (db *datastore) typeChar(l int) string {
|
|
if db.driverName == driverSQLite {
|
|
return "TEXT"
|
|
}
|
|
return fmt.Sprintf("CHAR(%d)", l)
|
|
}
|
|
|
|
func (db *datastore) typeVarChar(l int) string {
|
|
if db.driverName == driverSQLite {
|
|
return "TEXT"
|
|
}
|
|
return fmt.Sprintf("VARCHAR(%d)", l)
|
|
}
|
|
|
|
func (db *datastore) typeBool() string {
|
|
if db.driverName == driverSQLite {
|
|
return "INTEGER"
|
|
}
|
|
return "TINYINT(1)"
|
|
}
|
|
|
|
func (db *datastore) typeDateTime() string {
|
|
return "DATETIME"
|
|
}
|
|
|
|
func (db *datastore) collateMultiByte() string {
|
|
if db.driverName == driverSQLite {
|
|
return ""
|
|
}
|
|
return " COLLATE utf8_bin"
|
|
}
|
|
|
|
func (db *datastore) engine() string {
|
|
if db.driverName == driverSQLite {
|
|
return ""
|
|
}
|
|
return " ENGINE = InnoDB"
|
|
}
|