From d86204f264baadd48bd287cb74e04ad31694af8b Mon Sep 17 00:00:00 2001 From: Trevor Austin Date: Fri, 17 May 2024 19:31:45 -0500 Subject: [PATCH] Introduce breaking change --- .../20200224T184700-create_tables.sql | 3 ++- .../20240219_create_combined_table.sql | 11 ++++++----- .../20240220_backfill_old_posts.sql | 6 ++++++ .../20240221_backfill_old_comments.sql | 13 +++---------- ...222_drop_old_posts_and_comments_tables.sql | 2 +- .../week_8/posts_and_comments/weblog.sqlite3 | Bin 20480 -> 20480 bytes .../passwords/__init__.py | 2 +- 7 files changed, 19 insertions(+), 18 deletions(-) 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 1383b8bd62b04ecccedb1d99fb7417fc1cf6bce3..10adc8cc5189757726cdf442b0fedec00e44ee23 100644 GIT binary patch delta 236 zcmZozz}T>Wae}m<3IhWJD-<&VY5s{i#-b_=df^_tKpr#i76$%2zMZ^V_;NN2I`H#O zZss-QYGPt$7dJFyY}TLrnb&XfM?M*E1%>>al=y=D;*$8x6a`Pe5Lb8CARR6RASg&I zO3f?5E?1mWnywJ$8075X7^Gorpb643`3k=xzk)(ieoCc6h-*X$NNn?BzC=bQ1_7WO b-t$ik;AR6k4hMIF7$*x*5{!ZB-|zzf+9f#3 literal 20480 zcmeHO&2t<_72nmj+L6Qom&;`ow+_@=WVMAI0+d9Rk({-)M3#iKw&F@rqGzUeXRMj& z&2*2ZHWZ{}ND9J%ONu+Ez>#Ba{1aR_aHaega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.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)