mirror of
https://scm.univ-tours.fr/22107988t/rappaurio-sae501_502.git
synced 2025-08-29 03:25:59 +02:00
la base de données configurée
This commit is contained in:
33
mariadb/rappaurio.sql
Normal file
33
mariadb/rappaurio.sql
Normal file
@@ -0,0 +1,33 @@
|
||||
-- Créer la base de données
|
||||
CREATE DATABASE rappaurio;
|
||||
|
||||
-- Utiliser la base de données
|
||||
USE rappaurio;
|
||||
|
||||
-- Créer la table "User"
|
||||
CREATE TABLE User (
|
||||
id_user INT AUTO_INCREMENT PRIMARY KEY,
|
||||
name VARCHAR(255) NOT NULL,
|
||||
email VARCHAR(255) NOT NULL UNIQUE,
|
||||
password VARCHAR(255) NOT NULL
|
||||
);
|
||||
|
||||
-- Créer la table "Search"
|
||||
CREATE TABLE Search (
|
||||
id_search INT AUTO_INCREMENT PRIMARY KEY,
|
||||
id_user INT,
|
||||
article1 VARCHAR(255) NOT NULL,
|
||||
article2 VARCHAR(255) NOT NULL,
|
||||
date TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
FOREIGN KEY (id_user) REFERENCES User(id_user)
|
||||
);
|
||||
|
||||
-- Créer l'utilsateur "radar"
|
||||
CREATE USER IF NOT EXISTS 'radar'@'%' IDENTIFIED BY '$MYSQL_USER_PASSWORD';
|
||||
SET PASSWORD FOR 'radar'@'%' = PASSWORD('$MYSQL_USER_PASSWORD');
|
||||
|
||||
-- Donne les droits à l'utilisateur "radar" pour la BDD "rappaurio"
|
||||
GRANT ALL PRIVILEGES ON rappaurio.* TO 'radar'@'%';
|
||||
|
||||
-- Applique les modifications
|
||||
FLUSH PRIVILEGES;
|
Reference in New Issue
Block a user