1
0
Fork 0
mirror of https://github.com/Eggbertx/gochan.git synced 2025-08-28 08:06:24 -07:00

Remove unique on navbar position for usability.

Actually order by navbar position. Then order by name.
This commit is contained in:
comraderat 2020-05-27 21:18:19 +02:00
parent 092aa8aede
commit 2039958d1e
5 changed files with 6 additions and 9 deletions

View file

@ -46,8 +46,7 @@ CREATE TABLE DBPREFIXboards(
enable_catalog BOOL NOT NULL,
FOREIGN KEY(section_id) REFERENCES DBPREFIXsections(id),
UNIQUE(dir),
UNIQUE(uri),
UNIQUE(navbar_position)
UNIQUE(uri)
);
CREATE TABLE DBPREFIXthreads(

View file

@ -46,8 +46,7 @@ CREATE TABLE DBPREFIXboards(
enable_catalog BOOL NOT NULL,
FOREIGN KEY(section_id) REFERENCES DBPREFIXsections(id),
UNIQUE(dir),
UNIQUE(uri),
UNIQUE(navbar_position)
UNIQUE(uri)
);
CREATE TABLE DBPREFIXthreads(

View file

@ -46,8 +46,7 @@ CREATE TABLE DBPREFIXboards(
enable_catalog BOOL NOT NULL,
FOREIGN KEY(section_id) REFERENCES DBPREFIXsections(id),
UNIQUE(dir),
UNIQUE(uri),
UNIQUE(navbar_position)
UNIQUE(uri)
);
CREATE TABLE DBPREFIXthreads(

View file

@ -46,8 +46,7 @@ CREATE TABLE DBPREFIXboards(
enable_catalog BOOL NOT NULL,
FOREIGN KEY(section_id) REFERENCES DBPREFIXsections(id),
UNIQUE(dir),
UNIQUE(uri),
UNIQUE(navbar_position)
UNIQUE(uri)
);
CREATE TABLE DBPREFIXthreads(

View file

@ -931,7 +931,8 @@ func DoesBoardExistByID(ID int) (bool, error) {
// Deprecated: This method was created to support old functionality during the database refactor of april 2020
// The code should be changed to reflect the new database design
func GetAllBoards() ([]Board, error) {
const sql = "SELECT id, section_id, dir, navbar_position, title, subtitle, description, max_file_size, default_style, locked, created_at, anonymous_name, force_anonymous, autosage_after, no_images_after, max_message_length, allow_embeds, redirect_to_thread, require_file, enable_catalog FROM DBPREFIXboards"
const sql = `SELECT id, section_id, dir, navbar_position, title, subtitle, description, max_file_size, default_style, locked, created_at, anonymous_name, force_anonymous, autosage_after, no_images_after, max_message_length, allow_embeds, redirect_to_thread, require_file, enable_catalog FROM DBPREFIXboards
ORDER BY navbar_position ASC, dir ASC`
rows, err := QuerySQL(sql)
if err != nil {
return nil, err