-
-
Notifications
You must be signed in to change notification settings - Fork 521
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add SQLite "sakila.db" demo [issues]
- Loading branch information
Showing
39 changed files
with
2,401 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
[workspace] | ||
# A separate workspace | ||
|
||
[package] | ||
name = "sea-orm-issues-386" | ||
version = "0.1.0" | ||
edition = "2021" | ||
publish = false | ||
|
||
[dependencies] | ||
sea-orm = { path = "../../", features = [ "sqlx-mysql", "runtime-async-std-native-tls" ]} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
//! SeaORM Entity. Generated by sea-orm-codegen 0.4.2 | ||
use sea_orm::entity::prelude::*; | ||
|
||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel)] | ||
#[sea_orm(table_name = "actor")] | ||
pub struct Model { | ||
#[sea_orm(primary_key)] | ||
pub actor_id: i32, | ||
pub first_name: String, | ||
pub last_name: String, | ||
pub last_update: DateTime, | ||
} | ||
|
||
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] | ||
pub enum Relation { | ||
#[sea_orm(has_many = "super::film_actor::Entity")] | ||
FilmActor, | ||
} | ||
|
||
impl Related<super::film_actor::Entity> for Entity { | ||
fn to() -> RelationDef { | ||
Relation::FilmActor.def() | ||
} | ||
} | ||
|
||
impl ActiveModelBehavior for ActiveModel {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
//! SeaORM Entity. Generated by sea-orm-codegen 0.4.2 | ||
use sea_orm::entity::prelude::*; | ||
|
||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel)] | ||
#[sea_orm(table_name = "address")] | ||
pub struct Model { | ||
#[sea_orm(primary_key, auto_increment = false)] | ||
pub address_id: i32, | ||
pub address: String, | ||
pub address2: Option<String>, | ||
pub district: String, | ||
pub city_id: i32, | ||
pub postal_code: Option<String>, | ||
pub phone: String, | ||
pub last_update: DateTime, | ||
} | ||
|
||
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] | ||
pub enum Relation { | ||
#[sea_orm( | ||
belongs_to = "super::city::Entity", | ||
from = "Column::CityId", | ||
to = "super::city::Column::CityId", | ||
on_update = "Cascade", | ||
on_delete = "NoAction" | ||
)] | ||
City, | ||
#[sea_orm(has_many = "super::customer::Entity")] | ||
Customer, | ||
#[sea_orm(has_many = "super::staff::Entity")] | ||
Staff, | ||
#[sea_orm(has_many = "super::store::Entity")] | ||
Store, | ||
} | ||
|
||
impl Related<super::city::Entity> for Entity { | ||
fn to() -> RelationDef { | ||
Relation::City.def() | ||
} | ||
} | ||
|
||
impl Related<super::customer::Entity> for Entity { | ||
fn to() -> RelationDef { | ||
Relation::Customer.def() | ||
} | ||
} | ||
|
||
impl Related<super::staff::Entity> for Entity { | ||
fn to() -> RelationDef { | ||
Relation::Staff.def() | ||
} | ||
} | ||
|
||
impl Related<super::store::Entity> for Entity { | ||
fn to() -> RelationDef { | ||
Relation::Store.def() | ||
} | ||
} | ||
|
||
impl ActiveModelBehavior for ActiveModel {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
//! SeaORM Entity. Generated by sea-orm-codegen 0.4.2 | ||
use sea_orm::entity::prelude::*; | ||
|
||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel)] | ||
#[sea_orm(table_name = "category")] | ||
pub struct Model { | ||
#[sea_orm( | ||
primary_key, | ||
auto_increment = false, | ||
column_type = "Custom(\"BLOB\".to_owned())" | ||
)] | ||
pub category_id: String, | ||
pub name: String, | ||
pub last_update: DateTime, | ||
} | ||
|
||
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] | ||
pub enum Relation { | ||
#[sea_orm(has_many = "super::film_category::Entity")] | ||
FilmCategory, | ||
} | ||
|
||
impl Related<super::film_category::Entity> for Entity { | ||
fn to() -> RelationDef { | ||
Relation::FilmCategory.def() | ||
} | ||
} | ||
|
||
impl ActiveModelBehavior for ActiveModel {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
//! SeaORM Entity. Generated by sea-orm-codegen 0.4.2 | ||
use sea_orm::entity::prelude::*; | ||
|
||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel)] | ||
#[sea_orm(table_name = "city")] | ||
pub struct Model { | ||
#[sea_orm(primary_key, auto_increment = false)] | ||
pub city_id: i32, | ||
pub city: String, | ||
#[sea_orm(column_type = "Custom(\"BLOB\".to_owned())")] | ||
pub country_id: String, | ||
pub last_update: DateTime, | ||
} | ||
|
||
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] | ||
pub enum Relation { | ||
#[sea_orm( | ||
belongs_to = "super::country::Entity", | ||
from = "Column::CountryId", | ||
to = "super::country::Column::CountryId", | ||
on_update = "Cascade", | ||
on_delete = "NoAction" | ||
)] | ||
Country, | ||
#[sea_orm(has_many = "super::address::Entity")] | ||
Address, | ||
} | ||
|
||
impl Related<super::country::Entity> for Entity { | ||
fn to() -> RelationDef { | ||
Relation::Country.def() | ||
} | ||
} | ||
|
||
impl Related<super::address::Entity> for Entity { | ||
fn to() -> RelationDef { | ||
Relation::Address.def() | ||
} | ||
} | ||
|
||
impl ActiveModelBehavior for ActiveModel {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
//! SeaORM Entity. Generated by sea-orm-codegen 0.4.2 | ||
use sea_orm::entity::prelude::*; | ||
|
||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel)] | ||
#[sea_orm(table_name = "country")] | ||
pub struct Model { | ||
#[sea_orm( | ||
primary_key, | ||
auto_increment = false, | ||
column_type = "Custom(\"BLOB\".to_owned())" | ||
)] | ||
pub country_id: String, | ||
pub country: String, | ||
pub last_update: Option<DateTime>, | ||
} | ||
|
||
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] | ||
pub enum Relation { | ||
#[sea_orm(has_many = "super::city::Entity")] | ||
City, | ||
} | ||
|
||
impl Related<super::city::Entity> for Entity { | ||
fn to() -> RelationDef { | ||
Relation::City.def() | ||
} | ||
} | ||
|
||
impl ActiveModelBehavior for ActiveModel {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
//! SeaORM Entity. Generated by sea-orm-codegen 0.4.2 | ||
use sea_orm::entity::prelude::*; | ||
|
||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel)] | ||
#[sea_orm(table_name = "customer")] | ||
pub struct Model { | ||
#[sea_orm(primary_key, auto_increment = false)] | ||
pub customer_id: i32, | ||
pub store_id: i32, | ||
pub first_name: String, | ||
pub last_name: String, | ||
pub email: Option<String>, | ||
pub address_id: i32, | ||
#[sea_orm(column_type = "Custom(\"BLOB\".to_owned())")] | ||
pub active: String, | ||
pub create_date: DateTime, | ||
pub last_update: DateTime, | ||
} | ||
|
||
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] | ||
pub enum Relation { | ||
#[sea_orm( | ||
belongs_to = "super::address::Entity", | ||
from = "Column::AddressId", | ||
to = "super::address::Column::AddressId", | ||
on_update = "Cascade", | ||
on_delete = "NoAction" | ||
)] | ||
Address, | ||
#[sea_orm( | ||
belongs_to = "super::store::Entity", | ||
from = "Column::StoreId", | ||
to = "super::store::Column::StoreId", | ||
on_update = "Cascade", | ||
on_delete = "NoAction" | ||
)] | ||
Store, | ||
#[sea_orm(has_many = "super::payment::Entity")] | ||
Payment, | ||
#[sea_orm(has_many = "super::rental::Entity")] | ||
Rental, | ||
} | ||
|
||
impl Related<super::address::Entity> for Entity { | ||
fn to() -> RelationDef { | ||
Relation::Address.def() | ||
} | ||
} | ||
|
||
impl Related<super::store::Entity> for Entity { | ||
fn to() -> RelationDef { | ||
Relation::Store.def() | ||
} | ||
} | ||
|
||
impl Related<super::payment::Entity> for Entity { | ||
fn to() -> RelationDef { | ||
Relation::Payment.def() | ||
} | ||
} | ||
|
||
impl Related<super::rental::Entity> for Entity { | ||
fn to() -> RelationDef { | ||
Relation::Rental.def() | ||
} | ||
} | ||
|
||
impl ActiveModelBehavior for ActiveModel {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
//! SeaORM Entity. Generated by sea-orm-codegen 0.4.2 | ||
use sea_orm::entity::prelude::*; | ||
|
||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel)] | ||
#[sea_orm(table_name = "film")] | ||
pub struct Model { | ||
#[sea_orm(primary_key, auto_increment = false)] | ||
pub film_id: i32, | ||
pub title: String, | ||
#[sea_orm(column_type = "Custom(\"BLOB\".to_owned())", nullable)] | ||
pub description: Option<String>, | ||
pub release_year: Option<String>, | ||
#[sea_orm(column_type = "Custom(\"BLOB\".to_owned())")] | ||
pub language_id: String, | ||
#[sea_orm(column_type = "Custom(\"BLOB\".to_owned())", nullable)] | ||
pub original_language_id: Option<String>, | ||
#[sea_orm(column_type = "Custom(\"BLOB\".to_owned())")] | ||
pub rental_duration: String, | ||
#[sea_orm(column_type = "Decimal(Some((4, 2)))")] | ||
pub rental_rate: Decimal, | ||
#[sea_orm(column_type = "Custom(\"BLOB\".to_owned())", nullable)] | ||
pub length: Option<String>, | ||
#[sea_orm(column_type = "Decimal(Some((5, 2)))")] | ||
pub replacement_cost: Decimal, | ||
pub rating: Option<String>, | ||
pub special_features: Option<String>, | ||
pub last_update: DateTime, | ||
} | ||
|
||
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] | ||
pub enum Relation { | ||
#[sea_orm( | ||
belongs_to = "super::language::Entity", | ||
from = "Column::OriginalLanguageId", | ||
to = "super::language::Column::LanguageId", | ||
on_update = "NoAction", | ||
on_delete = "NoAction" | ||
)] | ||
Language2, | ||
#[sea_orm( | ||
belongs_to = "super::language::Entity", | ||
from = "Column::LanguageId", | ||
to = "super::language::Column::LanguageId", | ||
on_update = "NoAction", | ||
on_delete = "NoAction" | ||
)] | ||
Language1, | ||
#[sea_orm(has_many = "super::film_actor::Entity")] | ||
FilmActor, | ||
#[sea_orm(has_many = "super::film_category::Entity")] | ||
FilmCategory, | ||
#[sea_orm(has_many = "super::inventory::Entity")] | ||
Inventory, | ||
} | ||
|
||
impl Related<super::film_actor::Entity> for Entity { | ||
fn to() -> RelationDef { | ||
Relation::FilmActor.def() | ||
} | ||
} | ||
|
||
impl Related<super::film_category::Entity> for Entity { | ||
fn to() -> RelationDef { | ||
Relation::FilmCategory.def() | ||
} | ||
} | ||
|
||
impl Related<super::inventory::Entity> for Entity { | ||
fn to() -> RelationDef { | ||
Relation::Inventory.def() | ||
} | ||
} | ||
|
||
impl ActiveModelBehavior for ActiveModel {} |
Oops, something went wrong.