feat: add initial database schema migration for project core tables
This commit is contained in:
@@ -0,0 +1,599 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
|
||||
|
||||
|
||||
// Table: contents
|
||||
if (!Schema::hasTable('contents')) {
|
||||
DB::statement("
|
||||
CREATE TABLE `contents` (
|
||||
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`slug` varchar(180) DEFAULT NULL,
|
||||
`title` varchar(180) DEFAULT NULL,
|
||||
`type` varchar(180) DEFAULT NULL,
|
||||
`alt_type` varchar(180) DEFAULT NULL,
|
||||
`cover` varchar(180) DEFAULT NULL,
|
||||
`files` longtext DEFAULT NULL,
|
||||
`uid` varchar(180) DEFAULT NULL,
|
||||
`html` longtext DEFAULT NULL,
|
||||
`json` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
|
||||
`created_at` timestamp NULL DEFAULT NULL,
|
||||
`updated_at` timestamp NULL DEFAULT NULL,
|
||||
`kid` varchar(180) DEFAULT NULL,
|
||||
`s` int(11) DEFAULT NULL,
|
||||
`tkid` text DEFAULT NULL,
|
||||
`deleted_at` varchar(180) DEFAULT NULL,
|
||||
`y` int(11) DEFAULT 0,
|
||||
`breadcrumb` text DEFAULT NULL,
|
||||
`fields` text DEFAULT NULL,
|
||||
`max` float(255,2) DEFAULT NULL,
|
||||
`min` float(255,2) DEFAULT NULL,
|
||||
`date` date DEFAULT NULL,
|
||||
`time1` time DEFAULT NULL,
|
||||
`time2` time DEFAULT NULL,
|
||||
`title2` varchar(255) DEFAULT NULL,
|
||||
`alias` varchar(255) DEFAULT NULL,
|
||||
`datetime1` datetime DEFAULT NULL,
|
||||
`datetime2` datetime DEFAULT NULL,
|
||||
`vd` varchar(255) DEFAULT NULL,
|
||||
`vn` varchar(255) DEFAULT NULL,
|
||||
`adres` text DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=555 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
");
|
||||
}
|
||||
|
||||
// Table: counters
|
||||
if (!Schema::hasTable('counters')) {
|
||||
DB::statement("
|
||||
CREATE TABLE `counters` (
|
||||
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`created_at` timestamp NULL DEFAULT NULL,
|
||||
`updated_at` timestamp NULL DEFAULT NULL,
|
||||
`prefix` varchar(100) DEFAULT NULL,
|
||||
`value` int(11) DEFAULT 0,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=41 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
");
|
||||
}
|
||||
|
||||
// Table: document_history
|
||||
if (!Schema::hasTable('document_history')) {
|
||||
DB::statement("
|
||||
CREATE TABLE `document_history` (
|
||||
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`table_name` varchar(255) DEFAULT NULL,
|
||||
`column_name` varchar(255) DEFAULT NULL,
|
||||
`row_id` bigint(20) unsigned DEFAULT NULL,
|
||||
`user_name` varchar(255) DEFAULT NULL,
|
||||
`action` varchar(255) NOT NULL,
|
||||
`file_name` varchar(255) NOT NULL,
|
||||
`file_size` varchar(255) DEFAULT NULL,
|
||||
`moved_from` varchar(255) DEFAULT NULL,
|
||||
`moved_to` varchar(255) DEFAULT NULL,
|
||||
`action_date` timestamp NOT NULL,
|
||||
`file_path` text NOT NULL,
|
||||
`notes` text DEFAULT NULL,
|
||||
`created_at` timestamp NULL DEFAULT NULL,
|
||||
`updated_at` timestamp NULL DEFAULT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `document_history_table_name_column_name_row_id_index` (`table_name`,`column_name`,`row_id`),
|
||||
KEY `document_history_file_name_table_name_index` (`file_name`,`table_name`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=64182 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
");
|
||||
}
|
||||
|
||||
// Table: document_manager_permissions
|
||||
if (!Schema::hasTable('document_manager_permissions')) {
|
||||
DB::statement("
|
||||
CREATE TABLE `document_manager_permissions` (
|
||||
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`user_level` varchar(255) NOT NULL,
|
||||
`folder_path` varchar(500) NOT NULL,
|
||||
`permission_type` enum('read','write','edit') NOT NULL,
|
||||
`is_allowed` tinyint(1) NOT NULL DEFAULT 0,
|
||||
`created_at` timestamp NULL DEFAULT NULL,
|
||||
`updated_at` timestamp NULL DEFAULT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `unique_permission` (`user_level`,`folder_path`,`permission_type`),
|
||||
KEY `document_manager_permissions_user_level_index` (`user_level`),
|
||||
KEY `document_manager_permissions_folder_path_index` (`folder_path`),
|
||||
KEY `document_manager_permissions_permission_type_index` (`permission_type`),
|
||||
KEY `document_manager_permissions_user_level_permission_type_index` (`user_level`,`permission_type`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=2058 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
");
|
||||
}
|
||||
|
||||
// Table: document_revisions
|
||||
if (!Schema::hasTable('document_revisions')) {
|
||||
DB::statement("
|
||||
CREATE TABLE `document_revisions` (
|
||||
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`created_at` timestamp NULL DEFAULT NULL,
|
||||
`updated_at` timestamp NULL DEFAULT NULL,
|
||||
`transmittal_document` varchar(100) DEFAULT NULL,
|
||||
`publish_date` date DEFAULT NULL,
|
||||
`zone` varchar(100) DEFAULT NULL,
|
||||
`subcontructer` varchar(100) DEFAULT NULL,
|
||||
`area` varchar(100) DEFAULT NULL,
|
||||
`drawing_no` varchar(100) DEFAULT NULL,
|
||||
`line_number` varchar(255) DEFAULT NULL,
|
||||
`revision_no` varchar(100) DEFAULT NULL,
|
||||
`remarks` varchar(100) DEFAULT NULL,
|
||||
`pdf_engineering` text DEFAULT NULL,
|
||||
`pdf_spool_iso` text DEFAULT NULL,
|
||||
`pdf_as_build` text DEFAULT NULL,
|
||||
`document_name` varchar(255) NOT NULL,
|
||||
`working_documentation` varchar(100) DEFAULT NULL,
|
||||
`axonometry` varchar(100) DEFAULT NULL,
|
||||
`discipline` varchar(255) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `idx_dr_line_number` (`line_number`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=3104 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
");
|
||||
}
|
||||
|
||||
// Table: document_templates
|
||||
if (!Schema::hasTable('document_templates')) {
|
||||
DB::statement("
|
||||
CREATE TABLE `document_templates` (
|
||||
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`slug` varchar(180) DEFAULT NULL,
|
||||
`title` varchar(180) DEFAULT NULL,
|
||||
`type` varchar(180) DEFAULT NULL,
|
||||
`alt_type` varchar(180) DEFAULT NULL,
|
||||
`cover` varchar(180) DEFAULT NULL,
|
||||
`files` longtext DEFAULT NULL,
|
||||
`excel_analysis` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
|
||||
`uid` varchar(180) DEFAULT NULL,
|
||||
`html` longtext DEFAULT NULL,
|
||||
`json` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
|
||||
`created_at` timestamp NULL DEFAULT NULL,
|
||||
`updated_at` timestamp NULL DEFAULT NULL,
|
||||
`kid` varchar(180) DEFAULT NULL,
|
||||
`s` int(11) DEFAULT NULL,
|
||||
`tkid` text DEFAULT NULL,
|
||||
`deleted_at` varchar(180) DEFAULT NULL,
|
||||
`y` int(11) DEFAULT 0,
|
||||
`breadcrumb` text DEFAULT NULL,
|
||||
`fields` text DEFAULT NULL,
|
||||
`max` float(255,2) DEFAULT NULL,
|
||||
`min` float(255,2) DEFAULT NULL,
|
||||
`date` date DEFAULT NULL,
|
||||
`time1` time DEFAULT NULL,
|
||||
`time2` time DEFAULT NULL,
|
||||
`title2` varchar(255) DEFAULT NULL,
|
||||
`alias` varchar(255) DEFAULT NULL,
|
||||
`datetime1` datetime DEFAULT NULL,
|
||||
`datetime2` datetime DEFAULT NULL,
|
||||
`vd` varchar(255) DEFAULT NULL,
|
||||
`vn` varchar(255) DEFAULT NULL,
|
||||
`adres` text DEFAULT NULL,
|
||||
`lang` varchar(255) NOT NULL DEFAULT 'en',
|
||||
`title3` varchar(255) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
CONSTRAINT `document_templates_chk_1` CHECK (json_valid(`excel_analysis`))
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=53 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
");
|
||||
}
|
||||
|
||||
// Table: failed_jobs (Laravel best practice)
|
||||
if (!Schema::hasTable('failed_jobs')) {
|
||||
DB::statement("
|
||||
CREATE TABLE `failed_jobs` (
|
||||
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`uuid` varchar(255) NOT NULL,
|
||||
`connection` text NOT NULL,
|
||||
`queue` text NOT NULL,
|
||||
`payload` longtext NOT NULL,
|
||||
`exception` longtext NOT NULL,
|
||||
`failed_at` timestamp NOT NULL DEFAULT current_timestamp(),
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `failed_jobs_uuid_unique` (`uuid`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=16126 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
");
|
||||
}
|
||||
|
||||
// Table: fields
|
||||
if (!Schema::hasTable('fields')) {
|
||||
DB::statement("
|
||||
CREATE TABLE `fields` (
|
||||
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`type` varchar(180) NOT NULL,
|
||||
`title` varchar(180) NOT NULL,
|
||||
`created_at` timestamp NULL DEFAULT NULL,
|
||||
`updated_at` timestamp NULL DEFAULT NULL,
|
||||
`input_type` varchar(180) DEFAULT '' COMMENT 'input type',
|
||||
`values` text DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
");
|
||||
}
|
||||
|
||||
// Table: job_batches (Laravel best practice)
|
||||
if (!Schema::hasTable('job_batches')) {
|
||||
DB::statement("
|
||||
CREATE TABLE `job_batches` (
|
||||
`id` varchar(255) NOT NULL,
|
||||
`name` varchar(255) NOT NULL,
|
||||
`total_jobs` int(11) NOT NULL,
|
||||
`pending_jobs` int(11) NOT NULL,
|
||||
`failed_jobs` int(11) NOT NULL,
|
||||
`failed_job_ids` longtext NOT NULL,
|
||||
`options` mediumtext DEFAULT NULL,
|
||||
`cancelled_at` int(11) DEFAULT NULL,
|
||||
`created_at` int(11) NOT NULL,
|
||||
`finished_at` int(11) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
");
|
||||
}
|
||||
|
||||
// Table: job_descriptions
|
||||
if (!Schema::hasTable('job_descriptions')) {
|
||||
DB::statement("
|
||||
CREATE TABLE `job_descriptions` (
|
||||
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`created_at` timestamp NULL DEFAULT NULL,
|
||||
`updated_at` timestamp NULL DEFAULT NULL,
|
||||
`title` varchar(255) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=MyISAM AUTO_INCREMENT=7 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
");
|
||||
}
|
||||
|
||||
// Table: jobs (Laravel best practice)
|
||||
if (!Schema::hasTable('jobs')) {
|
||||
DB::statement("
|
||||
CREATE TABLE `jobs` (
|
||||
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`queue` varchar(255) NOT NULL,
|
||||
`payload` longtext NOT NULL,
|
||||
`attempts` tinyint(3) unsigned NOT NULL,
|
||||
`reserved_at` int(10) unsigned DEFAULT NULL,
|
||||
`available_at` int(10) unsigned NOT NULL,
|
||||
`created_at` int(10) unsigned NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `jobs_queue_index` (`queue`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=1348345 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
");
|
||||
}
|
||||
|
||||
// Table: mail_templates
|
||||
if (!Schema::hasTable('mail_templates')) {
|
||||
DB::statement("
|
||||
CREATE TABLE `mail_templates` (
|
||||
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`slug` varchar(180) DEFAULT NULL,
|
||||
`title` varchar(180) DEFAULT NULL,
|
||||
`type` varchar(180) DEFAULT NULL,
|
||||
`alt_type` varchar(180) DEFAULT NULL,
|
||||
`cover` varchar(180) DEFAULT NULL,
|
||||
`files` longtext DEFAULT NULL,
|
||||
`uid` varchar(180) DEFAULT NULL,
|
||||
`html` longtext DEFAULT NULL,
|
||||
`json` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
|
||||
`created_at` timestamp NULL DEFAULT NULL,
|
||||
`updated_at` timestamp NULL DEFAULT NULL,
|
||||
`kid` varchar(180) DEFAULT NULL,
|
||||
`s` int(11) DEFAULT NULL,
|
||||
`tkid` text DEFAULT NULL,
|
||||
`deleted_at` varchar(180) DEFAULT NULL,
|
||||
`y` int(11) DEFAULT 0,
|
||||
`breadcrumb` text DEFAULT NULL,
|
||||
`fields` text DEFAULT NULL,
|
||||
`max` float(255,2) DEFAULT NULL,
|
||||
`min` float(255,2) DEFAULT NULL,
|
||||
`date` date DEFAULT NULL,
|
||||
`time1` time DEFAULT NULL,
|
||||
`time2` time DEFAULT NULL,
|
||||
`title2` varchar(255) DEFAULT NULL,
|
||||
`alias` varchar(255) DEFAULT NULL,
|
||||
`datetime1` datetime DEFAULT NULL,
|
||||
`datetime2` datetime DEFAULT NULL,
|
||||
`vd` varchar(255) DEFAULT NULL,
|
||||
`vn` varchar(255) DEFAULT NULL,
|
||||
`adres` text DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=31 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
");
|
||||
}
|
||||
|
||||
// Table: mailgun_logs
|
||||
if (!Schema::hasTable('mailgun_logs')) {
|
||||
DB::statement("
|
||||
CREATE TABLE `mailgun_logs` (
|
||||
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`slug` varchar(180) DEFAULT NULL,
|
||||
`title` varchar(180) DEFAULT NULL,
|
||||
`type` varchar(180) DEFAULT NULL,
|
||||
`alt_type` varchar(180) DEFAULT NULL,
|
||||
`cover` varchar(180) DEFAULT NULL,
|
||||
`files` longtext DEFAULT NULL,
|
||||
`uid` varchar(180) DEFAULT NULL,
|
||||
`html` longtext DEFAULT NULL,
|
||||
`json` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
|
||||
`created_at` timestamp NULL DEFAULT NULL,
|
||||
`updated_at` timestamp NULL DEFAULT NULL,
|
||||
`kid` varchar(180) DEFAULT NULL,
|
||||
`s` int(11) DEFAULT NULL,
|
||||
`tkid` text DEFAULT NULL,
|
||||
`deleted_at` varchar(180) DEFAULT NULL,
|
||||
`y` int(11) DEFAULT 0,
|
||||
`breadcrumb` text DEFAULT NULL,
|
||||
`fields` text DEFAULT NULL,
|
||||
`max` float(255,2) DEFAULT NULL,
|
||||
`min` float(255,2) DEFAULT NULL,
|
||||
`date` date DEFAULT NULL,
|
||||
`time1` time DEFAULT NULL,
|
||||
`time2` time DEFAULT NULL,
|
||||
`title2` varchar(255) DEFAULT NULL,
|
||||
`alias` varchar(255) DEFAULT NULL,
|
||||
`datetime1` datetime DEFAULT NULL,
|
||||
`datetime2` datetime DEFAULT NULL,
|
||||
`vd` varchar(255) DEFAULT NULL,
|
||||
`vn` varchar(255) DEFAULT NULL,
|
||||
`adres` text DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
");
|
||||
}
|
||||
|
||||
// Table: notifications
|
||||
if (!Schema::hasTable('notifications')) {
|
||||
DB::statement("
|
||||
CREATE TABLE `notifications` (
|
||||
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`user_id` bigint(20) unsigned NOT NULL,
|
||||
`notification_code` varchar(255) NOT NULL,
|
||||
`title` varchar(255) NOT NULL,
|
||||
`message` text NOT NULL,
|
||||
`link` varchar(255) DEFAULT NULL,
|
||||
`filter_params` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`filter_params`)),
|
||||
`is_read` tinyint(1) NOT NULL DEFAULT 0,
|
||||
`created_at` timestamp NULL DEFAULT NULL,
|
||||
`updated_at` timestamp NULL DEFAULT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `notifications_user_id_is_read_index` (`user_id`,`is_read`),
|
||||
KEY `notifications_notification_code_index` (`notification_code`),
|
||||
KEY `notifications_created_at_index` (`created_at`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=86368 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
");
|
||||
}
|
||||
|
||||
// Table: personal_access_tokens (Laravel best practice)
|
||||
if (!Schema::hasTable('personal_access_tokens')) {
|
||||
DB::statement("
|
||||
CREATE TABLE `personal_access_tokens` (
|
||||
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`tokenable_type` varchar(255) NOT NULL,
|
||||
`tokenable_id` bigint(20) unsigned NOT NULL,
|
||||
`name` varchar(255) NOT NULL,
|
||||
`token` varchar(64) NOT NULL,
|
||||
`abilities` text DEFAULT NULL,
|
||||
`last_used_at` timestamp NULL DEFAULT NULL,
|
||||
`expires_at` timestamp NULL DEFAULT NULL,
|
||||
`created_at` timestamp NULL DEFAULT NULL,
|
||||
`updated_at` timestamp NULL DEFAULT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `personal_access_tokens_token_unique` (`token`),
|
||||
KEY `personal_access_tokens_tokenable_type_tokenable_id_index` (`tokenable_type`,`tokenable_id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=2905 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
");
|
||||
}
|
||||
|
||||
// Table: rows
|
||||
if (!Schema::hasTable('rows')) {
|
||||
DB::statement("
|
||||
CREATE TABLE `rows` (
|
||||
`id` bigint(20) unsigned NOT NULL,
|
||||
`type` varchar(255) NOT NULL,
|
||||
`title` varchar(255) NOT NULL,
|
||||
`created_at` timestamp NULL DEFAULT NULL,
|
||||
`updated_at` timestamp NULL DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;
|
||||
");
|
||||
}
|
||||
|
||||
// Table: settings
|
||||
if (!Schema::hasTable('settings')) {
|
||||
DB::statement("
|
||||
CREATE TABLE `settings` (
|
||||
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`slug` varchar(180) DEFAULT NULL,
|
||||
`title` varchar(180) DEFAULT NULL,
|
||||
`type` varchar(180) DEFAULT NULL,
|
||||
`alt_type` varchar(180) DEFAULT NULL,
|
||||
`cover` varchar(180) DEFAULT NULL,
|
||||
`files` longtext DEFAULT NULL,
|
||||
`uid` varchar(180) DEFAULT NULL,
|
||||
`html` longtext DEFAULT NULL,
|
||||
`json` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
|
||||
`created_at` timestamp NULL DEFAULT NULL,
|
||||
`updated_at` timestamp NULL DEFAULT NULL,
|
||||
`kid` varchar(180) DEFAULT NULL,
|
||||
`s` int(11) DEFAULT NULL,
|
||||
`tkid` text DEFAULT NULL,
|
||||
`deleted_at` varchar(180) DEFAULT NULL,
|
||||
`y` int(11) DEFAULT 0,
|
||||
`breadcrumb` text DEFAULT NULL,
|
||||
`fields` text DEFAULT NULL,
|
||||
`max` float(255,2) DEFAULT NULL,
|
||||
`min` float(255,2) DEFAULT NULL,
|
||||
`date` date DEFAULT NULL,
|
||||
`time1` time DEFAULT NULL,
|
||||
`time2` time DEFAULT NULL,
|
||||
`title2` varchar(255) DEFAULT NULL,
|
||||
`alias` varchar(255) DEFAULT NULL,
|
||||
`datetime1` datetime DEFAULT NULL,
|
||||
`datetime2` datetime DEFAULT NULL,
|
||||
`vd` varchar(255) DEFAULT NULL,
|
||||
`vn` varchar(255) DEFAULT NULL,
|
||||
`adres` text DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=2987 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
");
|
||||
}
|
||||
|
||||
// Table: translate
|
||||
if (!Schema::hasTable('translate')) {
|
||||
DB::statement("
|
||||
CREATE TABLE `translate` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`icerik` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_turkish_ci DEFAULT NULL,
|
||||
`ceviri` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_turkish_ci DEFAULT NULL,
|
||||
`dil` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
|
||||
`updated_at` timestamp NULL DEFAULT NULL,
|
||||
`created_at` timestamp NULL DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=MyISAM AUTO_INCREMENT=6117 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;
|
||||
");
|
||||
}
|
||||
|
||||
// Table: types
|
||||
if (!Schema::hasTable('types')) {
|
||||
DB::statement("
|
||||
CREATE TABLE `types` (
|
||||
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`title` varchar(180) NOT NULL,
|
||||
`fields` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
|
||||
`created_at` timestamp NULL DEFAULT NULL,
|
||||
`updated_at` timestamp NULL DEFAULT NULL,
|
||||
`slug` varchar(180) DEFAULT NULL,
|
||||
`icon` varchar(180) DEFAULT NULL,
|
||||
`kid` varchar(255) DEFAULT NULL,
|
||||
`s` int(11) DEFAULT NULL,
|
||||
`full_control` varchar(255) DEFAULT NULL,
|
||||
`write` varchar(255) DEFAULT NULL,
|
||||
`read` varchar(255) DEFAULT NULL,
|
||||
`modify` varchar(255) DEFAULT NULL,
|
||||
`enabled` tinyint(1) NOT NULL DEFAULT 1,
|
||||
`is_mobile` tinyint(1) NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=187 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
");
|
||||
}
|
||||
|
||||
// Table: user_levels
|
||||
if (!Schema::hasTable('user_levels')) {
|
||||
DB::statement("
|
||||
CREATE TABLE `user_levels` (
|
||||
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`created_at` timestamp NULL DEFAULT NULL,
|
||||
`updated_at` timestamp NULL DEFAULT NULL,
|
||||
`title` varchar(100) DEFAULT NULL,
|
||||
`level_index` int(11) NOT NULL,
|
||||
`full_control` int(11) NOT NULL,
|
||||
`write` int(11) NOT NULL,
|
||||
`read` int(11) NOT NULL,
|
||||
`modify` int(11) NOT NULL,
|
||||
`description` varchar(100) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=30 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
");
|
||||
}
|
||||
|
||||
// Table: users (Laravel best practice - including custom fields)
|
||||
if (!Schema::hasTable('users')) {
|
||||
DB::statement("
|
||||
CREATE TABLE `users` (
|
||||
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`registration_no` varchar(255) DEFAULT NULL,
|
||||
`name` varchar(180) DEFAULT NULL,
|
||||
`name_ru` varchar(255) DEFAULT NULL,
|
||||
`father_name` varchar(255) DEFAULT NULL,
|
||||
`level` varchar(255) DEFAULT 'User',
|
||||
`slug` varchar(180) DEFAULT NULL,
|
||||
`json` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
|
||||
`phone` varchar(180) DEFAULT NULL,
|
||||
`email` varchar(180) DEFAULT NULL,
|
||||
`email_verified_at` timestamp NULL DEFAULT NULL,
|
||||
`password` varchar(180) NOT NULL,
|
||||
`remember_token` varchar(100) DEFAULT NULL,
|
||||
`created_at` timestamp NULL DEFAULT NULL,
|
||||
`updated_at` timestamp NULL DEFAULT NULL,
|
||||
`pic` varchar(180) DEFAULT NULL,
|
||||
`permissions` text DEFAULT NULL,
|
||||
`recover` varchar(180) DEFAULT NULL,
|
||||
`country` varchar(255) DEFAULT NULL,
|
||||
`last_seen` datetime DEFAULT NULL,
|
||||
`alias` varchar(255) DEFAULT NULL,
|
||||
`ust` varchar(255) DEFAULT NULL,
|
||||
`uid` varchar(255) DEFAULT NULL,
|
||||
`note` text DEFAULT NULL,
|
||||
`date_of_birth` date DEFAULT NULL,
|
||||
`experience` int(11) DEFAULT NULL,
|
||||
`qualitification` int(11) DEFAULT NULL,
|
||||
`gender` varchar(255) DEFAULT NULL,
|
||||
`job_name` varchar(255) DEFAULT NULL,
|
||||
`passport_no` varchar(255) DEFAULT NULL,
|
||||
`subcontructer` varchar(255) DEFAULT NULL,
|
||||
`status` varchar(255) DEFAULT NULL,
|
||||
`date_start` date DEFAULT NULL,
|
||||
`date_finish` date DEFAULT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `users_email_unique` (`email`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=491 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
");
|
||||
}
|
||||
|
||||
// Table: values
|
||||
if (!Schema::hasTable('values')) {
|
||||
DB::statement("
|
||||
CREATE TABLE `values` (
|
||||
`id` bigint(20) unsigned NOT NULL,
|
||||
`row` varchar(180) NOT NULL,
|
||||
`titles` text NOT NULL,
|
||||
`created_at` timestamp NULL DEFAULT NULL,
|
||||
`updated_at` timestamp NULL DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
// For an initialization migration, down usually drops the tables, but we follow the 'if exists' rule
|
||||
Schema::dropIfExists('annotations');
|
||||
Schema::dropIfExists('contents');
|
||||
Schema::dropIfExists('counters');
|
||||
Schema::dropIfExists('document_history');
|
||||
Schema::dropIfExists('document_manager_permissions');
|
||||
Schema::dropIfExists('document_revisions');
|
||||
Schema::dropIfExists('document_templates');
|
||||
Schema::dropIfExists('failed_jobs');
|
||||
Schema::dropIfExists('fields');
|
||||
Schema::dropIfExists('job_batches');
|
||||
Schema::dropIfExists('job_descriptions');
|
||||
Schema::dropIfExists('jobs');
|
||||
Schema::dropIfExists('mail_templates');
|
||||
Schema::dropIfExists('mailgun_logs');
|
||||
Schema::dropIfExists('notifications');
|
||||
Schema::dropIfExists('personal_access_tokens');
|
||||
Schema::dropIfExists('rows');
|
||||
Schema::dropIfExists('settings');
|
||||
Schema::dropIfExists('translate');
|
||||
Schema::dropIfExists('types');
|
||||
Schema::dropIfExists('user_levels');
|
||||
Schema::dropIfExists('users');
|
||||
Schema::dropIfExists('values');
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user