Add geolocation

This commit is contained in:
eraden 2023-06-07 21:39:39 +02:00
parent bfb164ae36
commit eee5d6c22d
5 changed files with 332 additions and 246 deletions

View File

@ -1,5 +1,4 @@
use sea_orm_migration::prelude::*; use sea_orm_migration::prelude::*;
use sea_query::expr::SimpleExpr;
/// ```sql /// ```sql
/// CREATE TABLE cart_discounts /// CREATE TABLE cart_discounts

View File

@ -111,7 +111,7 @@ impl Migration {
/// tag_id uuid NOT NULL /// tag_id uuid NOT NULL
/// ); /// );
/// ``` /// ```
async fn create_claim_item_tags(manager: &SchemaManager) -> Result<(), DbErr> { async fn create_claim_item_tags(manager: &SchemaManager<'_>) -> Result<(), DbErr> {
manager manager
.create_table( .create_table(
Table::create() Table::create()
@ -139,7 +139,7 @@ impl Migration {
/// metadata jsonb /// metadata jsonb
/// ); /// );
/// ``` /// ```
async fn create_claim_items(manager: &SchemaManager) -> Result<(), DbErr> { async fn create_claim_items(manager: &SchemaManager<'_>) -> Result<(), DbErr> {
manager manager
.create_table( .create_table(
Table::create() Table::create()
@ -179,7 +179,7 @@ impl Migration {
/// metadata jsonb /// metadata jsonb
/// ); /// );
/// ``` /// ```
async fn create_claim_images(manager: &SchemaManager) -> Result<(), DbErr> { async fn create_claim_images(manager: &SchemaManager<'_>) -> Result<(), DbErr> {
manager manager
.create_table( .create_table(
Table::create() Table::create()
@ -215,7 +215,7 @@ impl Migration {
/// no_notification boolean /// no_notification boolean
/// ); /// );
/// ``` /// ```
async fn create_claim_orders(manager: &SchemaManager) -> Result<(), DbErr> { async fn create_claim_orders(manager: &SchemaManager<'_>) -> Result<(), DbErr> {
manager manager
.create_table( .create_table(
Table::create() Table::create()
@ -227,7 +227,7 @@ impl Migration {
ClaimOrderPaymentStatus::ClaimOrderPaymentStatuses, ClaimOrderPaymentStatus::ClaimOrderPaymentStatuses,
ClaimOrderPaymentStatus::iter().skip(1), ClaimOrderPaymentStatus::iter().skip(1),
) )
.default(ClaimOrderPaymentStatus::NA) .default(ClaimOrderPaymentStatus::NA.to_string())
.not_null(), .not_null(),
) )
.col( .col(
@ -236,7 +236,7 @@ impl Migration {
ClaimOrderFulfillmentStatus::ClaimOrderFulfillmentStatuses, ClaimOrderFulfillmentStatus::ClaimOrderFulfillmentStatuses,
ClaimOrderFulfillmentStatus::iter().skip(1), ClaimOrderFulfillmentStatus::iter().skip(1),
) )
.default(ClaimOrderFulfillmentStatus::NotFulfilled) .default(ClaimOrderFulfillmentStatus::NotFulfilled.to_string())
.not_null(), .not_null(),
) )
.col( .col(
@ -273,7 +273,7 @@ impl Migration {
/// metadata jsonb /// metadata jsonb
/// ); /// );
/// ``` /// ```
async fn create_claim_tags(manager: &SchemaManager) -> Result<(), DbErr> { async fn create_claim_tags(manager: &SchemaManager<'_>) -> Result<(), DbErr> {
manager manager
.create_table( .create_table(
Table::create() Table::create()

View File

@ -0,0 +1,84 @@
use sea_orm_migration::prelude::*;
use sea_orm_migration::sea_orm::Iterable;
use sea_query::expr::SimpleExpr;
use crate::types::*;
use crate::{auto_uuid_not_null, ts_def_now_not_null};
/// ```sql
/// ```
#[derive(DeriveMigrationName)]
pub struct Migration;
#[async_trait::async_trait]
impl MigrationTrait for Migration {
async fn up(&self, manager: &SchemaManager) -> Result<(), DbErr> {
Ok(())
}
async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> {
Ok(())
}
}
impl Migration {
/// ```sql
/// CREATE TABLE public.countries
/// (
/// id sequence NOT NULL,
/// iso_2 character varying NOT NULL,
/// iso_3 character varying NOT NULL,
/// num_code integer NOT NULL,
/// name character varying NOT NULL,
/// display_name character varying NOT NULL,
/// region_id character varying
/// );
/// ```
async fn create_countries(manager: &SchemaManager<'_>) -> Result<(), DbErr> {
todo!()
}
/// ```sql
/// CREATE TABLE public.currencies
/// (
/// code character varying NOT NULL,
/// symbol character varying NOT NULL,
/// symbol_native character varying NOT NULL,
/// name character varying NOT NULL
/// );
/// ```
async fn create_currencies(manager: &SchemaManager<'_>) -> Result<(), DbErr> {
todo!()
}
/// CREATE TABLE public.regions
/// (
/// id uuid NOT NULL,
/// name character varying NOT NULL,
/// currency_code character varying NOT NULL,
/// tax_rate real NOT NULL,
/// tax_code character varying,
/// created_at timestamp with time zone DEFAULT now() NOT NULL,
/// updated_at timestamp with time zone DEFAULT now() NOT NULL,
/// deleted_at timestamp with time zone,
/// metadata jsonb,
/// gift_cards_taxable boolean DEFAULT true NOT NULL,
/// automatic_taxes boolean DEFAULT true NOT NULL,
/// tax_provider_id uuid
/// );
async fn create_regions(manager: &SchemaManager<'_>) -> Result<(), DbErr> {
todo!()
}
}
#[derive(Iden)]
pub enum ClaimImage {
ClaimImages,
Id,
ClaimItemId,
Url,
CreatedAt,
UpdatedAt,
DeletedAt,
Metadata,
}

View File

@ -4,6 +4,7 @@ mod m20230603_102630_schema;
mod m20230603_102634_types; mod m20230603_102634_types;
mod m20230603_120814_addresses; mod m20230603_120814_addresses;
mod m20230603_120815_claims; mod m20230603_120815_claims;
mod m20230603_120816_geolocation;
pub struct PublicMigrator; pub struct PublicMigrator;
@ -16,6 +17,7 @@ impl MigratorTrait for PublicMigrator {
Box::new(m20230603_102634_types::Migration), Box::new(m20230603_102634_types::Migration),
Box::new(m20230603_120814_addresses::Migration), Box::new(m20230603_120814_addresses::Migration),
Box::new(m20230603_120815_claims::Migration), Box::new(m20230603_120815_claims::Migration),
Box::new(m20230603_120816_geolocation::Migration),
] ]
} }
} }

File diff suppressed because it is too large Load Diff