<commit_before>drop database if exists site;
create database site;
use site;

/*
 * entities
 */
  
create table account (
  id bigint not null primary key auto_increment,
  email varchar(250) not null unique,
  display_name varchar(63) not null unique,
  password_hash varchar(128) not null,
  password_salt varchar(31) not null
)ENGINE=InnoDB;

create table comment (
  id bigint not null primary key auto_increment,
  body text not null,  
  created datetime not null,
  updated datetime null,
  account bigint not null,
  ticket bigint not null  
)ENGINE=InnoDB;

create table member (
  id bigint not null primary key auto_increment,
  email varchar(250) not null unique,
  complete_name varchar(63) not null unique ,
  account bigint null
)ENGINE=InnoDB;

create table sector (
  id bigint not null primary key auto_increment,
  email varchar(250) not null unique,
  name varchar(255) not null,
  initial varchar(255) not null unique,  
  place varchar(255) not null,
  telephone varchar(255) not null
)ENGINE=InnoDB;

create table session (
  id bigint not null primary key auto_increment,
  code varchar(31) not null,
  created datetime not null,
  account bigint not null
)ENGINE=InnoDB;

create table setting (
  id bigint not null primary key auto_increment,
  site_name varchar(63) not null
)ENGINE=InnoDB;

create table ticket (
  id bigint not null primary key auto_increment,
  body text not null,
  created datetime not null,
  updated datetime null
)ENGINE=InnoDB;

/*
 * relations
 */

create table sector_closure (
  ancestor bigint not null,
  descendant bigint not null,
  primary key (ancestor, descendant)
);

create table ticket_sector (
  ticket bigint not null references ticket(id),
  sector bigint not null references sector(id)
)ENGINE=InnoDB;

/*
 * foreign keys
 */

alter table comment add foreign key (account) references account(id);
alter table comment add foreign key (ticket) references ticket(id);
alter table member add foreign key (account) references account(id);
alter table session add foreign key (account) references account(id);
alter table sector_closure add foreign key (ancestor) references sector(id),
alter table sector_closure add foreign key (descendant) references sector(id)
alter table ticket_sector add index (ticket, sector);<commit_msg>fixing a sql syntax error again<commit_after>drop database if exists site;
create database site;
use site;

/*
 * entities
 */
  
create table account (
  id bigint not null primary key auto_increment,
  email varchar(250) not null unique,
  display_name varchar(63) not null unique,
  password_hash varchar(128) not null,
  password_salt varchar(31) not null
)ENGINE=InnoDB;

create table comment (
  id bigint not null primary key auto_increment,
  body text not null,  
  created datetime not null,
  updated datetime null,
  account bigint not null,
  ticket bigint not null  
)ENGINE=InnoDB;

create table member (
  id bigint not null primary key auto_increment,
  email varchar(250) not null unique,
  complete_name varchar(63) not null unique ,
  account bigint null
)ENGINE=InnoDB;

create table sector (
  id bigint not null primary key auto_increment,
  email varchar(250) not null unique,
  name varchar(255) not null,
  initial varchar(255) not null unique,  
  place varchar(255) not null,
  telephone varchar(255) not null
)ENGINE=InnoDB;

create table session (
  id bigint not null primary key auto_increment,
  code varchar(31) not null,
  created datetime not null,
  account bigint not null
)ENGINE=InnoDB;

create table setting (
  id bigint not null primary key auto_increment,
  site_name varchar(63) not null
)ENGINE=InnoDB;

create table ticket (
  id bigint not null primary key auto_increment,
  body text not null,
  created datetime not null,
  updated datetime null
)ENGINE=InnoDB;

/*
 * relations
 */

create table sector_closure (
  ancestor bigint not null,
  descendant bigint not null,
  primary key (ancestor, descendant)
);

create table ticket_sector (
  ticket bigint not null references ticket(id),
  sector bigint not null references sector(id)
)ENGINE=InnoDB;

/*
 * foreign keys
 */

alter table comment add foreign key (account) references account(id);
alter table comment add foreign key (ticket) references ticket(id);
alter table member add foreign key (account) references account(id);
alter table session add foreign key (account) references account(id);
alter table sector_closure add foreign key (ancestor) references sector(id);
alter table sector_closure add foreign key (descendant) references sector(id);
alter table ticket_sector add index (ticket, sector);
{'fraction_non_alphanumeric': 0.0648730744196138, 'fraction_numerical': 0.014753742677370363, 'mean_word_length': 4.635696821515892, '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': '266703', 'n_tokens_mistral': 1429, 'n_tokens_neox': 1338, 'n_words': 568}