github.com/dolthub/go-mysql-server@v0.18.0/sql/mysql_db/help_tables.go (about)

     1  // Copyright 2023 Dolthub, Inc.
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License");
     4  // you may not use this file except in compliance with the License.
     5  // You may obtain a copy of the License at
     6  //
     7  //     http://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  // Unless required by applicable law or agreed to in writing, software
    10  // distributed under the License is distributed on an "AS IS" BASIS,
    11  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  // See the License for the specific language governing permissions and
    13  // limitations under the License.
    14  
    15  package mysql_db
    16  
    17  import (
    18  	"github.com/dolthub/vitess/go/sqltypes"
    19  
    20  	"github.com/dolthub/go-mysql-server/sql"
    21  	"github.com/dolthub/go-mysql-server/sql/types"
    22  )
    23  
    24  const helpTopicTableName = "help_topic"
    25  const helpKeywordTableName = "help_keyword"
    26  const helpCategoryTableName = "help_category"
    27  const helpRelationTableName = "help_relation"
    28  
    29  var helpTopicSchema sql.Schema
    30  var helpKeywordSchema sql.Schema
    31  var helpCategorySchema sql.Schema
    32  var helpRelationSchema sql.Schema
    33  
    34  func init() {
    35  	char64_utf8mb3_general_ci := types.MustCreateString(sqltypes.Char, 64, sql.Collation_utf8mb3_general_ci)
    36  	text_utf8mb3_general_ci := types.MustCreateString(sqltypes.Text, types.TextBlobMax, sql.Collation_utf8mb3_general_ci)
    37  
    38  	helpTopicSchema = sql.Schema{
    39  		columnTemplate("help_topic_id", helpTopicTableName, true, &sql.Column{
    40  			Type: types.Uint64,
    41  		}),
    42  		columnTemplate("name", helpTopicTableName, false, &sql.Column{
    43  			Type: char64_utf8mb3_general_ci,
    44  		}),
    45  		columnTemplate("help_category_id", helpTopicTableName, false, &sql.Column{
    46  			Type: types.Uint8,
    47  		}),
    48  		columnTemplate("description", helpTopicTableName, false, &sql.Column{
    49  			Type: text_utf8mb3_general_ci,
    50  		}),
    51  		columnTemplate("example", helpTopicTableName, false, &sql.Column{
    52  			Type: text_utf8mb3_general_ci,
    53  		}),
    54  		columnTemplate("url", helpTopicTableName, false, &sql.Column{
    55  			Type: text_utf8mb3_general_ci,
    56  		}),
    57  	}
    58  
    59  	helpKeywordSchema = sql.Schema{
    60  		columnTemplate("help_keyword_id", helpKeywordTableName, true, &sql.Column{
    61  			Type: types.Uint64,
    62  		}),
    63  		columnTemplate("name", helpKeywordTableName, false, &sql.Column{
    64  			Type: char64_utf8mb3_general_ci,
    65  		}),
    66  	}
    67  
    68  	helpCategorySchema = sql.Schema{
    69  		columnTemplate("help_category_id", helpCategoryTableName, true, &sql.Column{
    70  			Type: types.Uint8,
    71  		}),
    72  		columnTemplate("name", helpCategoryTableName, false, &sql.Column{
    73  			Type: char64_utf8mb3_general_ci,
    74  		}),
    75  		columnTemplate("parent_category_id", helpCategoryTableName, false, &sql.Column{
    76  			Type: types.Uint8,
    77  		}),
    78  		columnTemplate("url", helpCategoryTableName, false, &sql.Column{
    79  			Type: text_utf8mb3_general_ci,
    80  		}),
    81  	}
    82  
    83  	helpRelationSchema = sql.Schema{
    84  		columnTemplate("help_keyword_id", helpRelationTableName, true, &sql.Column{
    85  			Type: types.Uint64,
    86  		}),
    87  		columnTemplate("help_topic_id", helpRelationTableName, true, &sql.Column{
    88  			Type: types.Uint64,
    89  		}),
    90  	}
    91  }