Advertisement
Guest User

Untitled

a guest
Sep 15th, 2019
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.38 KB | None | 0 0
  1. # Learning A New Codebase
  2.  
  3. **1. How are the syntaxes async and await useful when writing JavaScript code?**
  4.  
  5. They provide a cleaner way to write functions using promises, with easier ways of dealing with error handling, conditionals, etc., especially for complex asynchronous code.
  6.  
  7. **2. With respect to Knex, how does the transaction method relate to BEGIN and COMMIT syntax in PostgreSQL?**
  8.  
  9. The transaction method allows queries to be grouped in a single database connection so that if anything fails within the transaction, it will roll back the previous lines, keeping the database consistent and safe from errors. This is exactly how BEGIN and COMMIT work in PostgreSQL--everything between those two commands tries to run and will roll back upon hitting any failures.
  10.  
  11. **3. What is a "sequence table" in PostgreSQL?**
  12.  
  13. A sequence table is a table of integers used to generate ids for other tables. The values in these tables can be controlled in various ways--being reset, given inital values, and increment values, etc.
  14.  
  15. **4. What does RESTART IDENTITY CASCADE do?**
  16.  
  17. This resets the sequence table for the associated table, so that the ids start over from the beginning when the table is truncated and re-created.
  18.  
  19. **5. What does SELECT setval('blogful_users_id_seq', 1) do?**
  20.  
  21. This sets the integer in sequence for 'blogful_users_id_seq' to 1, meaning blogful_users will return to generating ids at 1.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement