Add customer_id and order_id
This commit is contained in:
parent
8871f46738
commit
b04f73cb51
@ -184,9 +184,18 @@ async fn server(opts: ServerOpts) -> Result<()> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async fn migrate(opts: MigrateOpts) -> Result<()> {
|
async fn migrate(opts: MigrateOpts) -> Result<()> {
|
||||||
|
use sqlx::migrate::MigrateError;
|
||||||
|
|
||||||
let db = database::Database::build(&opts.db_url()).await?;
|
let db = database::Database::build(&opts.db_url()).await?;
|
||||||
sqlx::migrate!("../db/migrate").run(db.pool()).await.expect("Failed to migrate");
|
let res: std::result::Result<(), MigrateError> =
|
||||||
Ok(())
|
sqlx::migrate!("../db/migrate").run(db.pool()).await;
|
||||||
|
match res {
|
||||||
|
Ok(()) => return Ok(()),
|
||||||
|
Err(e) => {
|
||||||
|
eprintln!("{e}");
|
||||||
|
std::process::exit(1);
|
||||||
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn generate_hash(_opts: GenerateHashOpts) -> Result<()> {
|
async fn generate_hash(_opts: GenerateHashOpts) -> Result<()> {
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
BEGIN;
|
|
||||||
|
|
||||||
CREATE TYPE "Price" AS (
|
CREATE TYPE "Price" AS (
|
||||||
"value" integer,
|
"value" integer,
|
||||||
"currency" varchar
|
"currency" varchar
|
||||||
@ -10,5 +8,3 @@ ADD COLUMN "deliver_days_flag" int
|
|||||||
NOT NULL
|
NOT NULL
|
||||||
-- 0x1111111
|
-- 0x1111111
|
||||||
DEFAULT 127;
|
DEFAULT 127;
|
||||||
|
|
||||||
COMMIT;
|
|
||||||
|
5
db/migrate/202204180708_add_payment_fields.sql
Normal file
5
db/migrate/202204180708_add_payment_fields.sql
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
ALTER TABLE accounts
|
||||||
|
ADD COLUMN customer_id uuid not null default gen_random_uuid();
|
||||||
|
|
||||||
|
ALTER TABLE account_orders
|
||||||
|
ADD COLUMN order_id varchar unique;
|
Loading…
Reference in New Issue
Block a user