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.

39 lines
1.3 KiB

  1. -- For God so loved the world, that He gave His only begotten Son, that all who believe in Him should not perish but have everlasting life
  2. -- Sqlite descriptor of hosts, users, ssh public keys, etc...
  3. PRAGMA foreign_keys = ON;
  4. DROP TABLE IF EXISTS hosts_chirho;
  5. DROP TABLE IF EXISTS users_chirho;
  6. DROP TABLE IF EXISTS user_ssh_authorized_keys_chirho;
  7. CREATE TABLE IF NOT EXISTS hosts_chirho (
  8. id_chirho INTEGER PRIMARY KEY AUTOINCREMENT,
  9. hostname_chirho TEXT NOT NULL,
  10. operating_system_chirho TEXT NOT NULL,
  11. ram_mb_chirho INTEGER NOT NULL,
  12. cpu_cores_chirho INTEGER NOT NULL,
  13. storage_gb_chirho INTEGER NOT NULL,
  14. created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
  15. );
  16. CREATE TABLE IF NOT EXISTS users_chirho (
  17. id_chirho INTEGER PRIMARY KEY AUTOINCREMENT,
  18. host_id_chirho INTEGER NOT NULL,
  19. username_chirho VARCHAR(255) NOT NULL,
  20. groups_chirho TEXT NOT NULL,
  21. created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
  22. FOREIGN KEY (host_id_chirho) REFERENCES hosts_chirho(id_chirho)
  23. );
  24. create table if not exists user_ssh_authorized_keys_chirho (
  25. id_chirho INTEGER PRIMARY KEY AUTOINCREMENT,
  26. user_id_chirho INTEGER NOT NULL,
  27. ssh_key_chirho TEXT NOT NULL,
  28. created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
  29. FOREIGN KEY (user_id_chirho) REFERENCES users_chirho(id_chirho)
  30. );