001.sql 768 B

123456789101112131415161718
  1. -- Crea la tabla de los usuarios.
  2. CREATE TABLE IF NOT EXISTS users (
  3. id VARCHAR(36) NOT NULL,
  4. username VARCHAR(32) NOT NULL,
  5. email VARCHAR(255) NOT NULL,
  6. password VARCHAR(255) NOT NULL,
  7. active BOOLEAN NOT NULL DEFAULT FALSE,
  8. is_admin BOOLEAN NOT NULL DEFAULT FALSE,
  9. created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
  10. updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
  11. CONSTRAINT users_id_primary PRIMARY KEY(id),
  12. CONSTRAINT users_username_unique UNIQUE(username),
  13. CONSTRAINT users_email_unique UNIQUE(email)
  14. );
  15. INSERT INTO users(id, username, email, password, active, is_admin) VALUES
  16. ('a394ca44-7ff4-498a-9ce4-2f9ba7f57071', 'admin', 'admin@example.com', '$2y$10$WCTV774UrzVepTglmzV5NOqYtkH3dMO9uAjWCrYbIOcxBjQrRAAEi', TRUE, TRUE);