Premier commit

This commit is contained in:
2024-09-09 10:22:45 +02:00
commit bcc2604080
74 changed files with 25819 additions and 0 deletions

View File

@@ -0,0 +1,21 @@
CREATE TABLE IF NOT EXISTS `user` (
`id` int(11) NOT NULL auto_increment,
`name` varchar(50) NOT NULL,
`username` varchar(50) NOT NULL,
`email` varchar(100) NOT NULL,
`password` varchar(50) NOT NULL,
`auth_key` varchar(100) NOT NULL DEFAULT '',
`confirmed_at` datetime DEFAULT NULL,
`blocked_at` datetime DEFAULT NULL,
`registration_ip` varchar(40) DEFAULT '' COMMENT 'Stores ip v4 or ip v6',
`created_at` datetime DEFAULT NULL,
`updated_at` datetime DEFAULT NULL,
`last_login_at` datetime DEFAULT NULL,
`is_admin` tinyint(1) NOT NULL DEFAULT 0,
`timezone` varchar(40) DEFAULT '',
`profil` text NOT NULL DEFAULT '{}' COMMENT 'Json encoded profil',
PRIMARY KEY (`id`),
INDEX `username` (`username`),
UNIQUE INDEX `email` (`email`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci;

View File

@@ -0,0 +1,52 @@
CREATE TABLE IF NOT EXISTS "user" (
id INTEGER PRIMARY KEY AUTOINCREMENT,
name TEXT NOT NULL,
username TEXT NOT NULL,
email TEXT NOT NULL,
password TEXT NOT NULL,
auth_key TEXT,
confirmed_at INTEGER,
blocked_at INTEGER,
registration_ip TEXT,
created_at INTEGER,
updated_at INTEGER,
last_login_at INTEGER,
timezone TEXT,
profil TEXT,
UNIQUE(email)
);
CREATE TABLE IF NOT EXISTS auth_role
(
id INTEGER PRIMARY KEY AUTOINCREMENT,
name VARCHAR(64) NOT NULL,
description TEXT,
UNIQUE(name)
);
CREATE TABLE IF NOT EXISTS auth_permission
(
id INTEGER PRIMARY KEY AUTOINCREMENT,
name VARCHAR(64) NOT NULL,
UNIQUE(name)
);
CREATE TABLE IF NOT EXISTS auth_role_has_permission
(
role_id INTEGER NOT NULL,
permission_id INTEGER NOT NULL,
primary key (role_id, permission_id),
foreign key (role_id) references auth_role(id) on delete cascade on update cascade,
foreign key (permission_id) references auth_permission(id) on delete cascade on update cascade
);
CREATE TABLE IF NOT EXISTS auth_assignment
(
role_id INTEGER NOT NULL,
user_id INTEGER NOT NULL,
primary key (role_id, user_id),
foreign key (role_id) references auth_role(id) on delete cascade on update cascade,
foreign key (user_id) references "user" (id) on delete cascade on update cascade
);