31 lines
1.1 KiB
PHP
31 lines
1.1 KiB
PHP
<?php
|
|
require_once 'db/config.php';
|
|
$pdo = db();
|
|
|
|
// Tables pour le système de guildes
|
|
$pdo->exec("CREATE TABLE IF NOT EXISTS guilds (
|
|
id INT AUTO_INCREMENT PRIMARY KEY,
|
|
name VARCHAR(255) NOT NULL,
|
|
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
|
)");
|
|
|
|
$pdo->exec("CREATE TABLE IF NOT EXISTS guild_creation_requirements (
|
|
id INT AUTO_INCREMENT PRIMARY KEY,
|
|
resource_id INT NOT NULL,
|
|
amount INT NOT NULL,
|
|
FOREIGN KEY (resource_id) REFERENCES game_resources(id)
|
|
)");
|
|
|
|
// Vérifier si la table guild_restrictions existe déjà et ajouter la colonne si nécessaire
|
|
$pdo->exec("CREATE TABLE IF NOT EXISTS guild_restrictions (
|
|
id INT AUTO_INCREMENT PRIMARY KEY,
|
|
restriction_key VARCHAR(255) NOT NULL UNIQUE,
|
|
value VARCHAR(255) NOT NULL,
|
|
description TEXT
|
|
)");
|
|
|
|
// Migration pour ajouter member_limit si elle n'existe pas
|
|
$stmt = $pdo->query("SELECT COUNT(*) FROM guild_restrictions WHERE restriction_key = 'member_limit'");
|
|
if ($stmt->fetchColumn() == 0) {
|
|
$pdo->exec("INSERT INTO guild_restrictions (restriction_key, value, description) VALUES ('member_limit', '50', 'Nombre maximum de membres par guilde')");
|
|
} |