|
|
@@ -5,12 +5,12 @@ DB_FILE="test.db"
|
|
|
|
|
|
# Executa comandos SQL no SQLite
|
|
|
sqlite3 "$DB_FILE" <<EOF
|
|
|
--- Cria tabela 'user' se não existir, com coluna 'password'
|
|
|
+-- Cria tabela 'user' se não existir, com coluna 'user_password'
|
|
|
CREATE TABLE IF NOT EXISTS user (
|
|
|
user_id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
|
user_name TEXT NOT NULL,
|
|
|
user_flag TEXT NOT NULL,
|
|
|
- password TEXT NOT NULL -- Nova coluna para senha hasheada
|
|
|
+ user_password TEXT NOT NULL -- Nova coluna para senha hasheada
|
|
|
);
|
|
|
|
|
|
-- Cria tabela 'api_key' se não existir
|
|
|
@@ -23,8 +23,8 @@ CREATE TABLE IF NOT EXISTS api_key (
|
|
|
);
|
|
|
|
|
|
-- Insere usuário de exemplo ('admin') com senha hasheada se não existir
|
|
|
--- Hash de 'pass' (gere com password_hash em PHP e substitua)
|
|
|
-INSERT OR IGNORE INTO user (user_name, user_flag, password) VALUES ('admin', 'a', '\$2y\$10\$K.0XhB3kXjZfZfZfZfZfZfZfZfZfZfZfZfZfZfZfZfZfZfZfZfZ');
|
|
|
+-- Hash de 'pass' (gere com user_password_hash em PHP e substitua)
|
|
|
+INSERT OR IGNORE INTO user (user_name, user_flag, user_password) VALUES ('admin', 'a', '\$2y\$10\$K.0XhB3kXjZfZfZfZfZfZfZfZfZfZfZfZfZfZfZfZfZfZfZfZfZ');
|
|
|
|
|
|
-- Insere chave API para o usuário 'admin' se não existir
|
|
|
INSERT OR IGNORE INTO api_key (user_id, api_key_user, api_key_secret)
|
|
|
@@ -32,7 +32,7 @@ SELECT user_id, 'myapikey', 'myapisecret' FROM user WHERE user_name = 'admin';
|
|
|
|
|
|
-- Opcional: Insere mais um usuário de teste com senha hasheada
|
|
|
-- Hash de 'testpass' (substitua pelo real)
|
|
|
-INSERT OR IGNORE INTO user (user_name, user_flag, password) VALUES ('testuser', 'a', '\$2y\$10\$AnotherHashHereForTestPass');
|
|
|
+INSERT OR IGNORE INTO user (user_name, user_flag, user_password) VALUES ('testuser', 'a', '\$2y\$10\$AnotherHashHereForTestPass');
|
|
|
INSERT OR IGNORE INTO api_key (user_id, api_key_user, api_key_secret)
|
|
|
SELECT user_id, 'testapikey', 'testapisecret' FROM user WHERE user_name = 'testuser';
|
|
|
|