<commit_before>var db = require('./config.js');


//SCHEMAS ---------------------------------------------
//Cannot use USER as a table name || forbidden words: http://www.postgresql.org/docs/current/interactive/sql-keywords-appendix.html
db.query("CREATE TABLE IF NOT EXISTS salesperson (salesperson_name VARCHAR(40),salesperson_id SERIAL PRIMARY KEY);")
 .then(function(){
   console.log('sales created');
   return db.query("CREATE TABLE IF NOT EXISTS client (client_name VARCHAR(40),client_id SERIAL PRIMARY KEY)");
   //if you want to add additional basic schema fields to the client such as info, add it to the string here
 })
 .then(function(){
   console.log('client created');
   return db.query("CREATE TABLE IF NOT EXISTS salesperson_client (salesperson_id int REFERENCES salesperson (salesperson_id) ON UPDATE CASCADE ON DELETE CASCADE,client_id int REFERENCES client (client_id) ON UPDATE CASCADE ON DELETE CASCADE)");
 })
 .then(function(){
   console.log('user client join created');
 })
.catch(function(error){
  console.log('error creating tables');
  console.log(error);
});



module.exports.getAllClientsGivenUserQueryString = 'really long string $1';<commit_msg>Creates JOIN table schema for salesperson_client;<commit_after>var db = require('./config.js');


db.query("SELECT * FROM client INNERJOIN salesperson_client on (salesperson_client.client_id = client.client_id) WHERE salesperson_client.salesperson_id = 1")
.then(function(data){
  console.log('success');
  console.log(data);
})
.catch(function(error){
  console.log(error);
});

//SCHEMAS ---------------------------------------------
//Cannot use USER as a table name || forbidden words: http://www.postgresql.org/docs/current/interactive/sql-keywords-appendix.html
db.query("CREATE TABLE IF NOT EXISTS salesperson (salesperson_name VARCHAR(40),salesperson_id SERIAL PRIMARY KEY);")
 .then(function(){
   console.log('sales created');
   return db.query("CREATE TABLE IF NOT EXISTS client (client_name VARCHAR(40),client_id SERIAL PRIMARY KEY)");
   //if you want to add additional basic schema fields to the client such as info, add it to the string here
 })
 .then(function(){
   console.log('client created');
   return db.query("CREATE TABLE IF NOT EXISTS salesperson_client (salesperson_id int NOT NULL, client_id int NOT NULL, PRIMARY KEY (salesperson_id,client_id), FOREIGN KEY (salesperson_id) REFERENCES salesperson(salesperson_id), FOREIGN KEY (client_id) REFERENCES client(client_id));")
 })
 .then(function(){
   console.log('user client join created');
 })
.catch(function(error){
  console.log('error creating tables');
  console.log(error);
});



module.exports.getAllClientsGivenUserQueryString = 'really long string $1';
{'fraction_non_alphanumeric': 0.1502571638501102, 'fraction_numerical': 0.004041146216017634, 'mean_word_length': 4.501010101010101, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '856654', 'n_tokens_mistral': 833, 'n_tokens_neox': 775, 'n_words': 236}