-
Notifications
You must be signed in to change notification settings - Fork 12
Brianna/step two #17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
BCerki
wants to merge
9
commits into
button-inc:main
Choose a base branch
from
BCerki:brianna/step-two
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Brianna/step two #17
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
267eb9a
initialize sqitch configuration
BCerki e6f064b
add todo_app schema
BCerki c34caf4
add todos table
BCerki 9576df2
change SQL to lowercase
BCerki 20ead7d
add insert todo function
BCerki 1a63977
give date_updated in todos table a default value
BCerki ad343d0
create seed data
BCerki a79b5df
add username and email to sqitch config
BCerki bfb218f
install postgraphile
BCerki File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| node_modules |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| { | ||
| "name": "button-onboarding", | ||
| "version": "1.0.0", | ||
| "description": "A guide to help developers onboard to the Button stack by building a simple todo app.", | ||
| "main": "index.js", | ||
| "scripts": { | ||
| "test": "echo \"Error: no test specified\" && exit 1" | ||
| }, | ||
| "repository": { | ||
| "type": "git", | ||
| "url": "git+https://github.com/BCerki/button-onboarding.git" | ||
| }, | ||
| "author": "", | ||
| "license": "ISC", | ||
| "bugs": { | ||
| "url": "https://github.com/BCerki/button-onboarding/issues" | ||
| }, | ||
| "homepage": "https://github.com/BCerki/button-onboarding#readme" | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| -- Deploy todo_app:insert_todo to pg | ||
| -- requires: todos | ||
| -- requires: todo_appschema | ||
|
|
||
| BEGIN; | ||
|
|
||
| create or replace function todo_app.insert_todo( | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Postgraphile should already expose a mutation that you can call, out of the box: mutation InsertTodo {
createToDo(
input: {
todo: { task: 'The Task\'s name', completed: false }
}
)
{
# ... whatever you want returned , or '__typename' if nothing
}
} |
||
| task text, | ||
| completed boolean | ||
| ) returns void language sql security definer as $$ | ||
| insert into todo_app.todos(task, completed) values($1, $2); | ||
| $$; | ||
|
|
||
| COMMIT; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| -- Deploy todo_app:seed_todo to pg | ||
| -- requires: insert_todo | ||
| -- requires: todos | ||
| -- requires: todo_appschema | ||
|
|
||
| BEGIN; | ||
|
|
||
| select todo_app.insert_todo('task not done', false); | ||
| select todo_app.insert_todo('task done', true); | ||
|
|
||
| COMMIT; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| -- Deploy todo_app:todo_appschema to pg | ||
|
|
||
| BEGIN; | ||
|
|
||
| create schema todo_app; | ||
|
|
||
| COMMIT; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| -- Deploy todo_app:todos to pg | ||
| -- requires: todo_appschema | ||
|
|
||
| BEGIN; | ||
|
|
||
| set client_min_messages = 'warning'; | ||
|
|
||
| create table todo_app.todos ( | ||
| id integer primary key generated always as identity, | ||
| task text not null, | ||
| completed boolean not null default false, | ||
| date_created timestamptz not null default now(), | ||
| date_updated timestamptz not null default now() | ||
| ); | ||
|
|
||
| COMMIT; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| -- Revert todo_app:insert_todo from pg | ||
|
|
||
| BEGIN; | ||
|
|
||
| drop function todo_app.insert_todo(text, boolean); | ||
|
|
||
| COMMIT; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| -- Revert todo_app:seed_todo from pg | ||
|
|
||
| BEGIN; | ||
|
|
||
| delete from todo_app.todos; | ||
|
|
||
| COMMIT; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| -- Revert todo_app:todo_appschema from pg | ||
|
|
||
| BEGIN; | ||
|
|
||
| drop schema todo_app; | ||
|
|
||
| COMMIT; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| -- Revert todo_app:todos from pg | ||
|
|
||
| BEGIN; | ||
|
|
||
| drop table todo_app.todos; | ||
|
|
||
| COMMIT; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| [core] | ||
| engine = pg | ||
| # plan_file = sqitch.plan | ||
| # top_dir = . | ||
| [engine "pg"] | ||
| target = todo_app | ||
| [target "todo_app"] | ||
| uri = db:pg://localhost/todo_app | ||
| [user] | ||
| name = Brianna Cerkiewicz | ||
| email = brianna@button.is |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| %syntax-version=1.0.0 | ||
| %project=todo_app | ||
|
|
||
| todo_appschema 2022-02-23T22:43:21Z Brianna Cerkiewicz <briannacerkiewicz@pop-os> # Add schema for all todo objects. | ||
| todos [todo_appschema] 2022-02-23T22:48:12Z Brianna Cerkiewicz <briannacerkiewicz@pop-os> # Create table to hold todos. | ||
| insert_todo [todos todo_appschema] 2022-02-23T23:18:41Z Brianna Cerkiewicz <briannacerkiewicz@pop-os> # Creates a function to insert a todo. | ||
| seed_todo [insert_todo todos todo_appschema] 2022-02-24T00:23:11Z Brianna Cerkiewicz <briannacerkiewicz@pop-os> # Creates seed todos. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| -- Verify todo_app:insert_todo on pg | ||
|
|
||
| BEGIN; | ||
|
|
||
| select has_function_privilege('todo_app.insert_todo(text, boolean)', 'execute'); | ||
|
|
||
| ROLLBACK; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| -- Verify todo_app:seed_todo on pg | ||
|
|
||
|
|
||
| BEGIN; | ||
| do $$ | ||
| declare | ||
| count integer; | ||
|
|
||
| BEGIN | ||
| count := (select count(id) from todo_app.todos); | ||
| assert count = 2; | ||
| end $$ | ||
|
|
||
| ROLLBACK; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| -- Verify todo_app:todo_appschema on pg | ||
|
|
||
| BEGIN; | ||
|
|
||
| select pg_catalog.has_schema_privilege('todo_app', 'usage'); | ||
|
|
||
| ROLLBACK; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| -- Verify todo_app:todos on pg | ||
|
|
||
| BEGIN; | ||
|
|
||
| select id, task, completed, date_created, date_updated | ||
| FROM todo_app.todos | ||
| WHERE FALSE; | ||
|
|
||
| ROLLBACK; |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
our team's code style is all lowercase for SQL code