mirror of
https://github.com/umami-software/umami.git
synced 2026-02-04 04:37:11 +01:00
big int
This commit is contained in:
parent
3414cb6a87
commit
d3f3e610a6
4 changed files with 235 additions and 28 deletions
106
db/mysql/migrations/03_big_int/migration.sql
Normal file
106
db/mysql/migrations/03_big_int/migration.sql
Normal file
|
|
@ -0,0 +1,106 @@
|
|||
/*
|
||||
Warnings:
|
||||
|
||||
- The primary key for the `account` table will be changed. If it partially fails, the table could be left without primary key constraint.
|
||||
- You are about to alter the column `user_id` on the `account` table. The data in that column could be lost. The data in that column will be cast from `UnsignedInt` to `UnsignedBigInt`.
|
||||
- The primary key for the `event` 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_id` on the `event` table. The data in that column could be lost. The data in that column will be cast from `UnsignedInt` to `UnsignedBigInt`.
|
||||
- You are about to alter the column `website_id` on the `event` table. The data in that column could be lost. The data in that column will be cast from `UnsignedInt` to `UnsignedBigInt`.
|
||||
- You are about to alter the column `session_id` on the `event` table. The data in that column could be lost. The data in that column will be cast from `UnsignedInt` to `UnsignedBigInt`.
|
||||
- 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 `UnsignedBigInt`.
|
||||
- You are about to alter the column `event_id` on the `event_data` table. The data in that column could be lost. The data in that column will be cast from `UnsignedInt` to `UnsignedBigInt`.
|
||||
- The primary key for the `pageview` table will be changed. If it partially fails, the table could be left without primary key constraint.
|
||||
- You are about to alter the column `view_id` on the `pageview` table. The data in that column could be lost. The data in that column will be cast from `UnsignedInt` to `UnsignedBigInt`.
|
||||
- You are about to alter the column `website_id` on the `pageview` table. The data in that column could be lost. The data in that column will be cast from `UnsignedInt` to `UnsignedBigInt`.
|
||||
- You are about to alter the column `session_id` on the `pageview` table. The data in that column could be lost. The data in that column will be cast from `UnsignedInt` to `UnsignedBigInt`.
|
||||
- The primary key for the `session` table will be changed. If it partially fails, the table could be left without primary key constraint.
|
||||
- You are about to alter the column `session_id` on the `session` table. The data in that column could be lost. The data in that column will be cast from `UnsignedInt` to `UnsignedBigInt`.
|
||||
- You are about to alter the column `website_id` on the `session` table. The data in that column could be lost. The data in that column will be cast from `UnsignedInt` to `UnsignedBigInt`.
|
||||
- The primary key for the `website` table will be changed. If it partially fails, the table could be left without primary key constraint.
|
||||
- You are about to alter the column `website_id` on the `website` table. The data in that column could be lost. The data in that column will be cast from `UnsignedInt` to `UnsignedBigInt`.
|
||||
- You are about to alter the column `user_id` on the `website` table. The data in that column could be lost. The data in that column will be cast from `UnsignedInt` to `UnsignedBigInt`.
|
||||
- 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_ibfk_1`;
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE `event` DROP FOREIGN KEY `event_ibfk_2`;
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE `event_data` DROP FOREIGN KEY `event_data_event_id_fkey`;
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE `pageview` DROP FOREIGN KEY `pageview_ibfk_1`;
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE `pageview` DROP FOREIGN KEY `pageview_ibfk_2`;
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE `session` DROP FOREIGN KEY `session_ibfk_1`;
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE `website` DROP FOREIGN KEY `website_ibfk_1`;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `account` DROP PRIMARY KEY,
|
||||
MODIFY `user_id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
ADD PRIMARY KEY (`user_id`);
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `event` DROP PRIMARY KEY,
|
||||
MODIFY `event_id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
MODIFY `website_id` BIGINT UNSIGNED NOT NULL,
|
||||
MODIFY `session_id` BIGINT UNSIGNED NOT NULL,
|
||||
ADD PRIMARY KEY (`event_id`);
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `event_data` DROP PRIMARY KEY,
|
||||
MODIFY `event_data_id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
MODIFY `event_id` BIGINT UNSIGNED NOT NULL,
|
||||
ADD PRIMARY KEY (`event_data_id`);
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `pageview` DROP PRIMARY KEY,
|
||||
MODIFY `view_id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
MODIFY `website_id` BIGINT UNSIGNED NOT NULL,
|
||||
MODIFY `session_id` BIGINT UNSIGNED NOT NULL,
|
||||
ADD PRIMARY KEY (`view_id`);
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `session` DROP PRIMARY KEY,
|
||||
MODIFY `session_id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
MODIFY `website_id` BIGINT UNSIGNED NOT NULL,
|
||||
ADD PRIMARY KEY (`session_id`);
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `website` DROP PRIMARY KEY,
|
||||
MODIFY `website_id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
MODIFY `user_id` BIGINT UNSIGNED NOT NULL,
|
||||
ADD PRIMARY KEY (`website_id`);
|
||||
|
||||
-- DropTable
|
||||
DROP TABLE `_event_old`;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `event` ADD CONSTRAINT `event_ibfk_2` FOREIGN KEY (`session_id`) REFERENCES `session`(`session_id`) ON DELETE CASCADE ON UPDATE NO ACTION;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `event` ADD CONSTRAINT `event_ibfk_1` FOREIGN KEY (`website_id`) REFERENCES `website`(`website_id`) ON DELETE CASCADE ON UPDATE NO ACTION;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `event_data` ADD CONSTRAINT `event_data_event_id_fkey` FOREIGN KEY (`event_id`) REFERENCES `event`(`event_id`) ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `pageview` ADD CONSTRAINT `pageview_ibfk_2` FOREIGN KEY (`session_id`) REFERENCES `session`(`session_id`) ON DELETE CASCADE ON UPDATE NO ACTION;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `pageview` ADD CONSTRAINT `pageview_ibfk_1` FOREIGN KEY (`website_id`) REFERENCES `website`(`website_id`) ON DELETE CASCADE ON UPDATE NO ACTION;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `session` ADD CONSTRAINT `session_ibfk_1` FOREIGN KEY (`website_id`) REFERENCES `website`(`website_id`) ON DELETE CASCADE ON UPDATE NO ACTION;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `website` ADD CONSTRAINT `website_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `account`(`user_id`) ON DELETE CASCADE ON UPDATE NO ACTION;
|
||||
|
|
@ -8,7 +8,7 @@ datasource db {
|
|||
}
|
||||
|
||||
model account {
|
||||
user_id Int @id @default(autoincrement()) @db.UnsignedInt
|
||||
user_id BigInt @id @default(autoincrement()) @db.UnsignedBigInt
|
||||
username String @unique() @db.VarChar(255)
|
||||
password String @db.VarChar(60)
|
||||
is_admin Boolean @default(false)
|
||||
|
|
@ -18,9 +18,9 @@ model account {
|
|||
}
|
||||
|
||||
model event {
|
||||
event_id Int @id @default(autoincrement()) @db.UnsignedInt
|
||||
website_id Int @db.UnsignedInt
|
||||
session_id Int @db.UnsignedInt
|
||||
event_id BigInt @id @default(autoincrement()) @db.UnsignedBigInt
|
||||
website_id BigInt @db.UnsignedBigInt
|
||||
session_id BigInt @db.UnsignedBigInt
|
||||
created_at DateTime? @default(now()) @db.Timestamp(0)
|
||||
url String @db.VarChar(500)
|
||||
event_name String @db.VarChar(50)
|
||||
|
|
@ -34,16 +34,16 @@ model event {
|
|||
}
|
||||
|
||||
model event_data {
|
||||
event_data_id Int @id @default(autoincrement())
|
||||
event_id Int @unique @db.UnsignedInt
|
||||
event_data_id BigInt @id @default(autoincrement()) @db.UnsignedBigInt
|
||||
event_id BigInt @unique @db.UnsignedBigInt
|
||||
event_data Json
|
||||
event event @relation(fields: [event_id], references: [event_id])
|
||||
event event @relation(fields: [event_id], references: [event_id])
|
||||
}
|
||||
|
||||
model pageview {
|
||||
view_id Int @id @default(autoincrement()) @db.UnsignedInt
|
||||
website_id Int @db.UnsignedInt
|
||||
session_id Int @db.UnsignedInt
|
||||
view_id BigInt @id @default(autoincrement()) @db.UnsignedBigInt
|
||||
website_id BigInt @db.UnsignedBigInt
|
||||
session_id BigInt @db.UnsignedBigInt
|
||||
created_at DateTime? @default(now()) @db.Timestamp(0)
|
||||
url String @db.VarChar(500)
|
||||
referrer String? @db.VarChar(500)
|
||||
|
|
@ -58,9 +58,9 @@ model pageview {
|
|||
}
|
||||
|
||||
model session {
|
||||
session_id Int @id @default(autoincrement()) @db.UnsignedInt
|
||||
session_id BigInt @id @default(autoincrement()) @db.UnsignedBigInt
|
||||
session_uuid String @unique() @db.VarChar(36)
|
||||
website_id Int @db.UnsignedInt
|
||||
website_id BigInt @db.UnsignedBigInt
|
||||
created_at DateTime? @default(now()) @db.Timestamp(0)
|
||||
hostname String? @db.VarChar(100)
|
||||
browser String? @db.VarChar(20)
|
||||
|
|
@ -78,9 +78,9 @@ model session {
|
|||
}
|
||||
|
||||
model website {
|
||||
website_id Int @id @default(autoincrement()) @db.UnsignedInt
|
||||
website_id BigInt @id @default(autoincrement()) @db.UnsignedBigInt
|
||||
website_uuid String @unique() @db.VarChar(36)
|
||||
user_id Int @db.UnsignedInt
|
||||
user_id BigInt @db.UnsignedBigInt
|
||||
name String @db.VarChar(100)
|
||||
domain String? @db.VarChar(500)
|
||||
share_id String? @unique() @db.VarChar(64)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue