Home Download Docs Code Community
     1	/*
     2	Copyright 2011 The Perkeep Authors.
     3	
     4	Licensed under the Apache License, Version 2.0 (the "License");
     5	you may not use this file except in compliance with the License.
     6	You may obtain a copy of the License at
     7	
     8	     http://www.apache.org/licenses/LICENSE-2.0
     9	
    10	Unless required by applicable law or agreed to in writing, software
    11	distributed under the License is distributed on an "AS IS" BASIS,
    12	WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13	See the License for the specific language governing permissions and
    14	limitations under the License.
    15	*/
    16	
    17	package mysql
    18	
    19	import (
    20		"strconv"
    21	
    22		"perkeep.org/pkg/sorted"
    23	)
    24	
    25	const requiredSchemaVersion = 22
    26	
    27	func SchemaVersion() int {
    28		return requiredSchemaVersion
    29	}
    30	
    31	// Note: using character set "binary", as any knowledge
    32	// of character set encodings is handled by higher layers.
    33	// At this layer we're just obeying the IndexStorage interface,
    34	// which is purely about bytes.
    35	func SQLCreateTables() []string {
    36		return []string{
    37			`CREATE TABLE IF NOT EXISTS /*DB*/.rows (
    38	 k VARCHAR(` + strconv.Itoa(sorted.MaxKeySize) + `) NOT NULL PRIMARY KEY,
    39	 v VARCHAR(` + strconv.Itoa(sorted.MaxValueSize) + `))
    40	 DEFAULT CHARACTER SET binary`,
    41	
    42			`CREATE TABLE IF NOT EXISTS /*DB*/.meta (
    43	 metakey VARCHAR(255) NOT NULL PRIMARY KEY,
    44	 value VARCHAR(255) NOT NULL)
    45	 DEFAULT CHARACTER SET binary`,
    46		}
    47	}
Website layout inspired by memcached.
Content by the authors.