From 1c315ed2eec6b10f6fa7efbfb05abab13b2aff59 Mon Sep 17 00:00:00 2001 From: christian Date: Fri, 12 Jan 2024 17:22:20 -0500 Subject: [PATCH] Migration: Change field type bigint by int and disk_quota in MB - refs CT#5033 --- public/main/admin/course_add.php | 3 +- public/main/admin/course_edit.php | 4 +- public/main/inc/lib/document.lib.php | 2 +- .../Entity/AgendaEventInvitation.php | 2 +- src/CoreBundle/Entity/AgendaEventInvitee.php | 2 +- src/CoreBundle/Entity/AgendaReminder.php | 2 +- src/CoreBundle/Entity/BranchSync.php | 2 +- src/CoreBundle/Entity/BranchTransaction.php | 4 +- src/CoreBundle/Entity/Course.php | 2 +- .../Entity/GradebookCertificate.php | 2 +- src/CoreBundle/Entity/GradebookComment.php | 2 +- src/CoreBundle/Entity/Message.php | 2 +- src/CoreBundle/Entity/MessageFeedback.php | 2 +- src/CoreBundle/Entity/MessageRelUser.php | 2 +- src/CoreBundle/Entity/MessageTag.php | 2 +- src/CoreBundle/Entity/Notification.php | 2 +- src/CoreBundle/Entity/Page.php | 2 +- src/CoreBundle/Entity/PageCategory.php | 2 +- .../Entity/Resource/ResourceTag.php | 2 +- .../Entity/Resource/ResourceUserTag.php | 2 +- src/CoreBundle/Entity/ResourceComment.php | 2 +- src/CoreBundle/Entity/ResourceFile.php | 2 +- src/CoreBundle/Entity/ResourceLink.php | 2 +- src/CoreBundle/Entity/ResourceNode.php | 2 +- src/CoreBundle/Entity/ResourceRight.php | 2 +- src/CoreBundle/Entity/SocialPost.php | 2 +- src/CoreBundle/Entity/SocialPostFeedback.php | 2 +- src/CoreBundle/Entity/TrackELastaccess.php | 2 +- src/CoreBundle/Entity/UserRelUser.php | 2 +- .../Migrations/Schema/V200/Version20.php | 2 +- .../Schema/V200/Version20170525122900.php | 20 +- .../Schema/V200/Version20170625122900.php | 6 +- .../Schema/V200/Version20170625123000.php | 2 +- .../Schema/V200/Version20170625143000.php | 12 +- .../Schema/V200/Version20170625144000.php | 8 +- .../Schema/V200/Version20170625145000.php | 4 +- .../Schema/V200/Version20170625153000.php | 10 +- .../Schema/V200/Version20170625154000.php | 4 +- .../Schema/V200/Version20170626122900.php | 2 +- .../Schema/V200/Version20170628122900.php | 2 +- .../Schema/V200/Version20170904145500.php | 14 +- .../Schema/V200/Version20170904173000.php | 4 +- .../Schema/V200/Version20180319145700.php | 2 +- .../Schema/V200/Version20180928172830.php | 2 +- .../Schema/V200/Version20181025064351.php | 2 +- .../Schema/V200/Version20190110182615.php | 4 +- .../Schema/V200/Version20190110182620.php | 4 +- .../Schema/V200/Version20191101132000.php | 4 +- .../Schema/V200/Version20200821224242.php | 22 +- .../Schema/V200/Version20211005153900.php | 2 +- .../Schema/V200/Version20211026140820.php | 4 +- .../Schema/V200/Version20230216122950.php | 4 +- .../Schema/V200/Version20230720222130.php | 2 +- .../Schema/V200/Version20240112103400.php | 45 ++ .../Schema/V200/Version20240112131200.php | 396 ++++++++++++++++++ src/CourseBundle/Entity/CExerciseCategory.php | 2 +- src/CourseBundle/Entity/CLpIvInteraction.php | 2 +- src/CourseBundle/Entity/CLpIvObjective.php | 2 +- .../Entity/CQuizRelQuestionCategory.php | 2 +- 59 files changed, 547 insertions(+), 107 deletions(-) create mode 100644 src/CoreBundle/Migrations/Schema/V200/Version20240112103400.php create mode 100644 src/CoreBundle/Migrations/Schema/V200/Version20240112131200.php diff --git a/public/main/admin/course_add.php b/public/main/admin/course_add.php index 287f6ee5e1..6153552fb6 100644 --- a/public/main/admin/course_add.php +++ b/public/main/admin/course_add.php @@ -164,7 +164,7 @@ $form->addButtonCreate(get_lang('Create a course')); // Set some default values. $values['course_language'] = api_get_setting('platformLanguage'); -$values['disk_quota'] = round(api_get_setting('default_document_quotum') / 1024 / 1024, 1); +$values['disk_quota'] = round(api_get_setting('default_document_quotum'), 1); $default_course_visibility = api_get_setting('courses_default_creation_visibility'); @@ -184,7 +184,6 @@ if ($form->validate()) { $course = $form->exportValues(); $course_teachers = isset($course['course_teachers']) ? $course['course_teachers'] : null; - $course['disk_quota'] = $course['disk_quota'] * 1024 * 1024; $course['exemplary_content'] = empty($course['exemplary_content']) ? false : true; $course['teachers'] = $course_teachers; $course['wanted_code'] = $course['visual_code']; diff --git a/public/main/admin/course_edit.php b/public/main/admin/course_edit.php index 826722830d..e35200512a 100644 --- a/public/main/admin/course_edit.php +++ b/public/main/admin/course_edit.php @@ -285,7 +285,7 @@ $(function() { $form->addButtonUpdate(get_lang('Edit course information')); // Set some default values -$courseInfo['disk_quota'] = round(DocumentManager::get_course_quota($courseInfo['code']) / 1024 / 1024, 1); +$courseInfo['disk_quota'] = round(DocumentManager::get_course_quota($courseInfo['code']), 1); $courseInfo['real_code'] = $courseInfo['code']; $courseInfo['add_teachers_to_sessions_courses'] = $courseInfo['add_teachers_to_sessions_courses'] ?? 0; @@ -357,7 +357,7 @@ if ($form->validate()) { ->setVisualCode($visual_code) ->setDepartmentName($course['department_name']) ->setDepartmentUrl($department_url) - ->setDiskQuota($course['disk_quota'] * 1024 * 1024) + ->setDiskQuota($course['disk_quota']) ->setSubscribe($course['subscribe']) ->setUnsubscribe($course['unsubscribe']) ->setVisibility($visibility) diff --git a/public/main/inc/lib/document.lib.php b/public/main/inc/lib/document.lib.php index 88ca333d85..0f7f796346 100644 --- a/public/main/inc/lib/document.lib.php +++ b/public/main/inc/lib/document.lib.php @@ -23,7 +23,7 @@ class DocumentManager /** * @param string $course_code * - * @return int the document folder quota for the current course in bytes + * @return int the document folder quota for the current course in megabytes * or the default quota */ public static function get_course_quota($course_code = null) diff --git a/src/CoreBundle/Entity/AgendaEventInvitation.php b/src/CoreBundle/Entity/AgendaEventInvitation.php index fcc3afa514..019cc4e84f 100644 --- a/src/CoreBundle/Entity/AgendaEventInvitation.php +++ b/src/CoreBundle/Entity/AgendaEventInvitation.php @@ -24,7 +24,7 @@ class AgendaEventInvitation use TimestampableTypedEntity; #[ORM\Id] - #[ORM\Column(type: 'bigint')] + #[ORM\Column(type: 'integer')] #[ORM\GeneratedValue(strategy: 'AUTO')] protected ?int $id = null; diff --git a/src/CoreBundle/Entity/AgendaEventInvitee.php b/src/CoreBundle/Entity/AgendaEventInvitee.php index f55dbe88c8..cdbf2cdfcd 100644 --- a/src/CoreBundle/Entity/AgendaEventInvitee.php +++ b/src/CoreBundle/Entity/AgendaEventInvitee.php @@ -22,7 +22,7 @@ class AgendaEventInvitee use TimestampableTypedEntity; #[ORM\Id] - #[ORM\Column(type: 'bigint')] + #[ORM\Column(type: 'integer')] #[ORM\GeneratedValue] private int $id; diff --git a/src/CoreBundle/Entity/AgendaReminder.php b/src/CoreBundle/Entity/AgendaReminder.php index 1512d136fb..94a4041ed1 100644 --- a/src/CoreBundle/Entity/AgendaReminder.php +++ b/src/CoreBundle/Entity/AgendaReminder.php @@ -17,7 +17,7 @@ class AgendaReminder use TimestampableTypedEntity; #[ORM\Id] - #[ORM\Column(type: 'bigint')] + #[ORM\Column(type: 'integer')] #[ORM\GeneratedValue(strategy: 'AUTO')] protected ?int $id = null; diff --git a/src/CoreBundle/Entity/BranchSync.php b/src/CoreBundle/Entity/BranchSync.php index b8b3cf3894..ad30943535 100644 --- a/src/CoreBundle/Entity/BranchSync.php +++ b/src/CoreBundle/Entity/BranchSync.php @@ -66,7 +66,7 @@ class BranchSync #[ORM\Column(name: 'admin_phone', type: 'string', length: 250, nullable: true, unique: false)] protected ?string $adminPhone = null; - #[ORM\Column(name: 'last_sync_trans_id', type: 'bigint', nullable: true, unique: false)] + #[ORM\Column(name: 'last_sync_trans_id', type: 'integer', nullable: true, unique: false)] protected ?int $lastSyncTransId = null; #[ORM\Column(name: 'last_sync_trans_date', type: 'datetime', nullable: true, unique: false)] diff --git a/src/CoreBundle/Entity/BranchTransaction.php b/src/CoreBundle/Entity/BranchTransaction.php index 0b1eb3defe..1ab6aa9dfb 100644 --- a/src/CoreBundle/Entity/BranchTransaction.php +++ b/src/CoreBundle/Entity/BranchTransaction.php @@ -16,7 +16,7 @@ use Doctrine\ORM\Mapping as ORM; #[ORM\Entity] class BranchTransaction { - #[ORM\Column(name: 'id', type: 'bigint', nullable: false)] + #[ORM\Column(name: 'id', type: 'integer', nullable: false)] #[ORM\Id] #[ORM\GeneratedValue] protected ?int $id = null; @@ -25,7 +25,7 @@ class BranchTransaction #[ORM\JoinColumn(name: 'status_id', referencedColumnName: 'id')] protected Room $branchTransactionStatus; - #[ORM\Column(name: 'transaction_id', type: 'bigint')] + #[ORM\Column(name: 'transaction_id', type: 'integer')] protected int $externalTransactionId; #[ORM\Column(name: 'action', type: 'string', length: 20, nullable: true, unique: false)] diff --git a/src/CoreBundle/Entity/Course.php b/src/CoreBundle/Entity/Course.php index 31efe1b015..d34eeab366 100644 --- a/src/CoreBundle/Entity/Course.php +++ b/src/CoreBundle/Entity/Course.php @@ -291,7 +291,7 @@ class Course extends AbstractResource implements ResourceInterface, ResourceWith #[ORM\Column(name: 'sticky', type: 'boolean')] protected bool $sticky; - #[ORM\Column(name: 'disk_quota', type: 'bigint', unique: false, nullable: true)] + #[ORM\Column(name: 'disk_quota', type: 'integer', unique: false, nullable: true)] protected ?int $diskQuota = null; #[ORM\Column(name: 'last_visit', type: 'datetime', unique: false, nullable: true)] diff --git a/src/CoreBundle/Entity/GradebookCertificate.php b/src/CoreBundle/Entity/GradebookCertificate.php index 1380bf5107..43f6651198 100644 --- a/src/CoreBundle/Entity/GradebookCertificate.php +++ b/src/CoreBundle/Entity/GradebookCertificate.php @@ -18,7 +18,7 @@ class GradebookCertificate { use UserTrait; - #[ORM\Column(name: 'id', type: 'bigint')] + #[ORM\Column(name: 'id', type: 'integer')] #[ORM\Id] #[ORM\GeneratedValue] protected ?int $id = null; diff --git a/src/CoreBundle/Entity/GradebookComment.php b/src/CoreBundle/Entity/GradebookComment.php index a25a53378c..ee5ef336d6 100644 --- a/src/CoreBundle/Entity/GradebookComment.php +++ b/src/CoreBundle/Entity/GradebookComment.php @@ -17,7 +17,7 @@ class GradebookComment use TimestampableEntity; use UserTrait; - #[ORM\Column(name: 'id', type: 'bigint')] + #[ORM\Column(name: 'id', type: 'integer')] #[ORM\Id] #[ORM\GeneratedValue] protected ?int $id = null; diff --git a/src/CoreBundle/Entity/Message.php b/src/CoreBundle/Entity/Message.php index 57604a3fbe..c7a06aeafe 100644 --- a/src/CoreBundle/Entity/Message.php +++ b/src/CoreBundle/Entity/Message.php @@ -78,7 +78,7 @@ class Message public const MESSAGE_STATUS_INVITATION_ACCEPTED = 6; public const MESSAGE_STATUS_INVITATION_DENIED = 7; - #[ORM\Column(name: 'id', type: 'bigint')] + #[ORM\Column(name: 'id', type: 'integer')] #[ORM\Id] #[ORM\GeneratedValue] #[Groups(['message:read'])] diff --git a/src/CoreBundle/Entity/MessageFeedback.php b/src/CoreBundle/Entity/MessageFeedback.php index 4c9ccbfc92..363b8bb3cb 100644 --- a/src/CoreBundle/Entity/MessageFeedback.php +++ b/src/CoreBundle/Entity/MessageFeedback.php @@ -18,7 +18,7 @@ use Doctrine\ORM\Mapping as ORM; #[ORM\Entity] class MessageFeedback { - #[ORM\Column(name: 'id', type: 'bigint')] + #[ORM\Column(name: 'id', type: 'integer')] #[ORM\Id()] #[ORM\GeneratedValue()] private int $id; diff --git a/src/CoreBundle/Entity/MessageRelUser.php b/src/CoreBundle/Entity/MessageRelUser.php index 4208b06052..dcf3736791 100644 --- a/src/CoreBundle/Entity/MessageRelUser.php +++ b/src/CoreBundle/Entity/MessageRelUser.php @@ -40,7 +40,7 @@ class MessageRelUser public const TYPE_TO = 1; public const TYPE_CC = 2; - #[ORM\Column(name: 'id', type: 'bigint')] + #[ORM\Column(name: 'id', type: 'integer')] #[ORM\Id] #[ORM\GeneratedValue] protected ?int $id = null; diff --git a/src/CoreBundle/Entity/MessageTag.php b/src/CoreBundle/Entity/MessageTag.php index 8f0ce2235d..de9fd45d37 100644 --- a/src/CoreBundle/Entity/MessageTag.php +++ b/src/CoreBundle/Entity/MessageTag.php @@ -57,7 +57,7 @@ class MessageTag use TimestampableTypedEntity; #[Groups(['message_tag:read', 'message:read'])] - #[ORM\Column(name: 'id', type: 'bigint')] + #[ORM\Column(name: 'id', type: 'integer')] #[ORM\Id] #[ORM\GeneratedValue] protected ?int $id = null; diff --git a/src/CoreBundle/Entity/Notification.php b/src/CoreBundle/Entity/Notification.php index 2c2ba3911e..e10d54fd36 100644 --- a/src/CoreBundle/Entity/Notification.php +++ b/src/CoreBundle/Entity/Notification.php @@ -16,7 +16,7 @@ use Gedmo\Mapping\Annotation as Gedmo; #[ORM\Entity] class Notification { - #[ORM\Column(name: 'id', type: 'bigint')] + #[ORM\Column(name: 'id', type: 'integer')] #[ORM\Id] #[ORM\GeneratedValue(strategy: 'IDENTITY')] protected ?int $id = null; diff --git a/src/CoreBundle/Entity/Page.php b/src/CoreBundle/Entity/Page.php index e0acfeea62..8898cae4e8 100644 --- a/src/CoreBundle/Entity/Page.php +++ b/src/CoreBundle/Entity/Page.php @@ -53,7 +53,7 @@ use Symfony\Component\Validator\Constraints as Assert; class Page { use TimestampableTypedEntity; - #[ORM\Column(name: 'id', type: 'bigint')] + #[ORM\Column(name: 'id', type: 'integer')] #[ORM\Id] #[ORM\GeneratedValue] protected ?int $id = null; diff --git a/src/CoreBundle/Entity/PageCategory.php b/src/CoreBundle/Entity/PageCategory.php index 5f0731710e..2d8721b140 100644 --- a/src/CoreBundle/Entity/PageCategory.php +++ b/src/CoreBundle/Entity/PageCategory.php @@ -40,7 +40,7 @@ class PageCategory { use TimestampableTypedEntity; #[Groups(['page_category:read', 'page_category:write'])] - #[ORM\Column(name: 'id', type: 'bigint')] + #[ORM\Column(name: 'id', type: 'integer')] #[ORM\Id] #[ORM\GeneratedValue] protected ?int $id = null; diff --git a/src/CoreBundle/Entity/Resource/ResourceTag.php b/src/CoreBundle/Entity/Resource/ResourceTag.php index 526e26d7c2..65b289276a 100644 --- a/src/CoreBundle/Entity/Resource/ResourceTag.php +++ b/src/CoreBundle/Entity/Resource/ResourceTag.php @@ -17,7 +17,7 @@ class ResourceTag use TimestampableEntity; #[ORM\Id] - #[ORM\Column(type: 'bigint')] + #[ORM\Column(type: 'integer')] #[ORM\GeneratedValue(strategy: 'AUTO')] protected ?int $id = null; diff --git a/src/CoreBundle/Entity/Resource/ResourceUserTag.php b/src/CoreBundle/Entity/Resource/ResourceUserTag.php index ea0e28df31..86a625b86b 100644 --- a/src/CoreBundle/Entity/Resource/ResourceUserTag.php +++ b/src/CoreBundle/Entity/Resource/ResourceUserTag.php @@ -17,7 +17,7 @@ class ResourceUserTag use TimestampableEntity; #[ORM\Id] - #[ORM\Column(type: 'bigint')] + #[ORM\Column(type: 'integer')] #[ORM\GeneratedValue(strategy: 'AUTO')] protected ?int $id = null; diff --git a/src/CoreBundle/Entity/ResourceComment.php b/src/CoreBundle/Entity/ResourceComment.php index b329ba6cfb..ea1aa2b8dc 100644 --- a/src/CoreBundle/Entity/ResourceComment.php +++ b/src/CoreBundle/Entity/ResourceComment.php @@ -35,7 +35,7 @@ class ResourceComment use TimestampableTypedEntity; #[ORM\Id] - #[ORM\Column(type: 'bigint')] + #[ORM\Column(type: 'integer')] #[ORM\GeneratedValue(strategy: 'AUTO')] #[Groups(['comment:read'])] protected ?int $id = null; diff --git a/src/CoreBundle/Entity/ResourceFile.php b/src/CoreBundle/Entity/ResourceFile.php index e286e70baf..15f766dc81 100644 --- a/src/CoreBundle/Entity/ResourceFile.php +++ b/src/CoreBundle/Entity/ResourceFile.php @@ -83,7 +83,7 @@ class ResourceFile implements Stringable use TimestampableEntity; #[Groups(['resource_file:read', 'resource_node:read', 'document:read', 'message:read'])] #[ORM\Id] - #[ORM\Column(type: 'bigint')] + #[ORM\Column(type: 'integer')] #[ORM\GeneratedValue] protected ?int $id = null; #[Assert\NotBlank] diff --git a/src/CoreBundle/Entity/ResourceLink.php b/src/CoreBundle/Entity/ResourceLink.php index a718c71f52..6ab9a534de 100644 --- a/src/CoreBundle/Entity/ResourceLink.php +++ b/src/CoreBundle/Entity/ResourceLink.php @@ -30,7 +30,7 @@ class ResourceLink implements Stringable public const VISIBILITY_DELETED = 3; #[ORM\Id] - #[ORM\Column(type: 'bigint')] + #[ORM\Column(type: 'integer')] #[ORM\GeneratedValue] protected ?int $id = null; diff --git a/src/CoreBundle/Entity/ResourceNode.php b/src/CoreBundle/Entity/ResourceNode.php index 0df20f001d..872d5e2f93 100644 --- a/src/CoreBundle/Entity/ResourceNode.php +++ b/src/CoreBundle/Entity/ResourceNode.php @@ -78,7 +78,7 @@ class ResourceNode implements Stringable #[Groups(['resource_node:read', 'document:read', 'ctool:read', 'user_json:read', 'course:read'])] #[ORM\Id] - #[ORM\Column(type: 'bigint')] + #[ORM\Column(type: 'integer')] #[ORM\GeneratedValue(strategy: 'AUTO')] protected ?int $id = null; diff --git a/src/CoreBundle/Entity/ResourceRight.php b/src/CoreBundle/Entity/ResourceRight.php index 7ffceb7b4d..69c00b2b15 100644 --- a/src/CoreBundle/Entity/ResourceRight.php +++ b/src/CoreBundle/Entity/ResourceRight.php @@ -14,7 +14,7 @@ use Stringable; class ResourceRight implements Stringable { #[ORM\Id] - #[ORM\Column(type: 'bigint')] + #[ORM\Column(type: 'integer')] #[ORM\GeneratedValue(strategy: 'AUTO')] protected ?int $id = null; diff --git a/src/CoreBundle/Entity/SocialPost.php b/src/CoreBundle/Entity/SocialPost.php index d7c435853c..a68d40b474 100644 --- a/src/CoreBundle/Entity/SocialPost.php +++ b/src/CoreBundle/Entity/SocialPost.php @@ -79,7 +79,7 @@ class SocialPost #[ORM\Id] #[ORM\GeneratedValue] - #[ORM\Column(name: 'id', type: 'bigint')] + #[ORM\Column(name: 'id', type: 'integer')] protected ?int $id = null; #[Groups(['social_post:read', 'social_post:write'])] diff --git a/src/CoreBundle/Entity/SocialPostFeedback.php b/src/CoreBundle/Entity/SocialPostFeedback.php index 657e11b23e..29617d41d7 100644 --- a/src/CoreBundle/Entity/SocialPostFeedback.php +++ b/src/CoreBundle/Entity/SocialPostFeedback.php @@ -19,7 +19,7 @@ class SocialPostFeedback { use UserTrait; - #[ORM\Column(name: 'id', type: 'bigint')] + #[ORM\Column(name: 'id', type: 'integer')] #[ORM\Id] #[ORM\GeneratedValue] protected ?int $id = null; diff --git a/src/CoreBundle/Entity/TrackELastaccess.php b/src/CoreBundle/Entity/TrackELastaccess.php index a4ae86f3e3..19b3395d6c 100644 --- a/src/CoreBundle/Entity/TrackELastaccess.php +++ b/src/CoreBundle/Entity/TrackELastaccess.php @@ -34,7 +34,7 @@ class TrackELastaccess #[ORM\Column(name: 'session_id', type: 'integer', nullable: true)] protected ?int $sessionId = null; - #[ORM\Column(name: 'access_id', type: 'bigint')] + #[ORM\Column(name: 'access_id', type: 'integer')] #[ORM\Id] #[ORM\GeneratedValue(strategy: 'IDENTITY')] protected int $accessId; diff --git a/src/CoreBundle/Entity/UserRelUser.php b/src/CoreBundle/Entity/UserRelUser.php index 0e5227fcae..eb96680161 100644 --- a/src/CoreBundle/Entity/UserRelUser.php +++ b/src/CoreBundle/Entity/UserRelUser.php @@ -83,7 +83,7 @@ class UserRelUser public const USER_RELATION_TYPE_HRM_REQUEST = 9; public const USER_RELATION_TYPE_FRIEND_REQUEST = 10; - #[ORM\Column(name: 'id', type: 'bigint')] + #[ORM\Column(name: 'id', type: 'integer')] #[ORM\Id] #[ORM\GeneratedValue] protected ?int $id = null; diff --git a/src/CoreBundle/Migrations/Schema/V200/Version20.php b/src/CoreBundle/Migrations/Schema/V200/Version20.php index 5403aed3b6..abfe46d260 100644 --- a/src/CoreBundle/Migrations/Schema/V200/Version20.php +++ b/src/CoreBundle/Migrations/Schema/V200/Version20.php @@ -342,7 +342,7 @@ class Version20 extends AbstractMigrationChamilo } if (false === $table->hasColumn('resource_node_id')) { - $this->addSql('ALTER TABLE usergroup ADD resource_node_id BIGINT DEFAULT NULL'); + $this->addSql('ALTER TABLE usergroup ADD resource_node_id INT DEFAULT NULL'); } // sequence_resource. diff --git a/src/CoreBundle/Migrations/Schema/V200/Version20170525122900.php b/src/CoreBundle/Migrations/Schema/V200/Version20170525122900.php index 5b9e63708e..584c0fd12b 100644 --- a/src/CoreBundle/Migrations/Schema/V200/Version20170525122900.php +++ b/src/CoreBundle/Migrations/Schema/V200/Version20170525122900.php @@ -20,13 +20,13 @@ class Version20170525122900 extends AbstractMigrationChamilo { if (false === $schema->hasTable('resource_file')) { $this->addSql( - 'CREATE TABLE resource_file (id BIGINT AUTO_INCREMENT NOT NULL, name VARCHAR(255) NOT NULL, original_name LONGTEXT DEFAULT NULL, size INT NOT NULL, dimensions LONGTEXT DEFAULT NULL COMMENT "(DC2Type:simple_array)",crop VARCHAR(255) DEFAULT NULL, mime_type LONGTEXT DEFAULT NULL, description longtext DEFAULT NULL, metadata LONGTEXT DEFAULT NULL COMMENT \'(DC2Type:array)\', created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB ROW_FORMAT = DYNAMIC' + 'CREATE TABLE resource_file (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) NOT NULL, original_name LONGTEXT DEFAULT NULL, size INT NOT NULL, dimensions LONGTEXT DEFAULT NULL COMMENT "(DC2Type:simple_array)",crop VARCHAR(255) DEFAULT NULL, mime_type LONGTEXT DEFAULT NULL, description longtext DEFAULT NULL, metadata LONGTEXT DEFAULT NULL COMMENT \'(DC2Type:array)\', created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB ROW_FORMAT = DYNAMIC' ); } if (false === $schema->hasTable('resource_node')) { $this->addSql( - 'CREATE TABLE IF NOT EXISTS resource_node (id BIGINT AUTO_INCREMENT NOT NULL, resource_type_id INT NOT NULL, resource_file_id BIGINT DEFAULT NULL, creator_id INT NOT NULL, parent_id BIGINT DEFAULT NULL, name VARCHAR(255) NOT NULL, level INT DEFAULT NULL, path VARCHAR(3000) DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX IDX_8A5F48FF98EC6B7B (resource_type_id), UNIQUE INDEX UNIQ_8A5F48FFCE6B9E84 (resource_file_id), INDEX IDX_8A5F48FF61220EA6 (creator_id), INDEX IDX_8A5F48FF727ACA70 (parent_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB ROW_FORMAT = DYNAMIC;' + 'CREATE TABLE IF NOT EXISTS resource_node (id INT AUTO_INCREMENT NOT NULL, resource_type_id INT NOT NULL, resource_file_id INT DEFAULT NULL, creator_id INT NOT NULL, parent_id INT DEFAULT NULL, name VARCHAR(255) NOT NULL, level INT DEFAULT NULL, path VARCHAR(3000) DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX IDX_8A5F48FF98EC6B7B (resource_type_id), UNIQUE INDEX UNIQ_8A5F48FFCE6B9E84 (resource_file_id), INDEX IDX_8A5F48FF61220EA6 (creator_id), INDEX IDX_8A5F48FF727ACA70 (parent_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB ROW_FORMAT = DYNAMIC;' ); $this->addSql( 'ALTER TABLE resource_node ADD slug VARCHAR(255) NOT NULL, ADD uuid BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', CHANGE creator_id creator_id INT DEFAULT NULL, CHANGE path path LONGTEXT DEFAULT NULL, CHANGE name title VARCHAR(255) NOT NULL' @@ -40,13 +40,13 @@ class Version20170525122900 extends AbstractMigrationChamilo if (!$schema->hasTable('resource_link')) { $this->addSql( - "CREATE TABLE resource_link (id BIGINT AUTO_INCREMENT NOT NULL, resource_node_id BIGINT DEFAULT NULL, session_id INT DEFAULT NULL, user_id INT DEFAULT NULL, c_id INT DEFAULT NULL, group_id INT DEFAULT NULL, usergroup_id INT DEFAULT NULL, visibility INT NOT NULL, start_visibility_at DATETIME DEFAULT NULL, end_visibility_at DATETIME DEFAULT NULL, created_at DATETIME NOT NULL COMMENT '(DC2Type:datetime)', updated_at DATETIME NOT NULL COMMENT '(DC2Type:datetime)', INDEX IDX_398C394B1BAD783F (resource_node_id), INDEX IDX_398C394B613FECDF (session_id), INDEX IDX_398C394BA76ED395 (user_id), INDEX IDX_398C394B91D79BD3 (c_id), INDEX IDX_398C394BFE54D947 (group_id), INDEX IDX_398C394BD2112630 (usergroup_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB ROW_FORMAT = DYNAMIC;" + "CREATE TABLE resource_link (id INT AUTO_INCREMENT NOT NULL, resource_node_id INT DEFAULT NULL, session_id INT DEFAULT NULL, user_id INT DEFAULT NULL, c_id INT DEFAULT NULL, group_id INT DEFAULT NULL, usergroup_id INT DEFAULT NULL, visibility INT NOT NULL, start_visibility_at DATETIME DEFAULT NULL, end_visibility_at DATETIME DEFAULT NULL, created_at DATETIME NOT NULL COMMENT '(DC2Type:datetime)', updated_at DATETIME NOT NULL COMMENT '(DC2Type:datetime)', INDEX IDX_398C394B1BAD783F (resource_node_id), INDEX IDX_398C394B613FECDF (session_id), INDEX IDX_398C394BA76ED395 (user_id), INDEX IDX_398C394B91D79BD3 (c_id), INDEX IDX_398C394BFE54D947 (group_id), INDEX IDX_398C394BD2112630 (usergroup_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB ROW_FORMAT = DYNAMIC;" ); } if (!$schema->hasTable('resource_comment')) { $this->addSql( - 'CREATE TABLE resource_comment (id BIGINT AUTO_INCREMENT NOT NULL, resource_node_id BIGINT DEFAULT NULL, author_id INT DEFAULT NULL, parent_id BIGINT DEFAULT NULL, content VARCHAR(255) NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, root INT DEFAULT NULL, lvl INT NOT NULL, lft INT NOT NULL, rgt INT NOT NULL, INDEX IDX_C9D4B5841BAD783F (resource_node_id), INDEX IDX_C9D4B584F675F31B (author_id), INDEX IDX_C9D4B584727ACA70 (parent_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB ROW_FORMAT = DYNAMIC;' + 'CREATE TABLE resource_comment (id INT AUTO_INCREMENT NOT NULL, resource_node_id INT DEFAULT NULL, author_id INT DEFAULT NULL, parent_id INT DEFAULT NULL, content VARCHAR(255) NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, root INT DEFAULT NULL, lvl INT NOT NULL, lft INT NOT NULL, rgt INT NOT NULL, INDEX IDX_C9D4B5841BAD783F (resource_node_id), INDEX IDX_C9D4B584F675F31B (author_id), INDEX IDX_C9D4B584727ACA70 (parent_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB ROW_FORMAT = DYNAMIC;' ); $this->addSql( 'ALTER TABLE resource_comment ADD CONSTRAINT FK_C9D4B5841BAD783F FOREIGN KEY (resource_node_id) REFERENCES resource_node (id) ON DELETE CASCADE' @@ -61,7 +61,7 @@ class Version20170525122900 extends AbstractMigrationChamilo if (false === $schema->hasTable('resource_tag')) { $this->addSql( - 'CREATE TABLE IF NOT EXISTS resource_tag (id BIGINT AUTO_INCREMENT NOT NULL, author_id INT DEFAULT NULL, name VARCHAR(255) NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX IDX_23D039CAF675F31B (author_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB ROW_FORMAT = DYNAMIC;' + 'CREATE TABLE IF NOT EXISTS resource_tag (id INT AUTO_INCREMENT NOT NULL, author_id INT DEFAULT NULL, name VARCHAR(255) NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX IDX_23D039CAF675F31B (author_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB ROW_FORMAT = DYNAMIC;' ); $this->addSql( 'ALTER TABLE resource_tag ADD CONSTRAINT FK_23D039CAF675F31B FOREIGN KEY (author_id) REFERENCES user (id) ON DELETE SET NULL;' @@ -70,7 +70,7 @@ class Version20170525122900 extends AbstractMigrationChamilo if (false === $schema->hasTable('resource_user_tag')) { $this->addSql( - 'CREATE TABLE IF NOT EXISTS resource_user_tag (id BIGINT AUTO_INCREMENT NOT NULL, user_id INT DEFAULT NULL, tag_id BIGINT DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX IDX_46131CA5A76ED395 (user_id), INDEX IDX_46131CA5BAD26311 (tag_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB ROW_FORMAT = DYNAMIC;' + 'CREATE TABLE IF NOT EXISTS resource_user_tag (id INT AUTO_INCREMENT NOT NULL, user_id INT DEFAULT NULL, tag_id INT DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX IDX_46131CA5A76ED395 (user_id), INDEX IDX_46131CA5BAD26311 (tag_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB ROW_FORMAT = DYNAMIC;' ); $this->addSql( 'ALTER TABLE resource_user_tag ADD CONSTRAINT FK_46131CA5A76ED395 FOREIGN KEY (user_id) REFERENCES user (id) ON DELETE SET NULL;' @@ -82,7 +82,7 @@ class Version20170525122900 extends AbstractMigrationChamilo if (false === $schema->hasTable('personal_file')) { $this->addSql( - 'CREATE TABLE IF NOT EXISTS personal_file (id INT AUTO_INCREMENT NOT NULL, resource_node_id BIGINT DEFAULT NULL, title VARCHAR(255) NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, UNIQUE INDEX UNIQ_BD95312D1BAD783F (resource_node_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB ROW_FORMAT = DYNAMIC;' + 'CREATE TABLE IF NOT EXISTS personal_file (id INT AUTO_INCREMENT NOT NULL, resource_node_id INT DEFAULT NULL, title VARCHAR(255) NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, UNIQUE INDEX UNIQ_BD95312D1BAD783F (resource_node_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB ROW_FORMAT = DYNAMIC;' ); $this->addSql( 'ALTER TABLE personal_file ADD CONSTRAINT FK_BD95312D1BAD783F FOREIGN KEY (resource_node_id) REFERENCES resource_node (id) ON DELETE CASCADE;' @@ -123,7 +123,7 @@ class Version20170525122900 extends AbstractMigrationChamilo if (false === $schema->hasTable('resource_right')) { $this->addSql( - 'CREATE TABLE IF NOT EXISTS resource_right (id BIGINT AUTO_INCREMENT NOT NULL, resource_link_id BIGINT DEFAULT NULL, role VARCHAR(255) NOT NULL, mask INT NOT NULL, INDEX IDX_9F710F26F004E599 (resource_link_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB ROW_FORMAT = DYNAMIC;' + 'CREATE TABLE IF NOT EXISTS resource_right (id INT AUTO_INCREMENT NOT NULL, resource_link_id INT DEFAULT NULL, role VARCHAR(255) NOT NULL, mask INT NOT NULL, INDEX IDX_9F710F26F004E599 (resource_link_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB ROW_FORMAT = DYNAMIC;' ); $this->addSql( 'ALTER TABLE resource_right ADD CONSTRAINT FK_9F710F26F004E599 FOREIGN KEY (resource_link_id) REFERENCES resource_link (id) ON DELETE CASCADE' @@ -159,7 +159,7 @@ class Version20170525122900 extends AbstractMigrationChamilo if (false === $schema->hasTable('illustration')) { $this->addSql( - "CREATE TABLE illustration (id BINARY(16) NOT NULL COMMENT '(DC2Type:uuid)', resource_node_id BIGINT DEFAULT NULL, name VARCHAR(255) NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, UNIQUE INDEX UNIQ_D67B9A421BAD783F (resource_node_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB ROW_FORMAT = DYNAMIC;" + "CREATE TABLE illustration (id BINARY(16) NOT NULL COMMENT '(DC2Type:uuid)', resource_node_id INT DEFAULT NULL, name VARCHAR(255) NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, UNIQUE INDEX UNIQ_D67B9A421BAD783F (resource_node_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB ROW_FORMAT = DYNAMIC;" ); $this->addSql( 'ALTER TABLE illustration ADD CONSTRAINT FK_D67B9A421BAD783F FOREIGN KEY (resource_node_id) REFERENCES resource_node (id) ON DELETE CASCADE;' @@ -168,7 +168,7 @@ class Version20170525122900 extends AbstractMigrationChamilo if (false === $schema->hasTable('c_shortcut')) { $this->addSql( - 'CREATE TABLE IF NOT EXISTS c_shortcut (id INT AUTO_INCREMENT NOT NULL, shortcut_node_id BIGINT DEFAULT NULL, resource_node_id BIGINT DEFAULT NULL, name VARCHAR(255) NOT NULL, UNIQUE INDEX UNIQ_3F6BB957937100BE (shortcut_node_id), UNIQUE INDEX UNIQ_3F6BB9571BAD783F (resource_node_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB ROW_FORMAT = DYNAMIC;' + 'CREATE TABLE IF NOT EXISTS c_shortcut (id INT AUTO_INCREMENT NOT NULL, shortcut_node_id INT DEFAULT NULL, resource_node_id INT DEFAULT NULL, name VARCHAR(255) NOT NULL, UNIQUE INDEX UNIQ_3F6BB957937100BE (shortcut_node_id), UNIQUE INDEX UNIQ_3F6BB9571BAD783F (resource_node_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB ROW_FORMAT = DYNAMIC;' ); $this->addSql( 'ALTER TABLE c_shortcut ADD CONSTRAINT FK_3F6BB957937100BE FOREIGN KEY (shortcut_node_id) REFERENCES resource_node (id) ON DELETE CASCADE;' diff --git a/src/CoreBundle/Migrations/Schema/V200/Version20170625122900.php b/src/CoreBundle/Migrations/Schema/V200/Version20170625122900.php index f337add31d..b7877ee30b 100644 --- a/src/CoreBundle/Migrations/Schema/V200/Version20170625122900.php +++ b/src/CoreBundle/Migrations/Schema/V200/Version20170625122900.php @@ -26,7 +26,7 @@ class Version20170625122900 extends AbstractMigrationChamilo $table = $schema->getTable('c_document'); if (false === $table->hasColumn('resource_node_id')) { - $this->addSql('ALTER TABLE c_document ADD resource_node_id BIGINT DEFAULT NULL'); + $this->addSql('ALTER TABLE c_document ADD resource_node_id INT DEFAULT NULL'); $this->addSql( 'ALTER TABLE c_document ADD CONSTRAINT FK_C9FA0CBD1BAD783F FOREIGN KEY (resource_node_id) REFERENCES resource_node (id) ON DELETE CASCADE;' ); @@ -60,7 +60,7 @@ class Version20170625122900 extends AbstractMigrationChamilo $table = $schema->getTable('c_announcement'); if (false === $table->hasColumn('resource_node_id')) { - $this->addSql('ALTER TABLE c_announcement ADD resource_node_id BIGINT DEFAULT NULL;'); + $this->addSql('ALTER TABLE c_announcement ADD resource_node_id INT DEFAULT NULL;'); $this->addSql( 'ALTER TABLE c_announcement ADD CONSTRAINT FK_39912E021BAD783F FOREIGN KEY (resource_node_id) REFERENCES resource_node (id) ON DELETE CASCADE;' ); @@ -81,7 +81,7 @@ class Version20170625122900 extends AbstractMigrationChamilo $this->addSql('ALTER TABLE c_announcement_attachment CHANGE announcement_id announcement_id INT DEFAULT NULL'); if (false === $table->hasColumn('resource_node_id')) { - $this->addSql('ALTER TABLE c_announcement_attachment ADD resource_node_id BIGINT DEFAULT NULL'); + $this->addSql('ALTER TABLE c_announcement_attachment ADD resource_node_id INT DEFAULT NULL'); $this->addSql( 'ALTER TABLE c_announcement_attachment ADD CONSTRAINT FK_5480BD4A913AEA17 FOREIGN KEY (announcement_id) REFERENCES c_announcement (iid) ON DELETE CASCADE' ); diff --git a/src/CoreBundle/Migrations/Schema/V200/Version20170625123000.php b/src/CoreBundle/Migrations/Schema/V200/Version20170625123000.php index 7e7f428e34..3c63cd1b11 100644 --- a/src/CoreBundle/Migrations/Schema/V200/Version20170625123000.php +++ b/src/CoreBundle/Migrations/Schema/V200/Version20170625123000.php @@ -30,7 +30,7 @@ class Version20170625123000 extends AbstractMigrationChamilo $this->addSql('ALTER TABLE c_attendance CHANGE active active INT NOT NULL'); if (false === $table->hasColumn('resource_node_id')) { - $this->addSql('ALTER TABLE c_attendance ADD resource_node_id BIGINT DEFAULT NULL'); + $this->addSql('ALTER TABLE c_attendance ADD resource_node_id INT DEFAULT NULL'); $this->addSql('ALTER TABLE c_attendance ADD CONSTRAINT FK_413634921BAD783F FOREIGN KEY (resource_node_id) REFERENCES resource_node (id) ON DELETE CASCADE'); $this->addSql('CREATE UNIQUE INDEX UNIQ_413634921BAD783F ON c_attendance (resource_node_id)'); } diff --git a/src/CoreBundle/Migrations/Schema/V200/Version20170625143000.php b/src/CoreBundle/Migrations/Schema/V200/Version20170625143000.php index 031f5b9342..5966787d32 100644 --- a/src/CoreBundle/Migrations/Schema/V200/Version20170625143000.php +++ b/src/CoreBundle/Migrations/Schema/V200/Version20170625143000.php @@ -20,7 +20,7 @@ class Version20170625143000 extends AbstractMigrationChamilo { $table = $schema->getTable('c_thematic'); if (false === $table->hasColumn('resource_node_id')) { - $this->addSql('ALTER TABLE c_thematic ADD resource_node_id BIGINT DEFAULT NULL'); + $this->addSql('ALTER TABLE c_thematic ADD resource_node_id INT DEFAULT NULL'); $this->addSql( 'ALTER TABLE c_thematic ADD CONSTRAINT FK_6D8F59B91BAD783F FOREIGN KEY (resource_node_id) REFERENCES resource_node (id) ON DELETE CASCADE' ); @@ -83,7 +83,7 @@ class Version20170625143000 extends AbstractMigrationChamilo /* if (false === $table->hasColumn('resource_node_id')) { - $this->addSql('ALTER TABLE c_thematic_advance ADD resource_node_id BIGINT DEFAULT NULL'); + $this->addSql('ALTER TABLE c_thematic_advance ADD resource_node_id INT DEFAULT NULL'); //$this->addSql('ALTER TABLE c_thematic_advance ADD CONSTRAINT FK_62798E971BAD783F FOREIGN KEY (resource_node_id) REFERENCES resource_node (id) ON DELETE CASCADE'); $this->addSql('CREATE UNIQUE INDEX UNIQ_62798E971BAD783F ON c_thematic_advance (resource_node_id)'); @@ -111,7 +111,7 @@ class Version20170625143000 extends AbstractMigrationChamilo /* if (false === $table->hasColumn('resource_node_id')) { - $this->addSql('ALTER TABLE c_thematic_plan ADD resource_node_id BIGINT DEFAULT NULL'); + $this->addSql('ALTER TABLE c_thematic_plan ADD resource_node_id INT DEFAULT NULL'); $this->addSql('ALTER TABLE c_thematic_plan ADD CONSTRAINT FK_1197487C1BAD783F FOREIGN KEY (resource_node_id) REFERENCES resource_node (id) ON DELETE CASCADE'); $this->addSql('CREATE UNIQUE INDEX UNIQ_1197487C1BAD783F ON c_thematic_plan (resource_node_id)'); @@ -120,7 +120,7 @@ class Version20170625143000 extends AbstractMigrationChamilo // CLink $table = $schema->getTable('c_link'); if (false === $table->hasColumn('resource_node_id')) { - $this->addSql('ALTER TABLE c_link ADD resource_node_id BIGINT DEFAULT NULL;'); + $this->addSql('ALTER TABLE c_link ADD resource_node_id INT DEFAULT NULL;'); $this->addSql( 'ALTER TABLE c_link ADD CONSTRAINT FK_9209C2A01BAD783F FOREIGN KEY (resource_node_id) REFERENCES resource_node (id) ON DELETE CASCADE;' ); @@ -146,7 +146,7 @@ class Version20170625143000 extends AbstractMigrationChamilo $table = $schema->getTable('c_link_category'); if (false === $table->hasColumn('resource_node_id')) { - $this->addSql('ALTER TABLE c_link_category ADD resource_node_id BIGINT DEFAULT NULL'); + $this->addSql('ALTER TABLE c_link_category ADD resource_node_id INT DEFAULT NULL'); $this->addSql( 'ALTER TABLE c_link_category ADD CONSTRAINT FK_319D6C9C1BAD783F FOREIGN KEY (resource_node_id) REFERENCES resource_node (id) ON DELETE CASCADE' ); @@ -171,7 +171,7 @@ class Version20170625143000 extends AbstractMigrationChamilo } if (false === $table->hasColumn('resource_node_id')) { - $this->addSql('ALTER TABLE c_glossary ADD resource_node_id BIGINT DEFAULT NULL'); + $this->addSql('ALTER TABLE c_glossary ADD resource_node_id INT DEFAULT NULL'); $this->addSql( 'ALTER TABLE c_glossary ADD CONSTRAINT FK_A1168D881BAD783F FOREIGN KEY (resource_node_id) REFERENCES resource_node (id) ON DELETE CASCADE' ); diff --git a/src/CoreBundle/Migrations/Schema/V200/Version20170625144000.php b/src/CoreBundle/Migrations/Schema/V200/Version20170625144000.php index e9b9f458e6..b02091b4e2 100644 --- a/src/CoreBundle/Migrations/Schema/V200/Version20170625144000.php +++ b/src/CoreBundle/Migrations/Schema/V200/Version20170625144000.php @@ -70,7 +70,7 @@ class Version20170625144000 extends AbstractMigrationChamilo $this->addSql('ALTER TABLE c_student_publication CHANGE active active INT DEFAULT NULL'); if (false === $table->hasColumn('resource_node_id')) { - $this->addSql('ALTER TABLE c_student_publication ADD resource_node_id BIGINT DEFAULT NULL'); + $this->addSql('ALTER TABLE c_student_publication ADD resource_node_id INT DEFAULT NULL'); $this->addSql( 'ALTER TABLE c_student_publication ADD CONSTRAINT FK_5246F7461BAD783F FOREIGN KEY (resource_node_id) REFERENCES resource_node (id) ON DELETE CASCADE' ); @@ -85,7 +85,7 @@ class Version20170625144000 extends AbstractMigrationChamilo /* if (false === $table->hasColumn('resource_node_id')) { - $this->addSql('ALTER TABLE c_student_publication_assignment ADD resource_node_id BIGINT DEFAULT NULL'); + $this->addSql('ALTER TABLE c_student_publication_assignment ADD resource_node_id INT DEFAULT NULL'); $this->addSql( 'ALTER TABLE c_student_publication_assignment ADD CONSTRAINT FK_25687EB81BAD783F FOREIGN KEY (resource_node_id) REFERENCES resource_node (id) ON DELETE CASCADE' ); @@ -114,7 +114,7 @@ class Version20170625144000 extends AbstractMigrationChamilo if (false === $schema->hasTable('c_student_publication_correction')) { $this->addSql( - 'CREATE TABLE c_student_publication_correction (id INT AUTO_INCREMENT NOT NULL, resource_node_id BIGINT DEFAULT NULL, title VARCHAR(255) NOT NULL, UNIQUE INDEX UNIQ_B7309BBA1BAD783F (resource_node_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB ROW_FORMAT = DYNAMIC' + 'CREATE TABLE c_student_publication_correction (id INT AUTO_INCREMENT NOT NULL, resource_node_id INT DEFAULT NULL, title VARCHAR(255) NOT NULL, UNIQUE INDEX UNIQ_B7309BBA1BAD783F (resource_node_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB ROW_FORMAT = DYNAMIC' ); $this->addSql( 'ALTER TABLE c_student_publication_correction ADD CONSTRAINT FK_B7309BBA1BAD783F FOREIGN KEY (resource_node_id) REFERENCES resource_node (id) ON DELETE CASCADE;' @@ -123,7 +123,7 @@ class Version20170625144000 extends AbstractMigrationChamilo $table = $schema->getTable('c_student_publication_comment'); if (false === $table->hasColumn('resource_node_id')) { - $this->addSql('ALTER TABLE c_student_publication_comment ADD resource_node_id BIGINT DEFAULT NULL'); + $this->addSql('ALTER TABLE c_student_publication_comment ADD resource_node_id INT DEFAULT NULL'); $this->addSql( 'ALTER TABLE c_student_publication_comment ADD CONSTRAINT FK_35C509F61BAD783F FOREIGN KEY (resource_node_id) REFERENCES resource_node (id) ON DELETE CASCADE' ); diff --git a/src/CoreBundle/Migrations/Schema/V200/Version20170625145000.php b/src/CoreBundle/Migrations/Schema/V200/Version20170625145000.php index 7d1e3dbf9a..7cad555e11 100644 --- a/src/CoreBundle/Migrations/Schema/V200/Version20170625145000.php +++ b/src/CoreBundle/Migrations/Schema/V200/Version20170625145000.php @@ -27,7 +27,7 @@ class Version20170625145000 extends AbstractMigrationChamilo $this->addSql('UPDATE c_calendar_event SET title = "Event" WHERE title = "" AND content <> "" '); if (!$table->hasColumn('resource_node_id')) { - $this->addSql('ALTER TABLE c_calendar_event ADD resource_node_id BIGINT DEFAULT NULL'); + $this->addSql('ALTER TABLE c_calendar_event ADD resource_node_id INT DEFAULT NULL'); $this->addSql( 'ALTER TABLE c_calendar_event ADD CONSTRAINT FK_A0622581EE3A445A FOREIGN KEY (parent_event_id) REFERENCES c_calendar_event (iid)' ); @@ -76,7 +76,7 @@ class Version20170625145000 extends AbstractMigrationChamilo $this->addSql('ALTER TABLE c_calendar_event_attachment CHANGE agenda_id agenda_id INT DEFAULT NULL'); if (false === $table->hasColumn('resource_node_id')) { - $this->addSql('ALTER TABLE c_calendar_event_attachment ADD resource_node_id BIGINT DEFAULT NULL'); + $this->addSql('ALTER TABLE c_calendar_event_attachment ADD resource_node_id INT DEFAULT NULL'); $this->addSql( 'ALTER TABLE c_calendar_event_attachment ADD CONSTRAINT FK_DDD745A6EA67784A FOREIGN KEY (agenda_id) REFERENCES c_calendar_event (iid) ON DELETE CASCADE' ); diff --git a/src/CoreBundle/Migrations/Schema/V200/Version20170625153000.php b/src/CoreBundle/Migrations/Schema/V200/Version20170625153000.php index 859b54d8e4..a0c90fa03f 100644 --- a/src/CoreBundle/Migrations/Schema/V200/Version20170625153000.php +++ b/src/CoreBundle/Migrations/Schema/V200/Version20170625153000.php @@ -22,7 +22,7 @@ class Version20170625153000 extends AbstractMigrationChamilo $this->addSql('ALTER TABLE c_forum_attachment CHANGE post_id post_id INT DEFAULT NULL'); if (false === $table->hasColumn('resource_node_id')) { - $this->addSql('ALTER TABLE c_forum_attachment ADD resource_node_id BIGINT DEFAULT NULL'); + $this->addSql('ALTER TABLE c_forum_attachment ADD resource_node_id INT DEFAULT NULL'); $this->addSql( 'ALTER TABLE c_forum_attachment ADD CONSTRAINT FK_F1113A884B89032C FOREIGN KEY (post_id) REFERENCES c_forum_post (iid) ON DELETE CASCADE' ); @@ -36,7 +36,7 @@ class Version20170625153000 extends AbstractMigrationChamilo $table = $schema->getTable('c_forum_category'); if (false === $table->hasColumn('resource_node_id')) { - $this->addSql('ALTER TABLE c_forum_category ADD resource_node_id BIGINT DEFAULT NULL'); + $this->addSql('ALTER TABLE c_forum_category ADD resource_node_id INT DEFAULT NULL'); $this->addSql( 'ALTER TABLE c_forum_category ADD CONSTRAINT FK_D627B86E1BAD783F FOREIGN KEY (resource_node_id) REFERENCES resource_node (id) ON DELETE CASCADE' ); @@ -53,7 +53,7 @@ class Version20170625153000 extends AbstractMigrationChamilo $table = $schema->getTable('c_forum_forum'); if (!$table->hasColumn('resource_node_id')) { - $this->addSql('ALTER TABLE c_forum_forum ADD resource_node_id BIGINT DEFAULT NULL, DROP forum_id'); + $this->addSql('ALTER TABLE c_forum_forum ADD resource_node_id INT DEFAULT NULL, DROP forum_id'); $this->addSql( 'ALTER TABLE c_forum_forum ADD CONSTRAINT FK_47A9C991BAD783F FOREIGN KEY (resource_node_id) REFERENCES resource_node (id) ON DELETE CASCADE' ); @@ -110,7 +110,7 @@ class Version20170625153000 extends AbstractMigrationChamilo $this->addSql('ALTER TABLE c_forum_thread CHANGE thread_date thread_date DATETIME NOT NULL'); if (false === $table->hasColumn('resource_node_id')) { - $this->addSql('ALTER TABLE c_forum_thread ADD resource_node_id BIGINT DEFAULT NULL, DROP thread_id'); + $this->addSql('ALTER TABLE c_forum_thread ADD resource_node_id INT DEFAULT NULL, DROP thread_id'); $this->addSql( 'ALTER TABLE c_forum_thread ADD CONSTRAINT FK_5DA7884C1BAD783F FOREIGN KEY (resource_node_id) REFERENCES resource_node (id) ON DELETE CASCADE' ); @@ -177,7 +177,7 @@ class Version20170625153000 extends AbstractMigrationChamilo } if (false === $table->hasColumn('resource_node_id')) { - $this->addSql('ALTER TABLE c_forum_post ADD resource_node_id BIGINT DEFAULT NULL'); + $this->addSql('ALTER TABLE c_forum_post ADD resource_node_id INT DEFAULT NULL'); $this->addSql( 'ALTER TABLE c_forum_post ADD CONSTRAINT FK_B5BEF55929CCBAD0 FOREIGN KEY (forum_id) REFERENCES c_forum_forum (iid) ON DELETE SET NULL' ); diff --git a/src/CoreBundle/Migrations/Schema/V200/Version20170625154000.php b/src/CoreBundle/Migrations/Schema/V200/Version20170625154000.php index a31fa7eae6..5da93ab326 100644 --- a/src/CoreBundle/Migrations/Schema/V200/Version20170625154000.php +++ b/src/CoreBundle/Migrations/Schema/V200/Version20170625154000.php @@ -20,7 +20,7 @@ class Version20170625154000 extends AbstractMigrationChamilo { $table = $schema->getTable('c_course_description'); if (false === $table->hasColumn('resource_node_id')) { - $this->addSql('ALTER TABLE c_course_description ADD resource_node_id BIGINT DEFAULT NULL'); + $this->addSql('ALTER TABLE c_course_description ADD resource_node_id INT DEFAULT NULL'); $this->addSql('ALTER TABLE c_course_description ADD CONSTRAINT FK_EC3CD8091BAD783F FOREIGN KEY (resource_node_id) REFERENCES resource_node (id) ON DELETE CASCADE'); $this->addSql('CREATE UNIQUE INDEX UNIQ_EC3CD8091BAD783F ON c_course_description (resource_node_id)'); } @@ -36,7 +36,7 @@ class Version20170625154000 extends AbstractMigrationChamilo } if (false === $table->hasColumn('resource_node_id')) { - $this->addSql('ALTER TABLE c_notebook ADD resource_node_id BIGINT DEFAULT NULL, DROP notebook_id'); + $this->addSql('ALTER TABLE c_notebook ADD resource_node_id INT DEFAULT NULL, DROP notebook_id'); $this->addSql('ALTER TABLE c_notebook ADD CONSTRAINT FK_E7EE1CE01BAD783F FOREIGN KEY (resource_node_id) REFERENCES resource_node (id) ON DELETE CASCADE'); $this->addSql('CREATE UNIQUE INDEX UNIQ_E7EE1CE01BAD783F ON c_notebook (resource_node_id)'); } diff --git a/src/CoreBundle/Migrations/Schema/V200/Version20170626122900.php b/src/CoreBundle/Migrations/Schema/V200/Version20170626122900.php index a05ffb6b5e..028ba5711a 100644 --- a/src/CoreBundle/Migrations/Schema/V200/Version20170626122900.php +++ b/src/CoreBundle/Migrations/Schema/V200/Version20170626122900.php @@ -35,7 +35,7 @@ class Version20170626122900 extends AbstractMigrationChamilo } if (false === $table->hasColumn('resource_node_id')) { - $this->addSql('ALTER TABLE user ADD resource_node_id BIGINT DEFAULT NULL;'); + $this->addSql('ALTER TABLE user ADD resource_node_id INT DEFAULT NULL;'); $this->addSql( 'ALTER TABLE user ADD CONSTRAINT FK_8D93D6491BAD783F FOREIGN KEY (resource_node_id) REFERENCES resource_node (id) ON DELETE CASCADE;' ); diff --git a/src/CoreBundle/Migrations/Schema/V200/Version20170628122900.php b/src/CoreBundle/Migrations/Schema/V200/Version20170628122900.php index 9c6f037399..2963955448 100644 --- a/src/CoreBundle/Migrations/Schema/V200/Version20170628122900.php +++ b/src/CoreBundle/Migrations/Schema/V200/Version20170628122900.php @@ -91,7 +91,7 @@ class Version20170628122900 extends AbstractMigrationChamilo } if (false === $table->hasColumn('resource_node_id')) { - $this->addSql('ALTER TABLE access_url ADD resource_node_id BIGINT DEFAULT NULL'); + $this->addSql('ALTER TABLE access_url ADD resource_node_id INT DEFAULT NULL'); $this->addSql( 'ALTER TABLE access_url ADD CONSTRAINT FK_9436187B1BAD783F FOREIGN KEY (resource_node_id) REFERENCES resource_node (id) ON DELETE CASCADE;' ); diff --git a/src/CoreBundle/Migrations/Schema/V200/Version20170904145500.php b/src/CoreBundle/Migrations/Schema/V200/Version20170904145500.php index 77b4d09878..25a0110f1c 100644 --- a/src/CoreBundle/Migrations/Schema/V200/Version20170904145500.php +++ b/src/CoreBundle/Migrations/Schema/V200/Version20170904145500.php @@ -20,9 +20,9 @@ class Version20170904145500 extends AbstractMigrationChamilo { if (false === $schema->hasTable('c_exercise_category')) { $this->addSql( - 'CREATE TABLE c_exercise_category (id BIGINT AUTO_INCREMENT NOT NULL, c_id INT NOT NULL, name VARCHAR(255) NOT NULL, description LONGTEXT DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, position INT NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB' + 'CREATE TABLE c_exercise_category (id INT AUTO_INCREMENT NOT NULL, c_id INT NOT NULL, name VARCHAR(255) NOT NULL, description LONGTEXT DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, position INT NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB' ); - $this->addSql('ALTER TABLE c_exercise_category ADD resource_node_id BIGINT DEFAULT NULL'); + $this->addSql('ALTER TABLE c_exercise_category ADD resource_node_id INT DEFAULT NULL'); $this->addSql( 'ALTER TABLE c_exercise_category ADD CONSTRAINT FK_B94C157E91D79BD3 FOREIGN KEY (c_id) REFERENCES course (id) ON DELETE CASCADE' ); @@ -40,14 +40,14 @@ class Version20170904145500 extends AbstractMigrationChamilo $this->addSql('ALTER TABLE c_quiz CHANGE active active INT NOT NULL'); if ($table->hasColumn('exercise_category_id')) { - $this->addSql('ALTER TABLE c_quiz CHANGE exercise_category_id exercise_category_id BIGINT DEFAULT NULL;'); + $this->addSql('ALTER TABLE c_quiz CHANGE exercise_category_id exercise_category_id INT DEFAULT NULL;'); if (false === $table->hasForeignKey('FK_B7A1C35FB48D66')) { $this->addSql( 'ALTER TABLE c_quiz ADD CONSTRAINT FK_B7A1C35FB48D66 FOREIGN KEY (exercise_category_id) REFERENCES c_exercise_category (id) ON DELETE SET NULL' ); } } else { - $this->addSql('ALTER TABLE c_quiz ADD COLUMN exercise_category_id BIGINT DEFAULT NULL;'); + $this->addSql('ALTER TABLE c_quiz ADD COLUMN exercise_category_id INT DEFAULT NULL;'); $this->addSql( 'ALTER TABLE c_quiz ADD CONSTRAINT FK_B7A1C35FB48D66 FOREIGN KEY (exercise_category_id) REFERENCES c_exercise_category (id) ON DELETE SET NULL' ); @@ -111,7 +111,7 @@ class Version20170904145500 extends AbstractMigrationChamilo $this->addSql('ALTER TABLE c_quiz CHANGE type type INT NOT NULL'); if (false === $table->hasColumn('resource_node_id')) { - $this->addSql('ALTER TABLE c_quiz ADD COLUMN resource_node_id BIGINT DEFAULT NULL'); + $this->addSql('ALTER TABLE c_quiz ADD COLUMN resource_node_id INT DEFAULT NULL'); $this->addSql( 'ALTER TABLE c_quiz ADD CONSTRAINT FK_B7A1C31BAD783F FOREIGN KEY (resource_node_id) REFERENCES resource_node (id) ON DELETE CASCADE' ); @@ -147,7 +147,7 @@ class Version20170904145500 extends AbstractMigrationChamilo // c_quiz_question. $table = $schema->getTable('c_quiz_question'); if (false === $table->hasColumn('resource_node_id')) { - $this->addSql('ALTER TABLE c_quiz_question ADD resource_node_id BIGINT DEFAULT NULL;'); + $this->addSql('ALTER TABLE c_quiz_question ADD resource_node_id INT DEFAULT NULL;'); $this->addSql( 'ALTER TABLE c_quiz_question ADD CONSTRAINT FK_9A48A59F1BAD783F FOREIGN KEY (resource_node_id) REFERENCES resource_node (id) ON DELETE CASCADE;' ); @@ -270,7 +270,7 @@ class Version20170904145500 extends AbstractMigrationChamilo $table = $schema->getTable('c_quiz_question_category'); if (false === $table->hasColumn('resource_node_id')) { - $this->addSql('ALTER TABLE c_quiz_question_category ADD resource_node_id BIGINT DEFAULT NULL'); + $this->addSql('ALTER TABLE c_quiz_question_category ADD resource_node_id INT DEFAULT NULL'); $this->addSql( 'ALTER TABLE c_quiz_question_category ADD CONSTRAINT FK_1414369D1BAD783F FOREIGN KEY (resource_node_id) REFERENCES resource_node (id) ON DELETE CASCADE' ); diff --git a/src/CoreBundle/Migrations/Schema/V200/Version20170904173000.php b/src/CoreBundle/Migrations/Schema/V200/Version20170904173000.php index 243bdde043..65d2110c3b 100644 --- a/src/CoreBundle/Migrations/Schema/V200/Version20170904173000.php +++ b/src/CoreBundle/Migrations/Schema/V200/Version20170904173000.php @@ -34,7 +34,7 @@ class Version20170904173000 extends AbstractMigrationChamilo } if (false === $table->hasColumn('resource_node_id')) { - $this->addSql('ALTER TABLE c_group_info ADD resource_node_id BIGINT DEFAULT NULL'); + $this->addSql('ALTER TABLE c_group_info ADD resource_node_id INT DEFAULT NULL'); $this->addSql('ALTER TABLE c_group_info ADD CONSTRAINT FK_CE0653241BAD783F FOREIGN KEY (resource_node_id) REFERENCES resource_node (id) ON DELETE CASCADE'); $this->addSql('CREATE UNIQUE INDEX UNIQ_CE0653241BAD783F ON c_group_info (resource_node_id)'); } @@ -100,7 +100,7 @@ class Version20170904173000 extends AbstractMigrationChamilo } if (false === $table->hasColumn('resource_node_id')) { - $this->addSql('ALTER TABLE c_group_category ADD resource_node_id BIGINT DEFAULT NULL'); + $this->addSql('ALTER TABLE c_group_category ADD resource_node_id INT DEFAULT NULL'); $this->addSql('ALTER TABLE c_group_category ADD CONSTRAINT FK_F8E479F61BAD783F FOREIGN KEY (resource_node_id) REFERENCES resource_node (id) ON DELETE CASCADE'); $this->addSql('CREATE UNIQUE INDEX UNIQ_F8E479F61BAD783F ON c_group_category (resource_node_id)'); } diff --git a/src/CoreBundle/Migrations/Schema/V200/Version20180319145700.php b/src/CoreBundle/Migrations/Schema/V200/Version20180319145700.php index 239b9e66da..876314f7f1 100644 --- a/src/CoreBundle/Migrations/Schema/V200/Version20180319145700.php +++ b/src/CoreBundle/Migrations/Schema/V200/Version20180319145700.php @@ -54,7 +54,7 @@ class Version20180319145700 extends AbstractMigrationChamilo } if (false === $survey->hasColumn('resource_node_id')) { - $this->addSql('ALTER TABLE c_survey ADD resource_node_id BIGINT DEFAULT NULL'); + $this->addSql('ALTER TABLE c_survey ADD resource_node_id INT DEFAULT NULL'); $this->addSql('ALTER TABLE c_survey ADD CONSTRAINT FK_F246DB301BAD783F FOREIGN KEY (resource_node_id) REFERENCES resource_node (id) ON DELETE CASCADE'); $this->addSql('CREATE UNIQUE INDEX UNIQ_F246DB301BAD783F ON c_survey (resource_node_id);'); } diff --git a/src/CoreBundle/Migrations/Schema/V200/Version20180928172830.php b/src/CoreBundle/Migrations/Schema/V200/Version20180928172830.php index 6e1659e3ed..1a1bfd53f3 100644 --- a/src/CoreBundle/Migrations/Schema/V200/Version20180928172830.php +++ b/src/CoreBundle/Migrations/Schema/V200/Version20180928172830.php @@ -70,7 +70,7 @@ class Version20180928172830 extends AbstractMigrationChamilo $this->addSql('UPDATE c_tool SET tool_id = (SELECT id FROM tool WHERE name = c_tool.name) WHERE tool_id IS NOT NULL'); if (!$table->hasColumn('resource_node_id')) { - $this->addSql('ALTER TABLE c_tool ADD resource_node_id BIGINT DEFAULT NULL'); + $this->addSql('ALTER TABLE c_tool ADD resource_node_id INT DEFAULT NULL'); } // @todo remove/move LP/Link shortcuts. diff --git a/src/CoreBundle/Migrations/Schema/V200/Version20181025064351.php b/src/CoreBundle/Migrations/Schema/V200/Version20181025064351.php index 2fdd118185..bb5d82eef0 100644 --- a/src/CoreBundle/Migrations/Schema/V200/Version20181025064351.php +++ b/src/CoreBundle/Migrations/Schema/V200/Version20181025064351.php @@ -377,7 +377,7 @@ class Version20181025064351 extends AbstractMigrationChamilo $table = $schema->hasTable('gradebook_comment'); if (false === $table) { - $this->addSql('CREATE TABLE gradebook_comment (id BIGINT AUTO_INCREMENT NOT NULL, user_id INT DEFAULT NULL, gradebook_id INT DEFAULT NULL, comment LONGTEXT NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX IDX_C3B70763A76ED395 (user_id), INDEX IDX_C3B70763AD3ED51C (gradebook_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB ROW_FORMAT = DYNAMIC;'); + $this->addSql('CREATE TABLE gradebook_comment (id INT AUTO_INCREMENT NOT NULL, user_id INT DEFAULT NULL, gradebook_id INT DEFAULT NULL, comment LONGTEXT NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX IDX_C3B70763A76ED395 (user_id), INDEX IDX_C3B70763AD3ED51C (gradebook_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB ROW_FORMAT = DYNAMIC;'); $this->addSql('ALTER TABLE gradebook_comment ADD CONSTRAINT FK_C3B70763A76ED395 FOREIGN KEY (user_id) REFERENCES user (id) ON DELETE CASCADE;'); $this->addSql('ALTER TABLE gradebook_comment ADD CONSTRAINT FK_C3B70763AD3ED51C FOREIGN KEY (gradebook_id) REFERENCES gradebook_category (id) ON DELETE CASCADE;'); } diff --git a/src/CoreBundle/Migrations/Schema/V200/Version20190110182615.php b/src/CoreBundle/Migrations/Schema/V200/Version20190110182615.php index b10eecb4db..e6579338bf 100644 --- a/src/CoreBundle/Migrations/Schema/V200/Version20190110182615.php +++ b/src/CoreBundle/Migrations/Schema/V200/Version20190110182615.php @@ -27,7 +27,7 @@ class Version20190110182615 extends AbstractMigrationChamilo $table = $schema->getTable('c_lp'); if (false === $table->hasColumn('resource_node_id')) { - $this->addSql('ALTER TABLE c_lp ADD resource_node_id BIGINT DEFAULT NULL;'); + $this->addSql('ALTER TABLE c_lp ADD resource_node_id INT DEFAULT NULL;'); $this->addSql( 'ALTER TABLE c_lp ADD CONSTRAINT FK_F67ABBEB1BAD783F FOREIGN KEY (resource_node_id) REFERENCES resource_node (id) ON DELETE CASCADE;' ); @@ -81,7 +81,7 @@ class Version20190110182615 extends AbstractMigrationChamilo } if (false === $table->hasColumn('resource_node_id')) { - $this->addSql('ALTER TABLE c_lp_category ADD resource_node_id BIGINT DEFAULT NULL'); + $this->addSql('ALTER TABLE c_lp_category ADD resource_node_id INT DEFAULT NULL'); } if ($table->hasIndex('course')) { diff --git a/src/CoreBundle/Migrations/Schema/V200/Version20190110182620.php b/src/CoreBundle/Migrations/Schema/V200/Version20190110182620.php index 7fcd8c5a32..976a6d261a 100644 --- a/src/CoreBundle/Migrations/Schema/V200/Version20190110182620.php +++ b/src/CoreBundle/Migrations/Schema/V200/Version20190110182620.php @@ -20,7 +20,7 @@ class Version20190110182620 extends AbstractMigrationChamilo { $table = $schema->getTable('c_blog'); if (false === $table->hasColumn('resource_node_id')) { - $this->addSql('ALTER TABLE c_blog ADD resource_node_id BIGINT DEFAULT NULL;'); + $this->addSql('ALTER TABLE c_blog ADD resource_node_id INT DEFAULT NULL;'); $this->addSql( 'ALTER TABLE c_blog ADD CONSTRAINT FK_64B00A121BAD783F FOREIGN KEY (resource_node_id) REFERENCES resource_node (id) ON DELETE CASCADE;' ); @@ -29,7 +29,7 @@ class Version20190110182620 extends AbstractMigrationChamilo $table = $schema->getTable('c_wiki'); if (false === $table->hasColumn('resource_node_id')) { - $this->addSql('ALTER TABLE c_wiki ADD resource_node_id BIGINT DEFAULT NULL;'); + $this->addSql('ALTER TABLE c_wiki ADD resource_node_id INT DEFAULT NULL;'); $this->addSql( 'ALTER TABLE c_wiki ADD CONSTRAINT FK_866887571BAD783F FOREIGN KEY (resource_node_id) REFERENCES resource_node (id) ON DELETE CASCADE;' ); diff --git a/src/CoreBundle/Migrations/Schema/V200/Version20191101132000.php b/src/CoreBundle/Migrations/Schema/V200/Version20191101132000.php index ed223db897..282da3e44a 100644 --- a/src/CoreBundle/Migrations/Schema/V200/Version20191101132000.php +++ b/src/CoreBundle/Migrations/Schema/V200/Version20191101132000.php @@ -39,7 +39,7 @@ class Version20191101132000 extends AbstractMigrationChamilo } if (!$table->hasColumn('resource_node_id')) { - $this->addSql('ALTER TABLE course ADD COLUMN resource_node_id BIGINT DEFAULT NULL;'); + $this->addSql('ALTER TABLE course ADD COLUMN resource_node_id INT DEFAULT NULL;'); $this->addSql( 'ALTER TABLE course ADD CONSTRAINT FK_169E6FB91BAD783F FOREIGN KEY (resource_node_id) REFERENCES resource_node (id) ON DELETE CASCADE;' ); @@ -197,7 +197,7 @@ class Version20191101132000 extends AbstractMigrationChamilo $this->addSql('ALTER TABLE c_tool_intro CHANGE id id VARCHAR(255) DEFAULT NULL'); if (!$table->hasColumn('resource_node_id')) { - $this->addSql('ALTER TABLE c_tool_intro ADD resource_node_id BIGINT DEFAULT NULL'); + $this->addSql('ALTER TABLE c_tool_intro ADD resource_node_id INT DEFAULT NULL'); $this->addSql('ALTER TABLE c_tool_intro ADD CONSTRAINT FK_D705267B1BAD783F FOREIGN KEY (resource_node_id) REFERENCES resource_node (id) ON DELETE CASCADE;'); $this->addSql('CREATE UNIQUE INDEX UNIQ_D705267B1BAD783F ON c_tool_intro (resource_node_id);'); } diff --git a/src/CoreBundle/Migrations/Schema/V200/Version20200821224242.php b/src/CoreBundle/Migrations/Schema/V200/Version20200821224242.php index b5e8d10115..89e05823a7 100644 --- a/src/CoreBundle/Migrations/Schema/V200/Version20200821224242.php +++ b/src/CoreBundle/Migrations/Schema/V200/Version20200821224242.php @@ -21,7 +21,7 @@ final class Version20200821224242 extends AbstractMigrationChamilo $connection = $this->getEntityManager()->getConnection(); $table = $schema->getTable('message'); - $this->addSql('ALTER TABLE message CHANGE parent_id parent_id BIGINT DEFAULT NULL'); + $this->addSql('ALTER TABLE message CHANGE parent_id parent_id INT DEFAULT NULL'); if ($table->hasColumn('msg_status')) { $this->addSql('ALTER TABLE message CHANGE msg_status msg_type SMALLINT NOT NULL'); @@ -87,10 +87,10 @@ final class Version20200821224242 extends AbstractMigrationChamilo if (!$schema->hasTable('message_rel_user')) { $this->addSql( - 'CREATE TABLE message_rel_user (id BIGINT AUTO_INCREMENT NOT NULL, message_id BIGINT NOT NULL, user_id INT NOT NULL, msg_read TINYINT(1) NOT NULL, starred TINYINT(1) NOT NULL, receiver_type SMALLINT NOT NULL, INDEX IDX_325D70B9537A1329 (message_id), INDEX IDX_325D70B9A76ED395 (user_id), UNIQUE INDEX message_receiver (message_id, user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB ROW_FORMAT = DYNAMIC' + 'CREATE TABLE message_rel_user (id INT AUTO_INCREMENT NOT NULL, message_id INT NOT NULL, user_id INT NOT NULL, msg_read TINYINT(1) NOT NULL, starred TINYINT(1) NOT NULL, receiver_type SMALLINT NOT NULL, INDEX IDX_325D70B9537A1329 (message_id), INDEX IDX_325D70B9A76ED395 (user_id), UNIQUE INDEX message_receiver (message_id, user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB ROW_FORMAT = DYNAMIC' ); $this->addSql( - 'CREATE TABLE message_rel_user_rel_tags (message_rel_user_id BIGINT NOT NULL, message_tag_id BIGINT NOT NULL, INDEX IDX_B4B37A20962B5422 (message_rel_user_id), INDEX IDX_B4B37A208DF5FE1E (message_tag_id), PRIMARY KEY(message_rel_user_id, message_tag_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB ROW_FORMAT = DYNAMIC' + 'CREATE TABLE message_rel_user_rel_tags (message_rel_user_id INT NOT NULL, message_tag_id INT NOT NULL, INDEX IDX_B4B37A20962B5422 (message_rel_user_id), INDEX IDX_B4B37A208DF5FE1E (message_tag_id), PRIMARY KEY(message_rel_user_id, message_tag_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB ROW_FORMAT = DYNAMIC' ); $this->addSql( 'ALTER TABLE message_rel_user ADD CONSTRAINT FK_325D70B9537A1329 FOREIGN KEY (message_id) REFERENCES message (id)' @@ -165,7 +165,7 @@ final class Version20200821224242 extends AbstractMigrationChamilo // $this->addSql('ALTER TABLE message CHANGE msg_status msg_status SMALLINT NOT NULL;'); - $this->addSql("CREATE TABLE social_post (id BIGINT AUTO_INCREMENT NOT NULL, sender_id INT NOT NULL, user_receiver_id INT DEFAULT NULL, group_receiver_id INT DEFAULT NULL, parent_id BIGINT DEFAULT NULL, subject LONGTEXT DEFAULT NULL, content LONGTEXT NOT NULL, type SMALLINT NOT NULL, status SMALLINT NOT NULL, send_date DATETIME NOT NULL COMMENT '(DC2Type:datetime)', updated_at DATETIME NOT NULL COMMENT '(DC2Type:datetime)', INDEX IDX_159BBFE9727ACA70 (parent_id), INDEX idx_social_post_sender (sender_id), INDEX idx_social_post_user (user_receiver_id), INDEX idx_social_post_group (group_receiver_id), INDEX idx_social_post_type (type), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB ROW_FORMAT = DYNAMIC"); + $this->addSql("CREATE TABLE social_post (id INT AUTO_INCREMENT NOT NULL, sender_id INT NOT NULL, user_receiver_id INT DEFAULT NULL, group_receiver_id INT DEFAULT NULL, parent_id INT DEFAULT NULL, subject LONGTEXT DEFAULT NULL, content LONGTEXT NOT NULL, type SMALLINT NOT NULL, status SMALLINT NOT NULL, send_date DATETIME NOT NULL COMMENT '(DC2Type:datetime)', updated_at DATETIME NOT NULL COMMENT '(DC2Type:datetime)', INDEX IDX_159BBFE9727ACA70 (parent_id), INDEX idx_social_post_sender (sender_id), INDEX idx_social_post_user (user_receiver_id), INDEX idx_social_post_group (group_receiver_id), INDEX idx_social_post_type (type), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB ROW_FORMAT = DYNAMIC"); $sql = 'INSERT INTO social_post (id, sender_id, user_receiver_id, group_receiver_id, parent_id, subject, content, type, status, send_date, updated_at) SELECT DISTINCT m.id, @@ -223,14 +223,14 @@ final class Version20200821224242 extends AbstractMigrationChamilo $this->addSql('DROP INDEX idx_message_feedback_uid_mid ON message_feedback'); } - $this->addSql('ALTER TABLE message_feedback CHANGE message_id social_post_id BIGINT NOT NULL'); + $this->addSql('ALTER TABLE message_feedback CHANGE message_id social_post_id INT NOT NULL'); $this->addSql('RENAME TABLE message_feedback TO social_post_feedback'); $this->addSql('DELETE FROM social_post_feedback WHERE social_post_id NOT IN (SELECT id FROM social_post)'); $this->addSql('CREATE INDEX IDX_DB7E436DA76ED395 ON social_post_feedback (user_id)'); $this->addSql('CREATE INDEX IDX_DB7E436DC4F2D6B1 ON social_post_feedback (social_post_id)'); $this->addSql('CREATE INDEX idx_social_post_uid_spid ON social_post_feedback (social_post_id, user_id)'); } else { - $this->addSql("CREATE TABLE social_post_feedback (id BIGINT AUTO_INCREMENT NOT NULL, social_post_id BIGINT NOT NULL, user_id INT NOT NULL, liked TINYINT(1) DEFAULT '0' NOT NULL, disliked TINYINT(1) DEFAULT '0' NOT NULL, updated_at DATETIME NOT NULL COMMENT '(DC2Type:datetime)', INDEX IDX_DB7E436DC4F2D6B1 (social_post_id), INDEX IDX_DB7E436DA76ED395 (user_id), INDEX idx_social_post_uid_spid (social_post_id, user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB ROW_FORMAT = DYNAMIC"); + $this->addSql("CREATE TABLE social_post_feedback (id INT AUTO_INCREMENT NOT NULL, social_post_id INT NOT NULL, user_id INT NOT NULL, liked TINYINT(1) DEFAULT '0' NOT NULL, disliked TINYINT(1) DEFAULT '0' NOT NULL, updated_at DATETIME NOT NULL COMMENT '(DC2Type:datetime)', INDEX IDX_DB7E436DC4F2D6B1 (social_post_id), INDEX IDX_DB7E436DA76ED395 (user_id), INDEX idx_social_post_uid_spid (social_post_id, user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB ROW_FORMAT = DYNAMIC"); } $this->addSql('ALTER TABLE social_post_feedback ADD CONSTRAINT FK_DB7E436DA76ED395 FOREIGN KEY (user_id) REFERENCES user (id) ON DELETE CASCADE'); @@ -244,14 +244,14 @@ final class Version20200821224242 extends AbstractMigrationChamilo if (false === $table->hasIndex('IDX_B68FF524537A1329')) { $this->addSql('CREATE INDEX IDX_B68FF524537A1329 ON message_attachment (message_id)'); } - $this->addSql('ALTER TABLE message_attachment CHANGE message_id message_id BIGINT NOT NULL'); + $this->addSql('ALTER TABLE message_attachment CHANGE message_id message_id INT NOT NULL'); if (false === $table->hasForeignKey('FK_B68FF524537A1329')) { $this->addSql('ALTER TABLE message_attachment ADD CONSTRAINT FK_B68FF524537A1329 FOREIGN KEY (message_id) REFERENCES message (id)'); } if (!$table->hasColumn('resource_node_id')) { - $this->addSql('ALTER TABLE message_attachment ADD resource_node_id BIGINT DEFAULT NULL;'); + $this->addSql('ALTER TABLE message_attachment ADD resource_node_id INT DEFAULT NULL;'); $this->addSql('CREATE UNIQUE INDEX UNIQ_B68FF5241BAD783F ON message_attachment (resource_node_id);'); } @@ -260,13 +260,13 @@ final class Version20200821224242 extends AbstractMigrationChamilo } if (!$schema->hasTable('c_chat_conversation')) { - $this->addSql('CREATE TABLE c_chat_conversation (id INT AUTO_INCREMENT NOT NULL, resource_node_id BIGINT DEFAULT NULL, name VARCHAR(255) DEFAULT NULL, UNIQUE INDEX UNIQ_CD09E33F1BAD783F (resource_node_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB ROW_FORMAT = DYNAMIC;'); + $this->addSql('CREATE TABLE c_chat_conversation (id INT AUTO_INCREMENT NOT NULL, resource_node_id INT DEFAULT NULL, name VARCHAR(255) DEFAULT NULL, UNIQUE INDEX UNIQ_CD09E33F1BAD783F (resource_node_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB ROW_FORMAT = DYNAMIC;'); $this->addSql('ALTER TABLE c_chat_conversation ADD CONSTRAINT FK_CD09E33F1BAD783F FOREIGN KEY (resource_node_id) REFERENCES resource_node (id) ON DELETE CASCADE'); } if (!$schema->hasTable('message_tag')) { - $this->addSql("CREATE TABLE message_tag (id BIGINT AUTO_INCREMENT NOT NULL, user_id INT NOT NULL, tag VARCHAR(255) NOT NULL, color VARCHAR(255) NOT NULL, position INT NOT NULL, created_at DATETIME NOT NULL COMMENT '(DC2Type:datetime)', updated_at DATETIME NOT NULL COMMENT '(DC2Type:datetime)', INDEX IDX_2ABC3D6FA76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB ROW_FORMAT = DYNAMIC;"); - $this->addSql('CREATE TABLE message_rel_tags (message_id BIGINT NOT NULL, message_tag_id BIGINT NOT NULL, INDEX IDX_D07232D6537A1329 (message_id), INDEX IDX_D07232D68DF5FE1E (message_tag_id), PRIMARY KEY(message_id, message_tag_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB ROW_FORMAT = DYNAMIC;'); + $this->addSql("CREATE TABLE message_tag (id INT AUTO_INCREMENT NOT NULL, user_id INT NOT NULL, tag VARCHAR(255) NOT NULL, color VARCHAR(255) NOT NULL, position INT NOT NULL, created_at DATETIME NOT NULL COMMENT '(DC2Type:datetime)', updated_at DATETIME NOT NULL COMMENT '(DC2Type:datetime)', INDEX IDX_2ABC3D6FA76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB ROW_FORMAT = DYNAMIC;"); + $this->addSql('CREATE TABLE message_rel_tags (message_id INT NOT NULL, message_tag_id INT NOT NULL, INDEX IDX_D07232D6537A1329 (message_id), INDEX IDX_D07232D68DF5FE1E (message_tag_id), PRIMARY KEY(message_id, message_tag_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB ROW_FORMAT = DYNAMIC;'); $this->addSql('ALTER TABLE message_tag ADD CONSTRAINT FK_2ABC3D6FA76ED395 FOREIGN KEY (user_id) REFERENCES user (id) ON DELETE CASCADE'); $this->addSql('ALTER TABLE message_rel_tags ADD CONSTRAINT FK_D07232D6537A1329 FOREIGN KEY (message_id) REFERENCES message (id) ON DELETE CASCADE'); $this->addSql('ALTER TABLE message_rel_tags ADD CONSTRAINT FK_D07232D68DF5FE1E FOREIGN KEY (message_tag_id) REFERENCES message_tag (id) ON DELETE CASCADE'); diff --git a/src/CoreBundle/Migrations/Schema/V200/Version20211005153900.php b/src/CoreBundle/Migrations/Schema/V200/Version20211005153900.php index b26136ba0a..331dc026a4 100644 --- a/src/CoreBundle/Migrations/Schema/V200/Version20211005153900.php +++ b/src/CoreBundle/Migrations/Schema/V200/Version20211005153900.php @@ -68,7 +68,7 @@ class Version20211005153900 extends AbstractMigrationChamilo } if (!$table->hasColumn('resource_node_id')) { - $this->addSql('ALTER TABLE ticket_message_attachments ADD resource_node_id BIGINT DEFAULT NULL;'); + $this->addSql('ALTER TABLE ticket_message_attachments ADD resource_node_id INT DEFAULT NULL;'); $this->addSql( 'ALTER TABLE ticket_message_attachments ADD CONSTRAINT FK_70BF9E261BAD783F FOREIGN KEY (resource_node_id) REFERENCES resource_node (id) ON DELETE CASCADE;' ); diff --git a/src/CoreBundle/Migrations/Schema/V200/Version20211026140820.php b/src/CoreBundle/Migrations/Schema/V200/Version20211026140820.php index 86798d95ba..c72f805350 100644 --- a/src/CoreBundle/Migrations/Schema/V200/Version20211026140820.php +++ b/src/CoreBundle/Migrations/Schema/V200/Version20211026140820.php @@ -17,8 +17,8 @@ final class Version20211026140820 extends AbstractMigrationChamilo public function up(Schema $schema): void { if (false === $schema->hasTable('page')) { - $this->addSql("CREATE TABLE page (id BIGINT AUTO_INCREMENT NOT NULL, access_url_id INT DEFAULT NULL, creator_id INT DEFAULT NULL, category_id BIGINT DEFAULT NULL, title VARCHAR(255) NOT NULL, content LONGTEXT NOT NULL, slug VARCHAR(255) NOT NULL, enabled TINYINT(1) NOT NULL, position INT NOT NULL, locale VARCHAR(10) NOT NULL, created_at DATETIME NOT NULL COMMENT '(DC2Type:datetime)', updated_at DATETIME NOT NULL COMMENT '(DC2Type:datetime)', INDEX IDX_140AB62073444FD5 (access_url_id), INDEX IDX_140AB62061220EA6 (creator_id), INDEX IDX_140AB62012469DE2 (category_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB ROW_FORMAT = DYNAMIC;"); - $this->addSql("CREATE TABLE page_category (id BIGINT AUTO_INCREMENT NOT NULL, creator_id INT DEFAULT NULL, title VARCHAR(255) NOT NULL, type VARCHAR(255) NOT NULL, created_at DATETIME NOT NULL COMMENT '(DC2Type:datetime)', updated_at DATETIME NOT NULL COMMENT '(DC2Type:datetime)', INDEX IDX_86D31EE161220EA6 (creator_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB ROW_FORMAT = DYNAMIC;"); + $this->addSql("CREATE TABLE page (id INT AUTO_INCREMENT NOT NULL, access_url_id INT DEFAULT NULL, creator_id INT DEFAULT NULL, category_id INT DEFAULT NULL, title VARCHAR(255) NOT NULL, content LONGTEXT NOT NULL, slug VARCHAR(255) NOT NULL, enabled TINYINT(1) NOT NULL, position INT NOT NULL, locale VARCHAR(10) NOT NULL, created_at DATETIME NOT NULL COMMENT '(DC2Type:datetime)', updated_at DATETIME NOT NULL COMMENT '(DC2Type:datetime)', INDEX IDX_140AB62073444FD5 (access_url_id), INDEX IDX_140AB62061220EA6 (creator_id), INDEX IDX_140AB62012469DE2 (category_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB ROW_FORMAT = DYNAMIC;"); + $this->addSql("CREATE TABLE page_category (id INT AUTO_INCREMENT NOT NULL, creator_id INT DEFAULT NULL, title VARCHAR(255) NOT NULL, type VARCHAR(255) NOT NULL, created_at DATETIME NOT NULL COMMENT '(DC2Type:datetime)', updated_at DATETIME NOT NULL COMMENT '(DC2Type:datetime)', INDEX IDX_86D31EE161220EA6 (creator_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB ROW_FORMAT = DYNAMIC;"); $this->addSql('ALTER TABLE page ADD CONSTRAINT FK_140AB62073444FD5 FOREIGN KEY (access_url_id) REFERENCES access_url (id) ON DELETE CASCADE;'); $this->addSql('ALTER TABLE page ADD CONSTRAINT FK_140AB62061220EA6 FOREIGN KEY (creator_id) REFERENCES user (id) ON DELETE CASCADE;'); diff --git a/src/CoreBundle/Migrations/Schema/V200/Version20230216122950.php b/src/CoreBundle/Migrations/Schema/V200/Version20230216122950.php index 779eb16ca4..c24dd2b942 100644 --- a/src/CoreBundle/Migrations/Schema/V200/Version20230216122950.php +++ b/src/CoreBundle/Migrations/Schema/V200/Version20230216122950.php @@ -62,7 +62,7 @@ final class Version20230216122950 extends AbstractMigrationChamilo if (!$schema->hasTable('agenda_reminder')) { $this->addSql( - 'CREATE TABLE agenda_reminder (id BIGINT AUTO_INCREMENT NOT NULL, type VARCHAR(255) NOT NULL, event_id INT NOT NULL, date_interval VARCHAR(255) NOT NULL COMMENT "(DC2Type:dateinterval)", sent TINYINT(1) NOT NULL, created_at DATETIME NOT NULL COMMENT "(DC2Type:datetime)", updated_at DATETIME NOT NULL COMMENT "(DC2Type:datetime)", PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB ROW_FORMAT = DYNAMIC;' + 'CREATE TABLE agenda_reminder (id INT AUTO_INCREMENT NOT NULL, type VARCHAR(255) NOT NULL, event_id INT NOT NULL, date_interval VARCHAR(255) NOT NULL COMMENT "(DC2Type:dateinterval)", sent TINYINT(1) NOT NULL, created_at DATETIME NOT NULL COMMENT "(DC2Type:datetime)", updated_at DATETIME NOT NULL COMMENT "(DC2Type:datetime)", PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB ROW_FORMAT = DYNAMIC;' ); } @@ -77,7 +77,7 @@ final class Version20230216122950 extends AbstractMigrationChamilo if (!$schema->hasTable('message_feedback')) { $this->addSql( - 'CREATE TABLE message_feedback (id BIGINT AUTO_INCREMENT NOT NULL, message_id BIGINT NOT NULL, user_id INT NOT NULL, liked TINYINT(1) DEFAULT 0 NOT NULL, disliked TINYINT(1) DEFAULT 0 NOT NULL, updated_at DATETIME NOT NULL COMMENT "(DC2Type:datetime)", INDEX IDX_DB0F8049537A1329 (message_id), INDEX IDX_DB0F8049A76ED395 (user_id), INDEX idx_message_feedback_uid_mid (message_id, user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB ROW_FORMAT = DYNAMIC' + 'CREATE TABLE message_feedback (id INT AUTO_INCREMENT NOT NULL, message_id INT NOT NULL, user_id INT NOT NULL, liked TINYINT(1) DEFAULT 0 NOT NULL, disliked TINYINT(1) DEFAULT 0 NOT NULL, updated_at DATETIME NOT NULL COMMENT "(DC2Type:datetime)", INDEX IDX_DB0F8049537A1329 (message_id), INDEX IDX_DB0F8049A76ED395 (user_id), INDEX idx_message_feedback_uid_mid (message_id, user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB ROW_FORMAT = DYNAMIC' ); $this->addSql( 'ALTER TABLE message_feedback ADD CONSTRAINT FK_DB0F8049537A1329 FOREIGN KEY (message_id) REFERENCES message (id) ON DELETE CASCADE' diff --git a/src/CoreBundle/Migrations/Schema/V200/Version20230720222130.php b/src/CoreBundle/Migrations/Schema/V200/Version20230720222130.php index 58e69a563a..08359157ae 100644 --- a/src/CoreBundle/Migrations/Schema/V200/Version20230720222130.php +++ b/src/CoreBundle/Migrations/Schema/V200/Version20230720222130.php @@ -19,7 +19,7 @@ final class Version20230720222130 extends AbstractMigrationChamilo public function up(Schema $schema): void { if (false === $schema->hasTable('social_post_attachments')) { - $this->addSql("CREATE TABLE social_post_attachments (id INT AUTO_INCREMENT NOT NULL, social_post_id BIGINT DEFAULT NULL, resource_node_id BIGINT DEFAULT NULL, path VARCHAR(255) NOT NULL, filename LONGTEXT NOT NULL, size INT NOT NULL, sys_insert_user_id INT NOT NULL, sys_insert_datetime DATETIME NOT NULL COMMENT '(DC2Type:datetime)', sys_lastedit_user_id INT DEFAULT NULL, sys_lastedit_datetime DATETIME DEFAULT NULL COMMENT '(DC2Type:datetime)', INDEX IDX_DF2A8F34C4F2D6B1 (social_post_id), UNIQUE INDEX UNIQ_DF2A8F341BAD783F (resource_node_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB ROW_FORMAT = DYNAMIC;"); + $this->addSql("CREATE TABLE social_post_attachments (id INT AUTO_INCREMENT NOT NULL, social_post_id INT DEFAULT NULL, resource_node_id INT DEFAULT NULL, path VARCHAR(255) NOT NULL, filename LONGTEXT NOT NULL, size INT NOT NULL, sys_insert_user_id INT NOT NULL, sys_insert_datetime DATETIME NOT NULL COMMENT '(DC2Type:datetime)', sys_lastedit_user_id INT DEFAULT NULL, sys_lastedit_datetime DATETIME DEFAULT NULL COMMENT '(DC2Type:datetime)', INDEX IDX_DF2A8F34C4F2D6B1 (social_post_id), UNIQUE INDEX UNIQ_DF2A8F341BAD783F (resource_node_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB ROW_FORMAT = DYNAMIC;"); $this->addSql('ALTER TABLE social_post_attachments ADD CONSTRAINT FK_DF2A8F34C4F2D6B1 FOREIGN KEY (social_post_id) REFERENCES social_post (id) ON DELETE CASCADE;'); $this->addSql('ALTER TABLE social_post_attachments ADD CONSTRAINT FK_DF2A8F341BAD783F FOREIGN KEY (resource_node_id) REFERENCES resource_node (id) ON DELETE CASCADE;'); } diff --git a/src/CoreBundle/Migrations/Schema/V200/Version20240112103400.php b/src/CoreBundle/Migrations/Schema/V200/Version20240112103400.php new file mode 100644 index 0000000000..41c35111e8 --- /dev/null +++ b/src/CoreBundle/Migrations/Schema/V200/Version20240112103400.php @@ -0,0 +1,45 @@ +getContainer(); + $em = $this->getEntityManager(); + + /** @var Connection $connection */ + $connection = $em->getConnection(); + $kernel = $container->get('kernel'); + $rootPath = $kernel->getProjectDir(); + + $q = $em->createQuery('SELECT c FROM Chamilo\CoreBundle\Entity\Course c'); + + /** @var Course $course */ + foreach ($q->toIterable() as $course) { + $diskQuotaInBytes = $course->getDiskQuota(); + if ($diskQuotaInBytes !== null) { + $diskQuotaInMegabytes = $diskQuotaInBytes / (1024 * 1024); + $course->setDiskQuota($diskQuotaInMegabytes); + $em->persist($course); + } + + $em->flush(); + } + } +} diff --git a/src/CoreBundle/Migrations/Schema/V200/Version20240112131200.php b/src/CoreBundle/Migrations/Schema/V200/Version20240112131200.php new file mode 100644 index 0000000000..31bde4c244 --- /dev/null +++ b/src/CoreBundle/Migrations/Schema/V200/Version20240112131200.php @@ -0,0 +1,396 @@ +addSql('SET FOREIGN_KEY_CHECKS=0;'); + $this->addSql('SET UNIQUE_CHECKS=0;'); + + if ($schema->hasTable('user_rel_user')) { + error_log('Perform the changes in the user_rel_user table'); + $this->addSql("ALTER TABLE user_rel_user CHANGE id id INT AUTO_INCREMENT NOT NULL;"); + } + + if ($schema->hasTable('resource_right')) { + error_log('Perform the changes in the resource_right table'); + $this->addSql("ALTER TABLE resource_right CHANGE id id INT AUTO_INCREMENT NOT NULL, CHANGE resource_link_id resource_link_id INT DEFAULT NULL;"); + } + + if ($schema->hasTable('page')) { + error_log('Perform the changes in the page table'); + $this->addSql("ALTER TABLE page CHANGE id id INT AUTO_INCREMENT NOT NULL, CHANGE category_id category_id INT DEFAULT NULL;"); + } + + if ($schema->hasTable('page_category')) { + error_log('Perform the changes in the page_category table'); + $this->addSql("ALTER TABLE page_category CHANGE id id INT AUTO_INCREMENT NOT NULL;"); + } + + if ($schema->hasTable('agenda_event_invitee')) { + error_log('Perform the changes in the agenda_event_invitee table'); + $this->addSql("ALTER TABLE agenda_event_invitee CHANGE id id INT AUTO_INCREMENT NOT NULL, CHANGE invitation_id invitation_id INT DEFAULT NULL;"); + } + + if ($schema->hasTable('branch_transaction')) { + error_log('Perform the changes in the branch_transaction table'); + $this->addSql("ALTER TABLE branch_transaction CHANGE id id INT AUTO_INCREMENT NOT NULL, CHANGE transaction_id transaction_id INT NOT NULL;"); + } + + if ($schema->hasTable('resource_node')) { + error_log('Perform the changes in the resource_node table'); + $this->addSql("ALTER TABLE resource_node CHANGE id id INT AUTO_INCREMENT NOT NULL, CHANGE resource_file_id resource_file_id INT DEFAULT NULL, CHANGE parent_id parent_id INT DEFAULT NULL;"); + } + + if ($schema->hasTable('resource_file')) { + error_log('Perform the changes in the resource_file table'); + $this->addSql("ALTER TABLE resource_file CHANGE id id INT AUTO_INCREMENT NOT NULL;"); + } + + if ($schema->hasTable('resource_user_tag')) { + error_log('Perform the changes in the resource_user_tag table'); + $this->addSql("ALTER TABLE resource_user_tag CHANGE id id INT AUTO_INCREMENT NOT NULL, CHANGE tag_id tag_id INT DEFAULT NULL;"); + } + + if ($schema->hasTable('resource_tag')) { + error_log('Perform the changes in the resource_tag table'); + $this->addSql("ALTER TABLE resource_tag CHANGE id id INT AUTO_INCREMENT NOT NULL;"); + } + + if ($schema->hasTable('agenda_event_invitation')) { + error_log('Perform the changes in the agenda_event_invitation table'); + $this->addSql("ALTER TABLE agenda_event_invitation CHANGE id id INT AUTO_INCREMENT NOT NULL;"); + } + + if ($schema->hasTable('gradebook_comment')) { + error_log('Perform the changes in the gradebook_comment table'); + $this->addSql("ALTER TABLE gradebook_comment CHANGE id id INT AUTO_INCREMENT NOT NULL;"); + } + + if ($schema->hasTable('gradebook_certificate')) { + error_log('Perform the changes in the gradebook_certificate table'); + $this->addSql("ALTER TABLE gradebook_certificate CHANGE id id INT AUTO_INCREMENT NOT NULL;"); + } + + if ($schema->hasTable('social_post')) { + error_log('Perform the changes in the social_post table'); + $this->addSql("ALTER TABLE social_post CHANGE id id INT AUTO_INCREMENT NOT NULL, CHANGE parent_id parent_id INT DEFAULT NULL;"); + } + + if ($schema->hasTable('social_post_feedback')) { + error_log('Perform the changes in the social_post_feedback table'); + $this->addSql("ALTER TABLE social_post_feedback CHANGE id id INT AUTO_INCREMENT NOT NULL, CHANGE social_post_id social_post_id INT NOT NULL;"); + } + + if ($schema->hasTable('branch_sync')) { + error_log('Perform the changes in the branch_sync table'); + $this->addSql("ALTER TABLE branch_sync CHANGE last_sync_trans_id last_sync_trans_id INT DEFAULT NULL;"); + } + + if ($schema->hasTable('track_e_lastaccess')) { + error_log('Perform the changes in the track_e_lastaccess table'); + $this->addSql("ALTER TABLE track_e_lastaccess CHANGE access_id access_id INT AUTO_INCREMENT NOT NULL;"); + } + + if ($schema->hasTable('notification')) { + error_log('Perform the changes in the notification table'); + $this->addSql("ALTER TABLE notification CHANGE id id INT AUTO_INCREMENT NOT NULL;"); + } + + if ($schema->hasTable('message_feedback')) { + error_log('Perform the changes in the message_feedback table'); + $this->addSql("ALTER TABLE message_feedback CHANGE id id INT AUTO_INCREMENT NOT NULL, CHANGE message_id message_id INT NOT NULL;"); + } + + if ($schema->hasTable('agenda_reminder')) { + error_log('Perform the changes in the agenda_reminder table'); + $this->addSql("ALTER TABLE agenda_reminder CHANGE id id INT AUTO_INCREMENT NOT NULL;"); + } + + if ($schema->hasTable('c_quiz_rel_category')) { + error_log('Perform the changes in the c_quiz_rel_category table'); + $this->addSql("ALTER TABLE c_quiz_rel_category CHANGE iid iid INT AUTO_INCREMENT NOT NULL;"); + } + + if ($schema->hasTable('c_lp_iv_interaction')) { + error_log('Perform the changes in the c_lp_iv_interaction table'); + $this->addSql("ALTER TABLE c_lp_iv_interaction CHANGE lp_iv_id lp_iv_id INT NOT NULL;"); + } + + if ($schema->hasTable('c_lp_iv_objective')) { + error_log('Perform the changes in the c_lp_iv_objective table'); + $this->addSql("ALTER TABLE c_lp_iv_objective CHANGE lp_iv_id lp_iv_id INT NOT NULL;"); + } + + if ($schema->hasTable('user')) { + error_log('Perform the changes in the user table'); + $this->addSql("ALTER TABLE user CHANGE resource_node_id resource_node_id INT DEFAULT NULL;"); + } + + if ($schema->hasTable('illustration')) { + error_log('Perform the changes in the illustration table'); + $this->addSql("ALTER TABLE illustration CHANGE resource_node_id resource_node_id INT DEFAULT NULL;"); + } + + if ($schema->hasTable('personal_file')) { + error_log('Perform the changes in the personal_file table'); + $this->addSql("ALTER TABLE personal_file CHANGE resource_node_id resource_node_id INT DEFAULT NULL;"); + } + + if ($schema->hasTable('access_url')) { + error_log('Perform the changes in the access_url table'); + $this->addSql("ALTER TABLE access_url CHANGE resource_node_id resource_node_id INT DEFAULT NULL;"); + } + + if ($schema->hasTable('social_post_attachments')) { + error_log('Perform the changes in the social_post_attachments table'); + $this->addSql("ALTER TABLE social_post_attachments CHANGE social_post_id social_post_id INT DEFAULT NULL, CHANGE resource_node_id resource_node_id INT DEFAULT NULL;"); + } + + if ($schema->hasTable('message_attachment')) { + error_log('Perform the changes in the message_attachment table'); + $this->addSql("ALTER TABLE message_attachment CHANGE message_id message_id INT NOT NULL, CHANGE resource_node_id resource_node_id INT DEFAULT NULL;"); + } + + if ($schema->hasTable('resource_comment')) { + error_log('Perform the changes in the resource_comment table'); + $this->addSql("ALTER TABLE resource_comment CHANGE id id INT AUTO_INCREMENT NOT NULL, CHANGE resource_node_id resource_node_id INT DEFAULT NULL, CHANGE parent_id parent_id INT DEFAULT NULL;"); + } + + if ($schema->hasTable('usergroup')) { + error_log('Perform the changes in the usergroup table'); + $this->addSql("ALTER TABLE usergroup CHANGE resource_node_id resource_node_id INT DEFAULT NULL;"); + } + + if ($schema->hasTable('course')) { + error_log('Perform the changes in the course table'); + $this->addSql("ALTER TABLE course CHANGE resource_node_id resource_node_id INT DEFAULT NULL, CHANGE disk_quota disk_quota INT DEFAULT NULL;"); + } + + if ($schema->hasTable('ticket_message_attachments')) { + error_log('Perform the changes in the ticket_message_attachments table'); + $this->addSql("ALTER TABLE ticket_message_attachments CHANGE resource_node_id resource_node_id INT DEFAULT NULL;"); + } + + if ($schema->hasTable('resource_link')) { + error_log('Perform the changes in the resource_link table'); + $this->addSql("ALTER TABLE resource_link CHANGE id id INT AUTO_INCREMENT NOT NULL, CHANGE resource_node_id resource_node_id INT DEFAULT NULL;"); + } + + if ($schema->hasTable('c_student_publication_correction')) { + error_log('Perform the changes in the c_student_publication_correction table'); + $this->addSql("ALTER TABLE c_student_publication_correction CHANGE resource_node_id resource_node_id INT DEFAULT NULL;"); + } + + if ($schema->hasTable('c_forum_attachment')) { + error_log('Perform the changes in the c_forum_attachment table'); + $this->addSql("ALTER TABLE c_forum_attachment CHANGE resource_node_id resource_node_id INT DEFAULT NULL;"); + } + + if ($schema->hasTable('c_calendar_event')) { + error_log('Perform the changes in the c_calendar_event table'); + $this->addSql("ALTER TABLE c_calendar_event CHANGE resource_node_id resource_node_id INT DEFAULT NULL;"); + } + + if ($schema->hasTable('c_tool')) { + error_log('Perform the changes in the c_tool table'); + $this->addSql("ALTER TABLE c_tool CHANGE resource_node_id resource_node_id INT DEFAULT NULL;"); + } + + if ($schema->hasTable('c_glossary')) { + error_log('Perform the changes in the c_glossary table'); + $this->addSql("ALTER TABLE c_glossary CHANGE resource_node_id resource_node_id INT DEFAULT NULL;"); + } + + if ($schema->hasTable('c_thematic')) { + error_log('Perform the changes in the c_thematic table'); + $this->addSql("ALTER TABLE c_thematic CHANGE resource_node_id resource_node_id INT DEFAULT NULL;"); + } + + if ($schema->hasTable('c_lp_category')) { + error_log('Perform the changes in the c_lp_category table'); + $this->addSql("ALTER TABLE c_lp_category CHANGE resource_node_id resource_node_id INT DEFAULT NULL;"); + } + + if ($schema->hasTable('c_shortcut')) { + error_log('Perform the changes in the c_shortcut table'); + $this->addSql("ALTER TABLE c_shortcut CHANGE shortcut_node_id shortcut_node_id INT DEFAULT NULL, CHANGE resource_node_id resource_node_id INT DEFAULT NULL;"); + } + + if ($schema->hasTable('c_forum_forum')) { + error_log('Perform the changes in the c_forum_forum table'); + $this->addSql("ALTER TABLE c_forum_forum CHANGE resource_node_id resource_node_id INT DEFAULT NULL;"); + } + + if ($schema->hasTable('c_quiz_question_category')) { + error_log('Perform the changes in the c_quiz_question_category table'); + $this->addSql("ALTER TABLE c_quiz_question_category CHANGE resource_node_id resource_node_id INT DEFAULT NULL;"); + } + + if ($schema->hasTable('c_student_publication')) { + error_log('Perform the changes in the c_student_publication table'); + $this->addSql("ALTER TABLE c_student_publication CHANGE resource_node_id resource_node_id INT DEFAULT NULL;"); + } + + if ($schema->hasTable('c_link')) { + error_log('Perform the changes in the c_link table'); + $this->addSql("ALTER TABLE c_link CHANGE resource_node_id resource_node_id INT DEFAULT NULL;"); + } + + if ($schema->hasTable('c_wiki')) { + error_log('Perform the changes in the c_wiki table'); + $this->addSql("ALTER TABLE c_wiki CHANGE resource_node_id resource_node_id INT DEFAULT NULL;"); + } + + if ($schema->hasTable('c_quiz_question')) { + error_log('Perform the changes in the c_quiz_question table'); + $this->addSql("ALTER TABLE c_quiz_question CHANGE resource_node_id resource_node_id INT DEFAULT NULL;"); + } + + if ($schema->hasTable('c_announcement')) { + error_log('Perform the changes in the c_announcement table'); + $this->addSql("ALTER TABLE c_announcement CHANGE resource_node_id resource_node_id INT DEFAULT NULL;"); + } + + if ($schema->hasTable('c_chat_conversation')) { + error_log('Perform the changes in the c_chat_conversation table'); + $this->addSql("ALTER TABLE c_chat_conversation CHANGE resource_node_id resource_node_id INT DEFAULT NULL;"); + } + + if ($schema->hasTable('c_course_description')) { + error_log('Perform the changes in the c_course_description table'); + $this->addSql("ALTER TABLE c_course_description CHANGE resource_node_id resource_node_id INT DEFAULT NULL;"); + } + + if ($schema->hasTable('c_group_category')) { + error_log('Perform the changes in the c_group_category table'); + $this->addSql("ALTER TABLE c_group_category CHANGE resource_node_id resource_node_id INT DEFAULT NULL;"); + } + + if ($schema->hasTable('c_student_publication_comment')) { + error_log('Perform the changes in the c_student_publication_comment table'); + $this->addSql("ALTER TABLE c_student_publication_comment CHANGE resource_node_id resource_node_id INT DEFAULT NULL;"); + } + + if ($schema->hasTable('c_quiz')) { + error_log('Perform the changes in the c_quiz table'); + $this->addSql("ALTER TABLE c_quiz CHANGE exercise_category_id exercise_category_id INT DEFAULT NULL, CHANGE resource_node_id resource_node_id INT DEFAULT NULL;"); + } + + if ($schema->hasTable('c_forum_post')) { + error_log('Perform the changes in the c_forum_post table'); + $this->addSql("ALTER TABLE c_forum_post CHANGE resource_node_id resource_node_id INT DEFAULT NULL;"); + } + + if ($schema->hasTable('c_attendance')) { + error_log('Perform the changes in the c_attendance table'); + $this->addSql("ALTER TABLE c_attendance CHANGE resource_node_id resource_node_id INT DEFAULT NULL;"); + } + + if ($schema->hasTable('c_link_category')) { + error_log('Perform the changes in the c_link_category table'); + $this->addSql("ALTER TABLE c_link_category CHANGE resource_node_id resource_node_id INT DEFAULT NULL;"); + } + + if ($schema->hasTable('c_forum_category')) { + error_log('Perform the changes in the c_forum_category table'); + $this->addSql("ALTER TABLE c_forum_category CHANGE resource_node_id resource_node_id INT DEFAULT NULL;"); + } + + if ($schema->hasTable('c_lp')) { + error_log('Perform the changes in the c_lp table'); + $this->addSql("ALTER TABLE c_lp CHANGE resource_node_id resource_node_id INT DEFAULT NULL;"); + } + + if ($schema->hasTable('c_document')) { + error_log('Perform the changes in the c_document table'); + $this->addSql("ALTER TABLE c_document CHANGE resource_node_id resource_node_id INT DEFAULT NULL;"); + } + + if ($schema->hasTable('c_survey')) { + error_log('Perform the changes in the c_survey table'); + $this->addSql("ALTER TABLE c_survey CHANGE resource_node_id resource_node_id INT DEFAULT NULL;"); + } + + if ($schema->hasTable('c_calendar_event_attachment')) { + error_log('Perform the changes in the c_calendar_event_attachment table'); + $this->addSql("ALTER TABLE c_calendar_event_attachment CHANGE resource_node_id resource_node_id INT DEFAULT NULL;"); + } + + if ($schema->hasTable('c_announcement_attachment')) { + error_log('Perform the changes in the c_announcement_attachment table'); + $this->addSql("ALTER TABLE c_announcement_attachment CHANGE resource_node_id resource_node_id INT DEFAULT NULL;"); + } + + if ($schema->hasTable('c_tool_intro')) { + error_log('Perform the changes in the c_tool_intro table'); + $this->addSql("ALTER TABLE c_tool_intro CHANGE resource_node_id resource_node_id INT DEFAULT NULL;"); + } + + if ($schema->hasTable('c_forum_thread')) { + error_log('Perform the changes in the c_forum_thread table'); + $this->addSql("ALTER TABLE c_forum_thread CHANGE resource_node_id resource_node_id INT DEFAULT NULL;"); + } + + if ($schema->hasTable('c_group_info')) { + error_log('Perform the changes in the c_group_info table'); + $this->addSql("ALTER TABLE c_group_info CHANGE resource_node_id resource_node_id INT DEFAULT NULL;"); + } + + if ($schema->hasTable('c_notebook')) { + error_log('Perform the changes in the c_notebook table'); + $this->addSql("ALTER TABLE c_notebook CHANGE resource_node_id resource_node_id INT DEFAULT NULL;"); + } + + if ($schema->hasTable('c_exercise_category')) { + error_log('Perform the changes in the c_exercise_category table'); + $this->addSql("ALTER TABLE c_exercise_category CHANGE id id INT AUTO_INCREMENT NOT NULL, CHANGE resource_node_id resource_node_id INT DEFAULT NULL;"); + } + + if ($schema->hasTable('lti_external_tool')) { + error_log('Perform the changes in the lti_external_tool table'); + $this->addSql("ALTER TABLE lti_external_tool CHANGE resource_node_id resource_node_id INT DEFAULT NULL;"); + } + + if ($schema->hasTable('message')) { + error_log('Perform the changes in the message table'); + $this->addSql("ALTER TABLE message CHANGE id id INT AUTO_INCREMENT NOT NULL, CHANGE parent_id parent_id INT DEFAULT NULL;"); + } + + if ($schema->hasTable('message_rel_user')) { + error_log('Perform the changes in the message_rel_user table'); + $this->addSql("ALTER TABLE message_rel_user CHANGE id id INT AUTO_INCREMENT NOT NULL, CHANGE message_id message_id INT NOT NULL;"); + } + + if ($schema->hasTable('message_rel_user_rel_tags')) { + error_log('Perform the changes in the message_rel_user_rel_tags table'); + $this->addSql("ALTER TABLE message_rel_user_rel_tags CHANGE message_rel_user_id message_rel_user_id INT NOT NULL, CHANGE message_tag_id message_tag_id INT NOT NULL;"); + } + + if ($schema->hasTable('message_tag')) { + error_log('Perform the changes in the message_tag table'); + $this->addSql("ALTER TABLE message_tag CHANGE id id INT AUTO_INCREMENT NOT NULL;"); + } + + // Re-enable foreign key and unique checks to ensure database integrity + $this->addSql('SET UNIQUE_CHECKS=1;'); + $this->addSql('SET FOREIGN_KEY_CHECKS=1;'); + } +} diff --git a/src/CourseBundle/Entity/CExerciseCategory.php b/src/CourseBundle/Entity/CExerciseCategory.php index 11a128e38a..d17cad2f5c 100644 --- a/src/CourseBundle/Entity/CExerciseCategory.php +++ b/src/CourseBundle/Entity/CExerciseCategory.php @@ -22,7 +22,7 @@ class CExerciseCategory extends AbstractResource implements ResourceInterface, S { use TimestampableEntity; - #[ORM\Column(name: 'id', type: 'bigint')] + #[ORM\Column(name: 'id', type: 'integer')] #[ORM\Id] #[ORM\GeneratedValue] protected ?int $id = null; diff --git a/src/CourseBundle/Entity/CLpIvInteraction.php b/src/CourseBundle/Entity/CLpIvInteraction.php index f2f09b49c1..68487e96ea 100644 --- a/src/CourseBundle/Entity/CLpIvInteraction.php +++ b/src/CourseBundle/Entity/CLpIvInteraction.php @@ -28,7 +28,7 @@ class CLpIvInteraction #[ORM\Column(name: 'order_id', type: 'integer', nullable: false)] protected int $orderId; - #[ORM\Column(name: 'lp_iv_id', type: 'bigint', nullable: false)] + #[ORM\Column(name: 'lp_iv_id', type: 'integer', nullable: false)] protected int $lpIvId; #[ORM\Column(name: 'interaction_id', type: 'string', length: 255, nullable: false)] diff --git a/src/CourseBundle/Entity/CLpIvObjective.php b/src/CourseBundle/Entity/CLpIvObjective.php index 5e2875b7f2..c1ded9ab8b 100644 --- a/src/CourseBundle/Entity/CLpIvObjective.php +++ b/src/CourseBundle/Entity/CLpIvObjective.php @@ -25,7 +25,7 @@ class CLpIvObjective #[ORM\Column(name: 'c_id', type: 'integer')] protected int $cId; - #[ORM\Column(name: 'lp_iv_id', type: 'bigint', nullable: false)] + #[ORM\Column(name: 'lp_iv_id', type: 'integer', nullable: false)] protected int $lpIvId; #[ORM\Column(name: 'order_id', type: 'integer', nullable: false)] diff --git a/src/CourseBundle/Entity/CQuizRelQuestionCategory.php b/src/CourseBundle/Entity/CQuizRelQuestionCategory.php index 9f27d88b60..9bc329bf58 100644 --- a/src/CourseBundle/Entity/CQuizRelQuestionCategory.php +++ b/src/CourseBundle/Entity/CQuizRelQuestionCategory.php @@ -15,7 +15,7 @@ use Doctrine\ORM\Mapping as ORM; #[ORM\Entity] class CQuizRelQuestionCategory { - #[ORM\Column(name: 'iid', type: 'bigint')] + #[ORM\Column(name: 'iid', type: 'integer')] #[ORM\Id] #[ORM\GeneratedValue] protected ?int $iid = null;