No Description

migrations.moon 1.4KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. import create_table, types, create_index, add_column, drop_column from require "lapis.db.schema"
  2. import make_migrations, autoload from require "locator"
  3. import settings from autoload "utility"
  4. make_migrations {
  5. [1524503851]: =>
  6. create_table "tasks", {
  7. {"id", types.serial primary_key: true}
  8. {"user_id", types.foreign_key}
  9. {"content", types.text}
  10. {"done", types.boolean default: false}
  11. {"created_at", types.time}
  12. {"updated_at", types.time}
  13. }
  14. create_table "api_keys", {
  15. {"user_id", types.foreign_key}
  16. {"key", types.varchar unique: true}
  17. {"created_at", types.time}
  18. {"updated_at", types.time}
  19. }
  20. create_index "api_keys", "user_id"
  21. create_index "api_keys", "key"
  22. create_index "tasks", "id"
  23. create_index "tasks", "user_id"
  24. create_index "tasks", "user_id", "done"
  25. -- botched migration
  26. [1524517478]: =>
  27. settings["simplex.key-increment"] = 0
  28. [1524517479]: =>
  29. settings.set "simplex.key-increment", 0
  30. [1524605427]: =>
  31. add_column "api_keys", "id", types.serial primary_key: true
  32. -- technically there should be a migration here to wipe out the api_keys table
  33. -- due to a strange bug with how adding an id to api_keys works (I think)
  34. [1524607145]: =>
  35. settings.set "simplex.key-increment", 100 -- I had been accidentally deleting this key over and over again
  36. [1525245815]: =>
  37. drop_column "api_keys", "id"
  38. }