up.sql 1.1 KB

1234567891011121314151617181920212223242526272829
  1. -- Create new auth_requests table with master_password_hash as nullable column
  2. CREATE TABLE auth_requests_new (
  3. uuid TEXT NOT NULL PRIMARY KEY,
  4. user_uuid TEXT NOT NULL,
  5. organization_uuid TEXT,
  6. request_device_identifier TEXT NOT NULL,
  7. device_type INTEGER NOT NULL,
  8. request_ip TEXT NOT NULL,
  9. response_device_id TEXT,
  10. access_code TEXT NOT NULL,
  11. public_key TEXT NOT NULL,
  12. enc_key TEXT,
  13. master_password_hash TEXT,
  14. approved BOOLEAN,
  15. creation_date DATETIME NOT NULL,
  16. response_date DATETIME,
  17. authentication_date DATETIME,
  18. FOREIGN KEY (user_uuid) REFERENCES users (uuid),
  19. FOREIGN KEY (organization_uuid) REFERENCES organizations (uuid)
  20. );
  21. -- Transfer current data to new table
  22. INSERT INTO auth_requests_new SELECT * FROM auth_requests;
  23. -- Drop the old table
  24. DROP TABLE auth_requests;
  25. -- Rename the new table to the original name
  26. ALTER TABLE auth_requests_new RENAME TO auth_requests;