Dotfiles, utilities, and other apparatus.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
500 B

  1. #!/usr/bin/env python3
  2. # Create a metadata.db in ~/notes
  3. import os
  4. import sqlite3
  5. os.chdir(os.path.join(os.getenv('HOME'), 'notes'))
  6. conn = sqlite3.connect('metadata.db')
  7. c = conn.cursor()
  8. c.execute(
  9. '''CREATE TABLE links (
  10. page text,
  11. target text,
  12. UNIQUE(page, target)
  13. );
  14. '''
  15. )
  16. c.execute(
  17. '''CREATE TABLE pages (
  18. page text,
  19. title text,
  20. datetime text,
  21. UNIQUE(page)
  22. );
  23. '''
  24. )
  25. conn.commit()
  26. conn.close()