реализован механизм миграций

This commit is contained in:
rsgrinko committed 2022-07-05 23:56:27 +03:00
1 parent 0b31f06efb
commit 4571b24fce
19 files changed
+471 -135

No files matched your search

+11
View File
@@ -0,0 +1,11 @@
-- Таблица versions --
create table if not exists `migrations` (
`id` int(10) unsigned not null auto_increment,
`name` varchar(255) not null,
`date_created` timestamp default current_timestamp,
primary key (id)
)
engine = innodb
auto_increment = 1
character set utf8
collate utf8_general_ci;
+96
View File
@@ -0,0 +1,96 @@
CREATE TABLE `users`
(
`id` int(11) NOT NULL,
`login` varchar(100) NOT NULL,
`password` varchar(100) NOT NULL,
`name` varchar(150) NOT NULL,
`email` text,
`image_id` int(11) DEFAULT NULL,
`token` text,
`last_active` varchar(100) NOT NULL,
`date_created` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`date_updated` datetime DEFAULT NULL
) ENGINE = MyISAM
DEFAULT CHARSET = utf8;
INSERT INTO `users` (`id`, `login`, `password`, `name`, `email`, `image_id`, `token`, `last_active`, `date_created`, `date_updated`)
VALUES (1, 'admin', '5321ef98bd96cccf03f50979fdd8c893', 'Роман Гринько', 'rsgrinko@yandex.ru', 18, 'RG1819-1000-77EB-8F7A-9B112FB69D3A0',
'1657051585', '2022-06-17 16:18:56', NULL),
(2, 'a.kirilcev', 'c7e82c3d2bed998ea1f4c1aca09c282b', 'Александр Кирильцев', 'a.kirilcev@it-tula.ru', 20,
'RG17DE-1000-26FC-837F-8F9C47E643970', '1655471459', '2022-06-17 16:18:56', NULL),
(3, 'system', '', 'Система', 'info@it-stories.ru', NULL, 'RG17DE-1000-2702-816F-97E3877DD6650', '1651673702', '2022-06-17 16:18:56', NULL);
ALTER TABLE `users` ADD PRIMARY KEY (`id`);
ALTER TABLE `users` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT = 25;
CREATE TABLE `roles` (
`id` int(11) NOT NULL,
`name` text,
`description` text
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
INSERT INTO `roles` (`id`, `name`, `description`) VALUES
(1, 'Админисистратор', 'Группа, имеющая доступ ко всему'),
(2, 'Пользователи', 'Базовая группа для простых пользователей');
ALTER TABLE `roles` ADD PRIMARY KEY (`id`), ADD UNIQUE KEY `id` (`id`);
CREATE TABLE `user_roles` (
`id` int(11) NOT NULL,
`user_id` int(11) NOT NULL,
`role_id` int(11) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
INSERT INTO `user_roles` (`id`, `user_id`, `role_id`) VALUES (1, 1, 1);
ALTER TABLE `user_roles` ADD PRIMARY KEY (`id`), ADD UNIQUE KEY `id` (`id`);
ALTER TABLE `user_roles` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
CREATE TABLE `threads` (
`id` int(11) NOT NULL,
`active` varchar(1) NOT NULL DEFAULT 'N',
`in_progress` varchar(1) NOT NULL DEFAULT 'N',
`executed` varchar(1) NOT NULL DEFAULT 'N',
`execution_time` varchar(255) DEFAULT NULL,
`attempts` int(11) NOT NULL,
`date_created` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`date_updated` datetime DEFAULT NULL,
`class` varchar(255) DEFAULT NULL,
`method` varchar(255) DEFAULT NULL,
`params` text,
`status` varchar(255) DEFAULT NULL,
`response` text
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
ALTER TABLE `threads` ADD PRIMARY KEY (`id`), ADD UNIQUE KEY `id` (`id`);
ALTER TABLE `threads` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=17923;
CREATE TABLE `threads_history` (
`id` int(11) NOT NULL,
`task_id` int(11) DEFAULT NULL,
`execution_time` varchar(255) DEFAULT NULL,
`attempts` int(11) NOT NULL,
`date_created` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`date_updated` datetime DEFAULT NULL,
`class` varchar(255) DEFAULT NULL,
`method` varchar(255) DEFAULT NULL,
`params` text,
`status` varchar(255) DEFAULT NULL,
`response` text
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
ALTER TABLE `threads_history` ADD PRIMARY KEY (`id`), ADD UNIQUE KEY `id` (`id`);
ALTER TABLE `threads_history` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7946;
CREATE TABLE `files` (
`id` int(11) NOT NULL,
`name` varchar(255) DEFAULT NULL,
`path` text
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
ALTER TABLE `files` ADD PRIMARY KEY (`id`);
ALTER TABLE `files` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=23;
COMMIT;
+29
View File
@@ -0,0 +1,29 @@
CREATE TABLE if not exists `users`
(
`id` int(11) NOT NULL,
`login` varchar(100) NOT NULL,
`password` varchar(100) NOT NULL,
`name` varchar(150) NOT NULL,
`email` text,
`image_id` int(11) DEFAULT NULL,
`token` text,
`last_active` varchar(100) NOT NULL,
`date_created` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`date_updated` datetime DEFAULT NULL
) ENGINE = MyISAM
DEFAULT CHARSET = utf8;
INSERT INTO `users` (`id`, `login`, `password`, `name`, `email`, `image_id`, `token`, `last_active`, `date_created`, `date_updated`)
VALUES (1, 'admin', '5321ef98bd96cccf03f50979fdd8c893', 'Роман Гринько', 'rsgrinko@yandex.ru', 18, 'RG1819-1000-77EB-8F7A-9B112FB69D3A0',
'1657051585', '2022-06-17 16:18:56', NULL),
(2, 'a.kirilcev', 'c7e82c3d2bed998ea1f4c1aca09c282b', 'Александр Кирильцев', 'a.kirilcev@it-tula.ru', 20,
'RG17DE-1000-26FC-837F-8F9C47E643970', '1655471459', '2022-06-17 16:18:56', NULL),
(3, 'system', '', 'Система', 'info@it-stories.ru', NULL, 'RG17DE-1000-2702-816F-97E3877DD6650', '1651673702', '2022-06-17 16:18:56', NULL);
ALTER TABLE `users`
ADD PRIMARY KEY (`id`);
ALTER TABLE `users`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT,
AUTO_INCREMENT = 25;
COMMIT;
+12
View File
@@ -0,0 +1,12 @@
CREATE TABLE if not exists `roles` (
`id` int(11) NOT NULL,
`name` text,
`description` text
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
INSERT INTO `roles` (`id`, `name`, `description`) VALUES
(1, 'Админисистратор', 'Группа, имеющая доступ ко всему'),
(2, 'Пользователи', 'Базовая группа для простых пользователей'),
ALTER TABLE `roles` ADD PRIMARY KEY (`id`), ADD UNIQUE KEY `id` (`id`);
+9
View File
@@ -0,0 +1,9 @@
CREATE TABLE if not exists `user_roles` (
`id` int(11) NOT NULL,
`user_id` int(11) NOT NULL,
`role_id` int(11) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
INSERT INTO `user_roles` (`id`, `user_id`, `role_id`) VALUES (1, 1, 1),
ALTER TABLE `user_roles` ADD PRIMARY KEY (`id`), ADD UNIQUE KEY `id` (`id`);
ALTER TABLE `user_roles` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
+7
View File
@@ -0,0 +1,7 @@
CREATE TABLE if not exists `files` (
`id` int(11) NOT NULL,
`name` varchar(255) DEFAULT NULL,
`path` text
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
ALTER TABLE `files` ADD PRIMARY KEY (`id`);
ALTER TABLE `files` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=23;
+17
View File
@@ -0,0 +1,17 @@
CREATE TABLE if not exists `threads` (
`id` int(11) NOT NULL,
`active` varchar(1) NOT NULL DEFAULT 'N',
`in_progress` varchar(1) NOT NULL DEFAULT 'N',
`executed` varchar(1) NOT NULL DEFAULT 'N',
`execution_time` varchar(255) DEFAULT NULL,
`attempts` int(11) NOT NULL,
`date_created` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`date_updated` datetime DEFAULT NULL,
`class` varchar(255) DEFAULT NULL,
`method` varchar(255) DEFAULT NULL,
`params` text,
`status` varchar(255) DEFAULT NULL,
`response` text
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
ALTER TABLE `threads` ADD PRIMARY KEY (`id`), ADD UNIQUE KEY `id` (`id`);
ALTER TABLE `threads` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=17923;
@@ -0,0 +1,15 @@
CREATE TABLE if not exists `threads_history` (
`id` int(11) NOT NULL,
`task_id` int(11) DEFAULT NULL,
`execution_time` varchar(255) DEFAULT NULL,
`attempts` int(11) NOT NULL,
`date_created` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`date_updated` datetime DEFAULT NULL,
`class` varchar(255) DEFAULT NULL,
`method` varchar(255) DEFAULT NULL,
`params` text,
`status` varchar(255) DEFAULT NULL,
`response` text
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
ALTER TABLE `threads_history` ADD PRIMARY KEY (`id`), ADD UNIQUE KEY `id` (`id`);
ALTER TABLE `threads_history` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7946;