<commit_before>package group

import (
	"database/sql"
	"errors"

	"github.com/jmoiron/sqlx"
	"github.com/mijia/sweb/log"
	"github.com/laincloud/sso/ssolib/models"
	"github.com/laincloud/sso/ssolib/models/iuser"
)

var (
	ErrGroupNotFound      = errors.New("Group not found")
	ErrBackendUnsupported = errors.New("unsupported backend type")
)

const createGroupTableSQL = `
CREATE TABLE IF NOT EXISTS ` + "`group`" + ` (
	id INT NOT NULL AUTO_INCREMENT,
	name VARCHAR(32) NOT NULL,
	fullname VARCHAR(128) CHARACTER SET utf8 NOT NULL,
	created TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
	updated TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
	backend TINYINT NOT NULL DEFAULT 0,
	PRIMARY KEY (id),
	UNIQUE KEY (name)
) DEFAULT CHARSET=latin1`

type Group struct {
	Id       int
	Name     string
	FullName string
	Created  string
	Updated  string

	GroupType iuser.GroupType `db:"backend"` // default is 0 for ssolib-mysql
}

func InitDatabase(ctx *models.Context) {<commit_msg>change group name length limit from 32 to 128<commit_after>package group

import (
	"database/sql"
	"errors"

	"github.com/jmoiron/sqlx"
	"github.com/laincloud/sso/ssolib/models"
	"github.com/laincloud/sso/ssolib/models/iuser"
	"github.com/mijia/sweb/log"
)

var (
	ErrGroupNotFound      = errors.New("Group not found")
	ErrBackendUnsupported = errors.New("unsupported backend type")
)

const createGroupTableSQL = `
CREATE TABLE IF NOT EXISTS ` + "`group`" + ` (
	id INT NOT NULL AUTO_INCREMENT,
	name VARCHAR(128) NOT NULL,
	fullname VARCHAR(128) CHARACTER SET utf8 NOT NULL,
	created TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
	updated TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
	backend TINYINT NOT NULL DEFAULT 0,
	PRIMARY KEY (id),
	UNIQUE KEY (name)
) DEFAULT CHARSET=latin1`

type Group struct {
	Id       int
	Name     string
	FullName string
	Created  string
	Updated  string

	GroupType iuser.GroupType `db:"backend"` // default is 0 for ssolib-mysql
}

func InitDatabase(ctx *models.Context) {
{'fraction_non_alphanumeric': 0.09290953545232274, 'fraction_numerical': 0.0117359413202934, 'mean_word_length': 4.427055702917772, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6317464', 'n_tokens_mistral': 757, 'n_tokens_neox': 712, 'n_words': 198}