mirror of
https://github.com/umami-software/umami.git
synced 2026-02-19 20:15:41 +01:00
edit migrations
This commit is contained in:
parent
843f1a36ec
commit
ddeafe4ba8
6 changed files with 132 additions and 65 deletions
|
|
@ -1,35 +1,59 @@
|
|||
-- DropForeignKey
|
||||
ALTER TABLE `event` DROP FOREIGN KEY `event_ibfk_2`;
|
||||
ALTER TABLE
|
||||
`event` DROP FOREIGN KEY `event_ibfk_2`;
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE `event` DROP FOREIGN KEY `event_ibfk_1`;
|
||||
ALTER TABLE
|
||||
`event` DROP FOREIGN KEY `event_ibfk_1`;
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE `pageview` DROP FOREIGN KEY `pageview_ibfk_2`;
|
||||
ALTER TABLE
|
||||
`pageview` DROP FOREIGN KEY `pageview_ibfk_2`;
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE `pageview` DROP FOREIGN KEY `pageview_ibfk_1`;
|
||||
ALTER TABLE
|
||||
`pageview` DROP FOREIGN KEY `pageview_ibfk_1`;
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE `session` DROP FOREIGN KEY `session_ibfk_1`;
|
||||
ALTER TABLE
|
||||
`session` DROP FOREIGN KEY `session_ibfk_1`;
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE `website` DROP FOREIGN KEY `website_ibfk_1`;
|
||||
ALTER TABLE
|
||||
`website` DROP FOREIGN KEY `website_ibfk_1`;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `event` ADD CONSTRAINT `event_session_id_fkey` FOREIGN KEY (`session_id`) REFERENCES `session`(`session_id`) ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
ALTER TABLE
|
||||
`event`
|
||||
ADD
|
||||
CONSTRAINT `event_session_id_fkey` FOREIGN KEY (`session_id`) REFERENCES `session`(`session_id`) ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `event` ADD CONSTRAINT `event_website_id_fkey` FOREIGN KEY (`website_id`) REFERENCES `website`(`website_id`) ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
ALTER TABLE
|
||||
`event`
|
||||
ADD
|
||||
CONSTRAINT `event_website_id_fkey` FOREIGN KEY (`website_id`) REFERENCES `website`(`website_id`) ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `pageview` ADD CONSTRAINT `pageview_session_id_fkey` FOREIGN KEY (`session_id`) REFERENCES `session`(`session_id`) ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
ALTER TABLE
|
||||
`pageview`
|
||||
ADD
|
||||
CONSTRAINT `pageview_session_id_fkey` FOREIGN KEY (`session_id`) REFERENCES `session`(`session_id`) ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `pageview` ADD CONSTRAINT `pageview_website_id_fkey` FOREIGN KEY (`website_id`) REFERENCES `website`(`website_id`) ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
ALTER TABLE
|
||||
`pageview`
|
||||
ADD
|
||||
CONSTRAINT `pageview_website_id_fkey` FOREIGN KEY (`website_id`) REFERENCES `website`(`website_id`) ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `session` ADD CONSTRAINT `session_website_id_fkey` FOREIGN KEY (`website_id`) REFERENCES `website`(`website_id`) ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
ALTER TABLE
|
||||
`session`
|
||||
ADD
|
||||
CONSTRAINT `session_website_id_fkey` FOREIGN KEY (`website_id`) REFERENCES `website`(`website_id`) ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `website` ADD CONSTRAINT `website_user_id_fkey` FOREIGN KEY (`user_id`) REFERENCES `account`(`user_id`) ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
ALTER TABLE
|
||||
`website`
|
||||
ADD
|
||||
CONSTRAINT `website_user_id_fkey` FOREIGN KEY (`user_id`) REFERENCES `account`(`user_id`) ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
54
db/mysql/migrations/04_edit_session_model/migration.sql
Normal file
54
db/mysql/migrations/04_edit_session_model/migration.sql
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
/*
|
||||
Warnings:
|
||||
|
||||
- The primary key for the `event_data` table will be changed. If it partially fails, the table could be left without primary key constraint.
|
||||
- You are about to alter the column `event_data_id` on the `event_data` table. The data in that column could be lost. The data in that column will be cast from `Int` to `UnsignedInt`.
|
||||
- You are about to drop the `_event_old` table. If the table is not empty, all the data it contains will be lost.
|
||||
|
||||
*/
|
||||
-- DropForeignKey
|
||||
ALTER TABLE
|
||||
`event` DROP FOREIGN KEY `event_session_id_fkey`;
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE
|
||||
`event` DROP FOREIGN KEY `event_website_id_fkey`;
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE
|
||||
`event_data` DROP FOREIGN KEY `event_data_event_id_fkey`;
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE
|
||||
`pageview` DROP FOREIGN KEY `pageview_session_id_fkey`;
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE
|
||||
`pageview` DROP FOREIGN KEY `pageview_website_id_fkey`;
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE
|
||||
`session` DROP FOREIGN KEY `session_website_id_fkey`;
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE
|
||||
`website` DROP FOREIGN KEY `website_user_id_fkey`;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE
|
||||
`event_data` DROP PRIMARY KEY,
|
||||
MODIFY
|
||||
`event_data_id` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
ADD
|
||||
PRIMARY KEY (`event_data_id`);
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE
|
||||
`session`
|
||||
ADD
|
||||
COLUMN `ip` VARCHAR(255) NULL,
|
||||
ADD
|
||||
COLUMN `user_agent` TEXT NULL;
|
||||
|
||||
-- DropTable
|
||||
DROP TABLE `_event_old`;
|
||||
|
|
@ -1,10 +1,12 @@
|
|||
generator client {
|
||||
provider = "prisma-client-js"
|
||||
previewFeatures = ["referentialIntegrity"]
|
||||
}
|
||||
|
||||
datasource db {
|
||||
provider = "mysql"
|
||||
url = env("DATABASE_URL")
|
||||
referentialIntegrity = "prisma"
|
||||
}
|
||||
|
||||
model account {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue