fabien0102
12/15/2017, 4:35 PMsteve
12/15/2017, 4:53 PMfabien0102
12/15/2017, 4:53 PMagartha
12/15/2017, 4:53 PMgraphcool local stop
followed by docker volume prune
will completely reset your local environmentfabien0102
12/15/2017, 4:54 PMfabien0102
12/15/2017, 4:54 PMfabien0102
12/15/2017, 4:55 PMsteve
12/15/2017, 4:55 PMagartha
12/15/2017, 4:56 PMfabien0102
12/15/2017, 4:56 PMagartha
12/15/2017, 4:57 PMagartha
12/15/2017, 4:57 PMfabien0102
12/15/2017, 4:58 PMsteve
12/15/2017, 4:59 PMagartha
12/15/2017, 4:59 PMfabien0102
12/15/2017, 4:59 PMfabien0102
12/15/2017, 5:00 PMsteve
12/15/2017, 5:00 PMprune
command above will do thatagartha
12/15/2017, 5:00 PMfabien0102
12/15/2017, 5:01 PMsteve
12/15/2017, 5:02 PMimport mysql from 'mysql';
import projectId from '../tests/utils/projectId';
const createDbConnection = projectId => mysql.createConnection(
{
host : 'localhost',
port : 3306,
user : 'root',
password : 'graphcool',
database : projectId
}
);
const clearTables = (connection, tables) => {
const query = (query) => new Promise(
(resolve, reject) => {
connection.query(query, (err, results) => (
((err && reject(err) && false) ||
resolve(results))
))
}
)
return Promise.all(tables.map(t => query(`delete from ${t};`)));
};
export default (tables) => {
const conn = createDbConnection(projectId());
tables = [].concat(tables);
conn.connect();
return clearTables(conn, tables).then(()=>new Promise((res)=> conn.end(res)))
};
steve
12/15/2017, 5:02 PMsteve
12/15/2017, 5:03 PMsteve
12/15/2017, 5:03 PMfabien0102
12/15/2017, 5:03 PMfabien0102
12/15/2017, 5:03 PMfabien0102
12/15/2017, 5:04 PMgc local reset
(with a confirmation message of course)fabien0102
12/15/2017, 5:05 PMagartha
12/15/2017, 5:06 PMagartha
12/15/2017, 5:06 PMfabien0102
12/15/2017, 5:07 PMfabien0102
12/15/2017, 5:07 PMfabien0102
12/15/2017, 5:08 PMagartha
12/15/2017, 5:10 PMfabien0102
12/15/2017, 5:12 PMagartha
12/15/2017, 5:17 PMfabien0102
12/15/2017, 5:17 PMnilan
12/15/2017, 6:08 PM