Removed gallery tables and entity cleanup
ci/woodpecker/push/ociImagePush Pipeline was successful
Details
ci/woodpecker/push/ociImagePush Pipeline was successful
Details
This commit is contained in:
parent
364074aecc
commit
ff00dfebb6
|
@ -1,51 +0,0 @@
|
||||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.10
|
|
||||||
|
|
||||||
use sea_orm::entity::prelude::*;
|
|
||||||
use serde::{Deserialize, Serialize};
|
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)]
|
|
||||||
#[sea_orm(table_name = "gallery_like")]
|
|
||||||
pub struct Model {
|
|
||||||
#[sea_orm(primary_key, auto_increment = false)]
|
|
||||||
pub id: String,
|
|
||||||
#[sea_orm(column_name = "createdAt")]
|
|
||||||
pub created_at: DateTimeWithTimeZone,
|
|
||||||
#[sea_orm(column_name = "userId")]
|
|
||||||
pub user_id: String,
|
|
||||||
#[sea_orm(column_name = "postId")]
|
|
||||||
pub post_id: String,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
|
||||||
pub enum Relation {
|
|
||||||
#[sea_orm(
|
|
||||||
belongs_to = "super::gallery_post::Entity",
|
|
||||||
from = "Column::PostId",
|
|
||||||
to = "super::gallery_post::Column::Id",
|
|
||||||
on_update = "NoAction",
|
|
||||||
on_delete = "Cascade"
|
|
||||||
)]
|
|
||||||
GalleryPost,
|
|
||||||
#[sea_orm(
|
|
||||||
belongs_to = "super::user::Entity",
|
|
||||||
from = "Column::UserId",
|
|
||||||
to = "super::user::Column::Id",
|
|
||||||
on_update = "NoAction",
|
|
||||||
on_delete = "Cascade"
|
|
||||||
)]
|
|
||||||
User,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Related<super::gallery_post::Entity> for Entity {
|
|
||||||
fn to() -> RelationDef {
|
|
||||||
Relation::GalleryPost.def()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Related<super::user::Entity> for Entity {
|
|
||||||
fn to() -> RelationDef {
|
|
||||||
Relation::User.def()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl ActiveModelBehavior for ActiveModel {}
|
|
|
@ -1,54 +0,0 @@
|
||||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.10
|
|
||||||
|
|
||||||
use sea_orm::entity::prelude::*;
|
|
||||||
use serde::{Deserialize, Serialize};
|
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)]
|
|
||||||
#[sea_orm(table_name = "gallery_post")]
|
|
||||||
pub struct Model {
|
|
||||||
#[sea_orm(primary_key, auto_increment = false)]
|
|
||||||
pub id: String,
|
|
||||||
#[sea_orm(column_name = "createdAt")]
|
|
||||||
pub created_at: DateTimeWithTimeZone,
|
|
||||||
#[sea_orm(column_name = "updatedAt")]
|
|
||||||
pub updated_at: DateTimeWithTimeZone,
|
|
||||||
pub title: String,
|
|
||||||
pub description: Option<String>,
|
|
||||||
#[sea_orm(column_name = "userId")]
|
|
||||||
pub user_id: String,
|
|
||||||
#[sea_orm(column_name = "fileIds")]
|
|
||||||
pub file_ids: Vec<String>,
|
|
||||||
#[sea_orm(column_name = "isSensitive")]
|
|
||||||
pub is_sensitive: bool,
|
|
||||||
#[sea_orm(column_name = "likedCount")]
|
|
||||||
pub liked_count: i32,
|
|
||||||
pub tags: Vec<String>,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
|
||||||
pub enum Relation {
|
|
||||||
#[sea_orm(has_many = "super::gallery_like::Entity")]
|
|
||||||
GalleryLike,
|
|
||||||
#[sea_orm(
|
|
||||||
belongs_to = "super::user::Entity",
|
|
||||||
from = "Column::UserId",
|
|
||||||
to = "super::user::Column::Id",
|
|
||||||
on_update = "NoAction",
|
|
||||||
on_delete = "Cascade"
|
|
||||||
)]
|
|
||||||
User,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Related<super::gallery_like::Entity> for Entity {
|
|
||||||
fn to() -> RelationDef {
|
|
||||||
Relation::GalleryLike.def()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Related<super::user::Entity> for Entity {
|
|
||||||
fn to() -> RelationDef {
|
|
||||||
Relation::User.def()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl ActiveModelBehavior for ActiveModel {}
|
|
|
@ -20,8 +20,6 @@ pub mod drive_folder;
|
||||||
pub mod emoji;
|
pub mod emoji;
|
||||||
pub mod follow_request;
|
pub mod follow_request;
|
||||||
pub mod following;
|
pub mod following;
|
||||||
pub mod gallery_like;
|
|
||||||
pub mod gallery_post;
|
|
||||||
pub mod hashtag;
|
pub mod hashtag;
|
||||||
pub mod instance;
|
pub mod instance;
|
||||||
pub mod meta;
|
pub mod meta;
|
||||||
|
|
|
@ -1,90 +0,0 @@
|
||||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.10
|
|
||||||
|
|
||||||
use super::sea_orm_active_enums::PageVisibilityEnum;
|
|
||||||
use sea_orm::entity::prelude::*;
|
|
||||||
use serde::{Deserialize, Serialize};
|
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)]
|
|
||||||
#[sea_orm(table_name = "page")]
|
|
||||||
pub struct Model {
|
|
||||||
#[sea_orm(primary_key, auto_increment = false)]
|
|
||||||
pub id: String,
|
|
||||||
#[sea_orm(column_name = "createdAt")]
|
|
||||||
pub created_at: DateTimeWithTimeZone,
|
|
||||||
#[sea_orm(column_name = "updatedAt")]
|
|
||||||
pub updated_at: DateTimeWithTimeZone,
|
|
||||||
pub title: String,
|
|
||||||
pub name: String,
|
|
||||||
pub summary: Option<String>,
|
|
||||||
#[sea_orm(column_name = "alignCenter")]
|
|
||||||
pub align_center: bool,
|
|
||||||
pub font: String,
|
|
||||||
#[sea_orm(column_name = "userId")]
|
|
||||||
pub user_id: String,
|
|
||||||
#[sea_orm(column_name = "eyeCatchingImageId")]
|
|
||||||
pub eye_catching_image_id: Option<String>,
|
|
||||||
#[sea_orm(column_type = "JsonBinary")]
|
|
||||||
pub content: Json,
|
|
||||||
#[sea_orm(column_type = "JsonBinary")]
|
|
||||||
pub variables: Json,
|
|
||||||
pub visibility: PageVisibilityEnum,
|
|
||||||
#[sea_orm(column_name = "visibleUserIds")]
|
|
||||||
pub visible_user_ids: Vec<String>,
|
|
||||||
#[sea_orm(column_name = "likedCount")]
|
|
||||||
pub liked_count: i32,
|
|
||||||
#[sea_orm(column_name = "hideTitleWhenPinned")]
|
|
||||||
pub hide_title_when_pinned: bool,
|
|
||||||
pub script: String,
|
|
||||||
#[sea_orm(column_name = "isPublic")]
|
|
||||||
pub is_public: bool,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
|
||||||
pub enum Relation {
|
|
||||||
#[sea_orm(
|
|
||||||
belongs_to = "super::drive_file::Entity",
|
|
||||||
from = "Column::EyeCatchingImageId",
|
|
||||||
to = "super::drive_file::Column::Id",
|
|
||||||
on_update = "NoAction",
|
|
||||||
on_delete = "Cascade"
|
|
||||||
)]
|
|
||||||
DriveFile,
|
|
||||||
#[sea_orm(has_many = "super::page_like::Entity")]
|
|
||||||
PageLike,
|
|
||||||
#[sea_orm(
|
|
||||||
belongs_to = "super::user::Entity",
|
|
||||||
from = "Column::UserId",
|
|
||||||
to = "super::user::Column::Id",
|
|
||||||
on_update = "NoAction",
|
|
||||||
on_delete = "Cascade"
|
|
||||||
)]
|
|
||||||
User,
|
|
||||||
#[sea_orm(has_one = "super::user_profile::Entity")]
|
|
||||||
UserProfile,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Related<super::drive_file::Entity> for Entity {
|
|
||||||
fn to() -> RelationDef {
|
|
||||||
Relation::DriveFile.def()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Related<super::page_like::Entity> for Entity {
|
|
||||||
fn to() -> RelationDef {
|
|
||||||
Relation::PageLike.def()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Related<super::user::Entity> for Entity {
|
|
||||||
fn to() -> RelationDef {
|
|
||||||
Relation::User.def()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Related<super::user_profile::Entity> for Entity {
|
|
||||||
fn to() -> RelationDef {
|
|
||||||
Relation::UserProfile.def()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl ActiveModelBehavior for ActiveModel {}
|
|
|
@ -1,51 +0,0 @@
|
||||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.10
|
|
||||||
|
|
||||||
use sea_orm::entity::prelude::*;
|
|
||||||
use serde::{Deserialize, Serialize};
|
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)]
|
|
||||||
#[sea_orm(table_name = "page_like")]
|
|
||||||
pub struct Model {
|
|
||||||
#[sea_orm(primary_key, auto_increment = false)]
|
|
||||||
pub id: String,
|
|
||||||
#[sea_orm(column_name = "createdAt")]
|
|
||||||
pub created_at: DateTimeWithTimeZone,
|
|
||||||
#[sea_orm(column_name = "userId")]
|
|
||||||
pub user_id: String,
|
|
||||||
#[sea_orm(column_name = "pageId")]
|
|
||||||
pub page_id: String,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
|
||||||
pub enum Relation {
|
|
||||||
#[sea_orm(
|
|
||||||
belongs_to = "super::page::Entity",
|
|
||||||
from = "Column::PageId",
|
|
||||||
to = "super::page::Column::Id",
|
|
||||||
on_update = "NoAction",
|
|
||||||
on_delete = "Cascade"
|
|
||||||
)]
|
|
||||||
Page,
|
|
||||||
#[sea_orm(
|
|
||||||
belongs_to = "super::user::Entity",
|
|
||||||
from = "Column::UserId",
|
|
||||||
to = "super::user::Column::Id",
|
|
||||||
on_update = "NoAction",
|
|
||||||
on_delete = "Cascade"
|
|
||||||
)]
|
|
||||||
User,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Related<super::page::Entity> for Entity {
|
|
||||||
fn to() -> RelationDef {
|
|
||||||
Relation::Page.def()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Related<super::user::Entity> for Entity {
|
|
||||||
fn to() -> RelationDef {
|
|
||||||
Relation::User.def()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl ActiveModelBehavior for ActiveModel {}
|
|
|
@ -18,8 +18,6 @@ pub use super::drive_folder::Entity as DriveFolder;
|
||||||
pub use super::emoji::Entity as Emoji;
|
pub use super::emoji::Entity as Emoji;
|
||||||
pub use super::follow_request::Entity as FollowRequest;
|
pub use super::follow_request::Entity as FollowRequest;
|
||||||
pub use super::following::Entity as Following;
|
pub use super::following::Entity as Following;
|
||||||
pub use super::gallery_like::Entity as GalleryLike;
|
|
||||||
pub use super::gallery_post::Entity as GalleryPost;
|
|
||||||
pub use super::hashtag::Entity as Hashtag;
|
pub use super::hashtag::Entity as Hashtag;
|
||||||
pub use super::instance::Entity as Instance;
|
pub use super::instance::Entity as Instance;
|
||||||
pub use super::meta::Entity as Meta;
|
pub use super::meta::Entity as Meta;
|
||||||
|
|
|
@ -106,10 +106,6 @@ pub enum Relation {
|
||||||
DriveFile1,
|
DriveFile1,
|
||||||
#[sea_orm(has_many = "super::drive_folder::Entity")]
|
#[sea_orm(has_many = "super::drive_folder::Entity")]
|
||||||
DriveFolder,
|
DriveFolder,
|
||||||
#[sea_orm(has_many = "super::gallery_like::Entity")]
|
|
||||||
GalleryLike,
|
|
||||||
#[sea_orm(has_many = "super::gallery_post::Entity")]
|
|
||||||
GalleryPost,
|
|
||||||
#[sea_orm(has_many = "super::meta::Entity")]
|
#[sea_orm(has_many = "super::meta::Entity")]
|
||||||
Meta,
|
Meta,
|
||||||
#[sea_orm(has_many = "super::moderation_log::Entity")]
|
#[sea_orm(has_many = "super::moderation_log::Entity")]
|
||||||
|
@ -206,18 +202,6 @@ impl Related<super::drive_folder::Entity> for Entity {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Related<super::gallery_like::Entity> for Entity {
|
|
||||||
fn to() -> RelationDef {
|
|
||||||
Relation::GalleryLike.def()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Related<super::gallery_post::Entity> for Entity {
|
|
||||||
fn to() -> RelationDef {
|
|
||||||
Relation::GalleryPost.def()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Related<super::meta::Entity> for Entity {
|
impl Related<super::meta::Entity> for Entity {
|
||||||
fn to() -> RelationDef {
|
fn to() -> RelationDef {
|
||||||
Relation::Meta.def()
|
Relation::Meta.def()
|
||||||
|
|
|
@ -8,6 +8,7 @@ mod m20240107_005747_remove_user_groups;
|
||||||
mod m20240107_220523_generated_is_quote;
|
mod m20240107_220523_generated_is_quote;
|
||||||
mod m20240107_224446_generated_is_renote;
|
mod m20240107_224446_generated_is_renote;
|
||||||
mod m20240112_215106_remove_pages;
|
mod m20240112_215106_remove_pages;
|
||||||
|
mod m20240112_234759_remove_gallery;
|
||||||
|
|
||||||
pub struct Migrator;
|
pub struct Migrator;
|
||||||
|
|
||||||
|
@ -23,6 +24,7 @@ impl MigratorTrait for Migrator {
|
||||||
Box::new(m20240107_220523_generated_is_quote::Migration),
|
Box::new(m20240107_220523_generated_is_quote::Migration),
|
||||||
Box::new(m20240107_224446_generated_is_renote::Migration),
|
Box::new(m20240107_224446_generated_is_renote::Migration),
|
||||||
Box::new(m20240112_215106_remove_pages::Migration),
|
Box::new(m20240112_215106_remove_pages::Migration),
|
||||||
|
Box::new(m20240112_234759_remove_gallery::Migration),
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,102 @@
|
||||||
|
use sea_orm_migration::prelude::*;
|
||||||
|
|
||||||
|
#[derive(DeriveMigrationName)]
|
||||||
|
pub struct Migration;
|
||||||
|
|
||||||
|
#[async_trait::async_trait]
|
||||||
|
impl MigrationTrait for Migration {
|
||||||
|
async fn up(&self, manager: &SchemaManager) -> Result<(), DbErr> {
|
||||||
|
let db = manager.get_connection();
|
||||||
|
|
||||||
|
db.execute_unprepared(
|
||||||
|
r#"
|
||||||
|
DROP TABLE "gallery_like";
|
||||||
|
DROP TABLE "gallery_post";
|
||||||
|
"#,
|
||||||
|
)
|
||||||
|
.await?;
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> {
|
||||||
|
let db = manager.get_connection();
|
||||||
|
|
||||||
|
db.execute_unprepared(
|
||||||
|
r#"
|
||||||
|
create table gallery_post
|
||||||
|
(
|
||||||
|
id varchar(32) not null
|
||||||
|
constraint "PK_8e90d7b6015f2c4518881b14753"
|
||||||
|
primary key,
|
||||||
|
"createdAt" timestamp with time zone not null,
|
||||||
|
"updatedAt" timestamp with time zone not null,
|
||||||
|
title varchar(256) not null,
|
||||||
|
description varchar(2048),
|
||||||
|
"userId" varchar(32) not null
|
||||||
|
constraint "FK_985b836dddd8615e432d7043ddb"
|
||||||
|
references "user"
|
||||||
|
on delete cascade,
|
||||||
|
"fileIds" varchar(32)[] default '{}'::character varying[] not null,
|
||||||
|
"isSensitive" boolean default false not null,
|
||||||
|
"likedCount" integer default 0 not null,
|
||||||
|
tags varchar(128)[] default '{}'::character varying[] not null
|
||||||
|
);
|
||||||
|
|
||||||
|
comment on column gallery_post."createdAt" is 'The created date of the GalleryPost.';
|
||||||
|
|
||||||
|
comment on column gallery_post."updatedAt" is 'The updated date of the GalleryPost.';
|
||||||
|
|
||||||
|
comment on column gallery_post."userId" is 'The ID of author.';
|
||||||
|
|
||||||
|
comment on column gallery_post."isSensitive" is 'Whether the post is sensitive.';
|
||||||
|
|
||||||
|
create index "IDX_8f1a239bd077c8864a20c62c2c"
|
||||||
|
on gallery_post ("createdAt");
|
||||||
|
|
||||||
|
create index "IDX_f631d37835adb04792e361807c"
|
||||||
|
on gallery_post ("updatedAt");
|
||||||
|
|
||||||
|
create index "IDX_985b836dddd8615e432d7043dd"
|
||||||
|
on gallery_post ("userId");
|
||||||
|
|
||||||
|
create index "IDX_3ca50563facd913c425e7a89ee"
|
||||||
|
on gallery_post ("fileIds");
|
||||||
|
|
||||||
|
create index "IDX_f2d744d9a14d0dfb8b96cb7fc5"
|
||||||
|
on gallery_post ("isSensitive");
|
||||||
|
|
||||||
|
create index "IDX_1a165c68a49d08f11caffbd206"
|
||||||
|
on gallery_post ("likedCount");
|
||||||
|
|
||||||
|
create index "IDX_05cca34b985d1b8edc1d1e28df"
|
||||||
|
on gallery_post (tags);
|
||||||
|
|
||||||
|
create table gallery_like
|
||||||
|
(
|
||||||
|
id varchar(32) not null
|
||||||
|
constraint "PK_853ab02be39b8de45cd720cc15f"
|
||||||
|
primary key,
|
||||||
|
"createdAt" timestamp with time zone not null,
|
||||||
|
"userId" varchar(32) not null
|
||||||
|
constraint "FK_8fd5215095473061855ceb948cf"
|
||||||
|
references "user"
|
||||||
|
on delete cascade,
|
||||||
|
"postId" varchar(32) not null
|
||||||
|
constraint "FK_b1cb568bfe569e47b7051699fc8"
|
||||||
|
references gallery_post
|
||||||
|
on delete cascade
|
||||||
|
);
|
||||||
|
|
||||||
|
create index "IDX_8fd5215095473061855ceb948c"
|
||||||
|
on gallery_like ("userId");
|
||||||
|
|
||||||
|
create unique index "IDX_df1b5f4099e99fb0bc5eae53b6"
|
||||||
|
on gallery_like ("userId", "postId");
|
||||||
|
"#,
|
||||||
|
)
|
||||||
|
.await?;
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
}
|
|
@ -4,9 +4,9 @@ use ext_calckey_model_migration::{
|
||||||
};
|
};
|
||||||
use magnetar_sdk::types::SpanFilter;
|
use magnetar_sdk::types::SpanFilter;
|
||||||
use sea_orm::{
|
use sea_orm::{
|
||||||
ColumnTrait, Condition, ConnectionTrait, Cursor, CursorTrait, DbErr, DynIden, EntityTrait,
|
ColumnTrait, Condition, ConnectionTrait, Cursor, DbErr, DynIden, EntityTrait, FromQueryResult,
|
||||||
FromQueryResult, Iden, IntoIdentity, Iterable, JoinType, RelationDef, RelationTrait, Select,
|
Iden, IntoIdentity, Iterable, JoinType, RelationDef, RelationTrait, Select, SelectModel,
|
||||||
SelectModel, SelectorTrait,
|
SelectorTrait,
|
||||||
};
|
};
|
||||||
use std::fmt::Write;
|
use std::fmt::Write;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue