a guest Sep 15th, 2019 88 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # Learning A New Codebase
  3. **1. How are the syntaxes async and await useful when writing JavaScript code?**
  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.
  7. **2. With respect to Knex, how does the transaction method relate to BEGIN and COMMIT syntax in PostgreSQL?**
  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.
  11. **3. What is a "sequence table" in PostgreSQL?**
  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.
  15. **4. What does RESTART IDENTITY CASCADE do?**
  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.
  19. **5. What does SELECT setval('blogful_users_id_seq', 1) do?**
  21. This sets the integer in sequence for 'blogful_users_id_seq' to 1, meaning blogful_users will return to generating ids at 1.
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!