diff --git a/examples/week_8/posts_and_comments/20200224T184700-create_tables.sql b/examples/week_8/posts_and_comments/20200224T184700-create_tables.sql index c5c75a8..ffd0048 100644 --- a/examples/week_8/posts_and_comments/20200224T184700-create_tables.sql +++ b/examples/week_8/posts_and_comments/20200224T184700-create_tables.sql @@ -13,4 +13,5 @@ create table comments ( body TEXT, author VARCHAR(30), FOREIGN KEY(post_id) REFERENCES posts(id) -); \ No newline at end of file +); + diff --git a/examples/week_8/posts_and_comments/20240219_create_combined_table.sql b/examples/week_8/posts_and_comments/20240219_create_combined_table.sql index d3bd1da..89b8c05 100644 --- a/examples/week_8/posts_and_comments/20240219_create_combined_table.sql +++ b/examples/week_8/posts_and_comments/20240219_create_combined_table.sql @@ -1,9 +1,10 @@ create table posts_and_comments ( id INTEGER PRIMARY KEY, - post_id INTEGER, - is_post BOOLEAN, - body TEXT, + old_post_id INTEGER, + parent_post_id INTEGER, slug VARCHAR(30), - title VARCHAR(30), + title VARCHAR(255) NOT NULL, + body TEXT, author VARCHAR(30) -) \ No newline at end of file +); + diff --git a/examples/week_8/posts_and_comments/20240220_backfill_old_posts.sql b/examples/week_8/posts_and_comments/20240220_backfill_old_posts.sql index e69de29..ae13ecf 100644 --- a/examples/week_8/posts_and_comments/20240220_backfill_old_posts.sql +++ b/examples/week_8/posts_and_comments/20240220_backfill_old_posts.sql @@ -0,0 +1,6 @@ +insert into posts_and_comments( + old_post_id, + slug, + title, + body +) select id, slug, title, body from posts; \ No newline at end of file diff --git a/examples/week_8/posts_and_comments/20240221_backfill_old_comments.sql b/examples/week_8/posts_and_comments/20240221_backfill_old_comments.sql index b8f4559..92838a0 100644 --- a/examples/week_8/posts_and_comments/20240221_backfill_old_comments.sql +++ b/examples/week_8/posts_and_comments/20240221_backfill_old_comments.sql @@ -1,12 +1,5 @@ -insert into posts_and_comments -(post_id, -is_post, -body, -author) -VALUES - - select post_id, - 0, +insert into posts_and_comments ( + parent_post_id, body, author - from comments; \ No newline at end of file +) select post_id, body, author from comments; \ No newline at end of file diff --git a/examples/week_8/posts_and_comments/20240222_drop_old_posts_and_comments_tables.sql b/examples/week_8/posts_and_comments/20240222_drop_old_posts_and_comments_tables.sql index 232552b..b14cbe7 100644 --- a/examples/week_8/posts_and_comments/20240222_drop_old_posts_and_comments_tables.sql +++ b/examples/week_8/posts_and_comments/20240222_drop_old_posts_and_comments_tables.sql @@ -1 +1 @@ -drop table posts CASCADE; \ No newline at end of file +drop table posts cascade; \ No newline at end of file diff --git a/examples/week_8/posts_and_comments/weblog.sqlite3 b/examples/week_8/posts_and_comments/weblog.sqlite3 index 1383b8b..10adc8c 100644 Binary files a/examples/week_8/posts_and_comments/weblog.sqlite3 and b/examples/week_8/posts_and_comments/weblog.sqlite3 differ diff --git a/examples/week_9/passwords_with_tests/passwords/__init__.py b/examples/week_9/passwords_with_tests/passwords/__init__.py index 5e0481b..c97c17c 100644 --- a/examples/week_9/passwords_with_tests/passwords/__init__.py +++ b/examples/week_9/passwords_with_tests/passwords/__init__.py @@ -63,7 +63,7 @@ def signup(): try: cursor.execute(query, (username, hashed)) connection.commit() - return {} + return {}, 404 except sqlite3.IntegrityError as e: template = "An exception of type {0} occurred. Arguments:\n{1!r}" message = template.format(type(e).__name__, e.args)