1- DROP TABLE IF EXISTS rating, solutions, kata, users;
1+ DROP TABLE IF EXISTS ratings, rating, solutions, katas , kata, users;
22
33CREATE TABLE users (
44 id serial primary key ,
@@ -14,33 +14,33 @@ CREATE TABLE users (
1414CREATE TABLE katas (
1515 id serial primary key ,
1616 kyu integer not null ,
17- test_script text not null ,
17+ test_script json not null ,
1818 description text ,
1919 starter_code text not null ,
2020 name varchar (255 ),
21- examples text
21+ examples json
2222);
2323
2424CREATE TABLE solutions (
2525 id serial primary key ,
2626 user_id integer references users(id),
27- kata_id integer references kata (id),
27+ kata_id integer references katas (id),
2828 script text not null
2929);
3030
3131CREATE TABLE ratings (
3232 id serial primary key ,
3333 user_id integer references users(id),
34- kata_id integer references kata (id),
34+ kata_id integer references katas (id),
3535 solution_id integer references solutions(id),
3636 liked boolean not null
3737);
3838
39- INSERT INTO users (github_id, first_name, last_name, email, username, picture_url )
40- VALUES (null , ' bob' , ' smith' , ' bob@smith.com' , ' bobIScool' , null );
39+ INSERT INTO users (github_id, first_name, last_name, email, username, picutre_url )
40+ VALUES (' 12 ' , ' bob' , ' smith' , ' bob@smith.com' , ' bobIScool' , null );
4141
42- INSERT INTO katas (kyu, test_script, description, starter_code, name, examples)
43- VALUES (8 , ' Test.assertEquals(a, 1) ' , ' a should equal 1' , ' var a = 1' , ' Sumbit This' , null );
42+ INSERT INTO katas (kyu, description, starter_code, name, examples, test_script )
43+ VALUES (8 , ' var a should equal 1' , ' var a = 1' , ' Sumbit This' , ' [{"test":"Test.assertEquals(a, 1)","result":""}] ' , ' [{"test":"Test.assertEquals(a, 0)","result":""},{"test":"Test.assertEquals(a, 2)","result":""},{"test":"Test.assertEquals(a, 1)","result":""}] ' );
4444
4545INSERT INTO solutions (user_id, kata_id, script)
4646VALUES (1 , 1 , ' var a = 1' ),
0 commit comments